aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/cpp/microbenchmarks/bm_call_create.cc
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2017-03-09 08:10:17 -0800
committerGravatar Craig Tiller <ctiller@google.com>2017-03-09 08:10:17 -0800
commitd720d5dd0aeaa96e2ee3fceef9dda17d33622077 (patch)
treefdaa35979efb5d770e0b256642042ed63a2fae82 /test/cpp/microbenchmarks/bm_call_create.cc
parent45c34c323ea2a48ccdb9a5b03311aed1bc21fd34 (diff)
Track zalloc times in microbenchmark
This forms our speed of light for call creation: at some point call creation is dominated by zeroing memory and all we can do is reduce the size of the call... let's track where that point is.
Diffstat (limited to 'test/cpp/microbenchmarks/bm_call_create.cc')
-rw-r--r--test/cpp/microbenchmarks/bm_call_create.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/cpp/microbenchmarks/bm_call_create.cc b/test/cpp/microbenchmarks/bm_call_create.cc
index f25bcd2df8..5810ebddeb 100644
--- a/test/cpp/microbenchmarks/bm_call_create.cc
+++ b/test/cpp/microbenchmarks/bm_call_create.cc
@@ -60,6 +60,16 @@ extern "C" {
auto &force_library_initialization = Library::get();
+void BM_Zalloc(benchmark::State& state) {
+ // speed of light for call creation is zalloc, so benchmark a few interesting
+ // sizes
+ size_t sz = state.range(0);
+ while (state.KeepRunning()) {
+ gpr_free(gpr_zalloc(sz));
+ }
+}
+BENCHMARK(BM_Zalloc)->Arg(64)->Arg(128)->Arg(256)->Arg(512)->Arg(1024)->Arg(1536)->Arg(2048)->Arg(3072)->Arg(4096)->Arg(5120)->Arg(6144)->Arg(7168);
+
class BaseChannelFixture {
public:
BaseChannelFixture(grpc_channel *channel) : channel_(channel) {}