diff --git a/test/cpp/microbenchmarks/fullstack_fixtures.h b/test/cpp/microbenchmarks/fullstack_fixtures.h index cb96ac5d7182484e99f758ffc53d1518ea75d9bb..b3ea12cb7a37d06974d269526fbe4a346c0a0fce 100644 --- a/test/cpp/microbenchmarks/fullstack_fixtures.h +++ b/test/cpp/microbenchmarks/fullstack_fixtures.h @@ -100,10 +100,12 @@ class FullstackFixture : public BaseFixture { } } - void Finish(benchmark::State &state) { + void Finish(benchmark::State& state) { std::ostringstream out; AddToLabel(out, state); - AppendToLabel(out, "polls/iter", (double)grpc_get_cq_poll_num(this->cq()->cq())/state.iterations()); + AppendToLabel( + out, "polls/iter", + (double)grpc_get_cq_poll_num(this->cq()->cq()) / state.iterations()); auto label = out.str(); if (label.length() && label[0] == ' ') { label = label.substr(1); @@ -223,17 +225,19 @@ class EndpointPairFixture : public BaseFixture { } } - void Finish(benchmark::State &state) { + void Finish(benchmark::State& state) { std::ostringstream out; AddToLabel(out, state); - AppendToLabel(out, "polls/iter", (double)grpc_get_cq_poll_num(this->cq()->cq())/state.iterations()); + AppendToLabel( + out, "polls/iter", + (double)grpc_get_cq_poll_num(this->cq()->cq()) / state.iterations()); auto label = out.str(); if (label.length() && label[0] == ' ') { label = label.substr(1); } state.SetLabel(label); } - + ServerCompletionQueue* cq() { return cq_.get(); } std::shared_ptr<Channel> channel() { return channel_; } diff --git a/test/cpp/microbenchmarks/helpers.cc b/test/cpp/microbenchmarks/helpers.cc index 3bf67c3c01bed4a89b66b9574b820086d9de02c4..76ae0558039391a8f9034455d9a9974eee85a82d 100644 --- a/test/cpp/microbenchmarks/helpers.cc +++ b/test/cpp/microbenchmarks/helpers.cc @@ -68,6 +68,7 @@ void TrackCounters::AddToLabel(std::ostream &out, benchmark::State &state) { #endif } -void TrackCounters::AppendToLabel(std::ostream& out, std::string metric, double value) { +void TrackCounters::AppendToLabel(std::ostream &out, std::string metric, + double value) { out << " " << key << ":" << value; } diff --git a/test/cpp/microbenchmarks/helpers.h b/test/cpp/microbenchmarks/helpers.h index d2402a2d96a55cc278d77e8d90ed8f234fbe23d1..47dda4d4b29fb7aa3c958328eb8567a00da6333e 100644 --- a/test/cpp/microbenchmarks/helpers.h +++ b/test/cpp/microbenchmarks/helpers.h @@ -80,7 +80,8 @@ class TrackCounters { public: virtual void Finish(benchmark::State& state); virtual void AddToLabel(std::ostream& out, benchmark::State& state); - virtual void AppendToLabel(std::ostream& out, std::string metric, double value); + virtual void AppendToLabel(std::ostream& out, std::string metric, + double value); private: #ifdef GPR_LOW_LEVEL_COUNTERS diff --git a/test/cpp/qps/client.h b/test/cpp/qps/client.h index 92c6c7a3a3abaffd4a597de015f87e6fe4991c60..173f5ab0c43148ab6d7aadd8e379a2ba2054173f 100644 --- a/test/cpp/qps/client.h +++ b/test/cpp/qps/client.h @@ -198,7 +198,8 @@ class Client { stats.set_time_elapsed(timer_result.wall); stats.set_time_system(timer_result.system); stats.set_time_user(timer_result.user); - gpr_log(GPR_INFO, "*****poll count : %d %d %d", GetPollCount(), last_reset_poll_count_, last_reset_poll_count_to_use); + gpr_log(GPR_INFO, "*****poll count : %d %d %d", GetPollCount(), + last_reset_poll_count_, last_reset_poll_count_to_use); stats.set_cq_poll_count(GetPollCount() - last_reset_poll_count_to_use); return stats; diff --git a/test/cpp/qps/client_async.cc b/test/cpp/qps/client_async.cc index 2e4b7acba7a2dde3aed7523228bc94f063f93e5f..49f9b5ca40e0d6589e37753a3c17acddac6532cb 100644 --- a/test/cpp/qps/client_async.cc +++ b/test/cpp/qps/client_async.cc @@ -209,16 +209,16 @@ class AsyncClient : public ClientImpl<StubType, RequestType> { } } -int GetPollCount() { - int count = 0; - int i = 0; - for (auto cq = cli_cqs_.begin(); cq != cli_cqs_.end(); cq++) { - int k = (int)grpc_get_cq_poll_num((*cq)->cq()); - gpr_log(GPR_INFO, "%d: per cq poll:%d", i++, k); - count += k; + int GetPollCount() { + int count = 0; + // int i = 0; + for (auto cq = cli_cqs_.begin(); cq != cli_cqs_.end(); cq++) { + int k = (int)grpc_get_cq_poll_num((*cq)->cq()); + // gpr_log(GPR_INFO, "%d: per cq poll:%d", i++, k); + count += k; + } + return count; } - return count; -} protected: const int num_async_threads_; diff --git a/test/cpp/qps/driver.cc b/test/cpp/qps/driver.cc index 24e9f730af1edbc1dbf05fd82b4ce2ca577a0464..c41dcaa914fa0462535d405204b0620aa708ecdf 100644 --- a/test/cpp/qps/driver.cc +++ b/test/cpp/qps/driver.cc @@ -182,10 +182,14 @@ static void postprocess_scenario_result(ScenarioResult* result) { result->mutable_summary()->set_failed_requests_per_second(failures / time_estimate); } - gpr_log(GPR_INFO, "client poll count : %f", sum(result->client_stats(), CliPollCount)); - result->mutable_summary()->set_client_polls_per_request(sum(result->client_stats(), CliPollCount)/histogram.Count()); - gpr_log(GPR_INFO, "server poll count : %f", sum(result->server_stats(), SvrPollCount)); - result->mutable_summary()->set_server_polls_per_request(sum(result->server_stats(), SvrPollCount)/histogram.Count()); + gpr_log(GPR_INFO, "client poll count : %f", + sum(result->client_stats(), CliPollCount)); + result->mutable_summary()->set_client_polls_per_request( + sum(result->client_stats(), CliPollCount) / histogram.Count()); + gpr_log(GPR_INFO, "server poll count : %f", + sum(result->server_stats(), SvrPollCount)); + result->mutable_summary()->set_server_polls_per_request( + sum(result->server_stats(), SvrPollCount) / histogram.Count()); } std::unique_ptr<ScenarioResult> RunScenario( diff --git a/test/cpp/qps/server.h b/test/cpp/qps/server.h index 5d5d5ffe096d61ffc1fe2b5ba8458590dc51c0e2..e9951564cbdc7449b7d7c5050b8e043204091680 100644 --- a/test/cpp/qps/server.h +++ b/test/cpp/qps/server.h @@ -49,7 +49,8 @@ namespace testing { class Server { public: - explicit Server(const ServerConfig& config) : timer_(new UsageTimer), last_reset_poll_count_(0) { + explicit Server(const ServerConfig& config) + : timer_(new UsageTimer), last_reset_poll_count_(0) { cores_ = gpr_cpu_num_cores(); if (config.port()) { port_ = config.port(); diff --git a/test/cpp/qps/server_async.cc b/test/cpp/qps/server_async.cc index e503e6220474d5b2561c3f85f52a0af0eb4915f3..4bd7af3d2daada1a6f4cde08a1ebc1a5da197c0b 100644 --- a/test/cpp/qps/server_async.cc +++ b/test/cpp/qps/server_async.cc @@ -160,14 +160,15 @@ class AsyncQpsServerTest final : public grpc::testing::Server { int GetPollCount() { int count = 0; - int i = 0; + // int i = 0; for (auto cq = srv_cqs_.begin(); cq != srv_cqs_.end(); cq++) { int k = (int)grpc_get_cq_poll_num((*cq)->cq()); - gpr_log(GPR_INFO, "%d: per cq poll:%d", i++, k); + // gpr_log(GPR_INFO, "%d: per cq poll:%d", i++, k); count += k; } return count; } + private: void ShutdownThreadFunc() { // TODO (vpai): Remove this deadline and allow Shutdown to finish properly