aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/cpp
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2017-11-03 09:09:36 -0700
committerGravatar Craig Tiller <ctiller@google.com>2017-11-03 09:09:36 -0700
commitbaa14a975ef92ee6fb301f0e684f56f18f2c55a7 (patch)
tree9a6cb2df58fe175e8abfccf2cbd40349726e46f3 /test/cpp
parentef68fe7239a89095f1eaa89c1dd28b2b7be2a3c7 (diff)
Update clang-format to 5.0
Diffstat (limited to 'test/cpp')
-rw-r--r--test/cpp/codegen/golden_file_test.cc2
-rw-r--r--test/cpp/common/channel_arguments_test.cc2
-rw-r--r--test/cpp/end2end/client_crash_test.cc3
-rw-r--r--test/cpp/end2end/client_crash_test_server.cc4
-rw-r--r--test/cpp/end2end/generic_end2end_test.cc5
-rw-r--r--test/cpp/end2end/grpclb_end2end_test.cc48
-rw-r--r--test/cpp/end2end/mock_test.cc16
-rw-r--r--test/cpp/grpclb/grpclb_test.cc127
-rw-r--r--test/cpp/interop/interop_server.cc4
-rw-r--r--test/cpp/interop/reconnect_interop_server.cc2
-rw-r--r--test/cpp/interop/stress_test.cc2
-rw-r--r--test/cpp/microbenchmarks/bm_call_create.cc274
-rw-r--r--test/cpp/microbenchmarks/bm_chttp2_hpack.cc80
-rw-r--r--test/cpp/microbenchmarks/bm_chttp2_transport.cc186
-rw-r--r--test/cpp/microbenchmarks/bm_closure.cc14
-rw-r--r--test/cpp/microbenchmarks/bm_fullstack_trickle.cc9
-rw-r--r--test/cpp/microbenchmarks/helpers.cc15
-rw-r--r--test/cpp/naming/resolver_component_test.cc71
-rw-r--r--test/cpp/naming/resolver_component_tests_runner_invoker.cc10
-rw-r--r--test/cpp/qps/client_async.cc2
-rw-r--r--test/cpp/qps/driver.cc7
-rw-r--r--test/cpp/qps/histogram.h4
-rw-r--r--test/cpp/qps/interarrival.h4
-rw-r--r--test/cpp/qps/parse_json.cc4
-rw-r--r--test/cpp/qps/parse_json.h4
-rw-r--r--test/cpp/qps/qps_interarrival_test.cc8
-rw-r--r--test/cpp/qps/server_async.cc136
-rw-r--r--test/cpp/test/server_context_test_spouse_test.cc2
-rw-r--r--test/cpp/thread_manager/thread_manager_test.cc12
-rw-r--r--test/cpp/util/grpc_tool.h4
-rw-r--r--test/cpp/util/proto_reflection_descriptor_database.cc4
-rw-r--r--test/cpp/util/service_describer.h2
-rw-r--r--test/cpp/util/test_config_cc.cc2
33 files changed, 543 insertions, 526 deletions
diff --git a/test/cpp/codegen/golden_file_test.cc b/test/cpp/codegen/golden_file_test.cc
index 5df1b8a16b..14880982b5 100644
--- a/test/cpp/codegen/golden_file_test.cc
+++ b/test/cpp/codegen/golden_file_test.cc
@@ -58,7 +58,7 @@ TEST(GoldenMockFileTest, TestGeneratedMockFile) {
kMockGoldenFilePath);
}
-int main(int argc, char **argv) {
+int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
::google::ParseCommandLineFlags(&argc, &argv, true);
if (FLAGS_generated_file_path.empty()) {
diff --git a/test/cpp/common/channel_arguments_test.cc b/test/cpp/common/channel_arguments_test.cc
index cfe64f11b1..748ce27800 100644
--- a/test/cpp/common/channel_arguments_test.cc
+++ b/test/cpp/common/channel_arguments_test.cc
@@ -72,7 +72,7 @@ grpc_socket_mutator_vtable test_mutator_vtable = {
TestSocketMutator::TestSocketMutator() {
grpc_socket_mutator_init(this, &test_mutator_vtable);
}
-}
+} // namespace
class ChannelArgumentsTest : public ::testing::Test {
protected:
diff --git a/test/cpp/end2end/client_crash_test.cc b/test/cpp/end2end/client_crash_test.cc
index 4d2304feca..f34b27511b 100644
--- a/test/cpp/end2end/client_crash_test.cc
+++ b/test/cpp/end2end/client_crash_test.cc
@@ -56,7 +56,8 @@ class CrashTest : public ::testing::Test {
addr_stream << "localhost:" << port;
auto addr = addr_stream.str();
server_.reset(new SubProcess({
- g_root + "/client_crash_test_server", "--address=" + addr,
+ g_root + "/client_crash_test_server",
+ "--address=" + addr,
}));
GPR_ASSERT(server_);
return grpc::testing::EchoTestService::NewStub(
diff --git a/test/cpp/end2end/client_crash_test_server.cc b/test/cpp/end2end/client_crash_test_server.cc
index 01dcd40f9a..887504d308 100644
--- a/test/cpp/end2end/client_crash_test_server.cc
+++ b/test/cpp/end2end/client_crash_test_server.cc
@@ -68,8 +68,8 @@ void RunServer() {
std::cout << "Server listening on " << FLAGS_address << std::endl;
server->Wait();
}
-}
-}
+} // namespace testing
+} // namespace grpc
int main(int argc, char** argv) {
ParseCommandLineFlags(&argc, &argv, true);
diff --git a/test/cpp/end2end/generic_end2end_test.cc b/test/cpp/end2end/generic_end2end_test.cc
index 9450182302..7f7ed14802 100644
--- a/test/cpp/end2end/generic_end2end_test.cc
+++ b/test/cpp/end2end/generic_end2end_test.cc
@@ -321,8 +321,9 @@ TEST_F(GenericEnd2endTest, SimpleBidiStreaming) {
TEST_F(GenericEnd2endTest, Deadline) {
ResetStub();
- SendRpc(1, true, gpr_time_add(gpr_now(GPR_CLOCK_MONOTONIC),
- gpr_time_from_seconds(10, GPR_TIMESPAN)));
+ SendRpc(1, true,
+ gpr_time_add(gpr_now(GPR_CLOCK_MONOTONIC),
+ gpr_time_from_seconds(10, GPR_TIMESPAN)));
}
} // namespace
diff --git a/test/cpp/end2end/grpclb_end2end_test.cc b/test/cpp/end2end/grpclb_end2end_test.cc
index b9ee77d7ff..aaf7b14313 100644
--- a/test/cpp/end2end/grpclb_end2end_test.cc
+++ b/test/cpp/end2end/grpclb_end2end_test.cc
@@ -75,9 +75,9 @@ extern "C" {
using std::chrono::system_clock;
-using grpc::lb::v1::LoadBalancer;
using grpc::lb::v1::LoadBalanceRequest;
using grpc::lb::v1::LoadBalanceResponse;
+using grpc::lb::v1::LoadBalancer;
namespace grpc {
namespace testing {
@@ -661,8 +661,9 @@ TEST_F(SingleBalancerTest, Fallback) {
// Send non-empty serverlist only after kServerlistDelayMs.
ScheduleResponseForBalancer(
- 0, BalancerServiceImpl::BuildResponseForBackends(
- GetBackendPorts(kNumBackendInResolution /* start_index */), {}),
+ 0,
+ BalancerServiceImpl::BuildResponseForBackends(
+ GetBackendPorts(kNumBackendInResolution /* start_index */), {}),
kServerlistDelayMs);
// Wait until all the fallback backends are reachable.
@@ -727,10 +728,11 @@ TEST_F(SingleBalancerTest, FallbackUpdate) {
// Send non-empty serverlist only after kServerlistDelayMs.
ScheduleResponseForBalancer(
- 0, BalancerServiceImpl::BuildResponseForBackends(
- GetBackendPorts(kNumBackendInResolution +
- kNumBackendInResolutionUpdate /* start_index */),
- {}),
+ 0,
+ BalancerServiceImpl::BuildResponseForBackends(
+ GetBackendPorts(kNumBackendInResolution +
+ kNumBackendInResolutionUpdate /* start_index */),
+ {}),
kServerlistDelayMs);
// Wait until all the fallback backends are reachable.
@@ -1071,10 +1073,11 @@ TEST_F(SingleBalancerTest, Drop) {
num_of_drop_by_load_balancing_addresses;
const int num_total_addresses = num_backends_ + num_of_drop_addresses;
ScheduleResponseForBalancer(
- 0, BalancerServiceImpl::BuildResponseForBackends(
- GetBackendPorts(),
- {{"rate_limiting", num_of_drop_by_rate_limiting_addresses},
- {"load_balancing", num_of_drop_by_load_balancing_addresses}}),
+ 0,
+ BalancerServiceImpl::BuildResponseForBackends(
+ GetBackendPorts(),
+ {{"rate_limiting", num_of_drop_by_rate_limiting_addresses},
+ {"load_balancing", num_of_drop_by_load_balancing_addresses}}),
0);
// Wait until all backends are ready.
WaitForAllBackends();
@@ -1110,9 +1113,10 @@ TEST_F(SingleBalancerTest, DropAllFirst) {
const int num_of_drop_by_rate_limiting_addresses = 1;
const int num_of_drop_by_load_balancing_addresses = 1;
ScheduleResponseForBalancer(
- 0, BalancerServiceImpl::BuildResponseForBackends(
- {}, {{"rate_limiting", num_of_drop_by_rate_limiting_addresses},
- {"load_balancing", num_of_drop_by_load_balancing_addresses}}),
+ 0,
+ BalancerServiceImpl::BuildResponseForBackends(
+ {}, {{"rate_limiting", num_of_drop_by_rate_limiting_addresses},
+ {"load_balancing", num_of_drop_by_load_balancing_addresses}}),
0);
const Status status = SendRpc();
EXPECT_FALSE(status.ok());
@@ -1126,9 +1130,10 @@ TEST_F(SingleBalancerTest, DropAll) {
const int num_of_drop_by_rate_limiting_addresses = 1;
const int num_of_drop_by_load_balancing_addresses = 1;
ScheduleResponseForBalancer(
- 0, BalancerServiceImpl::BuildResponseForBackends(
- {}, {{"rate_limiting", num_of_drop_by_rate_limiting_addresses},
- {"load_balancing", num_of_drop_by_load_balancing_addresses}}),
+ 0,
+ BalancerServiceImpl::BuildResponseForBackends(
+ {}, {{"rate_limiting", num_of_drop_by_rate_limiting_addresses},
+ {"load_balancing", num_of_drop_by_load_balancing_addresses}}),
1000);
// First call succeeds.
@@ -1190,10 +1195,11 @@ TEST_F(SingleBalancerWithClientLoadReportingTest, Drop) {
num_of_drop_by_load_balancing_addresses;
const int num_total_addresses = num_backends_ + num_of_drop_addresses;
ScheduleResponseForBalancer(
- 0, BalancerServiceImpl::BuildResponseForBackends(
- GetBackendPorts(),
- {{"rate_limiting", num_of_drop_by_rate_limiting_addresses},
- {"load_balancing", num_of_drop_by_load_balancing_addresses}}),
+ 0,
+ BalancerServiceImpl::BuildResponseForBackends(
+ GetBackendPorts(),
+ {{"rate_limiting", num_of_drop_by_rate_limiting_addresses},
+ {"load_balancing", num_of_drop_by_load_balancing_addresses}}),
0);
// Wait until all backends are ready.
int num_warmup_ok = 0;
diff --git a/test/cpp/end2end/mock_test.cc b/test/cpp/end2end/mock_test.cc
index 0b63c25055..61f4111e3b 100644
--- a/test/cpp/end2end/mock_test.cc
+++ b/test/cpp/end2end/mock_test.cc
@@ -44,19 +44,19 @@
#include <iostream>
using namespace std;
+using ::testing::AtLeast;
+using ::testing::DoAll;
+using ::testing::Invoke;
+using ::testing::Return;
+using ::testing::SaveArg;
+using ::testing::SetArgPointee;
+using ::testing::WithArg;
+using ::testing::_;
using grpc::testing::EchoRequest;
using grpc::testing::EchoResponse;
using grpc::testing::EchoTestService;
using grpc::testing::MockClientReaderWriter;
using std::chrono::system_clock;
-using ::testing::AtLeast;
-using ::testing::SetArgPointee;
-using ::testing::SaveArg;
-using ::testing::_;
-using ::testing::Return;
-using ::testing::Invoke;
-using ::testing::WithArg;
-using ::testing::DoAll;
namespace grpc {
namespace testing {
diff --git a/test/cpp/grpclb/grpclb_test.cc b/test/cpp/grpclb/grpclb_test.cc
index 522bc9e0d6..cc5a4c7e64 100644
--- a/test/cpp/grpclb/grpclb_test.cc
+++ b/test/cpp/grpclb/grpclb_test.cc
@@ -88,19 +88,19 @@ namespace grpc {
namespace {
typedef struct client_fixture {
- grpc_channel *client;
- char *server_uri;
- grpc_completion_queue *cq;
+ grpc_channel* client;
+ char* server_uri;
+ grpc_completion_queue* cq;
} client_fixture;
typedef struct server_fixture {
- grpc_server *server;
- grpc_call *server_call;
- grpc_completion_queue *cq;
- char *servers_hostport;
- const char *balancer_name;
+ grpc_server* server;
+ grpc_call* server_call;
+ grpc_completion_queue* cq;
+ char* servers_hostport;
+ const char* balancer_name;
int port;
- const char *lb_token_prefix;
+ const char* lb_token_prefix;
gpr_thd_id tid;
int num_calls_serviced;
} server_fixture;
@@ -112,12 +112,12 @@ typedef struct test_fixture {
int lb_server_update_delay_ms;
} test_fixture;
-static void *tag(intptr_t t) { return (void *)t; }
+static void* tag(intptr_t t) { return (void*)t; }
static grpc_slice build_response_payload_slice(
- const char *host, int *ports, size_t nports,
+ const char* host, int* ports, size_t nports,
int64_t expiration_interval_secs, int32_t expiration_interval_nanos,
- const char *token_prefix) {
+ const char* token_prefix) {
// server_list {
// servers {
// ip_address: <in_addr/6 bytes of an IP>
@@ -127,10 +127,10 @@ static grpc_slice build_response_payload_slice(
// ...
// }
grpc::lb::v1::LoadBalanceResponse response;
- auto *serverlist = response.mutable_server_list();
+ auto* serverlist = response.mutable_server_list();
if (expiration_interval_secs > 0 || expiration_interval_nanos > 0) {
- auto *expiration_interval = serverlist->mutable_expiration_interval();
+ auto* expiration_interval = serverlist->mutable_expiration_interval();
if (expiration_interval_secs > 0) {
expiration_interval->set_seconds(expiration_interval_secs);
}
@@ -139,12 +139,12 @@ static grpc_slice build_response_payload_slice(
}
}
for (size_t i = 0; i < nports; i++) {
- auto *server = serverlist->add_servers();
+ auto* server = serverlist->add_servers();
// TODO(dgq): test ipv6
struct in_addr ip4;
GPR_ASSERT(inet_pton(AF_INET, host, &ip4) == 1);
server->set_ip_address(
- string(reinterpret_cast<const char *>(&ip4), sizeof(ip4)));
+ string(reinterpret_cast<const char*>(&ip4), sizeof(ip4)));
server->set_port(ports[i]);
// Missing tokens are acceptable. Test that path.
if (strlen(token_prefix) > 0) {
@@ -152,11 +152,11 @@ static grpc_slice build_response_payload_slice(
server->set_load_balance_token(token_data);
}
}
- const string &enc_resp = response.SerializeAsString();
+ const string& enc_resp = response.SerializeAsString();
return grpc_slice_from_copied_buffer(enc_resp.data(), enc_resp.size());
}
-static void drain_cq(grpc_completion_queue *cq) {
+static void drain_cq(grpc_completion_queue* cq) {
grpc_event ev;
do {
ev = grpc_completion_queue_next(cq, grpc_timeout_seconds_to_deadline(5),
@@ -169,18 +169,18 @@ static void sleep_ms(int delay_ms) {
gpr_time_from_millis(delay_ms, GPR_TIMESPAN)));
}
-static void start_lb_server(server_fixture *sf, int *ports, size_t nports,
+static void start_lb_server(server_fixture* sf, int* ports, size_t nports,
int update_delay_ms) {
- grpc_call *s;
- cq_verifier *cqv = cq_verifier_create(sf->cq);
+ grpc_call* s;
+ cq_verifier* cqv = cq_verifier_create(sf->cq);
grpc_op ops[6];
- grpc_op *op;
+ grpc_op* op;
grpc_metadata_array request_metadata_recv;
grpc_call_details call_details;
grpc_call_error error;
int was_cancelled = 2;
- grpc_byte_buffer *request_payload_recv;
- grpc_byte_buffer *response_payload;
+ grpc_byte_buffer* request_payload_recv;
+ grpc_byte_buffer* response_payload;
memset(ops, 0, sizeof(ops));
grpc_metadata_array_init(&request_metadata_recv);
@@ -304,17 +304,17 @@ static void start_lb_server(server_fixture *sf, int *ports, size_t nports,
grpc_call_details_destroy(&call_details);
}
-static void start_backend_server(server_fixture *sf) {
- grpc_call *s;
- cq_verifier *cqv;
+static void start_backend_server(server_fixture* sf) {
+ grpc_call* s;
+ cq_verifier* cqv;
grpc_op ops[6];
- grpc_op *op;
+ grpc_op* op;
grpc_metadata_array request_metadata_recv;
grpc_call_details call_details;
grpc_call_error error;
int was_cancelled;
- grpc_byte_buffer *request_payload_recv;
- grpc_byte_buffer *response_payload;
+ grpc_byte_buffer* request_payload_recv;
+ grpc_byte_buffer* response_payload;
grpc_event ev;
while (true) {
@@ -340,8 +340,9 @@ static void start_backend_server(server_fixture *sf) {
}
GPR_ASSERT(ev.type == GRPC_OP_COMPLETE);
const string expected_token =
- strlen(sf->lb_token_prefix) == 0 ? "" : sf->lb_token_prefix +
- std::to_string(sf->port);
+ strlen(sf->lb_token_prefix) == 0
+ ? ""
+ : sf->lb_token_prefix + std::to_string(sf->port);
GPR_ASSERT(contains_metadata(&request_metadata_recv, "lb-token",
expected_token.c_str()));
@@ -450,18 +451,18 @@ static void start_backend_server(server_fixture *sf) {
}
}
-static void perform_request(client_fixture *cf) {
- grpc_call *c;
- cq_verifier *cqv = cq_verifier_create(cf->cq);
+static void perform_request(client_fixture* cf) {
+ grpc_call* c;
+ cq_verifier* cqv = cq_verifier_create(cf->cq);
grpc_op ops[6];
- grpc_op *op;
+ grpc_op* op;
grpc_metadata_array initial_metadata_recv;
grpc_metadata_array trailing_metadata_recv;
grpc_status_code status;
grpc_call_error error;
grpc_slice details;
- grpc_byte_buffer *request_payload;
- grpc_byte_buffer *response_payload_recv;
+ grpc_byte_buffer* request_payload;
+ grpc_byte_buffer* response_payload_recv;
int i;
memset(ops, 0, sizeof(ops));
@@ -475,7 +476,7 @@ static void perform_request(client_fixture *cf) {
NULL);
gpr_log(GPR_INFO, "Call 0x%" PRIxPTR " created", (intptr_t)c);
GPR_ASSERT(c);
- char *peer;
+ char* peer;
grpc_metadata_array_init(&initial_metadata_recv);
grpc_metadata_array_init(&trailing_metadata_recv);
@@ -556,21 +557,21 @@ static void perform_request(client_fixture *cf) {
}
#define BALANCERS_NAME "lb.name"
-static void setup_client(const server_fixture *lb_server,
- const server_fixture *backends, client_fixture *cf) {
+static void setup_client(const server_fixture* lb_server,
+ const server_fixture* backends, client_fixture* cf) {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- char *expected_target_names = NULL;
- const char *backends_name = lb_server->servers_hostport;
+ char* expected_target_names = NULL;
+ const char* backends_name = lb_server->servers_hostport;
gpr_asprintf(&expected_target_names, "%s;%s", backends_name, BALANCERS_NAME);
- grpc_fake_resolver_response_generator *response_generator =
+ grpc_fake_resolver_response_generator* response_generator =
grpc_fake_resolver_response_generator_create();
- grpc_lb_addresses *addresses = grpc_lb_addresses_create(1, NULL);
- char *lb_uri_str;
+ grpc_lb_addresses* addresses = grpc_lb_addresses_create(1, NULL);
+ char* lb_uri_str;
gpr_asprintf(&lb_uri_str, "ipv4:%s", lb_server->servers_hostport);
- grpc_uri *lb_uri = grpc_uri_parse(&exec_ctx, lb_uri_str, true);
+ grpc_uri* lb_uri = grpc_uri_parse(&exec_ctx, lb_uri_str, true);
GPR_ASSERT(lb_uri != NULL);
grpc_lb_addresses_set_address_from_uri(addresses, 0, lb_uri, true,
lb_server->balancer_name, NULL);
@@ -580,7 +581,7 @@ static void setup_client(const server_fixture *lb_server,
gpr_asprintf(&cf->server_uri, "fake:///%s", lb_server->servers_hostport);
const grpc_arg fake_addresses =
grpc_lb_addresses_create_channel_arg(addresses);
- grpc_channel_args *fake_result =
+ grpc_channel_args* fake_result =
grpc_channel_args_copy_and_add(NULL, &fake_addresses, 1);
grpc_lb_addresses_destroy(&exec_ctx, addresses);
@@ -588,12 +589,12 @@ static void setup_client(const server_fixture *lb_server,
grpc_fake_transport_expected_targets_arg(expected_target_names),
grpc_fake_resolver_response_generator_arg(response_generator)};
- grpc_channel_args *args =
+ grpc_channel_args* args =
grpc_channel_args_copy_and_add(NULL, new_args, GPR_ARRAY_SIZE(new_args));
gpr_free(expected_target_names);
cf->cq = grpc_completion_queue_create_for_next(NULL);
- grpc_channel_credentials *fake_creds =
+ grpc_channel_credentials* fake_creds =
grpc_fake_transport_security_credentials_create();
cf->client =
grpc_secure_channel_create(fake_creds, cf->server_uri, args, NULL);
@@ -606,7 +607,7 @@ static void setup_client(const server_fixture *lb_server,
grpc_exec_ctx_finish(&exec_ctx);
}
-static void teardown_client(client_fixture *cf) {
+static void teardown_client(client_fixture* cf) {
grpc_completion_queue_shutdown(cf->cq);
drain_cq(cf->cq);
grpc_completion_queue_destroy(cf->cq);
@@ -616,13 +617,13 @@ static void teardown_client(client_fixture *cf) {
gpr_free(cf->server_uri);
}
-static void setup_server(const char *host, server_fixture *sf) {
+static void setup_server(const char* host, server_fixture* sf) {
int assigned_port;
sf->cq = grpc_completion_queue_create_for_next(NULL);
- const char *colon_idx = strchr(host, ':');
+ const char* colon_idx = strchr(host, ':');
if (colon_idx) {
- const char *port_str = colon_idx + 1;
+ const char* port_str = colon_idx + 1;
sf->port = atoi(port_str);
sf->servers_hostport = gpr_strdup(host);
} else {
@@ -630,7 +631,7 @@ static void setup_server(const char *host, server_fixture *sf) {
gpr_join_host_port(&sf->servers_hostport, host, sf->port);
}
- grpc_server_credentials *server_creds =
+ grpc_server_credentials* server_creds =
grpc_fake_transport_security_server_credentials_create();
sf->server = grpc_server_create(NULL, NULL);
@@ -642,12 +643,12 @@ static void setup_server(const char *host, server_fixture *sf) {
grpc_server_start(sf->server);
}
-static void teardown_server(server_fixture *sf) {
+static void teardown_server(server_fixture* sf) {
if (!sf->server) return;
gpr_log(GPR_INFO, "Server[%s] shutting down", sf->servers_hostport);
- grpc_completion_queue *shutdown_cq =
+ grpc_completion_queue* shutdown_cq =
grpc_completion_queue_create_for_pluck(NULL);
grpc_server_shutdown_and_notify(sf->server, shutdown_cq, tag(1000));
GPR_ASSERT(grpc_completion_queue_pluck(shutdown_cq, tag(1000),
@@ -667,13 +668,13 @@ static void teardown_server(server_fixture *sf) {
gpr_free(sf->servers_hostport);
}
-static void fork_backend_server(void *arg) {
- server_fixture *sf = static_cast<server_fixture *>(arg);
+static void fork_backend_server(void* arg) {
+ server_fixture* sf = static_cast<server_fixture*>(arg);
start_backend_server(sf);
}
-static void fork_lb_server(void *arg) {
- test_fixture *tf = static_cast<test_fixture *>(arg);
+static void fork_lb_server(void* arg) {
+ test_fixture* tf = static_cast<test_fixture*>(arg);
int ports[NUM_BACKENDS];
for (int i = 0; i < NUM_BACKENDS; i++) {
ports[i] = tf->lb_backends[i].port;
@@ -711,7 +712,7 @@ static test_fixture setup_test_fixture(int lb_server_update_delay_ms) {
return tf;
}
-static void teardown_test_fixture(test_fixture *tf) {
+static void teardown_test_fixture(test_fixture* tf) {
teardown_client(&tf->client);
for (int i = 0; i < NUM_BACKENDS; ++i) {
teardown_server(&tf->lb_backends[i]);
@@ -788,7 +789,7 @@ TEST(GrpclbTest, InvalidAddressInServerlist) {}
} // namespace
} // namespace grpc
-int main(int argc, char **argv) {
+int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
grpc_test_init(argc, argv);
// Make the backup poller poll very frequently in order to pick up
diff --git a/test/cpp/interop/interop_server.cc b/test/cpp/interop/interop_server.cc
index 4149724b1e..a24cdc7d2d 100644
--- a/test/cpp/interop/interop_server.cc
+++ b/test/cpp/interop/interop_server.cc
@@ -51,8 +51,9 @@ using grpc::ServerCredentials;
using grpc::ServerReader;
using grpc::ServerReaderWriter;
using grpc::ServerWriter;
-using grpc::WriteOptions;
using grpc::SslServerCredentialsOptions;
+using grpc::Status;
+using grpc::WriteOptions;
using grpc::testing::InteropServerContextInspector;
using grpc::testing::Payload;
using grpc::testing::SimpleRequest;
@@ -62,7 +63,6 @@ using grpc::testing::StreamingInputCallResponse;
using grpc::testing::StreamingOutputCallRequest;
using grpc::testing::StreamingOutputCallResponse;
using grpc::testing::TestService;
-using grpc::Status;
const char kEchoInitialMetadataKey[] = "x-grpc-test-echo-initial";
const char kEchoTrailingBinMetadataKey[] = "x-grpc-test-echo-trailing-bin";
diff --git a/test/cpp/interop/reconnect_interop_server.cc b/test/cpp/interop/reconnect_interop_server.cc
index 50af8fcc8a..5e257e1b38 100644
--- a/test/cpp/interop/reconnect_interop_server.cc
+++ b/test/cpp/interop/reconnect_interop_server.cc
@@ -53,9 +53,9 @@ using grpc::ServerWriter;
using grpc::SslServerCredentialsOptions;
using grpc::Status;
using grpc::testing::Empty;
-using grpc::testing::ReconnectService;
using grpc::testing::ReconnectInfo;
using grpc::testing::ReconnectParams;
+using grpc::testing::ReconnectService;
static bool got_sigint = false;
diff --git a/test/cpp/interop/stress_test.cc b/test/cpp/interop/stress_test.cc
index c6d3600be8..991fc88ad2 100644
--- a/test/cpp/interop/stress_test.cc
+++ b/test/cpp/interop/stress_test.cc
@@ -106,13 +106,13 @@ DEFINE_bool(use_test_ca, false, "False to use SSL roots for google");
DEFINE_string(server_host_override, "foo.test.google.fr",
"Override the server host which is sent in HTTP header");
-using grpc::testing::kTestCaseList;
using grpc::testing::MetricsService;
using grpc::testing::MetricsServiceImpl;
using grpc::testing::StressTestInteropClient;
using grpc::testing::TestCaseType;
using grpc::testing::UNKNOWN_TEST;
using grpc::testing::WeightedRandomTestSelector;
+using grpc::testing::kTestCaseList;
static int log_level = GPR_LOG_SEVERITY_DEBUG;
diff --git a/test/cpp/microbenchmarks/bm_call_create.cc b/test/cpp/microbenchmarks/bm_call_create.cc
index cf9a42e8c6..1c625c75c4 100644
--- a/test/cpp/microbenchmarks/bm_call_create.cc
+++ b/test/cpp/microbenchmarks/bm_call_create.cc
@@ -49,9 +49,9 @@ extern "C" {
#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;
@@ -80,13 +80,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 {
@@ -104,12 +104,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(
@@ -126,11 +126,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(
@@ -145,7 +145,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);
@@ -154,16 +154,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;
@@ -173,22 +173,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++;
@@ -212,7 +212,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);
@@ -230,14 +230,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;
@@ -247,22 +247,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++;
@@ -273,7 +273,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;
@@ -291,7 +291,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);
@@ -313,31 +313,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;
}
@@ -347,11 +347,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;
}
@@ -360,45 +360,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,
@@ -421,42 +421,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;
}
@@ -474,8 +474,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) {}
};
};
@@ -491,11 +491,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_);
}
@@ -516,7 +516,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;
@@ -529,7 +529,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);
}
@@ -541,8 +541,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,
@@ -552,8 +552,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");
@@ -630,12 +630,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,
@@ -650,42 +652,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,
@@ -704,7 +706,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(
@@ -718,24 +720,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);
@@ -747,14 +749,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;
@@ -778,7 +780,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);
@@ -793,13 +795,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;
@@ -810,7 +812,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);
diff --git a/test/cpp/microbenchmarks/bm_chttp2_hpack.cc b/test/cpp/microbenchmarks/bm_chttp2_hpack.cc
index bc2157b9f1..f8c31910fe 100644
--- a/test/cpp/microbenchmarks/bm_chttp2_hpack.cc
+++ b/test/cpp/microbenchmarks/bm_chttp2_hpack.cc
@@ -33,11 +33,11 @@ extern "C" {
#include "test/cpp/microbenchmarks/helpers.h"
#include "third_party/benchmark/include/benchmark/benchmark.h"
-auto &force_library_initialization = Library::get();
+auto& force_library_initialization = Library::get();
static grpc_slice MakeSlice(std::vector<uint8_t> bytes) {
grpc_slice s = grpc_slice_malloc(bytes.size());
- uint8_t *p = GRPC_SLICE_START_PTR(s);
+ uint8_t* p = GRPC_SLICE_START_PTR(s);
for (auto b : bytes) {
*p++ = b;
}
@@ -48,7 +48,7 @@ static grpc_slice MakeSlice(std::vector<uint8_t> bytes) {
// HPACK encoder
//
-static void BM_HpackEncoderInitDestroy(benchmark::State &state) {
+static void BM_HpackEncoderInitDestroy(benchmark::State& state) {
TrackCounters track_counters;
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_chttp2_hpack_compressor c;
@@ -62,7 +62,7 @@ static void BM_HpackEncoderInitDestroy(benchmark::State &state) {
}
BENCHMARK(BM_HpackEncoderInitDestroy);
-static void BM_HpackEncoderEncodeDeadline(benchmark::State &state) {
+static void BM_HpackEncoderEncodeDeadline(benchmark::State& state) {
TrackCounters track_counters;
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_millis saved_now = grpc_exec_ctx_now(&exec_ctx);
@@ -95,17 +95,19 @@ static void BM_HpackEncoderEncodeDeadline(benchmark::State &state) {
grpc_exec_ctx_finish(&exec_ctx);
std::ostringstream label;
- label << "framing_bytes/iter:" << (static_cast<double>(stats.framing_bytes) /
- static_cast<double>(state.iterations()))
- << " header_bytes/iter:" << (static_cast<double>(stats.header_bytes) /
- static_cast<double>(state.iterations()));
+ label << "framing_bytes/iter:"
+ << (static_cast<double>(stats.framing_bytes) /
+ static_cast<double>(state.iterations()))
+ << " header_bytes/iter:"
+ << (static_cast<double>(stats.header_bytes) /
+ static_cast<double>(state.iterations()));
track_counters.AddLabel(label.str());
track_counters.Finish(state);
}
BENCHMARK(BM_HpackEncoderEncodeDeadline);
template <class Fixture>
-static void BM_HpackEncoderEncodeHeader(benchmark::State &state) {
+static void BM_HpackEncoderEncodeHeader(benchmark::State& state) {
TrackCounters track_counters;
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
static bool logged_representative_output = false;
@@ -138,7 +140,7 @@ static void BM_HpackEncoderEncodeHeader(benchmark::State &state) {
if (!logged_representative_output && state.iterations() > 3) {
logged_representative_output = true;
for (size_t i = 0; i < outbuf.count; i++) {
- char *s = grpc_dump_slice(outbuf.slices[i], GPR_DUMP_HEX);
+ char* s = grpc_dump_slice(outbuf.slices[i], GPR_DUMP_HEX);
gpr_log(GPR_DEBUG, "%" PRIdPTR ": %s", i, s);
gpr_free(s);
}
@@ -152,10 +154,12 @@ static void BM_HpackEncoderEncodeHeader(benchmark::State &state) {
grpc_exec_ctx_finish(&exec_ctx);
std::ostringstream label;
- label << "framing_bytes/iter:" << (static_cast<double>(stats.framing_bytes) /
- static_cast<double>(state.iterations()))
- << " header_bytes/iter:" << (static_cast<double>(stats.header_bytes) /
- static_cast<double>(state.iterations()));
+ label << "framing_bytes/iter:"
+ << (static_cast<double>(stats.framing_bytes) /
+ static_cast<double>(state.iterations()))
+ << " header_bytes/iter:"
+ << (static_cast<double>(stats.header_bytes) /
+ static_cast<double>(state.iterations()));
track_counters.AddLabel(label.str());
track_counters.Finish(state);
}
@@ -165,7 +169,7 @@ namespace hpack_encoder_fixtures {
class EmptyBatch {
public:
static constexpr bool kEnableTrueBinary = false;
- static std::vector<grpc_mdelem> GetElems(grpc_exec_ctx *exec_ctx) {
+ static std::vector<grpc_mdelem> GetElems(grpc_exec_ctx* exec_ctx) {
return {};
}
};
@@ -173,7 +177,7 @@ class EmptyBatch {
class SingleStaticElem {
public:
static constexpr bool kEnableTrueBinary = false;
- static std::vector<grpc_mdelem> GetElems(grpc_exec_ctx *exec_ctx) {
+ static std::vector<grpc_mdelem> GetElems(grpc_exec_ctx* exec_ctx) {
return {GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY_COMMA_DEFLATE};
}
};
@@ -181,7 +185,7 @@ class SingleStaticElem {
class SingleInternedElem {
public:
static constexpr bool kEnableTrueBinary = false;
- static std::vector<grpc_mdelem> GetElems(grpc_exec_ctx *exec_ctx) {
+ static std::vector<grpc_mdelem> GetElems(grpc_exec_ctx* exec_ctx) {
return {grpc_mdelem_from_slices(
exec_ctx, grpc_slice_intern(grpc_slice_from_static_string("abc")),
grpc_slice_intern(grpc_slice_from_static_string("def")))};
@@ -192,7 +196,7 @@ template <int kLength, bool kTrueBinary>
class SingleInternedBinaryElem {
public:
static constexpr bool kEnableTrueBinary = kTrueBinary;
- static std::vector<grpc_mdelem> GetElems(grpc_exec_ctx *exec_ctx) {
+ static std::vector<grpc_mdelem> GetElems(grpc_exec_ctx* exec_ctx) {
grpc_slice bytes = MakeBytes();
std::vector<grpc_mdelem> out = {grpc_mdelem_from_slices(
exec_ctx, grpc_slice_intern(grpc_slice_from_static_string("abc-bin")),
@@ -214,7 +218,7 @@ class SingleInternedBinaryElem {
class SingleInternedKeyElem {
public:
static constexpr bool kEnableTrueBinary = false;
- static std::vector<grpc_mdelem> GetElems(grpc_exec_ctx *exec_ctx) {
+ static std::vector<grpc_mdelem> GetElems(grpc_exec_ctx* exec_ctx) {
return {grpc_mdelem_from_slices(
exec_ctx, grpc_slice_intern(grpc_slice_from_static_string("abc")),
grpc_slice_from_static_string("def"))};
@@ -224,7 +228,7 @@ class SingleInternedKeyElem {
class SingleNonInternedElem {
public:
static constexpr bool kEnableTrueBinary = false;
- static std::vector<grpc_mdelem> GetElems(grpc_exec_ctx *exec_ctx) {
+ static std::vector<grpc_mdelem> GetElems(grpc_exec_ctx* exec_ctx) {
return {grpc_mdelem_from_slices(exec_ctx,
grpc_slice_from_static_string("abc"),
grpc_slice_from_static_string("def"))};
@@ -235,7 +239,7 @@ template <int kLength, bool kTrueBinary>
class SingleNonInternedBinaryElem {
public:
static constexpr bool kEnableTrueBinary = kTrueBinary;
- static std::vector<grpc_mdelem> GetElems(grpc_exec_ctx *exec_ctx) {
+ static std::vector<grpc_mdelem> GetElems(grpc_exec_ctx* exec_ctx) {
return {grpc_mdelem_from_slices(
exec_ctx, grpc_slice_from_static_string("abc-bin"), MakeBytes())};
}
@@ -253,9 +257,10 @@ class SingleNonInternedBinaryElem {
class RepresentativeClientInitialMetadata {
public:
static constexpr bool kEnableTrueBinary = true;
- static std::vector<grpc_mdelem> GetElems(grpc_exec_ctx *exec_ctx) {
+ static std::vector<grpc_mdelem> GetElems(grpc_exec_ctx* exec_ctx) {
return {
- GRPC_MDELEM_SCHEME_HTTP, GRPC_MDELEM_METHOD_POST,
+ GRPC_MDELEM_SCHEME_HTTP,
+ GRPC_MDELEM_METHOD_POST,
grpc_mdelem_from_slices(
exec_ctx, GRPC_MDSTR_PATH,
grpc_slice_intern(grpc_slice_from_static_string("/foo/bar"))),
@@ -278,9 +283,10 @@ class RepresentativeClientInitialMetadata {
class MoreRepresentativeClientInitialMetadata {
public:
static constexpr bool kEnableTrueBinary = true;
- static std::vector<grpc_mdelem> GetElems(grpc_exec_ctx *exec_ctx) {
+ static std::vector<grpc_mdelem> GetElems(grpc_exec_ctx* exec_ctx) {
return {
- GRPC_MDELEM_SCHEME_HTTP, GRPC_MDELEM_METHOD_POST,
+ GRPC_MDELEM_SCHEME_HTTP,
+ GRPC_MDELEM_METHOD_POST,
grpc_mdelem_from_slices(exec_ctx, GRPC_MDSTR_PATH,
grpc_slice_intern(grpc_slice_from_static_string(
"/grpc.test.FooService/BarMethod"))),
@@ -314,7 +320,7 @@ class MoreRepresentativeClientInitialMetadata {
class RepresentativeServerInitialMetadata {
public:
static constexpr bool kEnableTrueBinary = true;
- static std::vector<grpc_mdelem> GetElems(grpc_exec_ctx *exec_ctx) {
+ static std::vector<grpc_mdelem> GetElems(grpc_exec_ctx* exec_ctx) {
return {GRPC_MDELEM_STATUS_200,
GRPC_MDELEM_CONTENT_TYPE_APPLICATION_SLASH_GRPC,
GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY_COMMA_DEFLATE_COMMA_GZIP};
@@ -324,7 +330,7 @@ class RepresentativeServerInitialMetadata {
class RepresentativeServerTrailingMetadata {
public:
static constexpr bool kEnableTrueBinary = true;
- static std::vector<grpc_mdelem> GetElems(grpc_exec_ctx *exec_ctx) {
+ static std::vector<grpc_mdelem> GetElems(grpc_exec_ctx* exec_ctx) {
return {GRPC_MDELEM_GRPC_STATUS_0};
}
};
@@ -423,7 +429,7 @@ BENCHMARK_TEMPLATE(BM_HpackEncoderEncodeHeader,
// HPACK parser
//
-static void BM_HpackParserInitDestroy(benchmark::State &state) {
+static void BM_HpackParserInitDestroy(benchmark::State& state) {
TrackCounters track_counters;
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_chttp2_hpack_parser p;
@@ -437,13 +443,13 @@ static void BM_HpackParserInitDestroy(benchmark::State &state) {
}
BENCHMARK(BM_HpackParserInitDestroy);
-static void UnrefHeader(grpc_exec_ctx *exec_ctx, void *user_data,
+static void UnrefHeader(grpc_exec_ctx* exec_ctx, void* user_data,
grpc_mdelem md) {
GRPC_MDELEM_UNREF(exec_ctx, md);
}
-template <class Fixture, void (*OnHeader)(grpc_exec_ctx *, void *, grpc_mdelem)>
-static void BM_HpackParserParseHeader(benchmark::State &state) {
+template <class Fixture, void (*OnHeader)(grpc_exec_ctx*, void*, grpc_mdelem)>
+static void BM_HpackParserParseHeader(benchmark::State& state) {
TrackCounters track_counters;
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
std::vector<grpc_slice> init_slices = Fixture::GetInitSlices();
@@ -760,20 +766,20 @@ class RepresentativeServerTrailingMetadata {
}
};
-static void free_timeout(void *p) { gpr_free(p); }
+static void free_timeout(void* p) { gpr_free(p); }
// New implementation.
-static void OnHeaderNew(grpc_exec_ctx *exec_ctx, void *user_data,
+static void OnHeaderNew(grpc_exec_ctx* exec_ctx, void* user_data,
grpc_mdelem md) {
if (grpc_slice_eq(GRPC_MDKEY(md), GRPC_MDSTR_GRPC_TIMEOUT)) {
- grpc_millis *cached_timeout =
- static_cast<grpc_millis *>(grpc_mdelem_get_user_data(md, free_timeout));
+ grpc_millis* cached_timeout =
+ static_cast<grpc_millis*>(grpc_mdelem_get_user_data(md, free_timeout));
grpc_millis timeout;
if (cached_timeout != NULL) {
timeout = *cached_timeout;
} else {
if (!grpc_http2_decode_timeout(GRPC_MDVALUE(md), &timeout)) {
- char *val = grpc_slice_to_c_string(GRPC_MDVALUE(md));
+ char* val = grpc_slice_to_c_string(GRPC_MDVALUE(md));
gpr_log(GPR_ERROR, "Ignoring bad timeout value '%s'", val);
gpr_free(val);
timeout = GRPC_MILLIS_INF_FUTURE;
@@ -781,7 +787,7 @@ static void OnHeaderNew(grpc_exec_ctx *exec_ctx, void *user_data,
if (GRPC_MDELEM_IS_INTERNED(md)) {
/* not already parsed: parse it now, and store the
* result away */
- cached_timeout = (grpc_millis *)gpr_malloc(sizeof(grpc_millis));
+ cached_timeout = (grpc_millis*)gpr_malloc(sizeof(grpc_millis));
*cached_timeout = timeout;
grpc_mdelem_set_user_data(md, free_timeout, cached_timeout);
}
diff --git a/test/cpp/microbenchmarks/bm_chttp2_transport.cc b/test/cpp/microbenchmarks/bm_chttp2_transport.cc
index e9f537faa4..154cc91778 100644
--- a/test/cpp/microbenchmarks/bm_chttp2_transport.cc
+++ b/test/cpp/microbenchmarks/bm_chttp2_transport.cc
@@ -35,7 +35,7 @@
#include "test/cpp/microbenchmarks/helpers.h"
#include "third_party/benchmark/include/benchmark/benchmark.h"
-auto &force_library_initialization = Library::get();
+auto& force_library_initialization = Library::get();
////////////////////////////////////////////////////////////////////////////////
// Helper classes
@@ -58,7 +58,7 @@ class DummyEndpoint : public grpc_endpoint {
ru_ = grpc_resource_user_create(Library::get().rq(), "dummy_endpoint");
}
- void PushInput(grpc_exec_ctx *exec_ctx, grpc_slice slice) {
+ void PushInput(grpc_exec_ctx* exec_ctx, grpc_slice slice) {
if (read_cb_ == nullptr) {
GPR_ASSERT(!have_slice_);
buffered_slice_ = slice;
@@ -71,14 +71,14 @@ class DummyEndpoint : public grpc_endpoint {
}
private:
- grpc_resource_user *ru_;
- grpc_closure *read_cb_ = nullptr;
- grpc_slice_buffer *slices_ = nullptr;
+ grpc_resource_user* ru_;
+ grpc_closure* read_cb_ = nullptr;
+ grpc_slice_buffer* slices_ = nullptr;
bool have_slice_ = false;
grpc_slice buffered_slice_;
- void QueueRead(grpc_exec_ctx *exec_ctx, grpc_slice_buffer *slices,
- grpc_closure *cb) {
+ void QueueRead(grpc_exec_ctx* exec_ctx, grpc_slice_buffer* slices,
+ grpc_closure* cb) {
GPR_ASSERT(read_cb_ == nullptr);
if (have_slice_) {
have_slice_ = false;
@@ -90,51 +90,50 @@ class DummyEndpoint : public grpc_endpoint {
slices_ = slices;
}
- static void read(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
- grpc_slice_buffer *slices, grpc_closure *cb) {
- static_cast<DummyEndpoint *>(ep)->QueueRead(exec_ctx, slices, cb);
+ static void read(grpc_exec_ctx* exec_ctx, grpc_endpoint* ep,
+ grpc_slice_buffer* slices, grpc_closure* cb) {
+ static_cast<DummyEndpoint*>(ep)->QueueRead(exec_ctx, slices, cb);
}
- static void write(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
- grpc_slice_buffer *slices, grpc_closure *cb) {
+ static void write(grpc_exec_ctx* exec_ctx, grpc_endpoint* ep,
+ grpc_slice_buffer* slices, grpc_closure* cb) {
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 NULL; }
- static void add_to_pollset(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
- grpc_pollset *pollset) {}
+ static void add_to_pollset(grpc_exec_ctx* exec_ctx, grpc_endpoint* ep,
+ grpc_pollset* pollset) {}
- static void add_to_pollset_set(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
- grpc_pollset_set *pollset) {}
+ static void add_to_pollset_set(grpc_exec_ctx* exec_ctx, grpc_endpoint* ep,
+ grpc_pollset_set* pollset) {}
- static void delete_from_pollset_set(grpc_exec_ctx *exec_ctx,
- grpc_endpoint *ep,
- grpc_pollset_set *pollset) {}
+ static void delete_from_pollset_set(grpc_exec_ctx* exec_ctx,
+ grpc_endpoint* ep,
+ grpc_pollset_set* pollset) {}
- static void shutdown(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
- grpc_error *why) {
- grpc_resource_user_shutdown(exec_ctx,
- static_cast<DummyEndpoint *>(ep)->ru_);
- GRPC_CLOSURE_SCHED(exec_ctx, static_cast<DummyEndpoint *>(ep)->read_cb_,
+ static void shutdown(grpc_exec_ctx* exec_ctx, grpc_endpoint* ep,
+ grpc_error* why) {
+ grpc_resource_user_shutdown(exec_ctx, static_cast<DummyEndpoint*>(ep)->ru_);
+ GRPC_CLOSURE_SCHED(exec_ctx, static_cast<DummyEndpoint*>(ep)->read_cb_,
why);
}
- static void destroy(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep) {
- grpc_resource_user_unref(exec_ctx, static_cast<DummyEndpoint *>(ep)->ru_);
- delete static_cast<DummyEndpoint *>(ep);
+ static void destroy(grpc_exec_ctx* exec_ctx, grpc_endpoint* ep) {
+ grpc_resource_user_unref(exec_ctx, static_cast<DummyEndpoint*>(ep)->ru_);
+ delete static_cast<DummyEndpoint*>(ep);
}
- static grpc_resource_user *get_resource_user(grpc_endpoint *ep) {
- return static_cast<DummyEndpoint *>(ep)->ru_;
+ static grpc_resource_user* get_resource_user(grpc_endpoint* ep) {
+ return static_cast<DummyEndpoint*>(ep)->ru_;
}
- static char *get_peer(grpc_endpoint *ep) { return gpr_strdup("test"); }
- static int get_fd(grpc_endpoint *ep) { return 0; }
+ static char* get_peer(grpc_endpoint* ep) { return gpr_strdup("test"); }
+ static int get_fd(grpc_endpoint* ep) { return 0; }
};
class Fixture {
public:
- Fixture(const grpc::ChannelArguments &args, bool client) {
+ Fixture(const grpc::ChannelArguments& args, bool client) {
grpc_channel_args c_args = args.c_channel_args();
ep_ = new DummyEndpoint;
t_ = grpc_create_chttp2_transport(exec_ctx(), &c_args, ep_, client);
@@ -149,18 +148,18 @@ class Fixture {
grpc_exec_ctx_finish(&exec_ctx_);
}
- grpc_chttp2_transport *chttp2_transport() {
- return reinterpret_cast<grpc_chttp2_transport *>(t_);
+ grpc_chttp2_transport* chttp2_transport() {
+ return reinterpret_cast<grpc_chttp2_transport*>(t_);
}
- grpc_transport *transport() { return t_; }
- grpc_exec_ctx *exec_ctx() { return &exec_ctx_; }
+ grpc_transport* transport() { return t_; }
+ grpc_exec_ctx* exec_ctx() { return &exec_ctx_; }
void PushInput(grpc_slice slice) { ep_->PushInput(exec_ctx(), slice); }
private:
- DummyEndpoint *ep_;
+ DummyEndpoint* ep_;
grpc_exec_ctx exec_ctx_ = GRPC_EXEC_CTX_INIT;
- grpc_transport *t_;
+ grpc_transport* t_;
};
class Closure : public grpc_closure {
@@ -170,37 +169,37 @@ class Closure : public grpc_closure {
template <class F>
std::unique_ptr<Closure> MakeClosure(
- F f, grpc_closure_scheduler *sched = grpc_schedule_on_exec_ctx) {
+ F f, grpc_closure_scheduler* sched = grpc_schedule_on_exec_ctx) {
struct C : public Closure {
- C(const F &f, grpc_closure_scheduler *sched) : f_(f) {
+ C(const F& f, grpc_closure_scheduler* sched) : f_(f) {
GRPC_CLOSURE_INIT(this, Execute, this, sched);
}
F f_;
- static void Execute(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {
- static_cast<C *>(arg)->f_(exec_ctx, error);
+ static void Execute(grpc_exec_ctx* exec_ctx, void* arg, grpc_error* error) {
+ static_cast<C*>(arg)->f_(exec_ctx, error);
}
};
return std::unique_ptr<Closure>(new C(f, sched));
}
template <class F>
-grpc_closure *MakeOnceClosure(
- F f, grpc_closure_scheduler *sched = grpc_schedule_on_exec_ctx) {
+grpc_closure* MakeOnceClosure(
+ F f, grpc_closure_scheduler* sched = grpc_schedule_on_exec_ctx) {
struct C : public grpc_closure {
- C(const F &f) : f_(f) {}
+ C(const F& f) : f_(f) {}
F f_;
- static void Execute(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {
- static_cast<C *>(arg)->f_(exec_ctx, error);
- delete static_cast<C *>(arg);
+ static void Execute(grpc_exec_ctx* exec_ctx, void* arg, grpc_error* error) {
+ static_cast<C*>(arg)->f_(exec_ctx, error);
+ delete static_cast<C*>(arg);
}
};
- auto *c = new C{f};
+ auto* c = new C{f};
return GRPC_CLOSURE_INIT(c, C::Execute, c, sched);
}
class Stream {
public:
- Stream(Fixture *f) : f_(f) {
+ Stream(Fixture* f) : f_(f) {
stream_size_ = grpc_transport_stream_size(f->transport());
stream_ = gpr_malloc(stream_size_);
arena_ = gpr_arena_create(4096);
@@ -212,7 +211,7 @@ class Stream {
gpr_arena_destroy(arena_);
}
- void Init(benchmark::State &state) {
+ void Init(benchmark::State& state) {
GRPC_STREAM_REF_INIT(&refcount_, 1, &Stream::FinishDestroy, this,
"test_stream");
gpr_event_init(&done_);
@@ -222,11 +221,11 @@ class Stream {
arena_ = gpr_arena_create(4096);
}
grpc_transport_init_stream(f_->exec_ctx(), f_->transport(),
- static_cast<grpc_stream *>(stream_), &refcount_,
+ static_cast<grpc_stream*>(stream_), &refcount_,
NULL, arena_);
}
- void DestroyThen(grpc_exec_ctx *exec_ctx, grpc_closure *closure) {
+ void DestroyThen(grpc_exec_ctx* exec_ctx, grpc_closure* closure) {
destroy_closure_ = closure;
#ifndef NDEBUG
grpc_stream_unref(exec_ctx, &refcount_, "DestroyThen");
@@ -235,31 +234,31 @@ class Stream {
#endif
}
- void Op(grpc_exec_ctx *exec_ctx, grpc_transport_stream_op_batch *op) {
+ void Op(grpc_exec_ctx* exec_ctx, grpc_transport_stream_op_batch* op) {
grpc_transport_perform_stream_op(exec_ctx, f_->transport(),
- static_cast<grpc_stream *>(stream_), op);
+ static_cast<grpc_stream*>(stream_), op);
}
- grpc_chttp2_stream *chttp2_stream() {
- return static_cast<grpc_chttp2_stream *>(stream_);
+ grpc_chttp2_stream* chttp2_stream() {
+ return static_cast<grpc_chttp2_stream*>(stream_);
}
private:
- static void FinishDestroy(grpc_exec_ctx *exec_ctx, void *arg,
- grpc_error *error) {
- auto stream = static_cast<Stream *>(arg);
+ static void FinishDestroy(grpc_exec_ctx* exec_ctx, void* arg,
+ grpc_error* error) {
+ auto stream = static_cast<Stream*>(arg);
grpc_transport_destroy_stream(exec_ctx, stream->f_->transport(),
- static_cast<grpc_stream *>(stream->stream_),
+ static_cast<grpc_stream*>(stream->stream_),
stream->destroy_closure_);
- gpr_event_set(&stream->done_, (void *)1);
+ gpr_event_set(&stream->done_, (void*)1);
}
- Fixture *f_;
+ Fixture* f_;
grpc_stream_refcount refcount_;
- gpr_arena *arena_;
+ gpr_arena* arena_;
size_t stream_size_;
- void *stream_;
- grpc_closure *destroy_closure_ = nullptr;
+ void* stream_;
+ grpc_closure* destroy_closure_ = nullptr;
gpr_event done_;
};
@@ -267,7 +266,7 @@ class Stream {
// Benchmarks
//
-static void BM_StreamCreateDestroy(benchmark::State &state) {
+static void BM_StreamCreateDestroy(benchmark::State& state) {
TrackCounters track_counters;
Fixture f(grpc::ChannelArguments(), true);
Stream s(&f);
@@ -278,7 +277,7 @@ static void BM_StreamCreateDestroy(benchmark::State &state) {
op.payload = &op_payload;
op_payload.cancel_stream.cancel_error = GRPC_ERROR_CANCELLED;
std::unique_ptr<Closure> next =
- MakeClosure([&](grpc_exec_ctx *exec_ctx, grpc_error *error) {
+ MakeClosure([&](grpc_exec_ctx* exec_ctx, grpc_error* error) {
if (!state.KeepRunning()) return;
s.Init(state);
s.Op(exec_ctx, &op);
@@ -292,9 +291,10 @@ BENCHMARK(BM_StreamCreateDestroy);
class RepresentativeClientInitialMetadata {
public:
- static std::vector<grpc_mdelem> GetElems(grpc_exec_ctx *exec_ctx) {
+ static std::vector<grpc_mdelem> GetElems(grpc_exec_ctx* exec_ctx) {
return {
- GRPC_MDELEM_SCHEME_HTTP, GRPC_MDELEM_METHOD_POST,
+ GRPC_MDELEM_SCHEME_HTTP,
+ GRPC_MDELEM_METHOD_POST,
grpc_mdelem_from_slices(
exec_ctx, GRPC_MDSTR_PATH,
grpc_slice_intern(grpc_slice_from_static_string("/foo/bar"))),
@@ -312,7 +312,7 @@ class RepresentativeClientInitialMetadata {
};
template <class Metadata>
-static void BM_StreamCreateSendInitialMetadataDestroy(benchmark::State &state) {
+static void BM_StreamCreateSendInitialMetadataDestroy(benchmark::State& state) {
TrackCounters track_counters;
Fixture f(grpc::ChannelArguments(), true);
Stream s(&f);
@@ -339,7 +339,7 @@ static void BM_StreamCreateSendInitialMetadataDestroy(benchmark::State &state) {
}
f.FlushExecCtx();
- start = MakeClosure([&](grpc_exec_ctx *exec_ctx, grpc_error *error) {
+ start = MakeClosure([&](grpc_exec_ctx* exec_ctx, grpc_error* error) {
if (!state.KeepRunning()) return;
s.Init(state);
reset_op();
@@ -348,7 +348,7 @@ static void BM_StreamCreateSendInitialMetadataDestroy(benchmark::State &state) {
op.payload->send_initial_metadata.send_initial_metadata = &b;
s.Op(exec_ctx, &op);
});
- done = MakeClosure([&](grpc_exec_ctx *exec_ctx, grpc_error *error) {
+ done = MakeClosure([&](grpc_exec_ctx* exec_ctx, grpc_error* error) {
reset_op();
op.cancel_stream = true;
op.payload->cancel_stream.cancel_error = GRPC_ERROR_CANCELLED;
@@ -363,7 +363,7 @@ static void BM_StreamCreateSendInitialMetadataDestroy(benchmark::State &state) {
BENCHMARK_TEMPLATE(BM_StreamCreateSendInitialMetadataDestroy,
RepresentativeClientInitialMetadata);
-static void BM_TransportEmptyOp(benchmark::State &state) {
+static void BM_TransportEmptyOp(benchmark::State& state) {
TrackCounters track_counters;
Fixture f(grpc::ChannelArguments(), true);
Stream s(&f);
@@ -376,7 +376,7 @@ static void BM_TransportEmptyOp(benchmark::State &state) {
op.payload = &op_payload;
};
std::unique_ptr<Closure> c =
- MakeClosure([&](grpc_exec_ctx *exec_ctx, grpc_error *error) {
+ MakeClosure([&](grpc_exec_ctx* exec_ctx, grpc_error* error) {
if (!state.KeepRunning()) return;
reset_op();
op.on_complete = c.get();
@@ -388,8 +388,8 @@ static void BM_TransportEmptyOp(benchmark::State &state) {
op.cancel_stream = true;
op_payload.cancel_stream.cancel_error = GRPC_ERROR_CANCELLED;
s.Op(f.exec_ctx(), &op);
- s.DestroyThen(f.exec_ctx(), MakeOnceClosure([](grpc_exec_ctx *exec_ctx,
- grpc_error *error) {}));
+ s.DestroyThen(f.exec_ctx(), MakeOnceClosure([](grpc_exec_ctx* exec_ctx,
+ grpc_error* error) {}));
f.FlushExecCtx();
track_counters.Finish(state);
}
@@ -397,7 +397,7 @@ BENCHMARK(BM_TransportEmptyOp);
std::vector<std::unique_ptr<gpr_event>> done_events;
-static void BM_TransportStreamSend(benchmark::State &state) {
+static void BM_TransportStreamSend(benchmark::State& state) {
TrackCounters track_counters;
Fixture f(grpc::ChannelArguments(), true);
auto s = std::unique_ptr<Stream>(new Stream(&f));
@@ -428,13 +428,13 @@ static void BM_TransportStreamSend(benchmark::State &state) {
grpc_metadata_batch_add_tail(f.exec_ctx(), &b, &storage[i], elems[i])));
}
- gpr_event *bm_done = new gpr_event;
+ gpr_event* bm_done = new gpr_event;
gpr_event_init(bm_done);
std::unique_ptr<Closure> c =
- MakeClosure([&](grpc_exec_ctx *exec_ctx, grpc_error *error) {
+ MakeClosure([&](grpc_exec_ctx* exec_ctx, grpc_error* error) {
if (!state.KeepRunning()) {
- gpr_event_set(bm_done, (void *)1);
+ gpr_event_set(bm_done, (void*)1);
return;
}
// force outgoing window to be yuge
@@ -462,8 +462,8 @@ static void BM_TransportStreamSend(benchmark::State &state) {
op.cancel_stream = true;
op.payload->cancel_stream.cancel_error = GRPC_ERROR_CANCELLED;
s->Op(f.exec_ctx(), &op);
- s->DestroyThen(f.exec_ctx(), MakeOnceClosure([](grpc_exec_ctx *exec_ctx,
- grpc_error *error) {}));
+ s->DestroyThen(f.exec_ctx(), MakeOnceClosure([](grpc_exec_ctx* exec_ctx,
+ grpc_error* error) {}));
f.FlushExecCtx();
s.reset();
track_counters.Finish(state);
@@ -529,7 +529,7 @@ static grpc_slice CreateIncomingDataSlice(size_t length, size_t frame_size) {
return grpc_slice_from_copied_buffer(framed.data(), framed.size());
}
-static void BM_TransportStreamRecv(benchmark::State &state) {
+static void BM_TransportStreamRecv(benchmark::State& state) {
TrackCounters track_counters;
Fixture f(grpc::ChannelArguments(), true);
Stream s(&f);
@@ -537,7 +537,7 @@ static void BM_TransportStreamRecv(benchmark::State &state) {
grpc_transport_stream_op_batch_payload op_payload;
memset(&op_payload, 0, sizeof(op_payload));
grpc_transport_stream_op_batch op;
- grpc_byte_stream *recv_stream;
+ grpc_byte_stream* recv_stream;
grpc_slice incoming_data = CreateIncomingDataSlice(state.range(0), 16384);
auto reset_op = [&]() {
@@ -560,7 +560,7 @@ static void BM_TransportStreamRecv(benchmark::State &state) {
}
std::unique_ptr<Closure> do_nothing =
- MakeClosure([](grpc_exec_ctx *exec_ctx, grpc_error *error) {});
+ MakeClosure([](grpc_exec_ctx* exec_ctx, grpc_error* error) {});
uint32_t received;
@@ -570,7 +570,7 @@ static void BM_TransportStreamRecv(benchmark::State &state) {
grpc_slice recv_slice;
std::unique_ptr<Closure> c =
- MakeClosure([&](grpc_exec_ctx *exec_ctx, grpc_error *error) {
+ MakeClosure([&](grpc_exec_ctx* exec_ctx, grpc_error* error) {
if (!state.KeepRunning()) return;
// force outgoing window to be yuge
s.chttp2_stream()->flow_control->TestOnlyForceHugeWindow();
@@ -585,7 +585,7 @@ static void BM_TransportStreamRecv(benchmark::State &state) {
f.PushInput(grpc_slice_ref(incoming_data));
});
- drain_start = MakeClosure([&](grpc_exec_ctx *exec_ctx, grpc_error *error) {
+ drain_start = MakeClosure([&](grpc_exec_ctx* exec_ctx, grpc_error* error) {
if (recv_stream == NULL) {
GPR_ASSERT(!state.KeepRunning());
return;
@@ -593,7 +593,7 @@ static void BM_TransportStreamRecv(benchmark::State &state) {
GRPC_CLOSURE_RUN(exec_ctx, drain.get(), GRPC_ERROR_NONE);
});
- drain = MakeClosure([&](grpc_exec_ctx *exec_ctx, grpc_error *error) {
+ drain = MakeClosure([&](grpc_exec_ctx* exec_ctx, grpc_error* error) {
do {
if (received == recv_stream->length) {
grpc_byte_stream_destroy(exec_ctx, recv_stream);
@@ -609,7 +609,7 @@ static void BM_TransportStreamRecv(benchmark::State &state) {
grpc_slice_unref_internal(exec_ctx, recv_slice), true));
});
- drain_continue = MakeClosure([&](grpc_exec_ctx *exec_ctx, grpc_error *error) {
+ drain_continue = MakeClosure([&](grpc_exec_ctx* exec_ctx, grpc_error* error) {
grpc_byte_stream_pull(exec_ctx, recv_stream, &recv_slice);
received += GRPC_SLICE_LENGTH(recv_slice);
grpc_slice_unref_internal(exec_ctx, recv_slice);
@@ -643,8 +643,8 @@ static void BM_TransportStreamRecv(benchmark::State &state) {
op.cancel_stream = true;
op.payload->cancel_stream.cancel_error = GRPC_ERROR_CANCELLED;
s.Op(f.exec_ctx(), &op);
- s.DestroyThen(f.exec_ctx(), MakeOnceClosure([](grpc_exec_ctx *exec_ctx,
- grpc_error *error) {}));
+ s.DestroyThen(f.exec_ctx(), MakeOnceClosure([](grpc_exec_ctx* exec_ctx,
+ grpc_error* error) {}));
f.FlushExecCtx();
track_counters.Finish(state);
grpc_metadata_batch_destroy(f.exec_ctx(), &b);
diff --git a/test/cpp/microbenchmarks/bm_closure.cc b/test/cpp/microbenchmarks/bm_closure.cc
index 41649b8a73..d600ce77d9 100644
--- a/test/cpp/microbenchmarks/bm_closure.cc
+++ b/test/cpp/microbenchmarks/bm_closure.cc
@@ -100,9 +100,10 @@ static void BM_ClosureCreateAndRun(benchmark::State& state) {
TrackCounters track_counters;
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
while (state.KeepRunning()) {
- GRPC_CLOSURE_RUN(&exec_ctx, GRPC_CLOSURE_CREATE(DoNothing, NULL,
- grpc_schedule_on_exec_ctx),
- GRPC_ERROR_NONE);
+ GRPC_CLOSURE_RUN(
+ &exec_ctx,
+ GRPC_CLOSURE_CREATE(DoNothing, NULL, grpc_schedule_on_exec_ctx),
+ GRPC_ERROR_NONE);
}
grpc_exec_ctx_finish(&exec_ctx);
track_counters.Finish(state);
@@ -114,9 +115,10 @@ static void BM_ClosureInitAndRun(benchmark::State& state) {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_closure c;
while (state.KeepRunning()) {
- GRPC_CLOSURE_RUN(&exec_ctx, GRPC_CLOSURE_INIT(&c, DoNothing, NULL,
- grpc_schedule_on_exec_ctx),
- GRPC_ERROR_NONE);
+ GRPC_CLOSURE_RUN(
+ &exec_ctx,
+ GRPC_CLOSURE_INIT(&c, DoNothing, NULL, grpc_schedule_on_exec_ctx),
+ GRPC_ERROR_NONE);
}
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 25d243a104..f75c3e4436 100644
--- a/test/cpp/microbenchmarks/bm_fullstack_trickle.cc
+++ b/test/cpp/microbenchmarks/bm_fullstack_trickle.cc
@@ -135,8 +135,9 @@ class TrickledCHTTP2 : public EndpointPairFixture {
? static_cast<grpc_chttp2_stream*>(server->stream_map.values[0])
: nullptr;
write_csv(
- log_.get(), static_cast<double>(now.tv_sec) +
- 1e-9 * static_cast<double>(now.tv_nsec),
+ log_.get(),
+ static_cast<double>(now.tv_sec) +
+ 1e-9 * static_cast<double>(now.tv_nsec),
iteration, grpc_trickle_get_backlog(endpoint_pair_.client),
grpc_trickle_get_backlog(endpoint_pair_.server),
client->lists[GRPC_CHTTP2_LIST_STALLED_BY_TRANSPORT].head != nullptr,
@@ -441,8 +442,8 @@ static void UnaryTrickleArgs(benchmark::internal::Benchmark* b) {
}
}
BENCHMARK(BM_PumpUnbalancedUnary_Trickle)->Apply(UnaryTrickleArgs);
-}
-}
+} // namespace testing
+} // namespace grpc
extern "C" gpr_timespec (*gpr_now_impl)(gpr_clock_type clock_type);
diff --git a/test/cpp/microbenchmarks/helpers.cc b/test/cpp/microbenchmarks/helpers.cc
index 782f12e99a..a4c0a3a0ce 100644
--- a/test/cpp/microbenchmarks/helpers.cc
+++ b/test/cpp/microbenchmarks/helpers.cc
@@ -20,9 +20,9 @@
#include "test/cpp/microbenchmarks/helpers.h"
-void TrackCounters::Finish(benchmark::State &state) {
+void TrackCounters::Finish(benchmark::State& state) {
std::ostringstream out;
- for (const auto &l : labels_) {
+ for (const auto& l : labels_) {
out << l << ' ';
}
AddToLabel(out, state);
@@ -33,11 +33,11 @@ void TrackCounters::Finish(benchmark::State &state) {
state.SetLabel(label.c_str());
}
-void TrackCounters::AddLabel(const grpc::string &label) {
+void TrackCounters::AddLabel(const grpc::string& label) {
labels_.push_back(label);
}
-void TrackCounters::AddToLabel(std::ostream &out, benchmark::State &state) {
+void TrackCounters::AddToLabel(std::ostream& out, benchmark::State& state) {
grpc_stats_data stats_end;
grpc_stats_collect(&stats_end);
grpc_stats_data stats;
@@ -58,9 +58,10 @@ void TrackCounters::AddToLabel(std::ostream &out, benchmark::State &state) {
}
#ifdef GPR_LOW_LEVEL_COUNTERS
grpc_memory_counters counters_at_end = grpc_memory_counters_snapshot();
- out << " locks/iter:" << ((double)(gpr_atm_no_barrier_load(&gpr_mu_locks) -
- mu_locks_at_start_) /
- (double)state.iterations())
+ out << " locks/iter:"
+ << ((double)(gpr_atm_no_barrier_load(&gpr_mu_locks) -
+ mu_locks_at_start_) /
+ (double)state.iterations())
<< " atm_cas/iter:"
<< ((double)(gpr_atm_no_barrier_load(&gpr_counter_atm_cas) -
atm_cas_at_start_) /
diff --git a/test/cpp/naming/resolver_component_test.cc b/test/cpp/naming/resolver_component_test.cc
index 7d0371bea4..205a68bca3 100644
--- a/test/cpp/naming/resolver_component_test.cc
+++ b/test/cpp/naming/resolver_component_test.cc
@@ -49,8 +49,8 @@ extern "C" {
#include "test/core/util/test_config.h"
}
-using std::vector;
using grpc::SubProcess;
+using std::vector;
using testing::UnorderedElementsAreArray;
// Hack copied from "test/cpp/end2end/server_crash_test_client.cc"!
@@ -85,12 +85,12 @@ class GrpcLBAddress final {
GrpcLBAddress(std::string address, bool is_balancer)
: is_balancer(is_balancer), address(address) {}
- bool operator==(const GrpcLBAddress &other) const {
+ bool operator==(const GrpcLBAddress& other) const {
return this->is_balancer == other.is_balancer &&
this->address == other.address;
}
- bool operator!=(const GrpcLBAddress &other) const {
+ bool operator!=(const GrpcLBAddress& other) const {
return !(*this == other);
}
@@ -141,19 +141,19 @@ gpr_timespec TestDeadline(void) {
struct ArgsStruct {
gpr_event ev;
gpr_atm done_atm;
- gpr_mu *mu;
- grpc_pollset *pollset;
- grpc_pollset_set *pollset_set;
- grpc_combiner *lock;
- grpc_channel_args *channel_args;
+ gpr_mu* mu;
+ grpc_pollset* pollset;
+ grpc_pollset_set* pollset_set;
+ grpc_combiner* lock;
+ grpc_channel_args* channel_args;
vector<GrpcLBAddress> expected_addrs;
std::string expected_service_config_string;
std::string expected_lb_policy;
};
-void ArgsInit(grpc_exec_ctx *exec_ctx, ArgsStruct *args) {
+void ArgsInit(grpc_exec_ctx* exec_ctx, ArgsStruct* args) {
gpr_event_init(&args->ev);
- args->pollset = (grpc_pollset *)gpr_zalloc(grpc_pollset_size());
+ args->pollset = (grpc_pollset*)gpr_zalloc(grpc_pollset_size());
grpc_pollset_init(args->pollset, &args->mu);
args->pollset_set = grpc_pollset_set_create();
grpc_pollset_set_add_pollset(exec_ctx, args->pollset_set, args->pollset);
@@ -162,9 +162,9 @@ void ArgsInit(grpc_exec_ctx *exec_ctx, ArgsStruct *args) {
args->channel_args = NULL;
}
-void DoNothing(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {}
+void DoNothing(grpc_exec_ctx* exec_ctx, void* arg, grpc_error* error) {}
-void ArgsFinish(grpc_exec_ctx *exec_ctx, ArgsStruct *args) {
+void ArgsFinish(grpc_exec_ctx* exec_ctx, ArgsStruct* args) {
GPR_ASSERT(gpr_event_wait(&args->ev, TestDeadline()));
grpc_pollset_set_del_pollset(exec_ctx, args->pollset_set, args->pollset);
grpc_pollset_set_destroy(exec_ctx, args->pollset_set);
@@ -184,7 +184,7 @@ gpr_timespec NSecondDeadline(int seconds) {
gpr_time_from_seconds(seconds, GPR_TIMESPAN));
}
-void PollPollsetUntilRequestDone(ArgsStruct *args) {
+void PollPollsetUntilRequestDone(ArgsStruct* args) {
gpr_timespec deadline = NSecondDeadline(10);
while (true) {
bool done = gpr_atm_acq_load(&args->done_atm) != 0;
@@ -196,7 +196,7 @@ void PollPollsetUntilRequestDone(ArgsStruct *args) {
gpr_log(GPR_DEBUG, "done=%d, time_left=%" PRId64 ".%09d", done,
time_left.tv_sec, time_left.tv_nsec);
GPR_ASSERT(gpr_time_cmp(time_left, gpr_time_0(GPR_TIMESPAN)) >= 0);
- grpc_pollset_worker *worker = NULL;
+ grpc_pollset_worker* worker = NULL;
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
gpr_mu_lock(args->mu);
GRPC_LOG_IF_ERROR("pollset_work",
@@ -206,12 +206,12 @@ void PollPollsetUntilRequestDone(ArgsStruct *args) {
gpr_mu_unlock(args->mu);
grpc_exec_ctx_finish(&exec_ctx);
}
- gpr_event_set(&args->ev, (void *)1);
+ gpr_event_set(&args->ev, (void*)1);
}
-void CheckServiceConfigResultLocked(grpc_channel_args *channel_args,
- ArgsStruct *args) {
- const grpc_arg *service_config_arg =
+void CheckServiceConfigResultLocked(grpc_channel_args* channel_args,
+ ArgsStruct* args) {
+ const grpc_arg* service_config_arg =
grpc_channel_args_find(channel_args, GRPC_ARG_SERVICE_CONFIG);
if (args->expected_service_config_string != "") {
GPR_ASSERT(service_config_arg != NULL);
@@ -223,9 +223,9 @@ void CheckServiceConfigResultLocked(grpc_channel_args *channel_args,
}
}
-void CheckLBPolicyResultLocked(grpc_channel_args *channel_args,
- ArgsStruct *args) {
- const grpc_arg *lb_policy_arg =
+void CheckLBPolicyResultLocked(grpc_channel_args* channel_args,
+ ArgsStruct* args) {
+ const grpc_arg* lb_policy_arg =
grpc_channel_args_find(channel_args, GRPC_ARG_LB_POLICY_NAME);
if (args->expected_lb_policy != "") {
GPR_ASSERT(lb_policy_arg != NULL);
@@ -236,23 +236,23 @@ void CheckLBPolicyResultLocked(grpc_channel_args *channel_args,
}
}
-void CheckResolverResultLocked(grpc_exec_ctx *exec_ctx, void *argsp,
- grpc_error *err) {
- ArgsStruct *args = (ArgsStruct *)argsp;
- grpc_channel_args *channel_args = args->channel_args;
- const grpc_arg *channel_arg =
+void CheckResolverResultLocked(grpc_exec_ctx* exec_ctx, void* argsp,
+ grpc_error* err) {
+ ArgsStruct* args = (ArgsStruct*)argsp;
+ grpc_channel_args* channel_args = args->channel_args;
+ const grpc_arg* channel_arg =
grpc_channel_args_find(channel_args, GRPC_ARG_LB_ADDRESSES);
GPR_ASSERT(channel_arg != NULL);
GPR_ASSERT(channel_arg->type == GRPC_ARG_POINTER);
- grpc_lb_addresses *addresses =
- (grpc_lb_addresses *)channel_arg->value.pointer.p;
+ grpc_lb_addresses* addresses =
+ (grpc_lb_addresses*)channel_arg->value.pointer.p;
gpr_log(GPR_INFO, "num addrs found: %" PRIdPTR ". expected %" PRIdPTR,
addresses->num_addresses, args->expected_addrs.size());
GPR_ASSERT(addresses->num_addresses == args->expected_addrs.size());
std::vector<GrpcLBAddress> found_lb_addrs;
for (size_t i = 0; i < addresses->num_addresses; i++) {
grpc_lb_address addr = addresses->addresses[i];
- char *str;
+ char* str;
grpc_sockaddr_to_string(&str, &addr.address, 1 /* normalize */);
gpr_log(GPR_INFO, "%s", str);
found_lb_addrs.emplace_back(
@@ -260,8 +260,9 @@ void CheckResolverResultLocked(grpc_exec_ctx *exec_ctx, void *argsp,
gpr_free(str);
}
if (args->expected_addrs.size() != found_lb_addrs.size()) {
- gpr_log(GPR_DEBUG, "found lb addrs size is: %" PRIdPTR
- ". expected addrs size is %" PRIdPTR,
+ gpr_log(GPR_DEBUG,
+ "found lb addrs size is: %" PRIdPTR
+ ". expected addrs size is %" PRIdPTR,
found_lb_addrs.size(), args->expected_addrs.size());
abort();
}
@@ -285,17 +286,17 @@ TEST(ResolverComponentTest, TestResolvesRelevantRecords) {
args.expected_service_config_string = FLAGS_expected_chosen_service_config;
args.expected_lb_policy = FLAGS_expected_lb_policy;
// maybe build the address with an authority
- char *whole_uri = NULL;
+ char* whole_uri = NULL;
GPR_ASSERT(asprintf(&whole_uri, "dns://%s/%s",
FLAGS_local_dns_server_address.c_str(),
FLAGS_target_name.c_str()));
// create resolver and resolve
- grpc_resolver *resolver = grpc_resolver_create(&exec_ctx, whole_uri, NULL,
+ grpc_resolver* resolver = grpc_resolver_create(&exec_ctx, whole_uri, NULL,
args.pollset_set, args.lock);
gpr_free(whole_uri);
grpc_closure on_resolver_result_changed;
GRPC_CLOSURE_INIT(&on_resolver_result_changed, CheckResolverResultLocked,
- (void *)&args, grpc_combiner_scheduler(args.lock));
+ (void*)&args, grpc_combiner_scheduler(args.lock));
grpc_resolver_next_locked(&exec_ctx, resolver, &args.channel_args,
&on_resolver_result_changed);
grpc_exec_ctx_flush(&exec_ctx);
@@ -307,7 +308,7 @@ TEST(ResolverComponentTest, TestResolvesRelevantRecords) {
} // namespace
-int main(int argc, char **argv) {
+int main(int argc, char** argv) {
grpc_init();
grpc_test_init(argc, argv);
::testing::InitGoogleTest(&argc, argv);
diff --git a/test/cpp/naming/resolver_component_tests_runner_invoker.cc b/test/cpp/naming/resolver_component_tests_runner_invoker.cc
index b14391284d..1577253a8f 100644
--- a/test/cpp/naming/resolver_component_tests_runner_invoker.cc
+++ b/test/cpp/naming/resolver_component_tests_runner_invoker.cc
@@ -70,8 +70,8 @@ namespace {
const int kTestTimeoutSeconds = 60 * 2;
-void RunSigHandlingThread(SubProcess *test_driver, gpr_mu *test_driver_mu,
- gpr_cv *test_driver_cv, int *test_driver_done) {
+void RunSigHandlingThread(SubProcess* test_driver, gpr_mu* test_driver_mu,
+ gpr_cv* test_driver_cv, int* test_driver_done) {
gpr_timespec overall_deadline =
gpr_time_add(gpr_now(GPR_CLOCK_MONOTONIC),
gpr_time_from_seconds(kTestTimeoutSeconds, GPR_TIMESPAN));
@@ -94,7 +94,7 @@ void RunSigHandlingThread(SubProcess *test_driver, gpr_mu *test_driver_mu,
test_driver->Interrupt();
return;
}
-}
+} // namespace
namespace grpc {
@@ -106,7 +106,7 @@ void InvokeResolverComponentTestsRunner(std::string test_runner_bin_path,
std::string records_config_path) {
int test_dns_server_port = grpc_pick_unused_port_or_die();
- SubProcess *test_driver = new SubProcess(
+ SubProcess* test_driver = new SubProcess(
{test_runner_bin_path, "--test_bin_path=" + test_bin_path,
"--dns_server_bin_path=" + dns_server_bin_path,
"--records_config_path=" + records_config_path,
@@ -153,7 +153,7 @@ void InvokeResolverComponentTestsRunner(std::string test_runner_bin_path,
} // namespace grpc
-int main(int argc, char **argv) {
+int main(int argc, char** argv) {
grpc::testing::InitTest(&argc, &argv, true);
grpc_init();
GPR_ASSERT(FLAGS_test_bin_name != "");
diff --git a/test/cpp/qps/client_async.cc b/test/cpp/qps/client_async.cc
index a541f94fa5..f7cdfc2bd7 100644
--- a/test/cpp/qps/client_async.cc
+++ b/test/cpp/qps/client_async.cc
@@ -149,9 +149,9 @@ class AsyncClient : public ClientImpl<StubType, RequestType> {
// Specify which protected members we are using since there is no
// member name resolution until the template types are fully resolved
public:
+ using Client::NextIssuer;
using Client::SetupLoadTest;
using Client::closed_loop_;
- using Client::NextIssuer;
using ClientImpl<StubType, RequestType>::cores_;
using ClientImpl<StubType, RequestType>::channels_;
using ClientImpl<StubType, RequestType>::request_;
diff --git a/test/cpp/qps/driver.cc b/test/cpp/qps/driver.cc
index 5504c0b96a..22d039d4b7 100644
--- a/test/cpp/qps/driver.cc
+++ b/test/cpp/qps/driver.cc
@@ -43,10 +43,10 @@
#include "test/cpp/qps/stats.h"
#include "test/cpp/util/test_credentials_provider.h"
+using std::deque;
using std::list;
using std::thread;
using std::unique_ptr;
-using std::deque;
using std::vector;
namespace grpc {
@@ -147,9 +147,8 @@ static void postprocess_scenario_result(ScenarioResult* result) {
result->mutable_summary()->set_server_cpu_usage(0);
} else {
auto server_cpu_usage =
- 100 -
- 100 * average(result->server_stats(), ServerIdleCpuTime) /
- average(result->server_stats(), ServerTotalCpuTime);
+ 100 - 100 * average(result->server_stats(), ServerIdleCpuTime) /
+ average(result->server_stats(), ServerTotalCpuTime);
result->mutable_summary()->set_server_cpu_usage(server_cpu_usage);
}
diff --git a/test/cpp/qps/histogram.h b/test/cpp/qps/histogram.h
index 3d04ee57da..e31d5d78a8 100644
--- a/test/cpp/qps/histogram.h
+++ b/test/cpp/qps/histogram.h
@@ -70,7 +70,7 @@ class Histogram {
gpr_histogram* impl_;
};
-}
-}
+} // namespace testing
+} // namespace grpc
#endif /* TEST_QPS_HISTOGRAM_H */
diff --git a/test/cpp/qps/interarrival.h b/test/cpp/qps/interarrival.h
index 1fa310c209..9c48066c9c 100644
--- a/test/cpp/qps/interarrival.h
+++ b/test/cpp/qps/interarrival.h
@@ -102,7 +102,7 @@ class InterarrivalTimer {
std::vector<time_table::const_iterator> thread_posns_;
time_table random_table_;
};
-}
-}
+} // namespace testing
+} // namespace grpc
#endif
diff --git a/test/cpp/qps/parse_json.cc b/test/cpp/qps/parse_json.cc
index 343e073f3f..a98ae394db 100644
--- a/test/cpp/qps/parse_json.cc
+++ b/test/cpp/qps/parse_json.cc
@@ -61,5 +61,5 @@ grpc::string SerializeJson(const GRPC_CUSTOM_MESSAGE& msg,
return json_string;
}
-} // testing
-} // grpc
+} // namespace testing
+} // namespace grpc
diff --git a/test/cpp/qps/parse_json.h b/test/cpp/qps/parse_json.h
index b320d26c1a..f2fffb52d4 100644
--- a/test/cpp/qps/parse_json.h
+++ b/test/cpp/qps/parse_json.h
@@ -31,7 +31,7 @@ void ParseJson(const grpc::string& json, const grpc::string& type,
grpc::string SerializeJson(const GRPC_CUSTOM_MESSAGE& msg,
const grpc::string& type);
-} // testing
-} // grpc
+} // namespace testing
+} // namespace grpc
#endif // TEST_QPS_PARSE_JSON_H
diff --git a/test/cpp/qps/qps_interarrival_test.cc b/test/cpp/qps/qps_interarrival_test.cc
index 87f09e8c5f..461bf624ce 100644
--- a/test/cpp/qps/qps_interarrival_test.cc
+++ b/test/cpp/qps/qps_interarrival_test.cc
@@ -25,13 +25,13 @@
#include "test/cpp/qps/interarrival.h"
#include "test/cpp/util/test_config.h"
-using grpc::testing::RandomDistInterface;
using grpc::testing::InterarrivalTimer;
+using grpc::testing::RandomDistInterface;
-static void RunTest(RandomDistInterface &&r, int threads, std::string title) {
+static void RunTest(RandomDistInterface&& r, int threads, std::string title) {
InterarrivalTimer timer;
timer.init(r, threads);
- gpr_histogram *h(gpr_histogram_create(0.01, 60e9));
+ gpr_histogram* h(gpr_histogram_create(0.01, 60e9));
for (int i = 0; i < 10000000; i++) {
for (int j = 0; j < threads; j++) {
@@ -50,7 +50,7 @@ static void RunTest(RandomDistInterface &&r, int threads, std::string title) {
using grpc::testing::ExpDist;
-int main(int argc, char **argv) {
+int main(int argc, char** argv) {
grpc::testing::InitTest(&argc, &argv, true);
RunTest(ExpDist(10.0), 5, std::string("Exponential(10)"));
diff --git a/test/cpp/qps/server_async.cc b/test/cpp/qps/server_async.cc
index 1c1a5636a9..23c7e85283 100644
--- a/test/cpp/qps/server_async.cc
+++ b/test/cpp/qps/server_async.cc
@@ -48,30 +48,30 @@ template <class RequestType, class ResponseType, class ServiceType,
class AsyncQpsServerTest final : public grpc::testing::Server {
public:
AsyncQpsServerTest(
- const ServerConfig &config,
- std::function<void(ServerBuilder *, ServiceType *)> register_service,
- std::function<void(ServiceType *, ServerContextType *, RequestType *,
- ServerAsyncResponseWriter<ResponseType> *,
- CompletionQueue *, ServerCompletionQueue *, void *)>
+ const ServerConfig& config,
+ std::function<void(ServerBuilder*, ServiceType*)> register_service,
+ std::function<void(ServiceType*, ServerContextType*, RequestType*,
+ ServerAsyncResponseWriter<ResponseType>*,
+ CompletionQueue*, ServerCompletionQueue*, void*)>
request_unary_function,
- std::function<void(ServiceType *, ServerContextType *,
- ServerAsyncReaderWriter<ResponseType, RequestType> *,
- CompletionQueue *, ServerCompletionQueue *, void *)>
+ std::function<void(ServiceType*, ServerContextType*,
+ ServerAsyncReaderWriter<ResponseType, RequestType>*,
+ CompletionQueue*, ServerCompletionQueue*, void*)>
request_streaming_function,
- std::function<void(ServiceType *, ServerContextType *,
- ServerAsyncReader<ResponseType, RequestType> *,
- CompletionQueue *, ServerCompletionQueue *, void *)>
+ std::function<void(ServiceType*, ServerContextType*,
+ ServerAsyncReader<ResponseType, RequestType>*,
+ CompletionQueue*, ServerCompletionQueue*, void*)>
request_streaming_from_client_function,
- std::function<void(ServiceType *, ServerContextType *, RequestType *,
- ServerAsyncWriter<ResponseType> *, CompletionQueue *,
- ServerCompletionQueue *, void *)>
+ std::function<void(ServiceType*, ServerContextType*, RequestType*,
+ ServerAsyncWriter<ResponseType>*, CompletionQueue*,
+ ServerCompletionQueue*, void*)>
request_streaming_from_server_function,
- std::function<void(ServiceType *, ServerContextType *,
- ServerAsyncReaderWriter<ResponseType, RequestType> *,
- CompletionQueue *, ServerCompletionQueue *, void *)>
+ std::function<void(ServiceType*, ServerContextType*,
+ ServerAsyncReaderWriter<ResponseType, RequestType>*,
+ CompletionQueue*, ServerCompletionQueue*, void*)>
request_streaming_both_ways_function,
- std::function<grpc::Status(const PayloadConfig &, RequestType *,
- ResponseType *)>
+ std::function<grpc::Status(const PayloadConfig&, RequestType*,
+ ResponseType*)>
process_rpc)
: Server(config) {
ServerBuilder builder;
@@ -79,7 +79,7 @@ class AsyncQpsServerTest final : public grpc::testing::Server {
auto port_num = port();
// Negative port number means inproc server, so no listen port needed
if (port_num >= 0) {
- char *server_address = NULL;
+ char* server_address = NULL;
gpr_join_host_port(&server_address, "::", port_num);
builder.AddListeningPort(server_address,
Server::CreateServerCredentials(config));
@@ -171,7 +171,7 @@ class AsyncQpsServerTest final : public grpc::testing::Server {
}
for (auto cq = srv_cqs_.begin(); cq != srv_cqs_.end(); ++cq) {
bool ok;
- void *got_tag;
+ void* got_tag;
while ((*cq)->Next(&got_tag, &ok))
;
}
@@ -187,7 +187,7 @@ class AsyncQpsServerTest final : public grpc::testing::Server {
}
std::shared_ptr<Channel> InProcessChannel(
- const ChannelArguments &args) override {
+ const ChannelArguments& args) override {
return server_->InProcessChannel(args);
}
@@ -201,12 +201,12 @@ class AsyncQpsServerTest final : public grpc::testing::Server {
void ThreadFunc(int thread_idx) {
// Wait until work is available or we are shutting down
bool ok;
- void *got_tag;
+ void* got_tag;
if (!srv_cqs_[cq_[thread_idx]]->Next(&got_tag, &ok)) {
return;
}
- ServerRpcContext *ctx;
- std::mutex *mu_ptr = &shutdown_state_[thread_idx]->mutex;
+ ServerRpcContext* ctx;
+ std::mutex* mu_ptr = &shutdown_state_[thread_idx]->mutex;
do {
ctx = detag(got_tag);
// The tag is a pointer to an RPC context to invoke
@@ -240,22 +240,21 @@ class AsyncQpsServerTest final : public grpc::testing::Server {
private:
std::mutex mu_;
};
- static void *tag(ServerRpcContext *func) {
- return reinterpret_cast<void *>(func);
+ static void* tag(ServerRpcContext* func) {
+ return reinterpret_cast<void*>(func);
}
- static ServerRpcContext *detag(void *tag) {
- return reinterpret_cast<ServerRpcContext *>(tag);
+ static ServerRpcContext* detag(void* tag) {
+ return reinterpret_cast<ServerRpcContext*>(tag);
}
class ServerRpcContextUnaryImpl final : public ServerRpcContext {
public:
ServerRpcContextUnaryImpl(
- std::function<void(ServerContextType *, RequestType *,
- grpc::ServerAsyncResponseWriter<ResponseType> *,
- void *)>
+ std::function<void(ServerContextType*, RequestType*,
+ grpc::ServerAsyncResponseWriter<ResponseType>*,
+ void*)>
request_method,
- std::function<grpc::Status(RequestType *, ResponseType *)>
- invoke_method)
+ std::function<grpc::Status(RequestType*, ResponseType*)> invoke_method)
: srv_ctx_(new ServerContextType),
next_state_(&ServerRpcContextUnaryImpl::invoker),
request_method_(request_method),
@@ -297,10 +296,10 @@ class AsyncQpsServerTest final : public grpc::testing::Server {
RequestType req_;
ResponseType response_;
bool (ServerRpcContextUnaryImpl::*next_state_)(bool);
- std::function<void(ServerContextType *, RequestType *,
- grpc::ServerAsyncResponseWriter<ResponseType> *, void *)>
+ std::function<void(ServerContextType*, RequestType*,
+ grpc::ServerAsyncResponseWriter<ResponseType>*, void*)>
request_method_;
- std::function<grpc::Status(RequestType *, ResponseType *)> invoke_method_;
+ std::function<grpc::Status(RequestType*, ResponseType*)> invoke_method_;
grpc::ServerAsyncResponseWriter<ResponseType> response_writer_;
};
@@ -308,11 +307,10 @@ class AsyncQpsServerTest final : public grpc::testing::Server {
public:
ServerRpcContextStreamingImpl(
std::function<void(
- ServerContextType *,
- grpc::ServerAsyncReaderWriter<ResponseType, RequestType> *, void *)>
+ ServerContextType*,
+ grpc::ServerAsyncReaderWriter<ResponseType, RequestType>*, void*)>
request_method,
- std::function<grpc::Status(RequestType *, ResponseType *)>
- invoke_method)
+ std::function<grpc::Status(RequestType*, ResponseType*)> invoke_method)
: srv_ctx_(new ServerContextType),
next_state_(&ServerRpcContextStreamingImpl::request_done),
request_method_(request_method),
@@ -376,10 +374,10 @@ class AsyncQpsServerTest final : public grpc::testing::Server {
ResponseType response_;
bool (ServerRpcContextStreamingImpl::*next_state_)(bool);
std::function<void(
- ServerContextType *,
- grpc::ServerAsyncReaderWriter<ResponseType, RequestType> *, void *)>
+ ServerContextType*,
+ grpc::ServerAsyncReaderWriter<ResponseType, RequestType>*, void*)>
request_method_;
- std::function<grpc::Status(RequestType *, ResponseType *)> invoke_method_;
+ std::function<grpc::Status(RequestType*, ResponseType*)> invoke_method_;
grpc::ServerAsyncReaderWriter<ResponseType, RequestType> stream_;
};
@@ -387,12 +385,11 @@ class AsyncQpsServerTest final : public grpc::testing::Server {
: public ServerRpcContext {
public:
ServerRpcContextStreamingFromClientImpl(
- std::function<void(ServerContextType *,
- grpc::ServerAsyncReader<ResponseType, RequestType> *,
- void *)>
+ std::function<void(ServerContextType*,
+ grpc::ServerAsyncReader<ResponseType, RequestType>*,
+ void*)>
request_method,
- std::function<grpc::Status(RequestType *, ResponseType *)>
- invoke_method)
+ std::function<grpc::Status(RequestType*, ResponseType*)> invoke_method)
: srv_ctx_(new ServerContextType),
next_state_(&ServerRpcContextStreamingFromClientImpl::request_done),
request_method_(request_method),
@@ -445,11 +442,11 @@ class AsyncQpsServerTest final : public grpc::testing::Server {
RequestType req_;
ResponseType response_;
bool (ServerRpcContextStreamingFromClientImpl::*next_state_)(bool);
- std::function<void(ServerContextType *,
- grpc::ServerAsyncReader<ResponseType, RequestType> *,
- void *)>
+ std::function<void(ServerContextType*,
+ grpc::ServerAsyncReader<ResponseType, RequestType>*,
+ void*)>
request_method_;
- std::function<grpc::Status(RequestType *, ResponseType *)> invoke_method_;
+ std::function<grpc::Status(RequestType*, ResponseType*)> invoke_method_;
grpc::ServerAsyncReader<ResponseType, RequestType> stream_;
};
@@ -457,11 +454,10 @@ class AsyncQpsServerTest final : public grpc::testing::Server {
: public ServerRpcContext {
public:
ServerRpcContextStreamingFromServerImpl(
- std::function<void(ServerContextType *, RequestType *,
- grpc::ServerAsyncWriter<ResponseType> *, void *)>
+ std::function<void(ServerContextType*, RequestType*,
+ grpc::ServerAsyncWriter<ResponseType>*, void*)>
request_method,
- std::function<grpc::Status(RequestType *, ResponseType *)>
- invoke_method)
+ std::function<grpc::Status(RequestType*, ResponseType*)> invoke_method)
: srv_ctx_(new ServerContextType),
next_state_(&ServerRpcContextStreamingFromServerImpl::request_done),
request_method_(request_method),
@@ -514,10 +510,10 @@ class AsyncQpsServerTest final : public grpc::testing::Server {
RequestType req_;
ResponseType response_;
bool (ServerRpcContextStreamingFromServerImpl::*next_state_)(bool);
- std::function<void(ServerContextType *, RequestType *,
- grpc::ServerAsyncWriter<ResponseType> *, void *)>
+ std::function<void(ServerContextType*, RequestType*,
+ grpc::ServerAsyncWriter<ResponseType>*, void*)>
request_method_;
- std::function<grpc::Status(RequestType *, ResponseType *)> invoke_method_;
+ std::function<grpc::Status(RequestType*, ResponseType*)> invoke_method_;
grpc::ServerAsyncWriter<ResponseType> stream_;
};
@@ -537,17 +533,17 @@ class AsyncQpsServerTest final : public grpc::testing::Server {
std::vector<std::unique_ptr<PerThreadShutdownState>> shutdown_state_;
};
-static void RegisterBenchmarkService(ServerBuilder *builder,
- BenchmarkService::AsyncService *service) {
+static void RegisterBenchmarkService(ServerBuilder* builder,
+ BenchmarkService::AsyncService* service) {
builder->RegisterService(service);
}
-static void RegisterGenericService(ServerBuilder *builder,
- grpc::AsyncGenericService *service) {
+static void RegisterGenericService(ServerBuilder* builder,
+ grpc::AsyncGenericService* service) {
builder->RegisterAsyncGenericService(service);
}
-static Status ProcessSimpleRPC(const PayloadConfig &, SimpleRequest *request,
- SimpleResponse *response) {
+static Status ProcessSimpleRPC(const PayloadConfig&, SimpleRequest* request,
+ SimpleResponse* response) {
if (request->response_size() > 0) {
if (!Server::SetPayload(request->response_type(), request->response_size(),
response->mutable_payload())) {
@@ -560,8 +556,8 @@ static Status ProcessSimpleRPC(const PayloadConfig &, SimpleRequest *request,
return Status::OK;
}
-static Status ProcessGenericRPC(const PayloadConfig &payload_config,
- ByteBuffer *request, ByteBuffer *response) {
+static Status ProcessGenericRPC(const PayloadConfig& payload_config,
+ ByteBuffer* request, ByteBuffer* response) {
// We are done using the request. Clear it to reduce working memory.
// This proves to reduce cache misses in large message size cases.
request->Clear();
@@ -572,7 +568,7 @@ static Status ProcessGenericRPC(const PayloadConfig &payload_config,
return Status::OK;
}
-std::unique_ptr<Server> CreateAsyncServer(const ServerConfig &config) {
+std::unique_ptr<Server> CreateAsyncServer(const ServerConfig& config) {
return std::unique_ptr<Server>(
new AsyncQpsServerTest<SimpleRequest, SimpleResponse,
BenchmarkService::AsyncService,
@@ -585,7 +581,7 @@ std::unique_ptr<Server> CreateAsyncServer(const ServerConfig &config) {
&BenchmarkService::AsyncService::RequestStreamingBothWays,
ProcessSimpleRPC));
}
-std::unique_ptr<Server> CreateAsyncGenericServer(const ServerConfig &config) {
+std::unique_ptr<Server> CreateAsyncGenericServer(const ServerConfig& config) {
return std::unique_ptr<Server>(
new AsyncQpsServerTest<ByteBuffer, ByteBuffer, grpc::AsyncGenericService,
grpc::GenericServerContext>(
diff --git a/test/cpp/test/server_context_test_spouse_test.cc b/test/cpp/test/server_context_test_spouse_test.cc
index c1ddb0019b..d1dc9d7cac 100644
--- a/test/cpp/test/server_context_test_spouse_test.cc
+++ b/test/cpp/test/server_context_test_spouse_test.cc
@@ -87,7 +87,7 @@ TEST(ServerContextTestSpouseTest, TrailingMetadata) {
ASSERT_EQ(metadata, spouse.GetTrailingMetadata());
}
-} // namespace
+} // namespace testing
} // namespace grpc
int main(int argc, char** argv) {
diff --git a/test/cpp/thread_manager/thread_manager_test.cc b/test/cpp/thread_manager/thread_manager_test.cc
index 85e58f466e..af90d44495 100644
--- a/test/cpp/thread_manager/thread_manager_test.cc
+++ b/test/cpp/thread_manager/thread_manager_test.cc
@@ -37,8 +37,8 @@ class ThreadManagerTest final : public grpc::ThreadManager {
num_poll_for_work_(0),
num_work_found_(0) {}
- grpc::ThreadManager::WorkStatus PollForWork(void **tag, bool *ok) override;
- void DoWork(void *tag, bool ok) override;
+ grpc::ThreadManager::WorkStatus PollForWork(void** tag, bool* ok) override;
+ void DoWork(void* tag, bool ok) override;
void PerformTest();
private:
@@ -65,8 +65,8 @@ void ThreadManagerTest::SleepForMs(int duration_ms) {
gpr_sleep_until(sleep_time);
}
-grpc::ThreadManager::WorkStatus ThreadManagerTest::PollForWork(void **tag,
- bool *ok) {
+grpc::ThreadManager::WorkStatus ThreadManagerTest::PollForWork(void** tag,
+ bool* ok) {
int call_num = gpr_atm_no_barrier_fetch_add(&num_poll_for_work_, 1);
if (call_num >= kMaxNumPollForWork) {
@@ -89,7 +89,7 @@ grpc::ThreadManager::WorkStatus ThreadManagerTest::PollForWork(void **tag,
}
}
-void ThreadManagerTest::DoWork(void *tag, bool ok) {
+void ThreadManagerTest::DoWork(void* tag, bool ok) {
gpr_atm_no_barrier_fetch_add(&num_do_work_, 1);
SleepForMs(kDoWorkDurationMsec); // Simulate doing work by sleeping
}
@@ -110,7 +110,7 @@ void ThreadManagerTest::PerformTest() {
}
} // namespace grpc
-int main(int argc, char **argv) {
+int main(int argc, char** argv) {
std::srand(std::time(NULL));
grpc::testing::InitTest(&argc, &argv, true);
diff --git a/test/cpp/util/grpc_tool.h b/test/cpp/util/grpc_tool.h
index 076ce530d9..a10422f882 100644
--- a/test/cpp/util/grpc_tool.h
+++ b/test/cpp/util/grpc_tool.h
@@ -28,9 +28,9 @@
namespace grpc {
namespace testing {
-typedef std::function<bool(const grpc::string &)> GrpcToolOutputCallback;
+typedef std::function<bool(const grpc::string&)> GrpcToolOutputCallback;
-int GrpcToolMainLib(int argc, const char **argv, const CliCredentials &cred,
+int GrpcToolMainLib(int argc, const char** argv, const CliCredentials& cred,
GrpcToolOutputCallback callback);
} // namespace testing
diff --git a/test/cpp/util/proto_reflection_descriptor_database.cc b/test/cpp/util/proto_reflection_descriptor_database.cc
index 184828c7b6..0f77934672 100644
--- a/test/cpp/util/proto_reflection_descriptor_database.cc
+++ b/test/cpp/util/proto_reflection_descriptor_database.cc
@@ -22,11 +22,11 @@
#include <grpc/support/log.h>
+using grpc::reflection::v1alpha::ErrorResponse;
+using grpc::reflection::v1alpha::ListServiceResponse;
using grpc::reflection::v1alpha::ServerReflection;
using grpc::reflection::v1alpha::ServerReflectionRequest;
using grpc::reflection::v1alpha::ServerReflectionResponse;
-using grpc::reflection::v1alpha::ListServiceResponse;
-using grpc::reflection::v1alpha::ErrorResponse;
namespace grpc {
diff --git a/test/cpp/util/service_describer.h b/test/cpp/util/service_describer.h
index b7a8c9207f..b7ab7578b4 100644
--- a/test/cpp/util/service_describer.h
+++ b/test/cpp/util/service_describer.h
@@ -36,7 +36,7 @@ grpc::string SummarizeService(const grpc::protobuf::ServiceDescriptor* service);
grpc::string SummarizeMethod(const grpc::protobuf::MethodDescriptor* method);
-} // namespase testing
+} // namespace testing
} // namespace grpc
#endif // GRPC_TEST_CPP_UTIL_SERVICE_DESCRIBER_H
diff --git a/test/cpp/util/test_config_cc.cc b/test/cpp/util/test_config_cc.cc
index f7e034253e..e4b6886335 100644
--- a/test/cpp/util/test_config_cc.cc
+++ b/test/cpp/util/test_config_cc.cc
@@ -16,8 +16,8 @@
*
*/
-#include "test/cpp/util/test_config.h"
#include <gflags/gflags.h>
+#include "test/cpp/util/test_config.h"
// In some distros, gflags is in the namespace google, and in some others,
// in gflags. This hack is enabling us to find both.