aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/cpp
diff options
context:
space:
mode:
authorGravatar Sree Kuchibhotla <sreek@google.com>2017-02-03 21:05:01 -0800
committerGravatar Sree Kuchibhotla <sreek@google.com>2017-02-03 21:05:01 -0800
commitdfb82e076f3ed49312d2c1d6e28f4e667f8415c2 (patch)
treebcf289b75929f3e92e0e1e8e8410e642c6ff00b4 /test/cpp
parent0b26e27056053f7e9651f849befdb466b96bea6e (diff)
Address code review comments
Diffstat (limited to 'test/cpp')
-rw-r--r--test/cpp/microbenchmarks/bm_fullstack.cc21
1 files changed, 15 insertions, 6 deletions
diff --git a/test/cpp/microbenchmarks/bm_fullstack.cc b/test/cpp/microbenchmarks/bm_fullstack.cc
index 4981f5e27e..dd180de48a 100644
--- a/test/cpp/microbenchmarks/bm_fullstack.cc
+++ b/test/cpp/microbenchmarks/bm_fullstack.cc
@@ -491,7 +491,8 @@ static void BM_StreamingPingPong(benchmark::State& state) {
}
// Send 'max_ping_pongs' number of ping pong messages
- while (state.iterations() < max_ping_pongs) {
+ int ping_pong_cnt = 0;
+ while (ping_pong_cnt < max_ping_pongs) {
request_rw->Write(send_request, tag(0)); // Start client send
response_rw.Read(&recv_request, tag(1)); // Start server recv
request_rw->Read(&recv_response, tag(2)); // Start client recv
@@ -510,6 +511,8 @@ static void BM_StreamingPingPong(benchmark::State& state) {
GPR_ASSERT(need_tags & (1 << i));
need_tags &= ~(1 << i);
}
+
+ ping_pong_cnt++;
}
request_rw->WritesDone(tag(0));
@@ -828,21 +831,27 @@ BENCHMARK_TEMPLATE(BM_PumpStreamServerToClient, InProcessCHTTP2)
// only "small streams" (i.e streams with 0, 1 or 2 messages)
static void StreamingPingPongArgs(benchmark::internal::Benchmark* b) {
int msg_size = 0;
- int num_ping_pongs = 0;
- for (msg_size = 1; msg_size <= 128 * 1024 * 1024; msg_size *= 8) {
- for (num_ping_pongs = 0; num_ping_pongs <= 2; num_ping_pongs++) {
- b->Args({msg_size, num_ping_pongs});
- }
+
+ b->Args({0, 0}); // spl case: 0 ping-pong msgs (msg_size doesn't matter here)
+
+ for (msg_size = 0; msg_size <= 128 * 1024 * 1024;
+ msg_size == 0 ? msg_size++ : msg_size *= 8) {
+ b->Args({msg_size, 1});
+ b->Args({msg_size, 2});
}
}
BENCHMARK_TEMPLATE(BM_StreamingPingPong, InProcessCHTTP2, NoOpMutator,
NoOpMutator)
->Apply(StreamingPingPongArgs);
+BENCHMARK_TEMPLATE(BM_StreamingPingPong, TCP, NoOpMutator, NoOpMutator)
+ ->Apply(StreamingPingPongArgs);
BENCHMARK_TEMPLATE(BM_StreamingPingPongMsgs, InProcessCHTTP2, NoOpMutator,
NoOpMutator)
->Range(0, 128 * 1024 * 1024);
+BENCHMARK_TEMPLATE(BM_StreamingPingPongMsgs, TCP, NoOpMutator, NoOpMutator)
+ ->Range(0, 128 * 1024 * 1024);
} // namespace testing
} // namespace grpc