aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/cpp/qps/sync_streaming_ping_pong_test.cc
diff options
context:
space:
mode:
authorGravatar David Garcia Quintas <dgq@google.com>2015-05-18 22:33:02 -0700
committerGravatar David Garcia Quintas <dgq@google.com>2015-05-20 23:08:29 -0700
commit3cc9ec92d90cf24603ee556da2d8b188428e2615 (patch)
treef2a01749b8d12e10d631a56fed6269a2362c827b /test/cpp/qps/sync_streaming_ping_pong_test.cc
parentcdbdedbf23203c5edae587fb42168eb3e2cdd3f3 (diff)
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.
Diffstat (limited to 'test/cpp/qps/sync_streaming_ping_pong_test.cc')
-rw-r--r--test/cpp/qps/sync_streaming_ping_pong_test.cc18
1 files changed, 10 insertions, 8 deletions
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<std::unique_ptr<Reporter> >& 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<ReportType> 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;
}