diff options
author | ncteisen <ncteisen@gmail.com> | 2017-11-15 16:48:19 -0800 |
---|---|---|
committer | ncteisen <ncteisen@gmail.com> | 2017-11-15 16:48:19 -0800 |
commit | df817f3e1a78c2760798f27d2c285936d818f656 (patch) | |
tree | c7cb8b1c3057b7d1d7d00b0e606a804d63d35846 /test/cpp/microbenchmarks | |
parent | 1037216ca165a9da963d41af575c55ca1b677311 (diff) | |
parent | ff2edb3eba20b30f232ded7769cab8cd20ff5009 (diff) |
Merge branch 'master' of https://github.com/grpc/grpc into surfacing-error-details
Diffstat (limited to 'test/cpp/microbenchmarks')
-rw-r--r-- | test/cpp/microbenchmarks/bm_call_create.cc | 91 | ||||
-rw-r--r-- | test/cpp/microbenchmarks/bm_chttp2_hpack.cc | 6 | ||||
-rw-r--r-- | test/cpp/microbenchmarks/bm_chttp2_transport.cc | 8 | ||||
-rw-r--r-- | test/cpp/microbenchmarks/bm_closure.cc | 60 | ||||
-rw-r--r-- | test/cpp/microbenchmarks/bm_cq.cc | 31 | ||||
-rw-r--r-- | test/cpp/microbenchmarks/bm_cq_multiple_threads.cc | 8 | ||||
-rw-r--r-- | test/cpp/microbenchmarks/bm_error.cc | 13 | ||||
-rw-r--r-- | test/cpp/microbenchmarks/bm_fullstack_trickle.cc | 4 | ||||
-rw-r--r-- | test/cpp/microbenchmarks/bm_metadata.cc | 18 | ||||
-rw-r--r-- | test/cpp/microbenchmarks/bm_pollset.cc | 11 | ||||
-rw-r--r-- | test/cpp/microbenchmarks/fullstack_fixtures.h | 10 |
11 files changed, 142 insertions, 118 deletions
diff --git a/test/cpp/microbenchmarks/bm_call_create.cc b/test/cpp/microbenchmarks/bm_call_create.cc index ec5c1275d1..a45c577320 100644 --- a/test/cpp/microbenchmarks/bm_call_create.cc +++ b/test/cpp/microbenchmarks/bm_call_create.cc @@ -91,7 +91,7 @@ class InsecureChannel : public BaseChannelFixture { public: InsecureChannel() : BaseChannelFixture( - grpc_insecure_channel_create("localhost:1234", NULL, NULL)) {} + grpc_insecure_channel_create("localhost:1234", nullptr, nullptr)) {} }; class LameChannel : public BaseChannelFixture { @@ -105,14 +105,14 @@ template <class Fixture> static void BM_CallCreateDestroy(benchmark::State& state) { TrackCounters track_counters; Fixture fixture; - grpc_completion_queue* cq = grpc_completion_queue_create_for_next(NULL); + grpc_completion_queue* cq = grpc_completion_queue_create_for_next(nullptr); gpr_timespec deadline = gpr_inf_future(GPR_CLOCK_MONOTONIC); - void* method_hdl = - grpc_channel_register_call(fixture.channel(), "/foo/bar", NULL, NULL); + void* method_hdl = grpc_channel_register_call(fixture.channel(), "/foo/bar", + nullptr, nullptr); while (state.KeepRunning()) { grpc_call_unref(grpc_channel_create_registered_call( - fixture.channel(), NULL, GRPC_PROPAGATE_DEFAULTS, cq, method_hdl, - deadline, NULL)); + fixture.channel(), nullptr, GRPC_PROPAGATE_DEFAULTS, cq, method_hdl, + deadline, nullptr)); } grpc_completion_queue_destroy(cq); track_counters.Finish(state); @@ -161,7 +161,7 @@ static void BM_LameChannelCallCreateCore(benchmark::State& state) { grpc_completion_queue* cq; grpc_metadata_array initial_metadata_recv; grpc_metadata_array trailing_metadata_recv; - grpc_byte_buffer* response_payload_recv = NULL; + grpc_byte_buffer* response_payload_recv = nullptr; grpc_status_code status; grpc_slice details; grpc::testing::EchoRequest send_request; @@ -170,14 +170,14 @@ static void BM_LameChannelCallCreateCore(benchmark::State& state) { channel = grpc_lame_client_channel_create( "localhost:1234", GRPC_STATUS_UNAUTHENTICATED, "blah"); - cq = grpc_completion_queue_create_for_next(NULL); + cq = grpc_completion_queue_create_for_next(nullptr); void* rc = grpc_channel_register_call( - channel, "/grpc.testing.EchoTestService/Echo", NULL, NULL); + channel, "/grpc.testing.EchoTestService/Echo", nullptr, nullptr); while (state.KeepRunning()) { GPR_TIMER_SCOPE("BenchmarkCycle", 0); grpc_call* call = grpc_channel_create_registered_call( - channel, NULL, GRPC_PROPAGATE_DEFAULTS, cq, rc, - gpr_inf_future(GPR_CLOCK_REALTIME), NULL); + channel, nullptr, GRPC_PROPAGATE_DEFAULTS, cq, rc, + gpr_inf_future(GPR_CLOCK_REALTIME), nullptr); grpc_metadata_array_init(&initial_metadata_recv); grpc_metadata_array_init(&trailing_metadata_recv); grpc_byte_buffer* request_payload_send = @@ -210,9 +210,9 @@ static void BM_LameChannelCallCreateCore(benchmark::State& state) { GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(call, ops, (size_t)(op - ops), - (void*)1, NULL)); + (void*)1, nullptr)); grpc_event ev = grpc_completion_queue_next( - cq, gpr_inf_future(GPR_CLOCK_REALTIME), NULL); + cq, gpr_inf_future(GPR_CLOCK_REALTIME), nullptr); GPR_ASSERT(ev.type != GRPC_QUEUE_SHUTDOWN); GPR_ASSERT(ev.success != 0); grpc_call_unref(call); @@ -235,7 +235,7 @@ static void BM_LameChannelCallCreateCoreSeparateBatch(benchmark::State& state) { grpc_completion_queue* cq; grpc_metadata_array initial_metadata_recv; grpc_metadata_array trailing_metadata_recv; - grpc_byte_buffer* response_payload_recv = NULL; + grpc_byte_buffer* response_payload_recv = nullptr; grpc_status_code status; grpc_slice details; grpc::testing::EchoRequest send_request; @@ -244,14 +244,14 @@ static void BM_LameChannelCallCreateCoreSeparateBatch(benchmark::State& state) { channel = grpc_lame_client_channel_create( "localhost:1234", GRPC_STATUS_UNAUTHENTICATED, "blah"); - cq = grpc_completion_queue_create_for_next(NULL); + cq = grpc_completion_queue_create_for_next(nullptr); void* rc = grpc_channel_register_call( - channel, "/grpc.testing.EchoTestService/Echo", NULL, NULL); + channel, "/grpc.testing.EchoTestService/Echo", nullptr, nullptr); while (state.KeepRunning()) { GPR_TIMER_SCOPE("BenchmarkCycle", 0); grpc_call* call = grpc_channel_create_registered_call( - channel, NULL, GRPC_PROPAGATE_DEFAULTS, cq, rc, - gpr_inf_future(GPR_CLOCK_REALTIME), NULL); + channel, nullptr, GRPC_PROPAGATE_DEFAULTS, cq, rc, + gpr_inf_future(GPR_CLOCK_REALTIME), nullptr); grpc_metadata_array_init(&initial_metadata_recv); grpc_metadata_array_init(&trailing_metadata_recv); grpc_byte_buffer* request_payload_send = @@ -271,7 +271,7 @@ static void BM_LameChannelCallCreateCoreSeparateBatch(benchmark::State& state) { op++; GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(call, ops, (size_t)(op - ops), - (void*)0, NULL)); + (void*)nullptr, nullptr)); memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_RECV_INITIAL_METADATA; @@ -289,13 +289,13 @@ static void BM_LameChannelCallCreateCoreSeparateBatch(benchmark::State& state) { GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(call, ops, (size_t)(op - ops), - (void*)1, NULL)); + (void*)1, nullptr)); grpc_event ev = grpc_completion_queue_next( - cq, gpr_inf_future(GPR_CLOCK_REALTIME), NULL); + cq, gpr_inf_future(GPR_CLOCK_REALTIME), nullptr); GPR_ASSERT(ev.type != GRPC_QUEUE_SHUTDOWN); GPR_ASSERT(ev.success == 0); ev = grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME), - NULL); + nullptr); GPR_ASSERT(ev.type != GRPC_QUEUE_SHUTDOWN); GPR_ASSERT(ev.success != 0); grpc_call_unref(call); @@ -538,7 +538,7 @@ static void BM_IsolatedFilter(benchmark::State& state) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; size_t channel_size = grpc_channel_stack_size( - filters.size() == 0 ? NULL : &filters[0], filters.size()); + filters.size() == 0 ? nullptr : &filters[0], filters.size()); grpc_channel_stack* channel_stack = static_cast<grpc_channel_stack*>(gpr_zalloc(channel_size)); GPR_ASSERT(GRPC_LOG_IF_ERROR( @@ -559,8 +559,8 @@ static void BM_IsolatedFilter(benchmark::State& state) { TestOp test_op_data; grpc_call_element_args call_args; call_args.call_stack = call_stack; - call_args.server_transport_data = NULL; - call_args.context = NULL; + call_args.server_transport_data = nullptr; + call_args.context = nullptr; call_args.path = method; call_args.start_time = start_time; call_args.deadline = deadline; @@ -569,9 +569,9 @@ static void BM_IsolatedFilter(benchmark::State& state) { while (state.KeepRunning()) { GPR_TIMER_SCOPE("BenchmarkCycle", 0); GRPC_ERROR_UNREF(grpc_call_stack_init(&exec_ctx, channel_stack, 1, - DoNothing, NULL, &call_args)); + DoNothing, nullptr, &call_args)); typename TestOp::Op op(&exec_ctx, &test_op_data, call_stack); - grpc_call_stack_destroy(&exec_ctx, call_stack, &final_info, NULL); + grpc_call_stack_destroy(&exec_ctx, call_stack, &final_info, nullptr); op.Finish(&exec_ctx); grpc_exec_ctx_flush(&exec_ctx); // recreate arena every 64k iterations to avoid oom @@ -708,14 +708,15 @@ class IsolatedCallFixture : public TrackCounters { grpc_channel_stack_builder_set_name(builder, "dummy"); grpc_channel_stack_builder_set_target(builder, "dummy_target"); GPR_ASSERT(grpc_channel_stack_builder_append_filter( - builder, &isolated_call_filter::isolated_call_filter, NULL, NULL)); + builder, &isolated_call_filter::isolated_call_filter, nullptr, + nullptr)); { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; channel_ = grpc_channel_create_with_builder(&exec_ctx, builder, GRPC_CLIENT_CHANNEL); grpc_exec_ctx_finish(&exec_ctx); } - cq_ = grpc_completion_queue_create_for_next(NULL); + cq_ = grpc_completion_queue_create_for_next(nullptr); } void Finish(benchmark::State& state) { @@ -735,13 +736,13 @@ class IsolatedCallFixture : public TrackCounters { static void BM_IsolatedCall_NoOp(benchmark::State& state) { IsolatedCallFixture fixture; gpr_timespec deadline = gpr_inf_future(GPR_CLOCK_MONOTONIC); - void* method_hdl = - grpc_channel_register_call(fixture.channel(), "/foo/bar", NULL, NULL); + void* method_hdl = grpc_channel_register_call(fixture.channel(), "/foo/bar", + nullptr, nullptr); while (state.KeepRunning()) { GPR_TIMER_SCOPE("BenchmarkCycle", 0); grpc_call_unref(grpc_channel_create_registered_call( fixture.channel(), nullptr, GRPC_PROPAGATE_DEFAULTS, fixture.cq(), - method_hdl, deadline, NULL)); + method_hdl, deadline, nullptr)); } fixture.Finish(state); } @@ -750,11 +751,11 @@ BENCHMARK(BM_IsolatedCall_NoOp); static void BM_IsolatedCall_Unary(benchmark::State& state) { IsolatedCallFixture fixture; gpr_timespec deadline = gpr_inf_future(GPR_CLOCK_MONOTONIC); - void* method_hdl = - grpc_channel_register_call(fixture.channel(), "/foo/bar", NULL, NULL); + void* method_hdl = grpc_channel_register_call(fixture.channel(), "/foo/bar", + nullptr, nullptr); grpc_slice slice = grpc_slice_from_static_string("hello world"); grpc_byte_buffer* send_message = grpc_raw_byte_buffer_create(&slice, 1); - grpc_byte_buffer* recv_message = NULL; + grpc_byte_buffer* recv_message = nullptr; grpc_status_code status_code; grpc_slice status_details = grpc_empty_slice(); grpc_metadata_array recv_initial_metadata; @@ -780,10 +781,10 @@ static void BM_IsolatedCall_Unary(benchmark::State& state) { GPR_TIMER_SCOPE("BenchmarkCycle", 0); grpc_call* call = grpc_channel_create_registered_call( fixture.channel(), nullptr, GRPC_PROPAGATE_DEFAULTS, fixture.cq(), - method_hdl, deadline, NULL); - grpc_call_start_batch(call, ops, 6, tag(1), NULL); + method_hdl, deadline, nullptr); + grpc_call_start_batch(call, ops, 6, tag(1), nullptr); grpc_completion_queue_next(fixture.cq(), - gpr_inf_future(GPR_CLOCK_MONOTONIC), NULL); + gpr_inf_future(GPR_CLOCK_MONOTONIC), nullptr); grpc_call_unref(call); } fixture.Finish(state); @@ -796,8 +797,8 @@ BENCHMARK(BM_IsolatedCall_Unary); static void BM_IsolatedCall_StreamingSend(benchmark::State& state) { IsolatedCallFixture fixture; gpr_timespec deadline = gpr_inf_future(GPR_CLOCK_MONOTONIC); - void* method_hdl = - grpc_channel_register_call(fixture.channel(), "/foo/bar", NULL, NULL); + void* method_hdl = grpc_channel_register_call(fixture.channel(), "/foo/bar", + nullptr, nullptr); grpc_slice slice = grpc_slice_from_static_string("hello world"); grpc_byte_buffer* send_message = grpc_raw_byte_buffer_create(&slice, 1); grpc_metadata_array recv_initial_metadata; @@ -812,18 +813,18 @@ static void BM_IsolatedCall_StreamingSend(benchmark::State& state) { &recv_initial_metadata; grpc_call* call = grpc_channel_create_registered_call( fixture.channel(), nullptr, GRPC_PROPAGATE_DEFAULTS, fixture.cq(), - method_hdl, deadline, NULL); - grpc_call_start_batch(call, ops, 2, tag(1), NULL); + method_hdl, deadline, nullptr); + grpc_call_start_batch(call, ops, 2, tag(1), nullptr); grpc_completion_queue_next(fixture.cq(), gpr_inf_future(GPR_CLOCK_MONOTONIC), - NULL); + nullptr); memset(ops, 0, sizeof(ops)); ops[0].op = GRPC_OP_SEND_MESSAGE; ops[0].data.send_message.send_message = send_message; while (state.KeepRunning()) { GPR_TIMER_SCOPE("BenchmarkCycle", 0); - grpc_call_start_batch(call, ops, 1, tag(2), NULL); + grpc_call_start_batch(call, ops, 1, tag(2), nullptr); grpc_completion_queue_next(fixture.cq(), - gpr_inf_future(GPR_CLOCK_MONOTONIC), NULL); + gpr_inf_future(GPR_CLOCK_MONOTONIC), nullptr); } grpc_call_unref(call); fixture.Finish(state); diff --git a/test/cpp/microbenchmarks/bm_chttp2_hpack.cc b/test/cpp/microbenchmarks/bm_chttp2_hpack.cc index 45f5382fde..3fff8b02d6 100644 --- a/test/cpp/microbenchmarks/bm_chttp2_hpack.cc +++ b/test/cpp/microbenchmarks/bm_chttp2_hpack.cc @@ -85,7 +85,7 @@ static void BM_HpackEncoderEncodeDeadline(benchmark::State& state) { (size_t)1024, &stats, }; - grpc_chttp2_encode_header(&exec_ctx, &c, NULL, 0, &b, &hopt, &outbuf); + grpc_chttp2_encode_header(&exec_ctx, &c, nullptr, 0, &b, &hopt, &outbuf); grpc_slice_buffer_reset_and_unref_internal(&exec_ctx, &outbuf); grpc_exec_ctx_flush(&exec_ctx); } @@ -136,7 +136,7 @@ static void BM_HpackEncoderEncodeHeader(benchmark::State& state) { (size_t)state.range(1), &stats, }; - grpc_chttp2_encode_header(&exec_ctx, &c, NULL, 0, &b, &hopt, &outbuf); + grpc_chttp2_encode_header(&exec_ctx, &c, nullptr, 0, &b, &hopt, &outbuf); if (!logged_representative_output && state.iterations() > 3) { logged_representative_output = true; for (size_t i = 0; i < outbuf.count; i++) { @@ -775,7 +775,7 @@ static void OnHeaderNew(grpc_exec_ctx* exec_ctx, void* user_data, grpc_millis* cached_timeout = static_cast<grpc_millis*>(grpc_mdelem_get_user_data(md, free_timeout)); grpc_millis timeout; - if (cached_timeout != NULL) { + if (cached_timeout != nullptr) { timeout = *cached_timeout; } else { if (!grpc_http2_decode_timeout(GRPC_MDVALUE(md), &timeout)) { diff --git a/test/cpp/microbenchmarks/bm_chttp2_transport.cc b/test/cpp/microbenchmarks/bm_chttp2_transport.cc index 154cc91778..b95ee0cc01 100644 --- a/test/cpp/microbenchmarks/bm_chttp2_transport.cc +++ b/test/cpp/microbenchmarks/bm_chttp2_transport.cc @@ -100,7 +100,7 @@ class DummyEndpoint : public grpc_endpoint { GRPC_CLOSURE_SCHED(exec_ctx, cb, GRPC_ERROR_NONE); } - static grpc_workqueue* get_workqueue(grpc_endpoint* ep) { return NULL; } + static grpc_workqueue* get_workqueue(grpc_endpoint* ep) { return nullptr; } static void add_to_pollset(grpc_exec_ctx* exec_ctx, grpc_endpoint* ep, grpc_pollset* pollset) {} @@ -137,7 +137,7 @@ class Fixture { grpc_channel_args c_args = args.c_channel_args(); ep_ = new DummyEndpoint; t_ = grpc_create_chttp2_transport(exec_ctx(), &c_args, ep_, client); - grpc_chttp2_transport_start_reading(exec_ctx(), t_, NULL); + grpc_chttp2_transport_start_reading(exec_ctx(), t_, nullptr); FlushExecCtx(); } @@ -222,7 +222,7 @@ class Stream { } grpc_transport_init_stream(f_->exec_ctx(), f_->transport(), static_cast<grpc_stream*>(stream_), &refcount_, - NULL, arena_); + nullptr, arena_); } void DestroyThen(grpc_exec_ctx* exec_ctx, grpc_closure* closure) { @@ -586,7 +586,7 @@ static void BM_TransportStreamRecv(benchmark::State& state) { }); drain_start = MakeClosure([&](grpc_exec_ctx* exec_ctx, grpc_error* error) { - if (recv_stream == NULL) { + if (recv_stream == nullptr) { GPR_ASSERT(!state.KeepRunning()); return; } diff --git a/test/cpp/microbenchmarks/bm_closure.cc b/test/cpp/microbenchmarks/bm_closure.cc index 458a2ceb13..2434d4e84e 100644 --- a/test/cpp/microbenchmarks/bm_closure.cc +++ b/test/cpp/microbenchmarks/bm_closure.cc @@ -59,7 +59,7 @@ static void BM_ClosureInitAgainstExecCtx(benchmark::State& state) { grpc_closure c; while (state.KeepRunning()) { benchmark::DoNotOptimize( - GRPC_CLOSURE_INIT(&c, DoNothing, NULL, grpc_schedule_on_exec_ctx)); + GRPC_CLOSURE_INIT(&c, DoNothing, nullptr, grpc_schedule_on_exec_ctx)); } track_counters.Finish(state); } @@ -72,7 +72,7 @@ static void BM_ClosureInitAgainstCombiner(benchmark::State& state) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; while (state.KeepRunning()) { benchmark::DoNotOptimize(GRPC_CLOSURE_INIT( - &c, DoNothing, NULL, grpc_combiner_scheduler(combiner))); + &c, DoNothing, nullptr, grpc_combiner_scheduler(combiner))); } GRPC_COMBINER_UNREF(&exec_ctx, combiner, "finished"); grpc_exec_ctx_finish(&exec_ctx); @@ -83,7 +83,7 @@ BENCHMARK(BM_ClosureInitAgainstCombiner); static void BM_ClosureRunOnExecCtx(benchmark::State& state) { TrackCounters track_counters; grpc_closure c; - GRPC_CLOSURE_INIT(&c, DoNothing, NULL, grpc_schedule_on_exec_ctx); + GRPC_CLOSURE_INIT(&c, DoNothing, nullptr, grpc_schedule_on_exec_ctx); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; while (state.KeepRunning()) { GRPC_CLOSURE_RUN(&exec_ctx, &c, GRPC_ERROR_NONE); @@ -100,7 +100,7 @@ static void BM_ClosureCreateAndRun(benchmark::State& state) { while (state.KeepRunning()) { GRPC_CLOSURE_RUN( &exec_ctx, - GRPC_CLOSURE_CREATE(DoNothing, NULL, grpc_schedule_on_exec_ctx), + GRPC_CLOSURE_CREATE(DoNothing, nullptr, grpc_schedule_on_exec_ctx), GRPC_ERROR_NONE); } grpc_exec_ctx_finish(&exec_ctx); @@ -115,7 +115,7 @@ static void BM_ClosureInitAndRun(benchmark::State& state) { while (state.KeepRunning()) { GRPC_CLOSURE_RUN( &exec_ctx, - GRPC_CLOSURE_INIT(&c, DoNothing, NULL, grpc_schedule_on_exec_ctx), + GRPC_CLOSURE_INIT(&c, DoNothing, nullptr, grpc_schedule_on_exec_ctx), GRPC_ERROR_NONE); } grpc_exec_ctx_finish(&exec_ctx); @@ -126,7 +126,7 @@ BENCHMARK(BM_ClosureInitAndRun); static void BM_ClosureSchedOnExecCtx(benchmark::State& state) { TrackCounters track_counters; grpc_closure c; - GRPC_CLOSURE_INIT(&c, DoNothing, NULL, grpc_schedule_on_exec_ctx); + GRPC_CLOSURE_INIT(&c, DoNothing, nullptr, grpc_schedule_on_exec_ctx); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; while (state.KeepRunning()) { GRPC_CLOSURE_SCHED(&exec_ctx, &c, GRPC_ERROR_NONE); @@ -141,8 +141,8 @@ static void BM_ClosureSched2OnExecCtx(benchmark::State& state) { TrackCounters track_counters; grpc_closure c1; 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); + GRPC_CLOSURE_INIT(&c1, DoNothing, nullptr, grpc_schedule_on_exec_ctx); + GRPC_CLOSURE_INIT(&c2, DoNothing, nullptr, grpc_schedule_on_exec_ctx); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; while (state.KeepRunning()) { GRPC_CLOSURE_SCHED(&exec_ctx, &c1, GRPC_ERROR_NONE); @@ -159,9 +159,9 @@ static void BM_ClosureSched3OnExecCtx(benchmark::State& state) { grpc_closure c1; grpc_closure c2; grpc_closure c3; - 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); + GRPC_CLOSURE_INIT(&c1, DoNothing, nullptr, grpc_schedule_on_exec_ctx); + GRPC_CLOSURE_INIT(&c2, DoNothing, nullptr, grpc_schedule_on_exec_ctx); + GRPC_CLOSURE_INIT(&c3, DoNothing, nullptr, grpc_schedule_on_exec_ctx); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; while (state.KeepRunning()) { GRPC_CLOSURE_SCHED(&exec_ctx, &c1, GRPC_ERROR_NONE); @@ -182,7 +182,7 @@ static void BM_AcquireMutex(benchmark::State& state) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; while (state.KeepRunning()) { gpr_mu_lock(&mu); - DoNothing(&exec_ctx, NULL, GRPC_ERROR_NONE); + DoNothing(&exec_ctx, nullptr, GRPC_ERROR_NONE); gpr_mu_unlock(&mu); } grpc_exec_ctx_finish(&exec_ctx); @@ -198,7 +198,7 @@ static void BM_TryAcquireMutex(benchmark::State& state) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; while (state.KeepRunning()) { if (gpr_mu_trylock(&mu)) { - DoNothing(&exec_ctx, NULL, GRPC_ERROR_NONE); + DoNothing(&exec_ctx, nullptr, GRPC_ERROR_NONE); gpr_mu_unlock(&mu); } else { abort(); @@ -216,7 +216,7 @@ static void BM_AcquireSpinlock(benchmark::State& state) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; while (state.KeepRunning()) { gpr_spinlock_lock(&mu); - DoNothing(&exec_ctx, NULL, GRPC_ERROR_NONE); + DoNothing(&exec_ctx, nullptr, GRPC_ERROR_NONE); gpr_spinlock_unlock(&mu); } grpc_exec_ctx_finish(&exec_ctx); @@ -231,7 +231,7 @@ static void BM_TryAcquireSpinlock(benchmark::State& state) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; while (state.KeepRunning()) { if (gpr_spinlock_trylock(&mu)) { - DoNothing(&exec_ctx, NULL, GRPC_ERROR_NONE); + DoNothing(&exec_ctx, nullptr, GRPC_ERROR_NONE); gpr_spinlock_unlock(&mu); } else { abort(); @@ -246,7 +246,7 @@ static void BM_ClosureSchedOnCombiner(benchmark::State& state) { TrackCounters track_counters; grpc_combiner* combiner = grpc_combiner_create(); grpc_closure c; - GRPC_CLOSURE_INIT(&c, DoNothing, NULL, grpc_combiner_scheduler(combiner)); + GRPC_CLOSURE_INIT(&c, DoNothing, nullptr, 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); @@ -263,8 +263,8 @@ static void BM_ClosureSched2OnCombiner(benchmark::State& state) { grpc_combiner* combiner = grpc_combiner_create(); grpc_closure c1; grpc_closure c2; - GRPC_CLOSURE_INIT(&c1, DoNothing, NULL, grpc_combiner_scheduler(combiner)); - GRPC_CLOSURE_INIT(&c2, DoNothing, NULL, grpc_combiner_scheduler(combiner)); + GRPC_CLOSURE_INIT(&c1, DoNothing, nullptr, grpc_combiner_scheduler(combiner)); + GRPC_CLOSURE_INIT(&c2, DoNothing, nullptr, 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); @@ -283,9 +283,9 @@ static void BM_ClosureSched3OnCombiner(benchmark::State& state) { grpc_closure c1; grpc_closure c2; grpc_closure c3; - 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_CLOSURE_INIT(&c1, DoNothing, nullptr, grpc_combiner_scheduler(combiner)); + GRPC_CLOSURE_INIT(&c2, DoNothing, nullptr, grpc_combiner_scheduler(combiner)); + GRPC_CLOSURE_INIT(&c3, DoNothing, nullptr, 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); @@ -305,8 +305,10 @@ static void BM_ClosureSched2OnTwoCombiners(benchmark::State& state) { grpc_combiner* combiner2 = grpc_combiner_create(); grpc_closure c1; grpc_closure c2; - GRPC_CLOSURE_INIT(&c1, DoNothing, NULL, grpc_combiner_scheduler(combiner1)); - GRPC_CLOSURE_INIT(&c2, DoNothing, NULL, grpc_combiner_scheduler(combiner2)); + GRPC_CLOSURE_INIT(&c1, DoNothing, nullptr, + grpc_combiner_scheduler(combiner1)); + GRPC_CLOSURE_INIT(&c2, DoNothing, nullptr, + 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); @@ -328,10 +330,14 @@ static void BM_ClosureSched4OnTwoCombiners(benchmark::State& state) { grpc_closure c2; grpc_closure c3; grpc_closure c4; - 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_CLOSURE_INIT(&c1, DoNothing, nullptr, + grpc_combiner_scheduler(combiner1)); + GRPC_CLOSURE_INIT(&c2, DoNothing, nullptr, + grpc_combiner_scheduler(combiner2)); + GRPC_CLOSURE_INIT(&c3, DoNothing, nullptr, + grpc_combiner_scheduler(combiner1)); + GRPC_CLOSURE_INIT(&c4, DoNothing, nullptr, + 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); diff --git a/test/cpp/microbenchmarks/bm_cq.cc b/test/cpp/microbenchmarks/bm_cq.cc index dac702b08b..f0dede7333 100644 --- a/test/cpp/microbenchmarks/bm_cq.cc +++ b/test/cpp/microbenchmarks/bm_cq.cc @@ -47,7 +47,7 @@ static void BM_CreateDestroyCpp2(benchmark::State& state) { TrackCounters track_counters; while (state.KeepRunning()) { grpc_completion_queue* core_cq = - grpc_completion_queue_create_for_next(NULL); + grpc_completion_queue_create_for_next(nullptr); CompletionQueue cq(core_cq); } track_counters.Finish(state); @@ -59,7 +59,8 @@ static void BM_CreateDestroyCore(benchmark::State& state) { while (state.KeepRunning()) { // TODO: sreek Templatize this benchmark and pass completion type and // polling type as parameters - grpc_completion_queue_destroy(grpc_completion_queue_create_for_next(NULL)); + grpc_completion_queue_destroy( + grpc_completion_queue_create_for_next(nullptr)); } track_counters.Finish(state); } @@ -83,7 +84,7 @@ static void BM_Pass1Cpp(benchmark::State& state) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; GPR_ASSERT(grpc_cq_begin_op(c_cq, &dummy_tag)); grpc_cq_end_op(&exec_ctx, c_cq, &dummy_tag, GRPC_ERROR_NONE, - DoneWithCompletionOnStack, NULL, &completion); + DoneWithCompletionOnStack, nullptr, &completion); grpc_exec_ctx_finish(&exec_ctx); void* tag; bool ok; @@ -96,16 +97,16 @@ BENCHMARK(BM_Pass1Cpp); static void BM_Pass1Core(benchmark::State& state) { TrackCounters track_counters; // TODO: sreek Templatize this benchmark and pass polling_type as a param - grpc_completion_queue* cq = grpc_completion_queue_create_for_next(NULL); + grpc_completion_queue* cq = grpc_completion_queue_create_for_next(nullptr); 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; - GPR_ASSERT(grpc_cq_begin_op(cq, NULL)); - grpc_cq_end_op(&exec_ctx, cq, NULL, GRPC_ERROR_NONE, - DoneWithCompletionOnStack, NULL, &completion); + GPR_ASSERT(grpc_cq_begin_op(cq, nullptr)); + grpc_cq_end_op(&exec_ctx, cq, nullptr, GRPC_ERROR_NONE, + DoneWithCompletionOnStack, nullptr, &completion); grpc_exec_ctx_finish(&exec_ctx); - grpc_completion_queue_next(cq, deadline, NULL); + grpc_completion_queue_next(cq, deadline, nullptr); } grpc_completion_queue_destroy(cq); track_counters.Finish(state); @@ -115,16 +116,16 @@ BENCHMARK(BM_Pass1Core); static void BM_Pluck1Core(benchmark::State& state) { TrackCounters track_counters; // TODO: sreek Templatize this benchmark and pass polling_type as a param - grpc_completion_queue* cq = grpc_completion_queue_create_for_pluck(NULL); + grpc_completion_queue* cq = grpc_completion_queue_create_for_pluck(nullptr); 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; - GPR_ASSERT(grpc_cq_begin_op(cq, NULL)); - grpc_cq_end_op(&exec_ctx, cq, NULL, GRPC_ERROR_NONE, - DoneWithCompletionOnStack, NULL, &completion); + GPR_ASSERT(grpc_cq_begin_op(cq, nullptr)); + grpc_cq_end_op(&exec_ctx, cq, nullptr, GRPC_ERROR_NONE, + DoneWithCompletionOnStack, nullptr, &completion); grpc_exec_ctx_finish(&exec_ctx); - grpc_completion_queue_pluck(cq, NULL, deadline, NULL); + grpc_completion_queue_pluck(cq, nullptr, deadline, nullptr); } grpc_completion_queue_destroy(cq); track_counters.Finish(state); @@ -134,10 +135,10 @@ BENCHMARK(BM_Pluck1Core); static void BM_EmptyCore(benchmark::State& state) { TrackCounters track_counters; // TODO: sreek Templatize this benchmark and pass polling_type as a param - grpc_completion_queue* cq = grpc_completion_queue_create_for_next(NULL); + grpc_completion_queue* cq = grpc_completion_queue_create_for_next(nullptr); gpr_timespec deadline = gpr_inf_past(GPR_CLOCK_MONOTONIC); while (state.KeepRunning()) { - grpc_completion_queue_next(cq, deadline, NULL); + grpc_completion_queue_next(cq, deadline, nullptr); } grpc_completion_queue_destroy(cq); track_counters.Finish(state); diff --git a/test/cpp/microbenchmarks/bm_cq_multiple_threads.cc b/test/cpp/microbenchmarks/bm_cq_multiple_threads.cc index 8d4349a297..7ccebb55ee 100644 --- a/test/cpp/microbenchmarks/bm_cq_multiple_threads.cc +++ b/test/cpp/microbenchmarks/bm_cq_multiple_threads.cc @@ -80,7 +80,7 @@ static grpc_error* pollset_work(grpc_exec_ctx* exec_ctx, grpc_pollset* ps, gpr_mu_unlock(&ps->mu); GPR_ASSERT(grpc_cq_begin_op(g_cq, g_tag)); - grpc_cq_end_op(exec_ctx, g_cq, g_tag, GRPC_ERROR_NONE, cq_done_cb, NULL, + grpc_cq_end_op(exec_ctx, g_cq, g_tag, GRPC_ERROR_NONE, cq_done_cb, nullptr, (grpc_cq_completion*)gpr_malloc(sizeof(grpc_cq_completion))); grpc_exec_ctx_flush(exec_ctx); gpr_mu_lock(&ps->mu); @@ -108,7 +108,7 @@ static void setup() { g_old_vtable = grpc_get_event_engine_test_only(); grpc_set_event_engine_test_only(&g_vtable); - g_cq = grpc_completion_queue_create_for_next(NULL); + g_cq = grpc_completion_queue_create_for_next(nullptr); } static void teardown() { @@ -116,7 +116,7 @@ static void teardown() { /* Drain any events */ gpr_timespec deadline = gpr_time_0(GPR_CLOCK_MONOTONIC); - while (grpc_completion_queue_next(g_cq, deadline, NULL).type != + while (grpc_completion_queue_next(g_cq, deadline, nullptr).type != GRPC_QUEUE_SHUTDOWN) { /* Do nothing */ } @@ -151,7 +151,7 @@ static void BM_Cq_Throughput(benchmark::State& state) { } while (state.KeepRunning()) { - GPR_ASSERT(grpc_completion_queue_next(g_cq, deadline, NULL).type == + GPR_ASSERT(grpc_completion_queue_next(g_cq, deadline, nullptr).type == GRPC_OP_COMPLETE); } diff --git a/test/cpp/microbenchmarks/bm_error.cc b/test/cpp/microbenchmarks/bm_error.cc index 0c7976b855..66f9fe3704 100644 --- a/test/cpp/microbenchmarks/bm_error.cc +++ b/test/cpp/microbenchmarks/bm_error.cc @@ -251,7 +251,11 @@ static void BM_ErrorGetStatus(benchmark::State& state) { grpc_status_code status; grpc_slice slice; grpc_error_get_status(&exec_ctx, fixture.error(), fixture.deadline(), +<<<<<<< HEAD &status, &slice, NULL, NULL); +======= + &status, &slice, nullptr); +>>>>>>> ff2edb3eba20b30f232ded7769cab8cd20ff5009 } grpc_exec_ctx_finish(&exec_ctx); track_counters.Finish(state); @@ -265,7 +269,11 @@ static void BM_ErrorGetStatusCode(benchmark::State& state) { while (state.KeepRunning()) { grpc_status_code status; grpc_error_get_status(&exec_ctx, fixture.error(), fixture.deadline(), +<<<<<<< HEAD &status, NULL, NULL, NULL); +======= + &status, nullptr, nullptr); +>>>>>>> ff2edb3eba20b30f232ded7769cab8cd20ff5009 } grpc_exec_ctx_finish(&exec_ctx); track_counters.Finish(state); @@ -278,8 +286,13 @@ static void BM_ErrorHttpError(benchmark::State& state) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; while (state.KeepRunning()) { grpc_http2_error_code error; +<<<<<<< HEAD grpc_error_get_status(&exec_ctx, fixture.error(), fixture.deadline(), NULL, NULL, &error, NULL); +======= + grpc_error_get_status(&exec_ctx, fixture.error(), fixture.deadline(), + nullptr, nullptr, &error); +>>>>>>> ff2edb3eba20b30f232ded7769cab8cd20ff5009 } grpc_exec_ctx_finish(&exec_ctx); track_counters.Finish(state); diff --git a/test/cpp/microbenchmarks/bm_fullstack_trickle.cc b/test/cpp/microbenchmarks/bm_fullstack_trickle.cc index f75c3e4436..bb974fad50 100644 --- a/test/cpp/microbenchmarks/bm_fullstack_trickle.cc +++ b/test/cpp/microbenchmarks/bm_fullstack_trickle.cc @@ -216,10 +216,10 @@ class TrickledCHTTP2 : public EndpointPairFixture { void UpdateStats(grpc_chttp2_transport* t, Stats* s, size_t backlog) GPR_ATTRIBUTE_NO_TSAN { if (backlog == 0) { - if (t->lists[GRPC_CHTTP2_LIST_STALLED_BY_STREAM].head != NULL) { + if (t->lists[GRPC_CHTTP2_LIST_STALLED_BY_STREAM].head != nullptr) { s->streams_stalled_due_to_stream_flow_control++; } - if (t->lists[GRPC_CHTTP2_LIST_STALLED_BY_TRANSPORT].head != NULL) { + if (t->lists[GRPC_CHTTP2_LIST_STALLED_BY_TRANSPORT].head != nullptr) { s->streams_stalled_due_to_transport_flow_control++; } } diff --git a/test/cpp/microbenchmarks/bm_metadata.cc b/test/cpp/microbenchmarks/bm_metadata.cc index 1ed05f7466..73bce08466 100644 --- a/test/cpp/microbenchmarks/bm_metadata.cc +++ b/test/cpp/microbenchmarks/bm_metadata.cc @@ -92,7 +92,7 @@ static void BM_MetadataFromNonInternedSlices(benchmark::State& state) { gpr_slice v = grpc_slice_from_static_string("value"); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; while (state.KeepRunning()) { - GRPC_MDELEM_UNREF(&exec_ctx, grpc_mdelem_create(&exec_ctx, k, v, NULL)); + GRPC_MDELEM_UNREF(&exec_ctx, grpc_mdelem_create(&exec_ctx, k, v, nullptr)); } grpc_exec_ctx_finish(&exec_ctx); track_counters.Finish(state); @@ -105,7 +105,7 @@ static void BM_MetadataFromInternedSlices(benchmark::State& state) { gpr_slice v = grpc_slice_intern(grpc_slice_from_static_string("value")); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; while (state.KeepRunning()) { - GRPC_MDELEM_UNREF(&exec_ctx, grpc_mdelem_create(&exec_ctx, k, v, NULL)); + GRPC_MDELEM_UNREF(&exec_ctx, grpc_mdelem_create(&exec_ctx, k, v, nullptr)); } grpc_exec_ctx_finish(&exec_ctx); grpc_slice_unref(k); @@ -120,9 +120,9 @@ static void BM_MetadataFromInternedSlicesAlreadyInIndex( gpr_slice k = grpc_slice_intern(grpc_slice_from_static_string("key")); gpr_slice v = grpc_slice_intern(grpc_slice_from_static_string("value")); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_mdelem seed = grpc_mdelem_create(&exec_ctx, k, v, NULL); + grpc_mdelem seed = grpc_mdelem_create(&exec_ctx, k, v, nullptr); while (state.KeepRunning()) { - GRPC_MDELEM_UNREF(&exec_ctx, grpc_mdelem_create(&exec_ctx, k, v, NULL)); + GRPC_MDELEM_UNREF(&exec_ctx, grpc_mdelem_create(&exec_ctx, k, v, nullptr)); } GRPC_MDELEM_UNREF(&exec_ctx, seed); grpc_exec_ctx_finish(&exec_ctx); @@ -138,7 +138,7 @@ static void BM_MetadataFromInternedKey(benchmark::State& state) { gpr_slice v = grpc_slice_from_static_string("value"); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; while (state.KeepRunning()) { - GRPC_MDELEM_UNREF(&exec_ctx, grpc_mdelem_create(&exec_ctx, k, v, NULL)); + GRPC_MDELEM_UNREF(&exec_ctx, grpc_mdelem_create(&exec_ctx, k, v, nullptr)); } grpc_exec_ctx_finish(&exec_ctx); grpc_slice_unref(k); @@ -209,7 +209,7 @@ static void BM_MetadataFromStaticMetadataStrings(benchmark::State& state) { gpr_slice v = GRPC_MDSTR_200; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; while (state.KeepRunning()) { - GRPC_MDELEM_UNREF(&exec_ctx, grpc_mdelem_create(&exec_ctx, k, v, NULL)); + GRPC_MDELEM_UNREF(&exec_ctx, grpc_mdelem_create(&exec_ctx, k, v, nullptr)); } grpc_exec_ctx_finish(&exec_ctx); grpc_slice_unref(k); @@ -224,7 +224,7 @@ static void BM_MetadataFromStaticMetadataStringsNotIndexed( gpr_slice v = GRPC_MDSTR_GZIP; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; while (state.KeepRunning()) { - GRPC_MDELEM_UNREF(&exec_ctx, grpc_mdelem_create(&exec_ctx, k, v, NULL)); + GRPC_MDELEM_UNREF(&exec_ctx, grpc_mdelem_create(&exec_ctx, k, v, nullptr)); } grpc_exec_ctx_finish(&exec_ctx); grpc_slice_unref(k); @@ -273,7 +273,7 @@ static void BM_MetadataRefUnrefAllocated(benchmark::State& state) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_mdelem el = grpc_mdelem_create(&exec_ctx, grpc_slice_from_static_string("a"), - grpc_slice_from_static_string("b"), NULL); + grpc_slice_from_static_string("b"), nullptr); while (state.KeepRunning()) { GRPC_MDELEM_UNREF(&exec_ctx, GRPC_MDELEM_REF(el)); } @@ -287,7 +287,7 @@ static void BM_MetadataRefUnrefStatic(benchmark::State& state) { TrackCounters track_counters; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_mdelem el = - grpc_mdelem_create(&exec_ctx, GRPC_MDSTR_STATUS, GRPC_MDSTR_200, NULL); + grpc_mdelem_create(&exec_ctx, GRPC_MDSTR_STATUS, GRPC_MDSTR_200, nullptr); while (state.KeepRunning()) { GRPC_MDELEM_UNREF(&exec_ctx, GRPC_MDELEM_REF(el)); } diff --git a/test/cpp/microbenchmarks/bm_pollset.cc b/test/cpp/microbenchmarks/bm_pollset.cc index 92d76f307e..4da79693f1 100644 --- a/test/cpp/microbenchmarks/bm_pollset.cc +++ b/test/cpp/microbenchmarks/bm_pollset.cc @@ -117,7 +117,7 @@ static void BM_PollEmptyPollset(benchmark::State& state) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; gpr_mu_lock(mu); while (state.KeepRunning()) { - GRPC_ERROR_UNREF(grpc_pollset_work(&exec_ctx, ps, NULL, 0)); + GRPC_ERROR_UNREF(grpc_pollset_work(&exec_ctx, ps, nullptr, 0)); } grpc_closure shutdown_ps_closure; GRPC_CLOSURE_INIT(&shutdown_ps_closure, shutdown_ps, ps, @@ -145,7 +145,8 @@ static void BM_PollAddFd(benchmark::State& state) { grpc_pollset_add_fd(&exec_ctx, ps, fd); grpc_exec_ctx_flush(&exec_ctx); } - grpc_fd_orphan(&exec_ctx, fd, NULL, NULL, false /* already_closed */, "xxx"); + grpc_fd_orphan(&exec_ctx, fd, nullptr, nullptr, false /* already_closed */, + "xxx"); grpc_closure shutdown_ps_closure; GRPC_CLOSURE_INIT(&shutdown_ps_closure, shutdown_ps, ps, grpc_schedule_on_exec_ctx); @@ -240,10 +241,10 @@ static void BM_SingleThreadPollOneFd(benchmark::State& state) { gpr_mu_lock(mu); while (!done) { GRPC_ERROR_UNREF( - grpc_pollset_work(&exec_ctx, ps, NULL, GRPC_MILLIS_INF_FUTURE)); + grpc_pollset_work(&exec_ctx, ps, nullptr, GRPC_MILLIS_INF_FUTURE)); } - grpc_fd_orphan(&exec_ctx, wakeup, NULL, NULL, false /* already_closed */, - "done"); + grpc_fd_orphan(&exec_ctx, wakeup, nullptr, nullptr, + false /* already_closed */, "done"); wakeup_fd.read_fd = 0; grpc_closure shutdown_ps_closure; GRPC_CLOSURE_INIT(&shutdown_ps_closure, shutdown_ps, ps, diff --git a/test/cpp/microbenchmarks/fullstack_fixtures.h b/test/cpp/microbenchmarks/fullstack_fixtures.h index 71bbb393db..7f1aa48b56 100644 --- a/test/cpp/microbenchmarks/fullstack_fixtures.h +++ b/test/cpp/microbenchmarks/fullstack_fixtures.h @@ -185,8 +185,9 @@ class EndpointPairFixture : public BaseFixture { } grpc_server_setup_transport(&exec_ctx, server_->c_server(), - server_transport_, NULL, server_args); - grpc_chttp2_transport_start_reading(&exec_ctx, server_transport_, NULL); + server_transport_, nullptr, server_args); + grpc_chttp2_transport_start_reading(&exec_ctx, server_transport_, + nullptr); } /* create channel */ @@ -202,7 +203,8 @@ class EndpointPairFixture : public BaseFixture { grpc_channel* channel = grpc_channel_create(&exec_ctx, "target", &c_args, GRPC_CLIENT_DIRECT_CHANNEL, client_transport_); - grpc_chttp2_transport_start_reading(&exec_ctx, client_transport_, NULL); + grpc_chttp2_transport_start_reading(&exec_ctx, client_transport_, + nullptr); channel_ = CreateChannelInternal("", channel); } @@ -244,7 +246,7 @@ class SockPair : public EndpointPairFixture { SockPair(Service* service, const FixtureConfiguration& fixture_configuration = FixtureConfiguration()) : EndpointPairFixture(service, - grpc_iomgr_create_endpoint_pair("test", NULL), + grpc_iomgr_create_endpoint_pair("test", nullptr), fixture_configuration) {} }; |