aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/cpp/microbenchmarks/bm_closure.cc
diff options
context:
space:
mode:
authorGravatar Yash Tibrewal <yashkt@google.com>2017-11-14 18:11:22 -0800
committerGravatar Yash Tibrewal <yashkt@google.com>2017-11-14 18:11:22 -0800
commit6c26b16fe06b1cc75b4dac372f4f51f6b7d1bfc0 (patch)
tree5d9b7bbdcf125bfc103b67778349ea075b049bb4 /test/cpp/microbenchmarks/bm_closure.cc
parent75122c23578e24417dcf64081c737571a9fc2dbc (diff)
Move ExecCtx to grpc_core namespace. Make exec_ctx a private static in ExecCtx and some minor changes
Diffstat (limited to 'test/cpp/microbenchmarks/bm_closure.cc')
-rw-r--r--test/cpp/microbenchmarks/bm_closure.cc66
1 files changed, 33 insertions, 33 deletions
diff --git a/test/cpp/microbenchmarks/bm_closure.cc b/test/cpp/microbenchmarks/bm_closure.cc
index ce8a054515..64925fd3f9 100644
--- a/test/cpp/microbenchmarks/bm_closure.cc
+++ b/test/cpp/microbenchmarks/bm_closure.cc
@@ -34,7 +34,7 @@ auto& force_library_initialization = Library::get();
static void BM_NoOpExecCtx(benchmark::State& state) {
TrackCounters track_counters;
while (state.KeepRunning()) {
- ExecCtx _local_exec_ctx;
+ grpc_core::ExecCtx _local_exec_ctx;
}
track_counters.Finish(state);
}
@@ -42,9 +42,9 @@ BENCHMARK(BM_NoOpExecCtx);
static void BM_WellFlushed(benchmark::State& state) {
TrackCounters track_counters;
- ExecCtx _local_exec_ctx;
+ grpc_core::ExecCtx _local_exec_ctx;
while (state.KeepRunning()) {
- ExecCtx::Get()->Flush();
+ grpc_core::ExecCtx::Get()->Flush();
}
track_counters.Finish(state);
@@ -68,7 +68,7 @@ static void BM_ClosureInitAgainstCombiner(benchmark::State& state) {
TrackCounters track_counters;
grpc_combiner* combiner = grpc_combiner_create();
grpc_closure c;
- ExecCtx _local_exec_ctx;
+ grpc_core::ExecCtx _local_exec_ctx;
while (state.KeepRunning()) {
benchmark::DoNotOptimize(GRPC_CLOSURE_INIT(
&c, DoNothing, NULL, grpc_combiner_scheduler(combiner)));
@@ -83,10 +83,10 @@ static void BM_ClosureRunOnExecCtx(benchmark::State& state) {
TrackCounters track_counters;
grpc_closure c;
GRPC_CLOSURE_INIT(&c, DoNothing, NULL, grpc_schedule_on_exec_ctx);
- ExecCtx _local_exec_ctx;
+ grpc_core::ExecCtx _local_exec_ctx;
while (state.KeepRunning()) {
GRPC_CLOSURE_RUN(&c, GRPC_ERROR_NONE);
- ExecCtx::Get()->Flush();
+ grpc_core::ExecCtx::Get()->Flush();
}
track_counters.Finish(state);
@@ -95,7 +95,7 @@ BENCHMARK(BM_ClosureRunOnExecCtx);
static void BM_ClosureCreateAndRun(benchmark::State& state) {
TrackCounters track_counters;
- ExecCtx _local_exec_ctx;
+ grpc_core::ExecCtx _local_exec_ctx;
while (state.KeepRunning()) {
GRPC_CLOSURE_RUN(
GRPC_CLOSURE_CREATE(DoNothing, NULL, grpc_schedule_on_exec_ctx),
@@ -108,7 +108,7 @@ BENCHMARK(BM_ClosureCreateAndRun);
static void BM_ClosureInitAndRun(benchmark::State& state) {
TrackCounters track_counters;
- ExecCtx _local_exec_ctx;
+ grpc_core::ExecCtx _local_exec_ctx;
grpc_closure c;
while (state.KeepRunning()) {
GRPC_CLOSURE_RUN(
@@ -124,10 +124,10 @@ static void BM_ClosureSchedOnExecCtx(benchmark::State& state) {
TrackCounters track_counters;
grpc_closure c;
GRPC_CLOSURE_INIT(&c, DoNothing, NULL, grpc_schedule_on_exec_ctx);
- ExecCtx _local_exec_ctx;
+ grpc_core::ExecCtx _local_exec_ctx;
while (state.KeepRunning()) {
GRPC_CLOSURE_SCHED(&c, GRPC_ERROR_NONE);
- ExecCtx::Get()->Flush();
+ grpc_core::ExecCtx::Get()->Flush();
}
track_counters.Finish(state);
@@ -140,11 +140,11 @@ static void BM_ClosureSched2OnExecCtx(benchmark::State& state) {
grpc_closure c2;
GRPC_CLOSURE_INIT(&c1, DoNothing, NULL, grpc_schedule_on_exec_ctx);
GRPC_CLOSURE_INIT(&c2, DoNothing, NULL, grpc_schedule_on_exec_ctx);
- ExecCtx _local_exec_ctx;
+ grpc_core::ExecCtx _local_exec_ctx;
while (state.KeepRunning()) {
GRPC_CLOSURE_SCHED(&c1, GRPC_ERROR_NONE);
GRPC_CLOSURE_SCHED(&c2, GRPC_ERROR_NONE);
- ExecCtx::Get()->Flush();
+ grpc_core::ExecCtx::Get()->Flush();
}
track_counters.Finish(state);
@@ -159,12 +159,12 @@ static void BM_ClosureSched3OnExecCtx(benchmark::State& state) {
GRPC_CLOSURE_INIT(&c1, DoNothing, NULL, grpc_schedule_on_exec_ctx);
GRPC_CLOSURE_INIT(&c2, DoNothing, NULL, grpc_schedule_on_exec_ctx);
GRPC_CLOSURE_INIT(&c3, DoNothing, NULL, grpc_schedule_on_exec_ctx);
- ExecCtx _local_exec_ctx;
+ grpc_core::ExecCtx _local_exec_ctx;
while (state.KeepRunning()) {
GRPC_CLOSURE_SCHED(&c1, GRPC_ERROR_NONE);
GRPC_CLOSURE_SCHED(&c2, GRPC_ERROR_NONE);
GRPC_CLOSURE_SCHED(&c3, GRPC_ERROR_NONE);
- ExecCtx::Get()->Flush();
+ grpc_core::ExecCtx::Get()->Flush();
}
track_counters.Finish(state);
@@ -176,7 +176,7 @@ static void BM_AcquireMutex(benchmark::State& state) {
// for comparison with the combiner stuff below
gpr_mu mu;
gpr_mu_init(&mu);
- ExecCtx _local_exec_ctx;
+ grpc_core::ExecCtx _local_exec_ctx;
while (state.KeepRunning()) {
gpr_mu_lock(&mu);
DoNothing(NULL, GRPC_ERROR_NONE);
@@ -192,7 +192,7 @@ static void BM_TryAcquireMutex(benchmark::State& state) {
// for comparison with the combiner stuff below
gpr_mu mu;
gpr_mu_init(&mu);
- ExecCtx _local_exec_ctx;
+ grpc_core::ExecCtx _local_exec_ctx;
while (state.KeepRunning()) {
if (gpr_mu_trylock(&mu)) {
DoNothing(NULL, GRPC_ERROR_NONE);
@@ -210,7 +210,7 @@ static void BM_AcquireSpinlock(benchmark::State& state) {
TrackCounters track_counters;
// for comparison with the combiner stuff below
gpr_spinlock mu = GPR_SPINLOCK_INITIALIZER;
- ExecCtx _local_exec_ctx;
+ grpc_core::ExecCtx _local_exec_ctx;
while (state.KeepRunning()) {
gpr_spinlock_lock(&mu);
DoNothing(NULL, GRPC_ERROR_NONE);
@@ -225,7 +225,7 @@ static void BM_TryAcquireSpinlock(benchmark::State& state) {
TrackCounters track_counters;
// for comparison with the combiner stuff below
gpr_spinlock mu = GPR_SPINLOCK_INITIALIZER;
- ExecCtx _local_exec_ctx;
+ grpc_core::ExecCtx _local_exec_ctx;
while (state.KeepRunning()) {
if (gpr_spinlock_trylock(&mu)) {
DoNothing(NULL, GRPC_ERROR_NONE);
@@ -244,10 +244,10 @@ static void BM_ClosureSchedOnCombiner(benchmark::State& state) {
grpc_combiner* combiner = grpc_combiner_create();
grpc_closure c;
GRPC_CLOSURE_INIT(&c, DoNothing, NULL, grpc_combiner_scheduler(combiner));
- ExecCtx _local_exec_ctx;
+ grpc_core::ExecCtx _local_exec_ctx;
while (state.KeepRunning()) {
GRPC_CLOSURE_SCHED(&c, GRPC_ERROR_NONE);
- ExecCtx::Get()->Flush();
+ grpc_core::ExecCtx::Get()->Flush();
}
GRPC_COMBINER_UNREF(combiner, "finished");
@@ -262,11 +262,11 @@ static void BM_ClosureSched2OnCombiner(benchmark::State& state) {
grpc_closure c2;
GRPC_CLOSURE_INIT(&c1, DoNothing, NULL, grpc_combiner_scheduler(combiner));
GRPC_CLOSURE_INIT(&c2, DoNothing, NULL, grpc_combiner_scheduler(combiner));
- ExecCtx _local_exec_ctx;
+ grpc_core::ExecCtx _local_exec_ctx;
while (state.KeepRunning()) {
GRPC_CLOSURE_SCHED(&c1, GRPC_ERROR_NONE);
GRPC_CLOSURE_SCHED(&c2, GRPC_ERROR_NONE);
- ExecCtx::Get()->Flush();
+ grpc_core::ExecCtx::Get()->Flush();
}
GRPC_COMBINER_UNREF(combiner, "finished");
@@ -283,12 +283,12 @@ static void BM_ClosureSched3OnCombiner(benchmark::State& state) {
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));
- ExecCtx _local_exec_ctx;
+ grpc_core::ExecCtx _local_exec_ctx;
while (state.KeepRunning()) {
GRPC_CLOSURE_SCHED(&c1, GRPC_ERROR_NONE);
GRPC_CLOSURE_SCHED(&c2, GRPC_ERROR_NONE);
GRPC_CLOSURE_SCHED(&c3, GRPC_ERROR_NONE);
- ExecCtx::Get()->Flush();
+ grpc_core::ExecCtx::Get()->Flush();
}
GRPC_COMBINER_UNREF(combiner, "finished");
@@ -304,11 +304,11 @@ static void BM_ClosureSched2OnTwoCombiners(benchmark::State& state) {
grpc_closure c2;
GRPC_CLOSURE_INIT(&c1, DoNothing, NULL, grpc_combiner_scheduler(combiner1));
GRPC_CLOSURE_INIT(&c2, DoNothing, NULL, grpc_combiner_scheduler(combiner2));
- ExecCtx _local_exec_ctx;
+ grpc_core::ExecCtx _local_exec_ctx;
while (state.KeepRunning()) {
GRPC_CLOSURE_SCHED(&c1, GRPC_ERROR_NONE);
GRPC_CLOSURE_SCHED(&c2, GRPC_ERROR_NONE);
- ExecCtx::Get()->Flush();
+ grpc_core::ExecCtx::Get()->Flush();
}
GRPC_COMBINER_UNREF(combiner1, "finished");
GRPC_COMBINER_UNREF(combiner2, "finished");
@@ -329,13 +329,13 @@ static void BM_ClosureSched4OnTwoCombiners(benchmark::State& state) {
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));
- ExecCtx _local_exec_ctx;
+ grpc_core::ExecCtx _local_exec_ctx;
while (state.KeepRunning()) {
GRPC_CLOSURE_SCHED(&c1, GRPC_ERROR_NONE);
GRPC_CLOSURE_SCHED(&c2, GRPC_ERROR_NONE);
GRPC_CLOSURE_SCHED(&c3, GRPC_ERROR_NONE);
GRPC_CLOSURE_SCHED(&c4, GRPC_ERROR_NONE);
- ExecCtx::Get()->Flush();
+ grpc_core::ExecCtx::Get()->Flush();
}
GRPC_COMBINER_UNREF(combiner1, "finished");
GRPC_COMBINER_UNREF(combiner2, "finished");
@@ -375,7 +375,7 @@ class Rescheduler {
static void BM_ClosureReschedOnExecCtx(benchmark::State& state) {
TrackCounters track_counters;
- ExecCtx _local_exec_ctx;
+ grpc_core::ExecCtx _local_exec_ctx;
Rescheduler r(state, grpc_schedule_on_exec_ctx);
r.ScheduleFirst();
@@ -385,11 +385,11 @@ BENCHMARK(BM_ClosureReschedOnExecCtx);
static void BM_ClosureReschedOnCombiner(benchmark::State& state) {
TrackCounters track_counters;
- ExecCtx _local_exec_ctx;
+ grpc_core::ExecCtx _local_exec_ctx;
grpc_combiner* combiner = grpc_combiner_create();
Rescheduler r(state, grpc_combiner_scheduler(combiner));
r.ScheduleFirst();
- ExecCtx::Get()->Flush();
+ grpc_core::ExecCtx::Get()->Flush();
GRPC_COMBINER_UNREF(combiner, "finished");
track_counters.Finish(state);
@@ -398,11 +398,11 @@ BENCHMARK(BM_ClosureReschedOnCombiner);
static void BM_ClosureReschedOnCombinerFinally(benchmark::State& state) {
TrackCounters track_counters;
- ExecCtx _local_exec_ctx;
+ grpc_core::ExecCtx _local_exec_ctx;
grpc_combiner* combiner = grpc_combiner_create();
Rescheduler r(state, grpc_combiner_finally_scheduler(combiner));
r.ScheduleFirstAgainstDifferentScheduler(grpc_combiner_scheduler(combiner));
- ExecCtx::Get()->Flush();
+ grpc_core::ExecCtx::Get()->Flush();
GRPC_COMBINER_UNREF(combiner, "finished");
track_counters.Finish(state);