diff --git a/src/proto/grpc/testing/control.proto b/src/proto/grpc/testing/control.proto index aa6a23abe5a..cb51756bf62 100644 --- a/src/proto/grpc/testing/control.proto +++ b/src/proto/grpc/testing/control.proto @@ -242,6 +242,7 @@ message ScenarioResultSummary double successful_requests_per_second = 13; double failed_requests_per_second = 14; + // Number of polls called inside completion queue per request double client_polls_per_request = 15; double server_polls_per_request = 16; } diff --git a/src/proto/grpc/testing/stats.proto b/src/proto/grpc/testing/stats.proto index 78df5333421..e236cf159b3 100644 --- a/src/proto/grpc/testing/stats.proto +++ b/src/proto/grpc/testing/stats.proto @@ -48,6 +48,7 @@ message ServerStats { // change in idle time of the server (data from proc/stat) uint64 idle_cpu_time = 5; + // Number of polls called inside completion queue uint64 cq_poll_count = 6; } @@ -84,5 +85,6 @@ message ClientStats { // Number of failed requests (one row per status code seen) repeated RequestResultCount request_results = 5; + // Number of polls called inside completion queue uint64 cq_poll_count = 6; } diff --git a/test/cpp/microbenchmarks/fullstack_fixtures.h b/test/cpp/microbenchmarks/fullstack_fixtures.h index b3ea12cb7a3..aa71c2ae3f9 100644 --- a/test/cpp/microbenchmarks/fullstack_fixtures.h +++ b/test/cpp/microbenchmarks/fullstack_fixtures.h @@ -100,17 +100,10 @@ class FullstackFixture : public BaseFixture { } } - 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()); - auto label = out.str(); - if (label.length() && label[0] == ' ') { - label = label.substr(1); - } - state.SetLabel(label); + void AddToLabel(std::ostream& out, benchmark::State& state) { + BaseFixture::AddToLabel(out, state); + out << " polls/iter:" + << (double)grpc_get_cq_poll_num(this->cq()->cq()) / state.iterations(); } ServerCompletionQueue* cq() { return cq_.get(); } @@ -225,17 +218,10 @@ class EndpointPairFixture : public BaseFixture { } } - 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()); - auto label = out.str(); - if (label.length() && label[0] == ' ') { - label = label.substr(1); - } - state.SetLabel(label); + void AddToLabel(std::ostream& out, benchmark::State& state) { + BaseFixture::AddToLabel(out, state); + out << " polls/iter:" + << (double)grpc_get_cq_poll_num(this->cq()->cq()) / state.iterations(); } ServerCompletionQueue* cq() { return cq_.get(); } @@ -271,7 +257,7 @@ class InProcessCHTTP2 : public EndpointPairFixture { void AddToLabel(std::ostream& out, benchmark::State& state) { EndpointPairFixture::AddToLabel(out, state); out << " writes/iter:" - << ((double)stats_.num_writes / (double)state.iterations()); + << (double)stats_.num_writes / (double)state.iterations(); } private: diff --git a/test/cpp/microbenchmarks/helpers.cc b/test/cpp/microbenchmarks/helpers.cc index 76ae0558039..6550742453a 100644 --- a/test/cpp/microbenchmarks/helpers.cc +++ b/test/cpp/microbenchmarks/helpers.cc @@ -67,8 +67,3 @@ void TrackCounters::AddToLabel(std::ostream &out, benchmark::State &state) { (double)state.iterations()); #endif } - -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 47dda4d4b29..66bf976e3c1 100644 --- a/test/cpp/microbenchmarks/helpers.h +++ b/test/cpp/microbenchmarks/helpers.h @@ -80,8 +80,6 @@ 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); private: #ifdef GPR_LOW_LEVEL_COUNTERS diff --git a/test/cpp/qps/report.h b/test/cpp/qps/report.h index 6ed3ea1b0dc..621fa7cb007 100644 --- a/test/cpp/qps/report.h +++ b/test/cpp/qps/report.h @@ -76,7 +76,7 @@ class Reporter { /** Reports server cpu usage. */ virtual void ReportCpuUsage(const ScenarioResult& result) = 0; - /** Reports server cpu usage. */ + /** Reports client and server poll usage inside completion queue. */ virtual void ReportPollCount(const ScenarioResult& result) = 0; private: