aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/cpp/microbenchmarks/bm_pollset.cc
diff options
context:
space:
mode:
authorGravatar Yash Tibrewal <yashkt@google.com>2017-11-09 18:27:37 -0800
committerGravatar Yash Tibrewal <yashkt@google.com>2017-11-09 18:27:37 -0800
commit3150744c712449585e6c0a3347f2b9366671a8eb (patch)
tree7083a7582f910a40d3718d8f7b36b249f18d2961 /test/cpp/microbenchmarks/bm_pollset.cc
parentcf9b084211d1f2d99b1ce4685801bca1557f2f7b (diff)
Removing more exec_ctx instances
Diffstat (limited to 'test/cpp/microbenchmarks/bm_pollset.cc')
-rw-r--r--test/cpp/microbenchmarks/bm_pollset.cc44
1 files changed, 21 insertions, 23 deletions
diff --git a/test/cpp/microbenchmarks/bm_pollset.cc b/test/cpp/microbenchmarks/bm_pollset.cc
index d097f8e32e..3da8e16788 100644
--- a/test/cpp/microbenchmarks/bm_pollset.cc
+++ b/test/cpp/microbenchmarks/bm_pollset.cc
@@ -41,8 +41,8 @@
auto& force_library_initialization = Library::get();
-static void shutdown_ps(grpc_exec_ctx* exec_ctx, void* ps, grpc_error* error) {
- grpc_pollset_destroy(exec_ctx, static_cast<grpc_pollset*>(ps));
+static void shutdown_ps(void* ps, grpc_error* error) {
+ grpc_pollset_destroy(static_cast<grpc_pollset*>(ps));
}
static void BM_CreateDestroyPollset(benchmark::State& state) {
@@ -58,11 +58,11 @@ static void BM_CreateDestroyPollset(benchmark::State& state) {
memset(ps, 0, ps_sz);
grpc_pollset_init(ps, &mu);
gpr_mu_lock(mu);
- grpc_pollset_shutdown(&exec_ctx, ps, &shutdown_ps_closure);
+ grpc_pollset_shutdown(ps, &shutdown_ps_closure);
gpr_mu_unlock(mu);
- grpc_exec_ctx_flush(&exec_ctx);
+ grpc_exec_ctx_flush();
}
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
gpr_free(ps);
track_counters.Finish(state);
}
@@ -117,14 +117,14 @@ static void BM_PollEmptyPollset(benchmark::State& state) {
ExecCtx _local_exec_ctx;
gpr_mu_lock(mu);
while (state.KeepRunning()) {
- GRPC_ERROR_UNREF(grpc_pollset_work(&exec_ctx, ps, NULL, 0));
+ GRPC_ERROR_UNREF(grpc_pollset_work(ps, NULL, 0));
}
grpc_closure shutdown_ps_closure;
GRPC_CLOSURE_INIT(&shutdown_ps_closure, shutdown_ps, ps,
grpc_schedule_on_exec_ctx);
- grpc_pollset_shutdown(&exec_ctx, ps, &shutdown_ps_closure);
+ grpc_pollset_shutdown(ps, &shutdown_ps_closure);
gpr_mu_unlock(mu);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
gpr_free(ps);
track_counters.Finish(state);
}
@@ -142,17 +142,17 @@ static void BM_PollAddFd(benchmark::State& state) {
GRPC_LOG_IF_ERROR("wakeup_fd_init", grpc_wakeup_fd_init(&wakeup_fd)));
grpc_fd* fd = grpc_fd_create(wakeup_fd.read_fd, "xxx");
while (state.KeepRunning()) {
- grpc_pollset_add_fd(&exec_ctx, ps, fd);
- grpc_exec_ctx_flush(&exec_ctx);
+ grpc_pollset_add_fd(ps, fd);
+ grpc_exec_ctx_flush();
}
- grpc_fd_orphan(&exec_ctx, fd, NULL, NULL, false /* already_closed */, "xxx");
+ grpc_fd_orphan(fd, NULL, NULL, false /* already_closed */, "xxx");
grpc_closure shutdown_ps_closure;
GRPC_CLOSURE_INIT(&shutdown_ps_closure, shutdown_ps, ps,
grpc_schedule_on_exec_ctx);
gpr_mu_lock(mu);
- grpc_pollset_shutdown(&exec_ctx, ps, &shutdown_ps_closure);
+ grpc_pollset_shutdown(ps, &shutdown_ps_closure);
gpr_mu_unlock(mu);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
gpr_free(ps);
track_counters.Finish(state);
}
@@ -169,7 +169,7 @@ Closure* MakeClosure(F f, grpc_closure_scheduler* scheduler) {
C(F f, grpc_closure_scheduler* scheduler) : f_(f) {
GRPC_CLOSURE_INIT(this, C::cbfn, this, scheduler);
}
- static void cbfn(grpc_exec_ctx* exec_ctx, void* arg, grpc_error* error) {
+ static void cbfn(void* arg, grpc_error* error) {
C* p = static_cast<C*>(arg);
p->f_();
}
@@ -222,7 +222,7 @@ static void BM_SingleThreadPollOneFd(benchmark::State& state) {
grpc_wakeup_fd wakeup_fd;
GRPC_ERROR_UNREF(grpc_wakeup_fd_init(&wakeup_fd));
grpc_fd* wakeup = grpc_fd_create(wakeup_fd.read_fd, "wakeup_read");
- grpc_pollset_add_fd(&exec_ctx, ps, wakeup);
+ grpc_pollset_add_fd(ps, wakeup);
bool done = false;
Closure* continue_closure = MakeClosure(
[&]() {
@@ -232,25 +232,23 @@ static void BM_SingleThreadPollOneFd(benchmark::State& state) {
return;
}
GRPC_ERROR_UNREF(grpc_wakeup_fd_wakeup(&wakeup_fd));
- grpc_fd_notify_on_read(&exec_ctx, wakeup, continue_closure);
+ grpc_fd_notify_on_read(wakeup, continue_closure);
},
grpc_schedule_on_exec_ctx);
GRPC_ERROR_UNREF(grpc_wakeup_fd_wakeup(&wakeup_fd));
- grpc_fd_notify_on_read(&exec_ctx, wakeup, continue_closure);
+ grpc_fd_notify_on_read(wakeup, continue_closure);
gpr_mu_lock(mu);
while (!done) {
- GRPC_ERROR_UNREF(
- grpc_pollset_work(&exec_ctx, ps, NULL, GRPC_MILLIS_INF_FUTURE));
+ GRPC_ERROR_UNREF(grpc_pollset_work(ps, NULL, GRPC_MILLIS_INF_FUTURE));
}
- grpc_fd_orphan(&exec_ctx, wakeup, NULL, NULL, false /* already_closed */,
- "done");
+ grpc_fd_orphan(wakeup, NULL, NULL, false /* already_closed */, "done");
wakeup_fd.read_fd = 0;
grpc_closure shutdown_ps_closure;
GRPC_CLOSURE_INIT(&shutdown_ps_closure, shutdown_ps, ps,
grpc_schedule_on_exec_ctx);
- grpc_pollset_shutdown(&exec_ctx, ps, &shutdown_ps_closure);
+ grpc_pollset_shutdown(ps, &shutdown_ps_closure);
gpr_mu_unlock(mu);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_finish();
grpc_wakeup_fd_destroy(&wakeup_fd);
gpr_free(ps);
track_counters.Finish(state);