aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/cpp/microbenchmarks/bm_call_create.cc
diff options
context:
space:
mode:
authorGravatar Yash Tibrewal <yashkt@google.com>2017-11-06 14:39:17 -0800
committerGravatar Yash Tibrewal <yashkt@google.com>2017-11-06 14:43:31 -0800
commit40422d5fa621624868280094efb2f01c2cd1352b (patch)
treecbb2baa955e11c03fa004e9e0f4f3037ba3d6150 /test/cpp/microbenchmarks/bm_call_create.cc
parentaae4ca01a315a69fcf182d09aea1efdfcda13d48 (diff)
parente759d2ad7abdb0702970eeccc5f033ff4b2a4c7f (diff)
Merge master
Diffstat (limited to 'test/cpp/microbenchmarks/bm_call_create.cc')
-rw-r--r--test/cpp/microbenchmarks/bm_call_create.cc274
1 files changed, 138 insertions, 136 deletions
diff --git a/test/cpp/microbenchmarks/bm_call_create.cc b/test/cpp/microbenchmarks/bm_call_create.cc
index a53565bb09..ec5c1275d1 100644
--- a/test/cpp/microbenchmarks/bm_call_create.cc
+++ b/test/cpp/microbenchmarks/bm_call_create.cc
@@ -47,9 +47,9 @@
#include "src/proto/grpc/testing/echo.grpc.pb.h"
#include "test/cpp/microbenchmarks/helpers.h"
-auto &force_library_initialization = Library::get();
+auto& force_library_initialization = Library::get();
-void BM_Zalloc(benchmark::State &state) {
+void BM_Zalloc(benchmark::State& state) {
// speed of light for call creation is zalloc, so benchmark a few interesting
// sizes
TrackCounters track_counters;
@@ -78,13 +78,13 @@ BENCHMARK(BM_Zalloc)
class BaseChannelFixture {
public:
- BaseChannelFixture(grpc_channel *channel) : channel_(channel) {}
+ BaseChannelFixture(grpc_channel* channel) : channel_(channel) {}
~BaseChannelFixture() { grpc_channel_destroy(channel_); }
- grpc_channel *channel() const { return channel_; }
+ grpc_channel* channel() const { return channel_; }
private:
- grpc_channel *const channel_;
+ grpc_channel* const channel_;
};
class InsecureChannel : public BaseChannelFixture {
@@ -102,12 +102,12 @@ class LameChannel : public BaseChannelFixture {
};
template <class Fixture>
-static void BM_CallCreateDestroy(benchmark::State &state) {
+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(NULL);
gpr_timespec deadline = gpr_inf_future(GPR_CLOCK_MONOTONIC);
- void *method_hdl =
+ void* method_hdl =
grpc_channel_register_call(fixture.channel(), "/foo/bar", NULL, NULL);
while (state.KeepRunning()) {
grpc_call_unref(grpc_channel_create_registered_call(
@@ -124,11 +124,11 @@ BENCHMARK_TEMPLATE(BM_CallCreateDestroy, LameChannel);
////////////////////////////////////////////////////////////////////////////////
// Benchmarks isolating individual filters
-static void *tag(int i) {
- return reinterpret_cast<void *>(static_cast<intptr_t>(i));
+static void* tag(int i) {
+ return reinterpret_cast<void*>(static_cast<intptr_t>(i));
}
-static void BM_LameChannelCallCreateCpp(benchmark::State &state) {
+static void BM_LameChannelCallCreateCpp(benchmark::State& state) {
TrackCounters track_counters;
auto stub =
grpc::testing::EchoTestService::NewStub(grpc::CreateChannelInternal(
@@ -143,7 +143,7 @@ static void BM_LameChannelCallCreateCpp(benchmark::State &state) {
grpc::ClientContext cli_ctx;
auto reader = stub->AsyncEcho(&cli_ctx, send_request, &cq);
reader->Finish(&recv_response, &recv_status, tag(0));
- void *t;
+ void* t;
bool ok;
GPR_ASSERT(cq.Next(&t, &ok));
GPR_ASSERT(ok);
@@ -152,16 +152,16 @@ static void BM_LameChannelCallCreateCpp(benchmark::State &state) {
}
BENCHMARK(BM_LameChannelCallCreateCpp);
-static void do_nothing(void *ignored) {}
+static void do_nothing(void* ignored) {}
-static void BM_LameChannelCallCreateCore(benchmark::State &state) {
+static void BM_LameChannelCallCreateCore(benchmark::State& state) {
TrackCounters track_counters;
- grpc_channel *channel;
- grpc_completion_queue *cq;
+ grpc_channel* channel;
+ 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 = NULL;
grpc_status_code status;
grpc_slice details;
grpc::testing::EchoRequest send_request;
@@ -171,22 +171,22 @@ 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);
- void *rc = grpc_channel_register_call(
+ void* rc = grpc_channel_register_call(
channel, "/grpc.testing.EchoTestService/Echo", NULL, NULL);
while (state.KeepRunning()) {
GPR_TIMER_SCOPE("BenchmarkCycle", 0);
- grpc_call *call = grpc_channel_create_registered_call(
+ grpc_call* call = grpc_channel_create_registered_call(
channel, NULL, GRPC_PROPAGATE_DEFAULTS, cq, rc,
gpr_inf_future(GPR_CLOCK_REALTIME), NULL);
grpc_metadata_array_init(&initial_metadata_recv);
grpc_metadata_array_init(&trailing_metadata_recv);
- grpc_byte_buffer *request_payload_send =
+ grpc_byte_buffer* request_payload_send =
grpc_raw_byte_buffer_create(&send_request_slice, 1);
// Fill in call ops
grpc_op ops[6];
memset(ops, 0, sizeof(ops));
- grpc_op *op = ops;
+ grpc_op* op = ops;
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op++;
@@ -210,7 +210,7 @@ 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, NULL));
grpc_event ev = grpc_completion_queue_next(
cq, gpr_inf_future(GPR_CLOCK_REALTIME), NULL);
GPR_ASSERT(ev.type != GRPC_QUEUE_SHUTDOWN);
@@ -228,14 +228,14 @@ static void BM_LameChannelCallCreateCore(benchmark::State &state) {
}
BENCHMARK(BM_LameChannelCallCreateCore);
-static void BM_LameChannelCallCreateCoreSeparateBatch(benchmark::State &state) {
+static void BM_LameChannelCallCreateCoreSeparateBatch(benchmark::State& state) {
TrackCounters track_counters;
- grpc_channel *channel;
- grpc_completion_queue *cq;
+ grpc_channel* channel;
+ 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 = NULL;
grpc_status_code status;
grpc_slice details;
grpc::testing::EchoRequest send_request;
@@ -245,22 +245,22 @@ 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);
- void *rc = grpc_channel_register_call(
+ void* rc = grpc_channel_register_call(
channel, "/grpc.testing.EchoTestService/Echo", NULL, NULL);
while (state.KeepRunning()) {
GPR_TIMER_SCOPE("BenchmarkCycle", 0);
- grpc_call *call = grpc_channel_create_registered_call(
+ grpc_call* call = grpc_channel_create_registered_call(
channel, NULL, GRPC_PROPAGATE_DEFAULTS, cq, rc,
gpr_inf_future(GPR_CLOCK_REALTIME), NULL);
grpc_metadata_array_init(&initial_metadata_recv);
grpc_metadata_array_init(&trailing_metadata_recv);
- grpc_byte_buffer *request_payload_send =
+ grpc_byte_buffer* request_payload_send =
grpc_raw_byte_buffer_create(&send_request_slice, 1);
// Fill in call ops
grpc_op ops[3];
memset(ops, 0, sizeof(ops));
- grpc_op *op = ops;
+ grpc_op* op = ops;
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op++;
@@ -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*)0, NULL));
memset(ops, 0, sizeof(ops));
op = ops;
op->op = GRPC_OP_RECV_INITIAL_METADATA;
@@ -289,7 +289,7 @@ 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, NULL));
grpc_event ev = grpc_completion_queue_next(
cq, gpr_inf_future(GPR_CLOCK_REALTIME), NULL);
GPR_ASSERT(ev.type != GRPC_QUEUE_SHUTDOWN);
@@ -311,31 +311,31 @@ static void BM_LameChannelCallCreateCoreSeparateBatch(benchmark::State &state) {
}
BENCHMARK(BM_LameChannelCallCreateCoreSeparateBatch);
-static void FilterDestroy(grpc_exec_ctx *exec_ctx, void *arg,
- grpc_error *error) {
+static void FilterDestroy(grpc_exec_ctx* exec_ctx, void* arg,
+ grpc_error* error) {
gpr_free(arg);
}
-static void DoNothing(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {}
+static void DoNothing(grpc_exec_ctx* exec_ctx, void* arg, grpc_error* error) {}
class FakeClientChannelFactory : public grpc_client_channel_factory {
public:
FakeClientChannelFactory() { vtable = &vtable_; }
private:
- static void NoRef(grpc_client_channel_factory *factory) {}
- static void NoUnref(grpc_exec_ctx *exec_ctx,
- grpc_client_channel_factory *factory) {}
- static grpc_subchannel *CreateSubchannel(grpc_exec_ctx *exec_ctx,
- grpc_client_channel_factory *factory,
- const grpc_subchannel_args *args) {
+ static void NoRef(grpc_client_channel_factory* factory) {}
+ static void NoUnref(grpc_exec_ctx* exec_ctx,
+ grpc_client_channel_factory* factory) {}
+ static grpc_subchannel* CreateSubchannel(grpc_exec_ctx* exec_ctx,
+ grpc_client_channel_factory* factory,
+ const grpc_subchannel_args* args) {
return nullptr;
}
- static grpc_channel *CreateClientChannel(grpc_exec_ctx *exec_ctx,
- grpc_client_channel_factory *factory,
- const char *target,
+ static grpc_channel* CreateClientChannel(grpc_exec_ctx* exec_ctx,
+ grpc_client_channel_factory* factory,
+ const char* target,
grpc_client_channel_type type,
- const grpc_channel_args *args) {
+ const grpc_channel_args* args) {
return nullptr;
}
@@ -345,11 +345,11 @@ class FakeClientChannelFactory : public grpc_client_channel_factory {
const grpc_client_channel_factory_vtable FakeClientChannelFactory::vtable_ = {
NoRef, NoUnref, CreateSubchannel, CreateClientChannel};
-static grpc_arg StringArg(const char *key, const char *value) {
+static grpc_arg StringArg(const char* key, const char* value) {
grpc_arg a;
a.type = GRPC_ARG_STRING;
- a.key = const_cast<char *>(key);
- a.value.string = const_cast<char *>(value);
+ a.key = const_cast<char*>(key);
+ a.value.string = const_cast<char*>(value);
return a;
}
@@ -358,45 +358,45 @@ enum FixtureFlags : uint32_t {
REQUIRES_TRANSPORT = 2,
};
-template <const grpc_channel_filter *kFilter, uint32_t kFlags>
+template <const grpc_channel_filter* kFilter, uint32_t kFlags>
struct Fixture {
- const grpc_channel_filter *filter = kFilter;
+ const grpc_channel_filter* filter = kFilter;
const uint32_t flags = kFlags;
};
namespace dummy_filter {
-static void StartTransportStreamOp(grpc_exec_ctx *exec_ctx,
- grpc_call_element *elem,
- grpc_transport_stream_op_batch *op) {}
+static void StartTransportStreamOp(grpc_exec_ctx* exec_ctx,
+ grpc_call_element* elem,
+ grpc_transport_stream_op_batch* op) {}
-static void StartTransportOp(grpc_exec_ctx *exec_ctx,
- grpc_channel_element *elem,
- grpc_transport_op *op) {}
+static void StartTransportOp(grpc_exec_ctx* exec_ctx,
+ grpc_channel_element* elem,
+ grpc_transport_op* op) {}
-static grpc_error *InitCallElem(grpc_exec_ctx *exec_ctx,
- grpc_call_element *elem,
- const grpc_call_element_args *args) {
+static grpc_error* InitCallElem(grpc_exec_ctx* exec_ctx,
+ grpc_call_element* elem,
+ const grpc_call_element_args* args) {
return GRPC_ERROR_NONE;
}
-static void SetPollsetOrPollsetSet(grpc_exec_ctx *exec_ctx,
- grpc_call_element *elem,
- grpc_polling_entity *pollent) {}
+static void SetPollsetOrPollsetSet(grpc_exec_ctx* exec_ctx,
+ grpc_call_element* elem,
+ grpc_polling_entity* pollent) {}
-static void DestroyCallElem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
- const grpc_call_final_info *final_info,
- grpc_closure *then_sched_closure) {}
+static void DestroyCallElem(grpc_exec_ctx* exec_ctx, grpc_call_element* elem,
+ const grpc_call_final_info* final_info,
+ grpc_closure* then_sched_closure) {}
-grpc_error *InitChannelElem(grpc_exec_ctx *exec_ctx, grpc_channel_element *elem,
- grpc_channel_element_args *args) {
+grpc_error* InitChannelElem(grpc_exec_ctx* exec_ctx, grpc_channel_element* elem,
+ grpc_channel_element_args* args) {
return GRPC_ERROR_NONE;
}
-void DestroyChannelElem(grpc_exec_ctx *exec_ctx, grpc_channel_element *elem) {}
+void DestroyChannelElem(grpc_exec_ctx* exec_ctx, grpc_channel_element* elem) {}
-void GetChannelInfo(grpc_exec_ctx *exec_ctx, grpc_channel_element *elem,
- const grpc_channel_info *channel_info) {}
+void GetChannelInfo(grpc_exec_ctx* exec_ctx, grpc_channel_element* elem,
+ const grpc_channel_info* channel_info) {}
static const grpc_channel_filter dummy_filter = {StartTransportStreamOp,
StartTransportOp,
@@ -419,42 +419,42 @@ namespace dummy_transport {
size_t sizeof_stream; /* = sizeof(transport stream) */
/* name of this transport implementation */
-const char *name;
+const char* name;
/* implementation of grpc_transport_init_stream */
-int InitStream(grpc_exec_ctx *exec_ctx, grpc_transport *self,
- grpc_stream *stream, grpc_stream_refcount *refcount,
- const void *server_data, gpr_arena *arena) {
+int InitStream(grpc_exec_ctx* exec_ctx, grpc_transport* self,
+ grpc_stream* stream, grpc_stream_refcount* refcount,
+ const void* server_data, gpr_arena* arena) {
return 0;
}
/* implementation of grpc_transport_set_pollset */
-void SetPollset(grpc_exec_ctx *exec_ctx, grpc_transport *self,
- grpc_stream *stream, grpc_pollset *pollset) {}
+void SetPollset(grpc_exec_ctx* exec_ctx, grpc_transport* self,
+ grpc_stream* stream, grpc_pollset* pollset) {}
/* implementation of grpc_transport_set_pollset */
-void SetPollsetSet(grpc_exec_ctx *exec_ctx, grpc_transport *self,
- grpc_stream *stream, grpc_pollset_set *pollset_set) {}
+void SetPollsetSet(grpc_exec_ctx* exec_ctx, grpc_transport* self,
+ grpc_stream* stream, grpc_pollset_set* pollset_set) {}
/* implementation of grpc_transport_perform_stream_op */
-void PerformStreamOp(grpc_exec_ctx *exec_ctx, grpc_transport *self,
- grpc_stream *stream, grpc_transport_stream_op_batch *op) {
+void PerformStreamOp(grpc_exec_ctx* exec_ctx, grpc_transport* self,
+ grpc_stream* stream, grpc_transport_stream_op_batch* op) {
GRPC_CLOSURE_SCHED(exec_ctx, op->on_complete, GRPC_ERROR_NONE);
}
/* implementation of grpc_transport_perform_op */
-void PerformOp(grpc_exec_ctx *exec_ctx, grpc_transport *self,
- grpc_transport_op *op) {}
+void PerformOp(grpc_exec_ctx* exec_ctx, grpc_transport* self,
+ grpc_transport_op* op) {}
/* implementation of grpc_transport_destroy_stream */
-void DestroyStream(grpc_exec_ctx *exec_ctx, grpc_transport *self,
- grpc_stream *stream, grpc_closure *then_sched_closure) {}
+void DestroyStream(grpc_exec_ctx* exec_ctx, grpc_transport* self,
+ grpc_stream* stream, grpc_closure* then_sched_closure) {}
/* implementation of grpc_transport_destroy */
-void Destroy(grpc_exec_ctx *exec_ctx, grpc_transport *self) {}
+void Destroy(grpc_exec_ctx* exec_ctx, grpc_transport* self) {}
/* implementation of grpc_transport_get_endpoint */
-grpc_endpoint *GetEndpoint(grpc_exec_ctx *exec_ctx, grpc_transport *self) {
+grpc_endpoint* GetEndpoint(grpc_exec_ctx* exec_ctx, grpc_transport* self) {
return nullptr;
}
@@ -472,8 +472,8 @@ class NoOp {
public:
class Op {
public:
- Op(grpc_exec_ctx *exec_ctx, NoOp *p, grpc_call_stack *s) {}
- void Finish(grpc_exec_ctx *exec_ctx) {}
+ Op(grpc_exec_ctx* exec_ctx, NoOp* p, grpc_call_stack* s) {}
+ void Finish(grpc_exec_ctx* exec_ctx) {}
};
};
@@ -489,11 +489,11 @@ class SendEmptyMetadata {
class Op {
public:
- Op(grpc_exec_ctx *exec_ctx, SendEmptyMetadata *p, grpc_call_stack *s) {
+ Op(grpc_exec_ctx* exec_ctx, SendEmptyMetadata* p, grpc_call_stack* s) {
grpc_metadata_batch_init(&batch_);
p->op_payload_.send_initial_metadata.send_initial_metadata = &batch_;
}
- void Finish(grpc_exec_ctx *exec_ctx) {
+ void Finish(grpc_exec_ctx* exec_ctx) {
grpc_metadata_batch_destroy(exec_ctx, &batch_);
}
@@ -514,7 +514,7 @@ class SendEmptyMetadata {
// Fixture<> template to specify this), and TestOp defines some unit of work to
// perform on said filter.
template <class Fixture, class TestOp>
-static void BM_IsolatedFilter(benchmark::State &state) {
+static void BM_IsolatedFilter(benchmark::State& state) {
TrackCounters track_counters;
Fixture fixture;
std::ostringstream label;
@@ -527,7 +527,7 @@ static void BM_IsolatedFilter(benchmark::State &state) {
grpc_channel_args channel_args = {args.size(), &args[0]};
- std::vector<const grpc_channel_filter *> filters;
+ std::vector<const grpc_channel_filter*> filters;
if (fixture.filter != nullptr) {
filters.push_back(fixture.filter);
}
@@ -539,8 +539,8 @@ 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());
- grpc_channel_stack *channel_stack =
- static_cast<grpc_channel_stack *>(gpr_zalloc(channel_size));
+ grpc_channel_stack* channel_stack =
+ static_cast<grpc_channel_stack*>(gpr_zalloc(channel_size));
GPR_ASSERT(GRPC_LOG_IF_ERROR(
"channel_stack_init",
grpc_channel_stack_init(&exec_ctx, 1, FilterDestroy, channel_stack,
@@ -550,8 +550,8 @@ static void BM_IsolatedFilter(benchmark::State &state) {
: nullptr,
"CHANNEL", channel_stack)));
grpc_exec_ctx_flush(&exec_ctx);
- grpc_call_stack *call_stack = static_cast<grpc_call_stack *>(
- gpr_zalloc(channel_stack->call_stack_size));
+ grpc_call_stack* call_stack =
+ static_cast<grpc_call_stack*>(gpr_zalloc(channel_stack->call_stack_size));
grpc_millis deadline = GRPC_MILLIS_INF_FUTURE;
gpr_timespec start_time = gpr_now(GPR_CLOCK_MONOTONIC);
grpc_slice method = grpc_slice_from_static_string("/foo/bar");
@@ -628,12 +628,14 @@ BENCHMARK_TEMPLATE(BM_IsolatedFilter, LoadReportingFilter, SendEmptyMetadata);
namespace isolated_call_filter {
-typedef struct { grpc_call_combiner *call_combiner; } call_data;
+typedef struct {
+ grpc_call_combiner* call_combiner;
+} call_data;
-static void StartTransportStreamOp(grpc_exec_ctx *exec_ctx,
- grpc_call_element *elem,
- grpc_transport_stream_op_batch *op) {
- call_data *calld = static_cast<call_data *>(elem->call_data);
+static void StartTransportStreamOp(grpc_exec_ctx* exec_ctx,
+ grpc_call_element* elem,
+ grpc_transport_stream_op_batch* op) {
+ call_data* calld = static_cast<call_data*>(elem->call_data);
if (op->recv_initial_metadata) {
GRPC_CALL_COMBINER_START(
exec_ctx, calld->call_combiner,
@@ -648,42 +650,42 @@ static void StartTransportStreamOp(grpc_exec_ctx *exec_ctx,
GRPC_CLOSURE_SCHED(exec_ctx, op->on_complete, GRPC_ERROR_NONE);
}
-static void StartTransportOp(grpc_exec_ctx *exec_ctx,
- grpc_channel_element *elem,
- grpc_transport_op *op) {
+static void StartTransportOp(grpc_exec_ctx* exec_ctx,
+ grpc_channel_element* elem,
+ grpc_transport_op* op) {
if (op->disconnect_with_error != GRPC_ERROR_NONE) {
GRPC_ERROR_UNREF(op->disconnect_with_error);
}
GRPC_CLOSURE_SCHED(exec_ctx, op->on_consumed, GRPC_ERROR_NONE);
}
-static grpc_error *InitCallElem(grpc_exec_ctx *exec_ctx,
- grpc_call_element *elem,
- const grpc_call_element_args *args) {
- call_data *calld = static_cast<call_data *>(elem->call_data);
+static grpc_error* InitCallElem(grpc_exec_ctx* exec_ctx,
+ grpc_call_element* elem,
+ const grpc_call_element_args* args) {
+ call_data* calld = static_cast<call_data*>(elem->call_data);
calld->call_combiner = args->call_combiner;
return GRPC_ERROR_NONE;
}
-static void SetPollsetOrPollsetSet(grpc_exec_ctx *exec_ctx,
- grpc_call_element *elem,
- grpc_polling_entity *pollent) {}
+static void SetPollsetOrPollsetSet(grpc_exec_ctx* exec_ctx,
+ grpc_call_element* elem,
+ grpc_polling_entity* pollent) {}
-static void DestroyCallElem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
- const grpc_call_final_info *final_info,
- grpc_closure *then_sched_closure) {
+static void DestroyCallElem(grpc_exec_ctx* exec_ctx, grpc_call_element* elem,
+ const grpc_call_final_info* final_info,
+ grpc_closure* then_sched_closure) {
GRPC_CLOSURE_SCHED(exec_ctx, then_sched_closure, GRPC_ERROR_NONE);
}
-grpc_error *InitChannelElem(grpc_exec_ctx *exec_ctx, grpc_channel_element *elem,
- grpc_channel_element_args *args) {
+grpc_error* InitChannelElem(grpc_exec_ctx* exec_ctx, grpc_channel_element* elem,
+ grpc_channel_element_args* args) {
return GRPC_ERROR_NONE;
}
-void DestroyChannelElem(grpc_exec_ctx *exec_ctx, grpc_channel_element *elem) {}
+void DestroyChannelElem(grpc_exec_ctx* exec_ctx, grpc_channel_element* elem) {}
-void GetChannelInfo(grpc_exec_ctx *exec_ctx, grpc_channel_element *elem,
- const grpc_channel_info *channel_info) {}
+void GetChannelInfo(grpc_exec_ctx* exec_ctx, grpc_channel_element* elem,
+ const grpc_channel_info* channel_info) {}
static const grpc_channel_filter isolated_call_filter = {
StartTransportStreamOp,
@@ -702,7 +704,7 @@ static const grpc_channel_filter isolated_call_filter = {
class IsolatedCallFixture : public TrackCounters {
public:
IsolatedCallFixture() {
- grpc_channel_stack_builder *builder = grpc_channel_stack_builder_create();
+ grpc_channel_stack_builder* builder = grpc_channel_stack_builder_create();
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(
@@ -716,24 +718,24 @@ class IsolatedCallFixture : public TrackCounters {
cq_ = grpc_completion_queue_create_for_next(NULL);
}
- void Finish(benchmark::State &state) {
+ void Finish(benchmark::State& state) {
grpc_completion_queue_destroy(cq_);
grpc_channel_destroy(channel_);
TrackCounters::Finish(state);
}
- grpc_channel *channel() const { return channel_; }
- grpc_completion_queue *cq() const { return cq_; }
+ grpc_channel* channel() const { return channel_; }
+ grpc_completion_queue* cq() const { return cq_; }
private:
- grpc_completion_queue *cq_;
- grpc_channel *channel_;
+ grpc_completion_queue* cq_;
+ grpc_channel* channel_;
};
-static void BM_IsolatedCall_NoOp(benchmark::State &state) {
+static void BM_IsolatedCall_NoOp(benchmark::State& state) {
IsolatedCallFixture fixture;
gpr_timespec deadline = gpr_inf_future(GPR_CLOCK_MONOTONIC);
- void *method_hdl =
+ void* method_hdl =
grpc_channel_register_call(fixture.channel(), "/foo/bar", NULL, NULL);
while (state.KeepRunning()) {
GPR_TIMER_SCOPE("BenchmarkCycle", 0);
@@ -745,14 +747,14 @@ static void BM_IsolatedCall_NoOp(benchmark::State &state) {
}
BENCHMARK(BM_IsolatedCall_NoOp);
-static void BM_IsolatedCall_Unary(benchmark::State &state) {
+static void BM_IsolatedCall_Unary(benchmark::State& state) {
IsolatedCallFixture fixture;
gpr_timespec deadline = gpr_inf_future(GPR_CLOCK_MONOTONIC);
- void *method_hdl =
+ void* method_hdl =
grpc_channel_register_call(fixture.channel(), "/foo/bar", NULL, NULL);
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* send_message = grpc_raw_byte_buffer_create(&slice, 1);
+ grpc_byte_buffer* recv_message = NULL;
grpc_status_code status_code;
grpc_slice status_details = grpc_empty_slice();
grpc_metadata_array recv_initial_metadata;
@@ -776,7 +778,7 @@ static void BM_IsolatedCall_Unary(benchmark::State &state) {
ops[5].data.recv_status_on_client.trailing_metadata = &recv_trailing_metadata;
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(),
method_hdl, deadline, NULL);
grpc_call_start_batch(call, ops, 6, tag(1), NULL);
@@ -791,13 +793,13 @@ static void BM_IsolatedCall_Unary(benchmark::State &state) {
}
BENCHMARK(BM_IsolatedCall_Unary);
-static void BM_IsolatedCall_StreamingSend(benchmark::State &state) {
+static void BM_IsolatedCall_StreamingSend(benchmark::State& state) {
IsolatedCallFixture fixture;
gpr_timespec deadline = gpr_inf_future(GPR_CLOCK_MONOTONIC);
- void *method_hdl =
+ void* method_hdl =
grpc_channel_register_call(fixture.channel(), "/foo/bar", NULL, NULL);
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* send_message = grpc_raw_byte_buffer_create(&slice, 1);
grpc_metadata_array recv_initial_metadata;
grpc_metadata_array_init(&recv_initial_metadata);
grpc_metadata_array recv_trailing_metadata;
@@ -808,7 +810,7 @@ static void BM_IsolatedCall_StreamingSend(benchmark::State &state) {
ops[1].op = GRPC_OP_RECV_INITIAL_METADATA;
ops[1].data.recv_initial_metadata.recv_initial_metadata =
&recv_initial_metadata;
- grpc_call *call = grpc_channel_create_registered_call(
+ 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);