diff options
author | Craig Tiller <ctiller@google.com> | 2017-03-10 09:49:31 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-10 09:49:31 -0800 |
commit | e7fe7f2b4542284ad28964219c82000c75e6ccad (patch) | |
tree | 89132cd0b89d349a95bcd739ee946ba4a0ea54c2 /test/cpp | |
parent | 833adc20285f4f30d09b9c2a6092ef2c6a5e649f (diff) | |
parent | 71c286466acffef07efbd83cf5424b0cfcf2aad8 (diff) |
Merge pull request #10067 from ctiller/less_counters
Dont use memory counters unless counters mode is on
Diffstat (limited to 'test/cpp')
-rw-r--r-- | test/cpp/microbenchmarks/helpers.cc | 8 | ||||
-rw-r--r-- | test/cpp/microbenchmarks/helpers.h | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/test/cpp/microbenchmarks/helpers.cc b/test/cpp/microbenchmarks/helpers.cc index 947e81ffd8..d277c5984c 100644 --- a/test/cpp/microbenchmarks/helpers.cc +++ b/test/cpp/microbenchmarks/helpers.cc @@ -45,6 +45,7 @@ void TrackCounters::Finish(benchmark::State &state) { void TrackCounters::AddToLabel(std::ostream &out, benchmark::State &state) { #ifdef GPR_LOW_LEVEL_COUNTERS + grpc_memory_counters counters_at_end = grpc_memory_counters_snapshot(); out << " locks/iter:" << ((double)(gpr_atm_no_barrier_load(&gpr_mu_locks) - mu_locks_at_start_) / (double)state.iterations()) @@ -55,11 +56,10 @@ void TrackCounters::AddToLabel(std::ostream &out, benchmark::State &state) { << " 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)state.iterations()) + << " allocs/iter:" << ((double)(counters_at_end.total_allocs_absolute - counters_at_start_.total_allocs_absolute) / (double)state.iterations()); +#endif } diff --git a/test/cpp/microbenchmarks/helpers.h b/test/cpp/microbenchmarks/helpers.h index 42a8fbaf0b..2829a46e5a 100644 --- a/test/cpp/microbenchmarks/helpers.h +++ b/test/cpp/microbenchmarks/helpers.h @@ -84,8 +84,8 @@ class TrackCounters { gpr_atm_no_barrier_load(&gpr_counter_atm_cas); const size_t atm_add_at_start_ = gpr_atm_no_barrier_load(&gpr_counter_atm_add); -#endif grpc_memory_counters counters_at_start_ = grpc_memory_counters_snapshot(); +#endif }; #endif |