diff --git a/test/cpp/microbenchmarks/bm_closure.cc b/test/cpp/microbenchmarks/bm_closure.cc index d52fe4ee309..fd540e994b0 100644 --- a/test/cpp/microbenchmarks/bm_closure.cc +++ b/test/cpp/microbenchmarks/bm_closure.cc @@ -84,12 +84,12 @@ BENCHMARK(BM_ClosureInitAgainstExecCtx); static void BM_ClosureInitAgainstCombiner(benchmark::State& state) { TrackCounters track_counters; - grpc_combiner* combiner = grpc_combiner_create(NULL); + grpc_combiner* combiner = grpc_combiner_create(); grpc_closure c; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; while (state.KeepRunning()) { benchmark::DoNotOptimize(grpc_closure_init( - &c, DoNothing, NULL, grpc_combiner_scheduler(combiner, false))); + &c, DoNothing, NULL, grpc_combiner_scheduler(combiner))); } GRPC_COMBINER_UNREF(&exec_ctx, combiner, "finished"); grpc_exec_ctx_finish(&exec_ctx); @@ -259,10 +259,9 @@ BENCHMARK(BM_TryAcquireSpinlock); static void BM_ClosureSchedOnCombiner(benchmark::State& state) { TrackCounters track_counters; - grpc_combiner* combiner = grpc_combiner_create(NULL); + grpc_combiner* combiner = grpc_combiner_create(); grpc_closure c; - grpc_closure_init(&c, DoNothing, NULL, - grpc_combiner_scheduler(combiner, false)); + grpc_closure_init(&c, DoNothing, NULL, grpc_combiner_scheduler(combiner)); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; while (state.KeepRunning()) { grpc_closure_sched(&exec_ctx, &c, GRPC_ERROR_NONE); @@ -276,13 +275,11 @@ BENCHMARK(BM_ClosureSchedOnCombiner); static void BM_ClosureSched2OnCombiner(benchmark::State& state) { TrackCounters track_counters; - grpc_combiner* combiner = grpc_combiner_create(NULL); + grpc_combiner* combiner = grpc_combiner_create(); grpc_closure c1; grpc_closure c2; - grpc_closure_init(&c1, DoNothing, NULL, - grpc_combiner_scheduler(combiner, false)); - grpc_closure_init(&c2, DoNothing, NULL, - grpc_combiner_scheduler(combiner, false)); + grpc_closure_init(&c1, DoNothing, NULL, grpc_combiner_scheduler(combiner)); + grpc_closure_init(&c2, DoNothing, NULL, grpc_combiner_scheduler(combiner)); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; while (state.KeepRunning()) { grpc_closure_sched(&exec_ctx, &c1, GRPC_ERROR_NONE); @@ -297,16 +294,13 @@ BENCHMARK(BM_ClosureSched2OnCombiner); static void BM_ClosureSched3OnCombiner(benchmark::State& state) { TrackCounters track_counters; - grpc_combiner* combiner = grpc_combiner_create(NULL); + grpc_combiner* combiner = grpc_combiner_create(); grpc_closure c1; grpc_closure c2; grpc_closure c3; - grpc_closure_init(&c1, DoNothing, NULL, - grpc_combiner_scheduler(combiner, false)); - grpc_closure_init(&c2, DoNothing, NULL, - grpc_combiner_scheduler(combiner, false)); - grpc_closure_init(&c3, DoNothing, NULL, - grpc_combiner_scheduler(combiner, false)); + grpc_closure_init(&c1, DoNothing, NULL, grpc_combiner_scheduler(combiner)); + grpc_closure_init(&c2, DoNothing, NULL, grpc_combiner_scheduler(combiner)); + grpc_closure_init(&c3, DoNothing, NULL, grpc_combiner_scheduler(combiner)); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; while (state.KeepRunning()) { grpc_closure_sched(&exec_ctx, &c1, GRPC_ERROR_NONE); @@ -322,14 +316,12 @@ BENCHMARK(BM_ClosureSched3OnCombiner); static void BM_ClosureSched2OnTwoCombiners(benchmark::State& state) { TrackCounters track_counters; - grpc_combiner* combiner1 = grpc_combiner_create(NULL); - grpc_combiner* combiner2 = grpc_combiner_create(NULL); + grpc_combiner* combiner1 = grpc_combiner_create(); + grpc_combiner* combiner2 = grpc_combiner_create(); grpc_closure c1; grpc_closure c2; - grpc_closure_init(&c1, DoNothing, NULL, - grpc_combiner_scheduler(combiner1, false)); - grpc_closure_init(&c2, DoNothing, NULL, - grpc_combiner_scheduler(combiner2, false)); + grpc_closure_init(&c1, DoNothing, NULL, grpc_combiner_scheduler(combiner1)); + grpc_closure_init(&c2, DoNothing, NULL, grpc_combiner_scheduler(combiner2)); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; while (state.KeepRunning()) { grpc_closure_sched(&exec_ctx, &c1, GRPC_ERROR_NONE); @@ -345,20 +337,16 @@ BENCHMARK(BM_ClosureSched2OnTwoCombiners); static void BM_ClosureSched4OnTwoCombiners(benchmark::State& state) { TrackCounters track_counters; - grpc_combiner* combiner1 = grpc_combiner_create(NULL); - grpc_combiner* combiner2 = grpc_combiner_create(NULL); + grpc_combiner* combiner1 = grpc_combiner_create(); + grpc_combiner* combiner2 = grpc_combiner_create(); grpc_closure c1; grpc_closure c2; grpc_closure c3; grpc_closure c4; - grpc_closure_init(&c1, DoNothing, NULL, - grpc_combiner_scheduler(combiner1, false)); - grpc_closure_init(&c2, DoNothing, NULL, - grpc_combiner_scheduler(combiner2, false)); - grpc_closure_init(&c3, DoNothing, NULL, - grpc_combiner_scheduler(combiner1, false)); - grpc_closure_init(&c4, DoNothing, NULL, - grpc_combiner_scheduler(combiner2, false)); + grpc_closure_init(&c1, DoNothing, NULL, grpc_combiner_scheduler(combiner1)); + grpc_closure_init(&c2, DoNothing, NULL, grpc_combiner_scheduler(combiner2)); + grpc_closure_init(&c3, DoNothing, NULL, grpc_combiner_scheduler(combiner1)); + grpc_closure_init(&c4, DoNothing, NULL, grpc_combiner_scheduler(combiner2)); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; while (state.KeepRunning()) { grpc_closure_sched(&exec_ctx, &c1, GRPC_ERROR_NONE); @@ -418,8 +406,8 @@ BENCHMARK(BM_ClosureReschedOnExecCtx); static void BM_ClosureReschedOnCombiner(benchmark::State& state) { TrackCounters track_counters; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_combiner* combiner = grpc_combiner_create(NULL); - Rescheduler r(state, grpc_combiner_scheduler(combiner, false)); + grpc_combiner* combiner = grpc_combiner_create(); + Rescheduler r(state, grpc_combiner_scheduler(combiner)); r.ScheduleFirst(&exec_ctx); grpc_exec_ctx_flush(&exec_ctx); GRPC_COMBINER_UNREF(&exec_ctx, combiner, "finished"); @@ -431,10 +419,10 @@ BENCHMARK(BM_ClosureReschedOnCombiner); static void BM_ClosureReschedOnCombinerFinally(benchmark::State& state) { TrackCounters track_counters; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_combiner* combiner = grpc_combiner_create(NULL); - Rescheduler r(state, grpc_combiner_finally_scheduler(combiner, false)); - r.ScheduleFirstAgainstDifferentScheduler( - &exec_ctx, grpc_combiner_scheduler(combiner, false)); + grpc_combiner* combiner = grpc_combiner_create(); + Rescheduler r(state, grpc_combiner_finally_scheduler(combiner)); + r.ScheduleFirstAgainstDifferentScheduler(&exec_ctx, + grpc_combiner_scheduler(combiner)); grpc_exec_ctx_flush(&exec_ctx); GRPC_COMBINER_UNREF(&exec_ctx, combiner, "finished"); grpc_exec_ctx_finish(&exec_ctx);