From baa14a975ef92ee6fb301f0e684f56f18f2c55a7 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 3 Nov 2017 09:09:36 -0700 Subject: Update clang-format to 5.0 --- test/core/memory_usage/client.c | 43 +++++++++++++------------ test/core/memory_usage/memory_usage_test.c | 12 +++---- test/core/memory_usage/server.c | 51 +++++++++++++++--------------- 3 files changed, 54 insertions(+), 52 deletions(-) (limited to 'test/core/memory_usage') diff --git a/test/core/memory_usage/client.c b/test/core/memory_usage/client.c index 6392554d85..cd84c4e63a 100644 --- a/test/core/memory_usage/client.c +++ b/test/core/memory_usage/client.c @@ -33,15 +33,15 @@ #include "test/core/util/memory_counters.h" #include "test/core/util/test_config.h" -static grpc_channel *channel; -static grpc_completion_queue *cq; +static grpc_channel* channel; +static grpc_completion_queue* cq; static grpc_op metadata_ops[2]; static grpc_op status_ops[2]; static grpc_op snapshot_ops[6]; -static grpc_op *op; +static grpc_op* op; typedef struct { - grpc_call *call; + grpc_call* call; grpc_metadata_array initial_metadata_recv; grpc_status_code status; grpc_slice details; @@ -52,7 +52,7 @@ typedef struct { // calls and 1 extra for the snapshot calls. static fling_call calls[10001]; -static void *tag(intptr_t t) { return (void *)t; } +static void* tag(intptr_t t) { return (void*)t; } // A call is intentionally divided into two steps. First step is to initiate a // call (i.e send and recv metadata). A call is outstanding after we initated, @@ -114,7 +114,7 @@ static struct grpc_memory_counters send_snapshot_request(int call_idx, grpc_metadata_array_init(&calls[call_idx].initial_metadata_recv); grpc_metadata_array_init(&calls[call_idx].trailing_metadata_recv); - grpc_byte_buffer *response_payload_recv = NULL; + grpc_byte_buffer* response_payload_recv = NULL; memset(snapshot_ops, 0, sizeof(snapshot_ops)); op = snapshot_ops; @@ -144,7 +144,7 @@ static struct grpc_memory_counters send_snapshot_request(int call_idx, gpr_inf_future(GPR_CLOCK_REALTIME), NULL); GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch( calls[call_idx].call, snapshot_ops, - (size_t)(op - snapshot_ops), (void *)0, NULL)); + (size_t)(op - snapshot_ops), (void*)0, NULL)); grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME), NULL); grpc_byte_buffer_reader reader; @@ -153,16 +153,16 @@ static struct grpc_memory_counters send_snapshot_request(int call_idx, struct grpc_memory_counters snapshot; snapshot.total_size_absolute = - ((struct grpc_memory_counters *)GRPC_SLICE_START_PTR(response)) + ((struct grpc_memory_counters*)GRPC_SLICE_START_PTR(response)) ->total_size_absolute; snapshot.total_allocs_absolute = - ((struct grpc_memory_counters *)GRPC_SLICE_START_PTR(response)) + ((struct grpc_memory_counters*)GRPC_SLICE_START_PTR(response)) ->total_allocs_absolute; snapshot.total_size_relative = - ((struct grpc_memory_counters *)GRPC_SLICE_START_PTR(response)) + ((struct grpc_memory_counters*)GRPC_SLICE_START_PTR(response)) ->total_size_relative; snapshot.total_allocs_relative = - ((struct grpc_memory_counters *)GRPC_SLICE_START_PTR(response)) + ((struct grpc_memory_counters*)GRPC_SLICE_START_PTR(response)) ->total_allocs_relative; grpc_metadata_array_destroy(&calls[call_idx].initial_metadata_recv); @@ -178,13 +178,13 @@ static struct grpc_memory_counters send_snapshot_request(int call_idx, return snapshot; } -int main(int argc, char **argv) { +int main(int argc, char** argv) { grpc_memory_counters_init(); grpc_slice slice = grpc_slice_from_copied_string("x"); - char *fake_argv[1]; + char* fake_argv[1]; - char *target = "localhost:443"; - gpr_cmdline *cl; + char* target = "localhost:443"; + gpr_cmdline* cl; grpc_event event; grpc_init(); @@ -251,8 +251,9 @@ int main(int argc, char **argv) { do { event = grpc_completion_queue_next( - cq, gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), - gpr_time_from_micros(10000, GPR_TIMESPAN)), + cq, + gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), + gpr_time_from_micros(10000, GPR_TIMESPAN)), NULL); } while (event.type != GRPC_QUEUE_TIMEOUT); @@ -301,11 +302,11 @@ int main(int argc, char **argv) { server_calls_end.total_size_relative - after_server_create.total_size_relative); - const char *csv_file = "memory_usage.csv"; - FILE *csv = fopen(csv_file, "w"); + const char* csv_file = "memory_usage.csv"; + FILE* csv = fopen(csv_file, "w"); if (csv) { - char *env_build = gpr_getenv("BUILD_NUMBER"); - char *env_job = gpr_getenv("JOB_NAME"); + char* env_build = gpr_getenv("BUILD_NUMBER"); + char* env_job = gpr_getenv("JOB_NAME"); fprintf(csv, "%f,%zi,%zi,%f,%zi,%s,%s\n", (double)(client_calls_inflight.total_size_relative - client_benchmark_calls_start.total_size_relative) / diff --git a/test/core/memory_usage/memory_usage_test.c b/test/core/memory_usage/memory_usage_test.c index f4ee6c65e3..258bf7511c 100644 --- a/test/core/memory_usage/memory_usage_test.c +++ b/test/core/memory_usage/memory_usage_test.c @@ -26,12 +26,12 @@ #include "src/core/lib/support/string.h" #include "test/core/util/port.h" -int main(int argc, char **argv) { - char *me = argv[0]; - char *lslash = strrchr(me, '/'); +int main(int argc, char** argv) { + char* me = argv[0]; + char* lslash = strrchr(me, '/'); char root[1024]; int port = grpc_pick_unused_port_or_die(); - char *args[10]; + char* args[10]; int status; gpr_subprocess *svr, *cli; /* figure out where we are */ @@ -47,7 +47,7 @@ int main(int argc, char **argv) { args[1] = "--bind"; gpr_join_host_port(&args[2], "::", port); args[3] = "--no-secure"; - svr = gpr_subprocess_create(4, (const char **)args); + svr = gpr_subprocess_create(4, (const char**)args); gpr_free(args[0]); gpr_free(args[2]); @@ -58,7 +58,7 @@ int main(int argc, char **argv) { gpr_join_host_port(&args[2], "127.0.0.1", port); args[3] = "--warmup=1000"; args[4] = "--benchmark=9000"; - cli = gpr_subprocess_create(5, (const char **)args); + cli = gpr_subprocess_create(5, (const char**)args); gpr_free(args[0]); gpr_free(args[2]); diff --git a/test/core/memory_usage/server.c b/test/core/memory_usage/server.c index b25341ead2..cc2cf75faf 100644 --- a/test/core/memory_usage/server.c +++ b/test/core/memory_usage/server.c @@ -39,17 +39,17 @@ #include "test/core/util/port.h" #include "test/core/util/test_config.h" -static grpc_completion_queue *cq; -static grpc_server *server; +static grpc_completion_queue* cq; +static grpc_server* server; static grpc_op metadata_ops[2]; static grpc_op snapshot_ops[5]; static grpc_op status_op; static int got_sigint = 0; -static grpc_byte_buffer *payload_buffer = NULL; -static grpc_byte_buffer *terminal_buffer = NULL; +static grpc_byte_buffer* payload_buffer = NULL; +static grpc_byte_buffer* terminal_buffer = NULL; static int was_cancelled = 2; -static void *tag(intptr_t t) { return (void *)t; } +static void* tag(intptr_t t) { return (void*)t; } typedef enum { FLING_SERVER_NEW_REQUEST = 1, @@ -62,7 +62,7 @@ typedef enum { typedef struct { fling_server_tags state; - grpc_call *call; + grpc_call* call; grpc_call_details call_details; grpc_metadata_array request_metadata_recv; grpc_metadata_array initial_metadata_send; @@ -82,33 +82,33 @@ static void request_call_unary(int call_idx) { &calls[call_idx].request_metadata_recv, cq, cq, &calls[call_idx]); } -static void send_initial_metadata_unary(void *tag) { - grpc_metadata_array_init(&(*(fling_call *)tag).initial_metadata_send); +static void send_initial_metadata_unary(void* tag) { + grpc_metadata_array_init(&(*(fling_call*)tag).initial_metadata_send); metadata_ops[0].op = GRPC_OP_SEND_INITIAL_METADATA; metadata_ops[0].data.send_initial_metadata.count = 0; - GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch((*(fling_call *)tag).call, + GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch((*(fling_call*)tag).call, metadata_ops, 1, tag, NULL)); } -static void send_status(void *tag) { +static void send_status(void* tag) { status_op.op = GRPC_OP_SEND_STATUS_FROM_SERVER; status_op.data.send_status_from_server.status = GRPC_STATUS_OK; status_op.data.send_status_from_server.trailing_metadata_count = 0; grpc_slice details = grpc_slice_from_static_string(""); status_op.data.send_status_from_server.status_details = &details; - GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch((*(fling_call *)tag).call, + GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch((*(fling_call*)tag).call, &status_op, 1, tag, NULL)); } -static void send_snapshot(void *tag, struct grpc_memory_counters *snapshot) { - grpc_op *op; +static void send_snapshot(void* tag, struct grpc_memory_counters* snapshot) { + grpc_op* op; grpc_slice snapshot_slice = grpc_slice_new(snapshot, sizeof(*snapshot), gpr_free); payload_buffer = grpc_raw_byte_buffer_create(&snapshot_slice, 1); - grpc_metadata_array_init(&(*(fling_call *)tag).initial_metadata_send); + grpc_metadata_array_init(&(*(fling_call*)tag).initial_metadata_send); op = snapshot_ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; @@ -134,26 +134,26 @@ static void send_snapshot(void *tag, struct grpc_memory_counters *snapshot) { op++; GPR_ASSERT(GRPC_CALL_OK == - grpc_call_start_batch((*(fling_call *)tag).call, snapshot_ops, + grpc_call_start_batch((*(fling_call*)tag).call, snapshot_ops, (size_t)(op - snapshot_ops), tag, NULL)); } /* We have some sort of deadlock, so let's not exit gracefully for now. When that is resolved, please remove the #include above. */ static void sigint_handler(int x) { _exit(0); } -int main(int argc, char **argv) { +int main(int argc, char** argv) { grpc_memory_counters_init(); grpc_event ev; - char *addr_buf = NULL; - gpr_cmdline *cl; - grpc_completion_queue *shutdown_cq; + char* addr_buf = NULL; + gpr_cmdline* cl; + grpc_completion_queue* shutdown_cq; int shutdown_started = 0; int shutdown_finished = 0; int secure = 0; - char *addr = NULL; + char* addr = NULL; - char *fake_argv[1]; + char* fake_argv[1]; GPR_ASSERT(argc >= 1); fake_argv[0] = argv[0]; @@ -181,7 +181,7 @@ int main(int argc, char **argv) { if (secure) { grpc_ssl_pem_key_cert_pair pem_key_cert_pair = {test_server1_key, test_server1_cert}; - grpc_server_credentials *ssl_creds = grpc_ssl_server_credentials_create( + grpc_server_credentials* ssl_creds = grpc_ssl_server_credentials_create( NULL, &pem_key_cert_pair, 1, 0, NULL); server = grpc_server_create(NULL, NULL); GPR_ASSERT(grpc_server_add_secure_http2_port(server, addr, ssl_creds)); @@ -228,10 +228,11 @@ int main(int argc, char **argv) { shutdown_started = 1; } ev = grpc_completion_queue_next( - cq, gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), - gpr_time_from_micros(1000000, GPR_TIMESPAN)), + cq, + gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), + gpr_time_from_micros(1000000, GPR_TIMESPAN)), NULL); - fling_call *s = ev.tag; + fling_call* s = ev.tag; switch (ev.type) { case GRPC_OP_COMPLETE: switch (s->state) { -- cgit v1.2.3