diff options
author | Yuxuan Li <yuxuanli@google.com> | 2017-05-04 16:13:49 -0700 |
---|---|---|
committer | Yuxuan Li <yuxuanli@google.com> | 2017-05-04 16:13:49 -0700 |
commit | a33e2b27a130d06271d9ed6fa102e9010a1ad1d0 (patch) | |
tree | 204ef376e519a2e932f9d5c2c12e8cb384016869 /test/cpp/microbenchmarks/fullstack_fixtures.h | |
parent | 5f9f37a33cd729ee225bbe0faa974db7e3634363 (diff) |
add some comments
Diffstat (limited to 'test/cpp/microbenchmarks/fullstack_fixtures.h')
-rw-r--r-- | test/cpp/microbenchmarks/fullstack_fixtures.h | 32 |
1 files changed, 9 insertions, 23 deletions
diff --git a/test/cpp/microbenchmarks/fullstack_fixtures.h b/test/cpp/microbenchmarks/fullstack_fixtures.h index b3ea12cb7a..aa71c2ae3f 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: |