Removed registry for benchmark reports & introduced benchmark_config.{h,cc} in the spirit of test_config.{h,cc}.
The purpose of benchmark_config is to allow for different behaviors to
be decided at compile-time.
diff --git a/test/cpp/qps/qps_test.cc b/test/cpp/qps/qps_test.cc
index 2f72519..869ec19 100644
--- a/test/cpp/qps/qps_test.cc
+++ b/test/cpp/qps/qps_test.cc
@@ -39,6 +39,7 @@
#include "test/cpp/qps/driver.h"
#include "test/cpp/qps/report.h"
+#include "test/cpp/util/benchmark_config.h"
namespace grpc {
namespace testing {
@@ -46,12 +47,9 @@
static const int WARMUP = 5;
static const int BENCHMARK = 10;
-static void RunQPS() {
+static void RunQPS(const std::vector<std::unique_ptr<Reporter> >& reporters) {
gpr_log(GPR_INFO, "Running QPS test");
- ReportersRegistry reporters_registry;
- reporters_registry.Register(new GprLogReporter("LogReporter"));
-
ClientConfig client_config;
client_config.set_client_type(ASYNC_CLIENT);
client_config.set_enable_ssl(false);
@@ -72,16 +70,20 @@
std::set<ReportType> types;
types.insert(grpc::testing::ReportType::REPORT_QPS_PER_CORE);
types.insert(grpc::testing::ReportType::REPORT_LATENCY);
- reporters_registry.Report({client_config, server_config, result}, types);
-
+ for (const auto& reporter : reporters) {
+ reporter->Report({client_config, server_config, result}, types);
+ }
}
} // namespace testing
} // namespace grpc
int main(int argc, char** argv) {
+ grpc::testing::InitBenchmark(&argc, &argv, true);
+ const auto& reporters = grpc::testing::InitBenchmarkReporters();
+
signal(SIGPIPE, SIG_IGN);
- grpc::testing::RunQPS();
+ grpc::testing::RunQPS(reporters);
return 0;
}