diff options
author | Ken Payson <kpayson@google.com> | 2017-10-27 14:33:17 -0700 |
---|---|---|
committer | Ken Payson <kpayson@google.com> | 2017-10-27 14:33:17 -0700 |
commit | 667aa2b9906aa4eb8bdb3f049444ad68adde5aa8 (patch) | |
tree | e7f40e364dd5171f1f68ca83a0e9d7a68ce6897d /test/cpp | |
parent | 9ba487c82dcb58fd10e56ba9811bb19cb3ca11fd (diff) |
Add call size bm_diff
Diffstat (limited to 'test/cpp')
-rw-r--r-- | test/cpp/microbenchmarks/helpers.cc | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/test/cpp/microbenchmarks/helpers.cc b/test/cpp/microbenchmarks/helpers.cc index 6802a0aa99..782f12e99a 100644 --- a/test/cpp/microbenchmarks/helpers.cc +++ b/test/cpp/microbenchmarks/helpers.cc @@ -16,6 +16,8 @@ * */ +#include <string.h> + #include "test/cpp/microbenchmarks/helpers.h" void TrackCounters::Finish(benchmark::State &state) { @@ -45,10 +47,14 @@ void TrackCounters::AddToLabel(std::ostream &out, benchmark::State &state) { << "/iter:" << ((double)stats.counters[i] / (double)state.iterations()); } for (int i = 0; i < GRPC_STATS_HISTOGRAM_COUNT; i++) { - out << " " << grpc_stats_histogram_name[i] << "-median:" - << grpc_stats_histo_percentile(&stats, (grpc_stats_histograms)i, 50.0) - << " " << grpc_stats_histogram_name[i] << "-99p:" - << grpc_stats_histo_percentile(&stats, (grpc_stats_histograms)i, 99.0); + std::ostringstream median_ss; + median_ss << grpc_stats_histogram_name[i] << "-median"; + state.counters[median_ss.str()] = benchmark::Counter( + grpc_stats_histo_percentile(&stats, (grpc_stats_histograms)i, 50.0)); + std::ostringstream tail_ss; + tail_ss << grpc_stats_histogram_name[i] << "-99p"; + state.counters[tail_ss.str()] = benchmark::Counter( + grpc_stats_histo_percentile(&stats, (grpc_stats_histograms)i, 99.0)); } #ifdef GPR_LOW_LEVEL_COUNTERS grpc_memory_counters counters_at_end = grpc_memory_counters_snapshot(); |