diff options
author | David Garcia Quintas <dgq@google.com> | 2015-05-20 17:27:23 -0700 |
---|---|---|
committer | David Garcia Quintas <dgq@google.com> | 2015-05-20 17:27:23 -0700 |
commit | 08116501cbe91dbf7b6a09ded111a4395c81a738 (patch) | |
tree | 141ff855cc7145f1a25e8b395f2c4e761fec8325 /test/cpp/qps | |
parent | 6ba29ba3fbfd2870ce57413f560f5470dfad2a7c (diff) |
Fix to work around the fact that Histogram isn't copyable.
Diffstat (limited to 'test/cpp/qps')
-rw-r--r-- | test/cpp/qps/async_streaming_ping_pong_test.cc | 4 | ||||
-rw-r--r-- | test/cpp/qps/async_unary_ping_pong_test.cc | 4 | ||||
-rw-r--r-- | test/cpp/qps/driver.cc | 23 | ||||
-rw-r--r-- | test/cpp/qps/driver.h | 13 | ||||
-rw-r--r-- | test/cpp/qps/qps_driver.cc | 15 | ||||
-rw-r--r-- | test/cpp/qps/qps_test.cc | 4 | ||||
-rw-r--r-- | test/cpp/qps/sync_streaming_ping_pong_test.cc | 4 | ||||
-rw-r--r-- | test/cpp/qps/sync_unary_ping_pong_test.cc | 4 |
8 files changed, 33 insertions, 38 deletions
diff --git a/test/cpp/qps/async_streaming_ping_pong_test.cc b/test/cpp/qps/async_streaming_ping_pong_test.cc index a1822b7e15..d4871c0ba1 100644 --- a/test/cpp/qps/async_streaming_ping_pong_test.cc +++ b/test/cpp/qps/async_streaming_ping_pong_test.cc @@ -64,8 +64,8 @@ static void RunAsyncStreamingPingPong() { const auto result = RunScenario(client_config, 1, server_config, 1, WARMUP, BENCHMARK, -2); - ReportQPS(result); - ReportLatency(result); + ReportQPS(*result); + ReportLatency(*result); } } // namespace testing diff --git a/test/cpp/qps/async_unary_ping_pong_test.cc b/test/cpp/qps/async_unary_ping_pong_test.cc index 8b037a8656..35f188c986 100644 --- a/test/cpp/qps/async_unary_ping_pong_test.cc +++ b/test/cpp/qps/async_unary_ping_pong_test.cc @@ -64,8 +64,8 @@ static void RunAsyncUnaryPingPong() { const auto result = RunScenario(client_config, 1, server_config, 1, WARMUP, BENCHMARK, -2); - ReportQPS(result); - ReportLatency(result); + ReportQPS(*result); + ReportLatency(*result); } } // namespace testing diff --git a/test/cpp/qps/driver.cc b/test/cpp/qps/driver.cc index 83f70e612d..7c84cfbe10 100644 --- a/test/cpp/qps/driver.cc +++ b/test/cpp/qps/driver.cc @@ -75,13 +75,10 @@ static deque<string> get_hosts(const string& name) { } } -ScenarioResult RunScenario(const ClientConfig& initial_client_config, - size_t num_clients, - const ServerConfig& server_config, - size_t num_servers, - int warmup_seconds, - int benchmark_seconds, - int spawn_local_worker_count) { +std::unique_ptr<ScenarioResult> RunScenario( + const ClientConfig& initial_client_config, size_t num_clients, + const ServerConfig& server_config, size_t num_servers, int warmup_seconds, + int benchmark_seconds, int spawn_local_worker_count) { // ClientContext allocator (all are destroyed at scope exit) list<ClientContext> contexts; auto alloc_context = [&contexts]() { @@ -205,9 +202,9 @@ ScenarioResult RunScenario(const ClientConfig& initial_client_config, gpr_sleep_until(gpr_time_add(start, gpr_time_from_seconds(benchmark_seconds))); // Finish a run - ScenarioResult result; - result.client_config = result_client_config; - result.server_config = result_server_config; + std::unique_ptr<ScenarioResult> result(new ScenarioResult); + result->client_config = result_client_config; + result->server_config = result_server_config; gpr_log(GPR_INFO, "Finishing"); for (auto server = servers.begin(); server != servers.end(); server++) { GPR_ASSERT(server->stream->Write(server_mark)); @@ -218,14 +215,14 @@ ScenarioResult RunScenario(const ClientConfig& initial_client_config, for (auto server = servers.begin(); server != servers.end(); server++) { GPR_ASSERT(server->stream->Read(&server_status)); const auto& stats = server_status.stats(); - result.server_resources.push_back(ResourceUsage{ + result->server_resources.push_back(ResourceUsage{ stats.time_elapsed(), stats.time_user(), stats.time_system()}); } for (auto client = clients.begin(); client != clients.end(); client++) { GPR_ASSERT(client->stream->Read(&client_status)); const auto& stats = client_status.stats(); - result.latencies.MergeProto(stats.latencies()); - result.client_resources.push_back(ResourceUsage{ + result->latencies.MergeProto(stats.latencies()); + result->client_resources.push_back(ResourceUsage{ stats.time_elapsed(), stats.time_user(), stats.time_system()}); } diff --git a/test/cpp/qps/driver.h b/test/cpp/qps/driver.h index 4c7d52f1ea..5e9d4b3cb9 100644 --- a/test/cpp/qps/driver.h +++ b/test/cpp/qps/driver.h @@ -34,6 +34,8 @@ #ifndef TEST_QPS_DRIVER_H #define TEST_QPS_DRIVER_H +#include <memory> + #include "test/cpp/qps/histogram.h" #include "test/cpp/qps/qpstest.grpc.pb.h" @@ -53,13 +55,10 @@ struct ScenarioResult { ServerConfig server_config; }; -ScenarioResult RunScenario(const grpc::testing::ClientConfig& client_config, - size_t num_clients, - const grpc::testing::ServerConfig& server_config, - size_t num_servers, - int warmup_seconds, - int benchmark_seconds, - int spawn_local_worker_count); +std::unique_ptr<ScenarioResult> RunScenario( + const grpc::testing::ClientConfig& client_config, size_t num_clients, + const grpc::testing::ServerConfig& server_config, size_t num_servers, + int warmup_seconds, int benchmark_seconds, int spawn_local_worker_count); } // namespace testing } // namespace grpc diff --git a/test/cpp/qps/qps_driver.cc b/test/cpp/qps/qps_driver.cc index fc8e04201c..f49cd38b33 100644 --- a/test/cpp/qps/qps_driver.cc +++ b/test/cpp/qps/qps_driver.cc @@ -103,14 +103,13 @@ int main(int argc, char** argv) { FLAGS_server_threads < FLAGS_client_channels * FLAGS_outstanding_rpcs_per_channel)); - auto result = RunScenario(client_config, FLAGS_num_clients, - server_config, FLAGS_num_servers, - FLAGS_warmup_seconds, FLAGS_benchmark_seconds, - FLAGS_local_workers); - - ReportQPSPerCore(result, server_config); - ReportLatency(result); - ReportTimes(result); + const auto result = RunScenario( + client_config, FLAGS_num_clients, server_config, FLAGS_num_servers, + FLAGS_warmup_seconds, FLAGS_benchmark_seconds, FLAGS_local_workers); + + ReportQPSPerCore(*result, server_config); + ReportLatency(*result); + ReportTimes(*result); return 0; } diff --git a/test/cpp/qps/qps_test.cc b/test/cpp/qps/qps_test.cc index f567e4cf06..9a81d0fc90 100644 --- a/test/cpp/qps/qps_test.cc +++ b/test/cpp/qps/qps_test.cc @@ -64,8 +64,8 @@ static void RunQPS() { const auto result = RunScenario(client_config, 1, server_config, 1, WARMUP, BENCHMARK, -2); - ReportQPSPerCore(result, server_config); - ReportLatency(result); + ReportQPSPerCore(*result, server_config); + ReportLatency(*result); } } // namespace testing diff --git a/test/cpp/qps/sync_streaming_ping_pong_test.cc b/test/cpp/qps/sync_streaming_ping_pong_test.cc index 48c7ff63e0..218306846b 100644 --- a/test/cpp/qps/sync_streaming_ping_pong_test.cc +++ b/test/cpp/qps/sync_streaming_ping_pong_test.cc @@ -63,8 +63,8 @@ static void RunSynchronousStreamingPingPong() { const auto result = RunScenario(client_config, 1, server_config, 1, WARMUP, BENCHMARK, -2); - ReportQPS(result); - ReportLatency(result); + ReportQPS(*result); + 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 4c4de6377b..137ef79f2f 100644 --- a/test/cpp/qps/sync_unary_ping_pong_test.cc +++ b/test/cpp/qps/sync_unary_ping_pong_test.cc @@ -63,8 +63,8 @@ static void RunSynchronousUnaryPingPong() { const auto result = RunScenario(client_config, 1, server_config, 1, WARMUP, BENCHMARK, -2); - ReportQPS(result); - ReportLatency(result); + ReportQPS(*result); + ReportLatency(*result); } } // namespace testing |