From 667aa2b9906aa4eb8bdb3f049444ad68adde5aa8 Mon Sep 17 00:00:00 2001 From: Ken Payson Date: Fri, 27 Oct 2017 14:33:17 -0700 Subject: [PATCH] Add call size bm_diff --- Makefile | 1 + grpc.gyp | 1 + test/cpp/microbenchmarks/helpers.cc | 14 ++++++++++---- third_party/benchmark | 2 +- .../microbenchmarks/bm_diff/bm_constants.py | 2 +- tools/run_tests/generated/sources_and_headers.json | 2 +- tools/run_tests/sanity/check_submodules.sh | 2 +- 7 files changed, 16 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 325c9123d99..236dc74779e 100644 --- a/Makefile +++ b/Makefile @@ -8298,6 +8298,7 @@ LIBBENCHMARK_SRC = \ third_party/benchmark/src/commandlineflags.cc \ third_party/benchmark/src/complexity.cc \ third_party/benchmark/src/console_reporter.cc \ + third_party/benchmark/src/counter.cc \ third_party/benchmark/src/csv_reporter.cc \ third_party/benchmark/src/json_reporter.cc \ third_party/benchmark/src/reporter.cc \ diff --git a/grpc.gyp b/grpc.gyp index 487d529316e..e61166e7698 100644 --- a/grpc.gyp +++ b/grpc.gyp @@ -2316,6 +2316,7 @@ 'third_party/benchmark/src/commandlineflags.cc', 'third_party/benchmark/src/complexity.cc', 'third_party/benchmark/src/console_reporter.cc', + 'third_party/benchmark/src/counter.cc', 'third_party/benchmark/src/csv_reporter.cc', 'third_party/benchmark/src/json_reporter.cc', 'third_party/benchmark/src/reporter.cc', diff --git a/test/cpp/microbenchmarks/helpers.cc b/test/cpp/microbenchmarks/helpers.cc index 6802a0aa99b..782f12e99a1 100644 --- a/test/cpp/microbenchmarks/helpers.cc +++ b/test/cpp/microbenchmarks/helpers.cc @@ -16,6 +16,8 @@ * */ +#include + #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(); diff --git a/third_party/benchmark b/third_party/benchmark index 44c25c892a6..5b7683f49e1 160000 --- a/third_party/benchmark +++ b/third_party/benchmark @@ -1 +1 @@ -Subproject commit 44c25c892a6229b20db7cd9dc05584ea865896de +Subproject commit 5b7683f49e1e9223cf9927b24f6fd3d6bd82e3f8 diff --git a/tools/profiling/microbenchmarks/bm_diff/bm_constants.py b/tools/profiling/microbenchmarks/bm_diff/bm_constants.py index f8989b17fc8..0ec17fa17e2 100644 --- a/tools/profiling/microbenchmarks/bm_diff/bm_constants.py +++ b/tools/profiling/microbenchmarks/bm_diff/bm_constants.py @@ -23,7 +23,7 @@ _AVAILABLE_BENCHMARK_TESTS = [ 'bm_metadata', 'bm_fullstack_trickle' ] -_INTERESTING = ('cpu_time', 'real_time', 'locks_per_iteration', +_INTERESTING = ('cpu_time', 'real_time', 'call_initial_size-median', 'locks_per_iteration', 'allocs_per_iteration', 'writes_per_iteration', 'atm_cas_per_iteration', 'atm_add_per_iteration', 'nows_per_iteration', 'cli_transport_stalls_per_iteration', diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json index 46f4cb65329..08ab2a5d931 100644 --- a/tools/run_tests/generated/sources_and_headers.json +++ b/tools/run_tests/generated/sources_and_headers.json @@ -7453,7 +7453,6 @@ "headers": [ "third_party/benchmark/include/benchmark/benchmark.h", "third_party/benchmark/include/benchmark/benchmark_api.h", - "third_party/benchmark/include/benchmark/macros.h", "third_party/benchmark/include/benchmark/reporter.h", "third_party/benchmark/src/arraysize.h", "third_party/benchmark/src/benchmark_api_internal.h", @@ -7461,6 +7460,7 @@ "third_party/benchmark/src/colorprint.h", "third_party/benchmark/src/commandlineflags.h", "third_party/benchmark/src/complexity.h", + "third_party/benchmark/src/counter.h", "third_party/benchmark/src/cycleclock.h", "third_party/benchmark/src/internal_macros.h", "third_party/benchmark/src/log.h", diff --git a/tools/run_tests/sanity/check_submodules.sh b/tools/run_tests/sanity/check_submodules.sh index 2aee0001a3b..1f7b078ff7a 100755 --- a/tools/run_tests/sanity/check_submodules.sh +++ b/tools/run_tests/sanity/check_submodules.sh @@ -26,7 +26,7 @@ want_submodules=`mktemp /tmp/submXXXXXX` git submodule | awk '{ print $1 }' | sort > $submodules cat << EOF | awk '{ print $1 }' | sort > $want_submodules - 44c25c892a6229b20db7cd9dc05584ea865896de third_party/benchmark (v0.1.0-343-g44c25c8) + 5b7683f49e1e9223cf9927b24f6fd3d6bd82e3f8 third_party/benchmark (v1.2.0) be2ee342d3781ddb954f91f8a7e660c6f59e87e5 third_party/boringssl (heads/chromium-stable) 886e7d75368e3f4fab3f4d0d3584e4abfc557755 third_party/boringssl-with-bazel (version_for_cocoapods_7.0-857-g886e7d7) 30dbc81fb5ffdc98ea9b14b1918bfe4e8779b26e third_party/gflags (v2.2.0)