diff options
author | Craig Tiller <ctiller@google.com> | 2017-08-31 12:20:04 -0700 |
---|---|---|
committer | Craig Tiller <ctiller@google.com> | 2017-08-31 12:20:04 -0700 |
commit | 5489d41c15926abbf12a5b8d27b24d1d605d7f0f (patch) | |
tree | da7b27b1b5389607d2e2119b11fb18c0bf51e4f9 /test | |
parent | 520d76d698f7f03038fd7fcfe1a2129acd0fa948 (diff) |
Expose histograms via microbenchmarks
Diffstat (limited to 'test')
-rw-r--r-- | test/cpp/microbenchmarks/helpers.cc | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/test/cpp/microbenchmarks/helpers.cc b/test/cpp/microbenchmarks/helpers.cc index 415d27445f..b0caa48cd0 100644 --- a/test/cpp/microbenchmarks/helpers.cc +++ b/test/cpp/microbenchmarks/helpers.cc @@ -31,10 +31,17 @@ void TrackCounters::Finish(benchmark::State &state) { void TrackCounters::AddToLabel(std::ostream &out, benchmark::State &state) { grpc_stats_data stats_end; grpc_stats_collect(&stats_end); + grpc_stats_data stats; + grpc_stats_diff(&stats_end, &stats_begin_, &stats); for (int i = 0; i < GRPC_STATS_COUNTER_COUNT; i++) { - out << " " << grpc_stats_counter_name[i] << "/iter:" - << ((double)(stats_end.counters[i] - stats_begin_.counters[i]) / - (double)state.iterations()); + out << " " << grpc_stats_counter_name[i] + << "/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); } #ifdef GPR_LOW_LEVEL_COUNTERS grpc_memory_counters counters_at_end = grpc_memory_counters_snapshot(); |