From 0911b1612afa2155940cb2bcaf8ea4e1533e1b88 Mon Sep 17 00:00:00 2001
From: ncteisen <ncteisen@gmail.com>
Date: Mon, 22 May 2017 10:04:01 -0700
Subject: [PATCH] Fix bm_diff

---
 .../microbenchmarks/bm_fullstack_trickle.cc   | 19 ++++++++++++-------
 tools/profiling/microbenchmarks/bm_json.py    |  2 +-
 2 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/test/cpp/microbenchmarks/bm_fullstack_trickle.cc b/test/cpp/microbenchmarks/bm_fullstack_trickle.cc
index d7e3a9cf47..41be66d4ea 100644
--- a/test/cpp/microbenchmarks/bm_fullstack_trickle.cc
+++ b/test/cpp/microbenchmarks/bm_fullstack_trickle.cc
@@ -382,7 +382,8 @@ static void BM_PumpUnbalancedUnary_Trickle(benchmark::State& state) {
     senv->response_writer.Finish(send_response, Status::OK, tag(3));
     response_reader->Finish(&recv_response, &recv_status, tag(4));
     for (int i = (1 << 3) | (1 << 4); i != 0;) {
-      TrickleCQNext(fixture.get(), &t, &ok, state.iterations());
+      TrickleCQNext(fixture.get(), &t, &ok,
+                    in_warmup ? -1 : state.iterations());
       GPR_ASSERT(ok);
       int tagnum = (int)reinterpret_cast<intptr_t>(t);
       GPR_ASSERT(i & (1 << tagnum));
@@ -419,18 +420,22 @@ static void BM_PumpUnbalancedUnary_Trickle(benchmark::State& state) {
 }
 
 static void UnaryTrickleArgs(benchmark::internal::Benchmark* b) {
+  // A selection of interesting numbers
   const int cli_1024k = 1024 * 1024;
   const int cli_32M = 32 * 1024 * 1024;
   const int svr_256k = 256 * 1024;
   const int svr_4M = 4 * 1024 * 1024;
   const int svr_64M = 64 * 1024 * 1024;
   for (int bw = 64; bw <= 128 * 1024 * 1024; bw *= 16) {
-    b->Args({bw, cli_1024k, svr_256k});
-    b->Args({bw, cli_1024k, svr_4M});
-    b->Args({bw, cli_1024k, svr_64M});
-    b->Args({bw, cli_32M, svr_256k});
-    b->Args({bw, cli_32M, svr_4M});
-    b->Args({bw, cli_32M, svr_64M});
+    b->Args({1, 1, bw});
+    for (int i = 64; i <= 128 * 1024 * 1024; i *= 64) {
+      double expected_time =
+          static_cast<double>(14 + i) / (125.0 * static_cast<double>(bw));
+      if (expected_time > 2.0) continue;
+      b->Args({i, 1, bw});
+      b->Args({1, i, bw});
+      b->Args({i, i, bw});
+    }
   }
 }
 BENCHMARK(BM_PumpUnbalancedUnary_Trickle)->Apply(UnaryTrickleArgs);
diff --git a/tools/profiling/microbenchmarks/bm_json.py b/tools/profiling/microbenchmarks/bm_json.py
index f4d628e11f..49a3707220 100644
--- a/tools/profiling/microbenchmarks/bm_json.py
+++ b/tools/profiling/microbenchmarks/bm_json.py
@@ -56,7 +56,7 @@ _BM_SPECS = {
   },
   'BM_PumpUnbalancedUnary_Trickle': {
     'tpl': [],
-    'dyn': ['request_size', 'bandwidth_kilobits'],
+    'dyn': ['cli_req_size', 'svr_req_size', 'bandwidth_kilobits'],
   },
   'BM_ErrorStringOnNewError': {
     'tpl': ['fixture'],
-- 
GitLab