diff options
author | vjpai <vpai@google.com> | 2016-02-26 10:30:17 -0800 |
---|---|---|
committer | vjpai <vpai@google.com> | 2016-02-26 10:30:17 -0800 |
commit | 60a7e3336df1554891bae57b3f8d6e7304f6e039 (patch) | |
tree | 8c4a34298432ba9a55a6c1a60f91e75ced7f96a9 /test/cpp/qps | |
parent | e7042b5ddf4f72dbba79e53621f28ba7d3cd9df4 (diff) |
Finish clients fully before finishing servers
Diffstat (limited to 'test/cpp/qps')
-rw-r--r-- | test/cpp/qps/driver.cc | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/test/cpp/qps/driver.cc b/test/cpp/qps/driver.cc index 18a9ae4d25..bc8780f74d 100644 --- a/test/cpp/qps/driver.cc +++ b/test/cpp/qps/driver.cc @@ -348,23 +348,11 @@ std::unique_ptr<ScenarioResult> RunScenario( 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[0]; server != &servers[num_servers]; server++) { - GPR_ASSERT(server->stream->Write(server_mark)); - GPR_ASSERT(server->stream->WritesDone()); - } + gpr_log(GPR_INFO, "Finishing clients"); for (auto client = &clients[0]; client != &clients[num_clients]; client++) { GPR_ASSERT(client->stream->Write(client_mark)); GPR_ASSERT(client->stream->WritesDone()); } - for (auto server = &servers[0]; server != &servers[num_servers]; server++) { - GPR_ASSERT(server->stream->Read(&server_status)); - const auto& stats = server_status.stats(); - result->server_resources.emplace_back( - stats.time_elapsed(), stats.time_user(), stats.time_system(), - server_status.cores()); - GPR_ASSERT(!server->stream->Read(&server_status)); - } for (auto client = &clients[0]; client != &clients[num_clients]; client++) { GPR_ASSERT(client->stream->Read(&client_status)); const auto& stats = client_status.stats(); @@ -373,14 +361,28 @@ std::unique_ptr<ScenarioResult> RunScenario( stats.time_elapsed(), stats.time_user(), stats.time_system(), -1); GPR_ASSERT(!client->stream->Read(&client_status)); } - for (auto client = &clients[0]; client != &clients[num_clients]; client++) { GPR_ASSERT(client->stream->Finish().ok()); } + delete[] clients; + + gpr_log(GPR_INFO, "Finishing servers"); + for (auto server = &servers[0]; server != &servers[num_servers]; server++) { + GPR_ASSERT(server->stream->Write(server_mark)); + GPR_ASSERT(server->stream->WritesDone()); + } + for (auto server = &servers[0]; server != &servers[num_servers]; server++) { + GPR_ASSERT(server->stream->Read(&server_status)); + const auto& stats = server_status.stats(); + result->server_resources.emplace_back( + stats.time_elapsed(), stats.time_user(), stats.time_system(), + server_status.cores()); + GPR_ASSERT(!server->stream->Read(&server_status)); + } for (auto server = &servers[0]; server != &servers[num_servers]; server++) { GPR_ASSERT(server->stream->Finish().ok()); } - delete[] clients; + delete[] servers; return result; } |