diff options
Diffstat (limited to 'test/cpp/microbenchmarks')
-rw-r--r-- | test/cpp/microbenchmarks/bm_call_create.cc | 14 | ||||
-rw-r--r-- | test/cpp/microbenchmarks/bm_chttp2_transport.cc | 29 |
2 files changed, 29 insertions, 14 deletions
diff --git a/test/cpp/microbenchmarks/bm_call_create.cc b/test/cpp/microbenchmarks/bm_call_create.cc index 4af2263e82..9af06d097b 100644 --- a/test/cpp/microbenchmarks/bm_call_create.cc +++ b/test/cpp/microbenchmarks/bm_call_create.cc @@ -346,13 +346,15 @@ class SendEmptyMetadata { memset(&op_, 0, sizeof(op_)); op_.on_complete = grpc_closure_init(&closure_, DoNothing, nullptr, grpc_schedule_on_exec_ctx); + op_.send_initial_metadata = true; + op_.payload = &op_payload_; } class Op { public: Op(grpc_exec_ctx *exec_ctx, SendEmptyMetadata *p, grpc_call_stack *s) { grpc_metadata_batch_init(&batch_); - p->op_.send_initial_metadata = &batch_; + p->op_payload_.send_initial_metadata.send_initial_metadata = &batch_; } void Finish(grpc_exec_ctx *exec_ctx) { grpc_metadata_batch_destroy(exec_ctx, &batch_); @@ -367,6 +369,7 @@ class SendEmptyMetadata { const gpr_timespec start_time_ = gpr_now(GPR_CLOCK_MONOTONIC); const grpc_slice method_ = grpc_slice_from_static_string("/foo/bar"); grpc_transport_stream_op op_; + grpc_transport_stream_op_payload op_payload_; grpc_closure closure_; }; @@ -490,11 +493,14 @@ static void StartTransportStreamOp(grpc_exec_ctx *exec_ctx, grpc_call_element *elem, grpc_transport_stream_op *op) { if (op->recv_initial_metadata) { - grpc_closure_sched(exec_ctx, op->recv_initial_metadata_ready, - GRPC_ERROR_NONE); + grpc_closure_sched( + exec_ctx, + op->payload->recv_initial_metadata.recv_initial_metadata_ready, + GRPC_ERROR_NONE); } if (op->recv_message) { - grpc_closure_sched(exec_ctx, op->recv_message_ready, GRPC_ERROR_NONE); + grpc_closure_sched(exec_ctx, op->payload->recv_message.recv_message_ready, + GRPC_ERROR_NONE); } grpc_closure_sched(exec_ctx, op->on_complete, GRPC_ERROR_NONE); } diff --git a/test/cpp/microbenchmarks/bm_chttp2_transport.cc b/test/cpp/microbenchmarks/bm_chttp2_transport.cc index 254d57de20..a084643c90 100644 --- a/test/cpp/microbenchmarks/bm_chttp2_transport.cc +++ b/test/cpp/microbenchmarks/bm_chttp2_transport.cc @@ -326,12 +326,14 @@ static void BM_StreamCreateSendInitialMetadataDestroy(benchmark::State &state) { s.Init(state); memset(&op, 0, sizeof(op)); op.on_complete = done.get(); - op.send_initial_metadata = &b; + op.send_initial_metadata = true; + op.payload->send_initial_metadata.send_initial_metadata = &b; s.Op(&op); }); done = MakeClosure([&](grpc_exec_ctx *exec_ctx, grpc_error *error) { memset(&op, 0, sizeof(op)); - op.cancel_error = GRPC_ERROR_CANCELLED; + op.cancel_stream = true; + op.payload->cancel_stream.cancel_error = GRPC_ERROR_CANCELLED; s.Op(&op); s.DestroyThen(start.get()); }); @@ -399,18 +401,21 @@ static void BM_TransportStreamSend(benchmark::State &state) { grpc_slice_buffer_stream_init(&send_stream, &send_buffer, 0); memset(&op, 0, sizeof(op)); op.on_complete = c.get(); - op.send_message = &send_stream.base; + op.send_message = true; + op.payload->send_message.send_message = &send_stream.base; s.Op(&op); }); memset(&op, 0, sizeof(op)); - op.send_initial_metadata = &b; + op.send_initial_metadata = true; + op.payload->send_initial_metadata.send_initial_metadata = &b; op.on_complete = c.get(); s.Op(&op); f.FlushExecCtx(); memset(&op, 0, sizeof(op)); - op.cancel_error = GRPC_ERROR_CANCELLED; + op.cancel_stream = true; + op.payload->cancel_stream.cancel_error = GRPC_ERROR_CANCELLED; s.Op(&op); s.DestroyThen( MakeOnceClosure([](grpc_exec_ctx *exec_ctx, grpc_error *error) {})); @@ -520,8 +525,9 @@ static void BM_TransportStreamRecv(benchmark::State &state) { received = 0; memset(&op, 0, sizeof(op)); op.on_complete = do_nothing.get(); - op.recv_message = &recv_stream; - op.recv_message_ready = drain_start.get(); + op.recv_message = true; + op.payload->recv_message.recv_message = &recv_stream; + op.payload->recv_message.recv_message_ready = drain_start.get(); s.Op(&op); f.PushInput(grpc_slice_ref(incoming_data)); }); @@ -553,8 +559,10 @@ static void BM_TransportStreamRecv(benchmark::State &state) { }); memset(&op, 0, sizeof(op)); - op.send_initial_metadata = &b; - op.recv_initial_metadata = &b_recv; + op.send_initial_metadata = true; + op.payload->send_initial_metadata.send_initial_metadata = &b; + op.recv_initial_metadata = true; + op.payload->recv_initial_metadata.recv_initial_metadata = &b_recv; op.on_complete = c.get(); s.Op(&op); f.PushInput(SLICE_FROM_BUFFER( @@ -572,7 +580,8 @@ static void BM_TransportStreamRecv(benchmark::State &state) { f.FlushExecCtx(); memset(&op, 0, sizeof(op)); - op.cancel_error = GRPC_ERROR_CANCELLED; + op.cancel_stream = true; + op.payload->cancel_stream.cancel_error = GRPC_ERROR_CANCELLED; s.Op(&op); s.DestroyThen( MakeOnceClosure([](grpc_exec_ctx *exec_ctx, grpc_error *error) {})); |