From 3cc9ec92d90cf24603ee556da2d8b188428e2615 Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Mon, 18 May 2015 22:33:02 -0700 Subject: 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. --- test/cpp/qps/sync_streaming_ping_pong_test.cc | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'test/cpp/qps/sync_streaming_ping_pong_test.cc') diff --git a/test/cpp/qps/sync_streaming_ping_pong_test.cc b/test/cpp/qps/sync_streaming_ping_pong_test.cc index ddc1573bfd..b17a3f6e48 100644 --- a/test/cpp/qps/sync_streaming_ping_pong_test.cc +++ b/test/cpp/qps/sync_streaming_ping_pong_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,10 @@ namespace testing { static const int WARMUP = 5; static const int BENCHMARK = 10; -static void RunSynchronousStreamingPingPong() { +static void RunSynchronousStreamingPingPong( + const std::vector >& reporters) { gpr_log(GPR_INFO, "Running Synchronous Streaming Ping Pong"); - ReportersRegistry reporters_registry; - reporters_registry.Register(new GprLogReporter("LogReporter")); - ClientConfig client_config; client_config.set_client_type(SYNCHRONOUS_CLIENT); client_config.set_enable_ssl(false); @@ -71,16 +70,19 @@ static void RunSynchronousStreamingPingPong() { std::set types; types.insert(grpc::testing::ReportType::REPORT_QPS); 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::RunSynchronousStreamingPingPong(); + grpc::testing::RunSynchronousStreamingPingPong(reporters); return 0; } -- cgit v1.2.3