diff options
author | 2017-03-03 16:52:37 -0800 | |
---|---|---|
committer | 2017-03-03 16:52:37 -0800 | |
commit | f09ec59222e4abd8a534f89139f6b52378776fc4 (patch) | |
tree | efe76223d005dab9e753acb229d8ad1f07a97c8f /test/cpp/microbenchmarks/helpers.h | |
parent | 0dc57ad46f376356c3d4d155e974b0c37e9609df (diff) |
Fix mac build
Diffstat (limited to 'test/cpp/microbenchmarks/helpers.h')
-rw-r--r-- | test/cpp/microbenchmarks/helpers.h | 32 |
1 files changed, 2 insertions, 30 deletions
diff --git a/test/cpp/microbenchmarks/helpers.h b/test/cpp/microbenchmarks/helpers.h index ea9024dce5..42a8fbaf0b 100644 --- a/test/cpp/microbenchmarks/helpers.h +++ b/test/cpp/microbenchmarks/helpers.h @@ -74,36 +74,8 @@ extern "C" gpr_atm gpr_counter_atm_add; class TrackCounters { public: - virtual void Finish(benchmark::State& state) { - std::ostringstream out; - AddToLabel(out, state); - auto label = out.str(); - if (label.length() && label[0] == ' ') { - label = label.substr(1); - } - state.SetLabel(label); - } - - virtual void AddToLabel(std::ostream& out, benchmark::State& state) { -#ifdef GPR_LOW_LEVEL_COUNTERS - out << " locks/iter:" << ((double)(gpr_atm_no_barrier_load(&gpr_mu_locks) - - mu_locks_at_start_) / - (double)state.iterations()) - << " atm_cas/iter:" - << ((double)(gpr_atm_no_barrier_load(&gpr_counter_atm_cas) - - atm_cas_at_start_) / - (double)state.iterations()) - << " atm_add/iter:" - << ((double)(gpr_atm_no_barrier_load(&gpr_counter_atm_add) - - atm_add_at_start_) / - (double)state.iterations()); -#endif - grpc_memory_counters counters_at_end = grpc_memory_counters_snapshot(); - out << " allocs/iter:" - << ((double)(counters_at_end.total_allocs_absolute - - counters_at_start_.total_allocs_absolute) / - (double)state.iterations()); - } + virtual void Finish(benchmark::State& state); + virtual void AddToLabel(std::ostream& out, benchmark::State& state); private: #ifdef GPR_LOW_LEVEL_COUNTERS |