diff options
author | David Garcia Quintas <dgq@google.com> | 2015-05-19 16:55:08 -0700 |
---|---|---|
committer | David Garcia Quintas <dgq@google.com> | 2015-05-20 23:08:29 -0700 |
commit | 226beffea1fe772e172b6eb3125b096d0d11b2b2 (patch) | |
tree | ac16e85252885457de22becde6ed4c3cae5b9361 /test | |
parent | 87ca82768dda5b32774f7ec49d279be01c79e4d6 (diff) |
Simplified code based on comments and fixed build.json
Diffstat (limited to 'test')
-rw-r--r-- | test/cpp/qps/async_streaming_ping_pong_test.cc | 6 | ||||
-rw-r--r-- | test/cpp/qps/async_unary_ping_pong_test.cc | 6 | ||||
-rw-r--r-- | test/cpp/qps/qps_driver.cc | 8 | ||||
-rw-r--r-- | test/cpp/qps/qps_test.cc | 6 | ||||
-rw-r--r-- | test/cpp/qps/report.cc | 26 | ||||
-rw-r--r-- | test/cpp/qps/report.h | 33 | ||||
-rw-r--r-- | test/cpp/qps/sync_streaming_ping_pong_test.cc | 6 | ||||
-rw-r--r-- | test/cpp/qps/sync_unary_ping_pong_test.cc | 9 | ||||
-rw-r--r-- | test/cpp/util/benchmark_config.cc | 2 |
9 files changed, 15 insertions, 87 deletions
diff --git a/test/cpp/qps/async_streaming_ping_pong_test.cc b/test/cpp/qps/async_streaming_ping_pong_test.cc index c7367d876d..8cb0949bb4 100644 --- a/test/cpp/qps/async_streaming_ping_pong_test.cc +++ b/test/cpp/qps/async_streaming_ping_pong_test.cc @@ -68,11 +68,9 @@ static void RunAsyncStreamingPingPong( const auto result = RunScenario(client_config, 1, server_config, 1, WARMUP, BENCHMARK, -2); - std::set<ReportType> types; - types.insert(grpc::testing::ReportType::REPORT_QPS); - types.insert(grpc::testing::ReportType::REPORT_LATENCY); for (const auto& reporter : reporters) { - reporter->Report({client_config, server_config, result}, types); + reporter->ReportQPS(result); + reporter->ReportLatency(result); } } diff --git a/test/cpp/qps/async_unary_ping_pong_test.cc b/test/cpp/qps/async_unary_ping_pong_test.cc index 50e824bf0e..997cbced30 100644 --- a/test/cpp/qps/async_unary_ping_pong_test.cc +++ b/test/cpp/qps/async_unary_ping_pong_test.cc @@ -68,11 +68,9 @@ static void RunAsyncUnaryPingPong( const auto result = RunScenario(client_config, 1, server_config, 1, WARMUP, BENCHMARK, -2); - std::set<ReportType> types; - types.insert(grpc::testing::ReportType::REPORT_QPS); - types.insert(grpc::testing::ReportType::REPORT_LATENCY); for (const auto& reporter : reporters) { - reporter->Report({client_config, server_config, result}, types); + reporter->ReportQPS(result); + reporter->ReportLatency(result); } } } // namespace testing diff --git a/test/cpp/qps/qps_driver.cc b/test/cpp/qps/qps_driver.cc index b06b88d8a0..1f17424fad 100644 --- a/test/cpp/qps/qps_driver.cc +++ b/test/cpp/qps/qps_driver.cc @@ -70,7 +70,6 @@ using grpc::testing::ClientType; using grpc::testing::ServerType; using grpc::testing::RpcType; using grpc::testing::ResourceUsage; -using grpc::testing::ReportType; namespace grpc { namespace testing { @@ -113,10 +112,11 @@ static void QpsDriver( client_config, FLAGS_num_clients, server_config, FLAGS_num_servers, FLAGS_warmup_seconds, FLAGS_benchmark_seconds, FLAGS_local_workers); - std::set<ReportType> types; - types.insert(grpc::testing::ReportType::REPORT_ALL); for (const auto& reporter : reporters) { - reporter->Report({client_config, server_config, result}, types); + reporter->ReportQPS(result); + reporter->ReportQPSPerCore(result, server_config); + reporter->ReportLatency(result); + reporter->ReportTimes(result); } } diff --git a/test/cpp/qps/qps_test.cc b/test/cpp/qps/qps_test.cc index 869ec19179..92940795a7 100644 --- a/test/cpp/qps/qps_test.cc +++ b/test/cpp/qps/qps_test.cc @@ -67,11 +67,9 @@ static void RunQPS(const std::vector<std::unique_ptr<Reporter> >& reporters) { const auto result = RunScenario(client_config, 1, server_config, 1, WARMUP, BENCHMARK, -2); - std::set<ReportType> types; - types.insert(grpc::testing::ReportType::REPORT_QPS_PER_CORE); - types.insert(grpc::testing::ReportType::REPORT_LATENCY); for (const auto& reporter : reporters) { - reporter->Report({client_config, server_config, result}, types); + reporter->ReportQPSPerCore(result, server_config); + reporter->ReportLatency(result); } } diff --git a/test/cpp/qps/report.cc b/test/cpp/qps/report.cc index 55726fbd00..9c4bb0d954 100644 --- a/test/cpp/qps/report.cc +++ b/test/cpp/qps/report.cc @@ -39,32 +39,6 @@ namespace grpc { namespace testing { -// Reporter implementation. -void Reporter::Report(const ReportData& data, - const std::set<ReportType>& types) const { - for (ReportType rtype : types) { - bool all = false; - switch (rtype) { - case REPORT_ALL: - all = true; - case REPORT_QPS: - ReportQPS(data.scenario_result); - if (!all) break; - case REPORT_QPS_PER_CORE: - ReportQPSPerCore(data.scenario_result, data.server_config); - if (!all) break; - case REPORT_LATENCY: - ReportLatency(data.scenario_result); - if (!all) break; - case REPORT_TIMES: - ReportTimes(data.scenario_result); - if (!all) break; - } - if (all) break; - } -} - -// GprLogReporter implementation. void GprLogReporter::ReportQPS(const ScenarioResult& result) const { gpr_log(GPR_INFO, "QPS: %.1f", result.latencies.Count() / diff --git a/test/cpp/qps/report.h b/test/cpp/qps/report.h index b28506cba3..32b948c34f 100644 --- a/test/cpp/qps/report.h +++ b/test/cpp/qps/report.h @@ -45,32 +45,6 @@ namespace grpc { namespace testing { -/** General set of data required for report generation. */ -struct ReportData { - const ClientConfig& client_config; - const ServerConfig& server_config; - const ScenarioResult& scenario_result; -}; - -/** Specifies the type of performance report we are interested in. - * - * \note The special type \c REPORT_ALL is equivalent to specifying all the - * other fields. */ -enum ReportType { - /** Equivalent to the combination of all other fields. */ - REPORT_ALL, - /** Report only QPS information. */ - REPORT_QPS, - /** Report only QPS per core information. */ - REPORT_QPS_PER_CORE, - /** Report latency info for the 50, 90, 95, 99 and 99.9th percentiles. */ - REPORT_LATENCY, - /** Report user and system time. */ - REPORT_TIMES -}; - -class Reporter; - /** Interface for all reporters. */ class Reporter { public: @@ -82,10 +56,6 @@ class Reporter { * Names are constants, set at construction time. */ string name() const { return name_; } - /** Template method responsible for the generation of the requested types. */ - void Report(const ReportData& data, const std::set<ReportType>& types) const; - - protected: /** Reports QPS for the given \a result. */ virtual void ReportQPS(const ScenarioResult& result) const = 0; @@ -103,9 +73,6 @@ class Reporter { const string name_; }; - -// Reporters. - /** Reporter to gpr_log(GPR_INFO). */ class GprLogReporter : public Reporter { public: diff --git a/test/cpp/qps/sync_streaming_ping_pong_test.cc b/test/cpp/qps/sync_streaming_ping_pong_test.cc index b17a3f6e48..6da107aa73 100644 --- a/test/cpp/qps/sync_streaming_ping_pong_test.cc +++ b/test/cpp/qps/sync_streaming_ping_pong_test.cc @@ -67,11 +67,9 @@ static void RunSynchronousStreamingPingPong( const auto result = RunScenario(client_config, 1, server_config, 1, WARMUP, BENCHMARK, -2); - std::set<ReportType> types; - types.insert(grpc::testing::ReportType::REPORT_QPS); - types.insert(grpc::testing::ReportType::REPORT_LATENCY); for (const auto& reporter : reporters) { - reporter->Report({client_config, server_config, result}, types); + reporter->ReportQPS(result); + reporter->ReportLatency(result); } } } // namespace testing diff --git a/test/cpp/qps/sync_unary_ping_pong_test.cc b/test/cpp/qps/sync_unary_ping_pong_test.cc index ff4038a386..eb930def2a 100644 --- a/test/cpp/qps/sync_unary_ping_pong_test.cc +++ b/test/cpp/qps/sync_unary_ping_pong_test.cc @@ -51,9 +51,6 @@ static void RunSynchronousUnaryPingPong( const std::vector<std::unique_ptr<Reporter> >& reporters) { gpr_log(GPR_INFO, "Running Synchronous Unary 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); @@ -70,11 +67,9 @@ static void RunSynchronousUnaryPingPong( const auto result = RunScenario(client_config, 1, server_config, 1, WARMUP, BENCHMARK, -2); - std::set<ReportType> types; - types.insert(grpc::testing::ReportType::REPORT_QPS); - types.insert(grpc::testing::ReportType::REPORT_LATENCY); for (const auto& reporter : reporters) { - reporter->Report({client_config, server_config, result}, types); + reporter->ReportQPS(result); + reporter->ReportLatency(result); } } diff --git a/test/cpp/util/benchmark_config.cc b/test/cpp/util/benchmark_config.cc index 1f019c9715..914afa91ca 100644 --- a/test/cpp/util/benchmark_config.cc +++ b/test/cpp/util/benchmark_config.cc @@ -34,7 +34,7 @@ #include <gflags/gflags.h> #include "test/cpp/util/benchmark_config.h" -DEFINE_bool(enable_log_reporter, false, +DEFINE_bool(enable_log_reporter, true, "Enable reporting of benchmark results through GprLog"); // In some distros, gflags is in the namespace google, and in some others, |