aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/cpp/microbenchmarks/bm_cq.cc
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2017-02-28 08:43:06 -0800
committerGravatar Craig Tiller <ctiller@google.com>2017-02-28 08:43:06 -0800
commit4d92a49fc0a96afc7f4539c0e600f06b6e4089f6 (patch)
tree7a936c867797e96cecbdd4f517d08629c05e6710 /test/cpp/microbenchmarks/bm_cq.cc
parent2363cadb3ee8fe4fa71895ef8da148f652e7b955 (diff)
parentcd232f64c634cba1e95b30db5d270114db6b1fc4 (diff)
Merge github.com:grpc/grpc into cpp_bazelness
Diffstat (limited to 'test/cpp/microbenchmarks/bm_cq.cc')
-rw-r--r--test/cpp/microbenchmarks/bm_cq.cc26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/cpp/microbenchmarks/bm_cq.cc b/test/cpp/microbenchmarks/bm_cq.cc
index e9f59ca37e..a252b44df7 100644
--- a/test/cpp/microbenchmarks/bm_cq.cc
+++ b/test/cpp/microbenchmarks/bm_cq.cc
@@ -112,6 +112,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