diff options
author | Craig Tiller <ctiller@google.com> | 2017-03-10 07:14:35 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-10 07:14:35 -0800 |
commit | 833adc20285f4f30d09b9c2a6092ef2c6a5e649f (patch) | |
tree | bd780452d0370a1028f45a880ea83d0056ca99c1 | |
parent | c9774348a5c19c7df727d5796debb82373608cd3 (diff) | |
parent | e667aaf9f97d37d331f4bb6c0a761061409c607a (diff) |
Merge pull request #10068 from ctiller/zalloc_bench
Track zalloc times in microbenchmark
-rw-r--r-- | test/cpp/microbenchmarks/bm_call_create.cc | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/cpp/microbenchmarks/bm_call_create.cc b/test/cpp/microbenchmarks/bm_call_create.cc index 92a0d18fbc..014e2b96b5 100644 --- a/test/cpp/microbenchmarks/bm_call_create.cc +++ b/test/cpp/microbenchmarks/bm_call_create.cc @@ -63,6 +63,28 @@ 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) {} |