Skip to content
Snippets Groups Projects
Commit 5bdffab4 authored by Craig Tiller's avatar Craig Tiller
Browse files

Add profiling annotations

parent a5da6e18
No related branches found
No related tags found
No related merge requests found
...@@ -54,6 +54,7 @@ extern "C" { ...@@ -54,6 +54,7 @@ extern "C" {
#include "src/core/lib/channel/http_client_filter.h" #include "src/core/lib/channel/http_client_filter.h"
#include "src/core/lib/channel/http_server_filter.h" #include "src/core/lib/channel/http_server_filter.h"
#include "src/core/lib/channel/message_size_filter.h" #include "src/core/lib/channel/message_size_filter.h"
#include "src/core/lib/profiling/timers.h"
#include "src/core/lib/surface/channel.h" #include "src/core/lib/surface/channel.h"
#include "src/core/lib/transport/transport_impl.h" #include "src/core/lib/transport/transport_impl.h"
} }
...@@ -152,6 +153,7 @@ static void BM_LameChannelCallCreateCpp(benchmark::State &state) { ...@@ -152,6 +153,7 @@ static void BM_LameChannelCallCreateCpp(benchmark::State &state) {
grpc::testing::EchoResponse recv_response; grpc::testing::EchoResponse recv_response;
grpc::Status recv_status; grpc::Status recv_status;
while (state.KeepRunning()) { while (state.KeepRunning()) {
GPR_TIMER_SCOPE("BenchmarkCycle", 0);
grpc::ClientContext cli_ctx; grpc::ClientContext cli_ctx;
auto reader = stub->AsyncEcho(&cli_ctx, send_request, &cq); auto reader = stub->AsyncEcho(&cli_ctx, send_request, &cq);
reader->Finish(&recv_response, &recv_status, tag(0)); reader->Finish(&recv_response, &recv_status, tag(0));
...@@ -426,6 +428,7 @@ static void BM_IsolatedFilter(benchmark::State &state) { ...@@ -426,6 +428,7 @@ static void BM_IsolatedFilter(benchmark::State &state) {
const int kArenaSize = 4096; const int kArenaSize = 4096;
call_args.arena = gpr_arena_create(kArenaSize); call_args.arena = gpr_arena_create(kArenaSize);
while (state.KeepRunning()) { while (state.KeepRunning()) {
GPR_TIMER_SCOPE("BenchmarkCycle", 0);
GRPC_ERROR_UNREF(grpc_call_stack_init(&exec_ctx, channel_stack, 1, GRPC_ERROR_UNREF(grpc_call_stack_init(&exec_ctx, channel_stack, 1,
DoNothing, NULL, &call_args)); DoNothing, NULL, &call_args));
typename TestOp::Op op(&exec_ctx, &test_op_data, call_stack); typename TestOp::Op op(&exec_ctx, &test_op_data, call_stack);
...@@ -590,6 +593,7 @@ static void BM_IsolatedCall_NoOp(benchmark::State &state) { ...@@ -590,6 +593,7 @@ static void BM_IsolatedCall_NoOp(benchmark::State &state) {
void *method_hdl = void *method_hdl =
grpc_channel_register_call(fixture.channel(), "/foo/bar", NULL, NULL); grpc_channel_register_call(fixture.channel(), "/foo/bar", NULL, NULL);
while (state.KeepRunning()) { while (state.KeepRunning()) {
GPR_TIMER_SCOPE("BenchmarkCycle", 0);
grpc_call_destroy(grpc_channel_create_registered_call( grpc_call_destroy(grpc_channel_create_registered_call(
fixture.channel(), nullptr, GRPC_PROPAGATE_DEFAULTS, fixture.cq(), fixture.channel(), nullptr, GRPC_PROPAGATE_DEFAULTS, fixture.cq(),
method_hdl, deadline, NULL)); method_hdl, deadline, NULL));
...@@ -628,6 +632,7 @@ static void BM_IsolatedCall_Unary(benchmark::State &state) { ...@@ -628,6 +632,7 @@ static void BM_IsolatedCall_Unary(benchmark::State &state) {
ops[5].data.recv_status_on_client.status_details = &status_details; ops[5].data.recv_status_on_client.status_details = &status_details;
ops[5].data.recv_status_on_client.trailing_metadata = &recv_trailing_metadata; ops[5].data.recv_status_on_client.trailing_metadata = &recv_trailing_metadata;
while (state.KeepRunning()) { while (state.KeepRunning()) {
GPR_TIMER_SCOPE("BenchmarkCycle", 0);
grpc_call *call = grpc_channel_create_registered_call( grpc_call *call = grpc_channel_create_registered_call(
fixture.channel(), nullptr, GRPC_PROPAGATE_DEFAULTS, fixture.cq(), fixture.channel(), nullptr, GRPC_PROPAGATE_DEFAULTS, fixture.cq(),
method_hdl, deadline, NULL); method_hdl, deadline, NULL);
...@@ -670,6 +675,7 @@ static void BM_IsolatedCall_StreamingSend(benchmark::State &state) { ...@@ -670,6 +675,7 @@ static void BM_IsolatedCall_StreamingSend(benchmark::State &state) {
ops[0].op = GRPC_OP_SEND_MESSAGE; ops[0].op = GRPC_OP_SEND_MESSAGE;
ops[0].data.send_message.send_message = send_message; ops[0].data.send_message.send_message = send_message;
while (state.KeepRunning()) { 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), NULL);
grpc_completion_queue_next(fixture.cq(), grpc_completion_queue_next(fixture.cq(),
gpr_inf_future(GPR_CLOCK_MONOTONIC), NULL); gpr_inf_future(GPR_CLOCK_MONOTONIC), NULL);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment