diff options
author | Craig Tiller <ctiller@google.com> | 2017-02-27 15:55:06 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-27 15:55:06 -0800 |
commit | 79ccb81b48433df9d56601663851a30de4ea8a6a (patch) | |
tree | fe3e3fdb99425c1f281aa12530ce743ef18e5342 | |
parent | 4776102ea4c967e339f3ba040a6fe5c24e8acf2d (diff) | |
parent | b843ff2ce4b8491b5d9c71bb736142b2f072b395 (diff) |
Merge pull request #9882 from ctiller/cqbm
Add more cq benchmarks
-rw-r--r-- | test/cpp/microbenchmarks/bm_cq.cc | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/test/cpp/microbenchmarks/bm_cq.cc b/test/cpp/microbenchmarks/bm_cq.cc index 195dcef3ab..c017474bf4 100644 --- a/test/cpp/microbenchmarks/bm_cq.cc +++ b/test/cpp/microbenchmarks/bm_cq.cc @@ -113,6 +113,32 @@ static void BM_Pass1Core(benchmark::State& state) { } BENCHMARK(BM_Pass1Core); +static void BM_Pluck1Core(benchmark::State& state) { + grpc_completion_queue* cq = grpc_completion_queue_create(NULL); + gpr_timespec deadline = gpr_inf_future(GPR_CLOCK_MONOTONIC); + while (state.KeepRunning()) { + grpc_cq_completion completion; + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + grpc_cq_begin_op(cq, NULL); + grpc_cq_end_op(&exec_ctx, cq, NULL, GRPC_ERROR_NONE, + DoneWithCompletionOnStack, NULL, &completion); + grpc_exec_ctx_finish(&exec_ctx); + grpc_completion_queue_pluck(cq, NULL, deadline, NULL); + } + grpc_completion_queue_destroy(cq); +} +BENCHMARK(BM_Pluck1Core); + +static void BM_EmptyCore(benchmark::State& state) { + grpc_completion_queue* cq = grpc_completion_queue_create(NULL); + gpr_timespec deadline = gpr_inf_past(GPR_CLOCK_MONOTONIC); + while (state.KeepRunning()) { + grpc_completion_queue_next(cq, deadline, NULL); + } + grpc_completion_queue_destroy(cq); +} +BENCHMARK(BM_EmptyCore); + } // namespace testing } // namespace grpc |