diff --git a/src/proto/grpc/testing/control.proto b/src/proto/grpc/testing/control.proto index aa6a23abe5a3c9b12907088386a3fb4539afbbea..cb51756bf627a0fcb718f69ef40cef2986272325 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 78df5333421d03d15d74e315c9fc795b104c1283..e236cf159b3e6773b94e4c84d5feeaa7ae66f515 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 b3ea12cb7a37d06974d269526fbe4a346c0a0fce..aa71c2ae3f9e5c167450b57915d382ad76d9e226 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 76ae0558039391a8f9034455d9a9974eee85a82d..6550742453a77674ec0fe74cb5c1049573846b5c 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 47dda4d4b29fb7aa3c958328eb8567a00da6333e..66bf976e3c1a192d6943887cd22ec4281f7668fa 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 6ed3ea1b0dca9402ffd51656a192ef5df978e58c..621fa7cb007c96b782537215a552c07401c7da03 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: