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 --- src/core/lib/debug/stats.cc | 36 +++++++++++++++--------------- src/core/lib/debug/stats.h | 18 +++++++-------- src/core/lib/debug/stats_data.cc | 47 +++++++++++++++++++++------------------- src/core/lib/debug/stats_data.h | 38 ++++++++++++++++---------------- src/core/lib/debug/trace.cc | 40 +++++++++++++++++----------------- src/core/lib/debug/trace.h | 6 ++--- 6 files changed, 94 insertions(+), 91 deletions(-) (limited to 'src/core/lib/debug') diff --git a/src/core/lib/debug/stats.cc b/src/core/lib/debug/stats.cc index 4096384dd9..b32cf19028 100644 --- a/src/core/lib/debug/stats.cc +++ b/src/core/lib/debug/stats.cc @@ -27,18 +27,18 @@ #include "src/core/lib/support/string.h" -grpc_stats_data *grpc_stats_per_cpu_storage = NULL; +grpc_stats_data* grpc_stats_per_cpu_storage = NULL; static size_t g_num_cores; void grpc_stats_init(void) { g_num_cores = GPR_MAX(1, gpr_cpu_num_cores()); grpc_stats_per_cpu_storage = - (grpc_stats_data *)gpr_zalloc(sizeof(grpc_stats_data) * g_num_cores); + (grpc_stats_data*)gpr_zalloc(sizeof(grpc_stats_data) * g_num_cores); } void grpc_stats_shutdown(void) { gpr_free(grpc_stats_per_cpu_storage); } -void grpc_stats_collect(grpc_stats_data *output) { +void grpc_stats_collect(grpc_stats_data* output) { memset(output, 0, sizeof(*output)); for (size_t core = 0; core < g_num_cores; core++) { for (size_t i = 0; i < GRPC_STATS_COUNTER_COUNT; i++) { @@ -52,8 +52,8 @@ void grpc_stats_collect(grpc_stats_data *output) { } } -void grpc_stats_diff(const grpc_stats_data *b, const grpc_stats_data *a, - grpc_stats_data *c) { +void grpc_stats_diff(const grpc_stats_data* b, const grpc_stats_data* a, + grpc_stats_data* c) { for (size_t i = 0; i < GRPC_STATS_COUNTER_COUNT; i++) { c->counters[i] = b->counters[i] - a->counters[i]; } @@ -62,13 +62,13 @@ void grpc_stats_diff(const grpc_stats_data *b, const grpc_stats_data *a, } } -int grpc_stats_histo_find_bucket_slow(grpc_exec_ctx *exec_ctx, int value, - const int *table, int table_size) { +int grpc_stats_histo_find_bucket_slow(grpc_exec_ctx* exec_ctx, int value, + const int* table, int table_size) { GRPC_STATS_INC_HISTOGRAM_SLOW_LOOKUPS(exec_ctx); - const int *const start = table; + const int* const start = table; while (table_size > 0) { int step = table_size / 2; - const int *it = table + step; + const int* it = table + step; if (value >= *it) { table = it + 1; table_size -= step + 1; @@ -79,7 +79,7 @@ int grpc_stats_histo_find_bucket_slow(grpc_exec_ctx *exec_ctx, int value, return (int)(table - start) - 1; } -size_t grpc_stats_histo_count(const grpc_stats_data *stats, +size_t grpc_stats_histo_count(const grpc_stats_data* stats, grpc_stats_histograms histogram) { size_t sum = 0; for (int i = 0; i < grpc_stats_histo_buckets[histogram]; i++) { @@ -88,8 +88,8 @@ size_t grpc_stats_histo_count(const grpc_stats_data *stats, return sum; } -static double threshold_for_count_below(const gpr_atm *bucket_counts, - const int *bucket_boundaries, +static double threshold_for_count_below(const gpr_atm* bucket_counts, + const int* bucket_boundaries, int num_buckets, double count_below) { double count_so_far; double lower_bound; @@ -119,13 +119,13 @@ static double threshold_for_count_below(const gpr_atm *bucket_counts, should lie */ lower_bound = bucket_boundaries[lower_idx]; upper_bound = bucket_boundaries[lower_idx + 1]; - return upper_bound - - (upper_bound - lower_bound) * (count_so_far - count_below) / - (double)bucket_counts[lower_idx]; + return upper_bound - (upper_bound - lower_bound) * + (count_so_far - count_below) / + (double)bucket_counts[lower_idx]; } } -double grpc_stats_histo_percentile(const grpc_stats_data *stats, +double grpc_stats_histo_percentile(const grpc_stats_data* stats, grpc_stats_histograms histogram, double percentile) { size_t count = grpc_stats_histo_count(stats, histogram); @@ -136,9 +136,9 @@ double grpc_stats_histo_percentile(const grpc_stats_data *stats, grpc_stats_histo_buckets[histogram], (double)count * percentile / 100.0); } -char *grpc_stats_data_as_json(const grpc_stats_data *data) { +char* grpc_stats_data_as_json(const grpc_stats_data* data) { gpr_strvec v; - char *tmp; + char* tmp; bool is_first = true; gpr_strvec_init(&v); gpr_strvec_add(&v, gpr_strdup("{")); diff --git a/src/core/lib/debug/stats.h b/src/core/lib/debug/stats.h index fec1d651e6..1c19e72345 100644 --- a/src/core/lib/debug/stats.h +++ b/src/core/lib/debug/stats.h @@ -32,7 +32,7 @@ typedef struct grpc_stats_data { gpr_atm histograms[GRPC_STATS_HISTOGRAM_BUCKETS]; } grpc_stats_data; -extern grpc_stats_data *grpc_stats_per_cpu_storage; +extern grpc_stats_data* grpc_stats_per_cpu_storage; #define GRPC_THREAD_STATS_DATA(exec_ctx) \ (&grpc_stats_per_cpu_storage[(exec_ctx)->starting_cpu]) @@ -49,17 +49,17 @@ extern grpc_stats_data *grpc_stats_per_cpu_storage; void grpc_stats_init(void); void grpc_stats_shutdown(void); -void grpc_stats_collect(grpc_stats_data *output); +void grpc_stats_collect(grpc_stats_data* output); // c = b-a -void grpc_stats_diff(const grpc_stats_data *b, const grpc_stats_data *a, - grpc_stats_data *c); -char *grpc_stats_data_as_json(const grpc_stats_data *data); -int grpc_stats_histo_find_bucket_slow(grpc_exec_ctx *exec_ctx, int value, - const int *table, int table_size); -double grpc_stats_histo_percentile(const grpc_stats_data *data, +void grpc_stats_diff(const grpc_stats_data* b, const grpc_stats_data* a, + grpc_stats_data* c); +char* grpc_stats_data_as_json(const grpc_stats_data* data); +int grpc_stats_histo_find_bucket_slow(grpc_exec_ctx* exec_ctx, int value, + const int* table, int table_size); +double grpc_stats_histo_percentile(const grpc_stats_data* data, grpc_stats_histograms histogram, double percentile); -size_t grpc_stats_histo_count(const grpc_stats_data *data, +size_t grpc_stats_histo_count(const grpc_stats_data* data, grpc_stats_histograms histogram); #ifdef __cplusplus diff --git a/src/core/lib/debug/stats_data.cc b/src/core/lib/debug/stats_data.cc index 5d737c56cb..17e15f4cfb 100644 --- a/src/core/lib/debug/stats_data.cc +++ b/src/core/lib/debug/stats_data.cc @@ -22,7 +22,7 @@ #include #include "src/core/lib/debug/stats.h" #include "src/core/lib/iomgr/exec_ctx.h" -const char *grpc_stats_counter_name[GRPC_STATS_COUNTER_COUNT] = { +const char* grpc_stats_counter_name[GRPC_STATS_COUNTER_COUNT] = { "client_calls_created", "server_calls_created", "cqs_created", @@ -120,11 +120,13 @@ const char *grpc_stats_counter_name[GRPC_STATS_COUNTER_COUNT] = { "cq_ev_queue_trylock_successes", "cq_ev_queue_transient_pop_failures", }; -const char *grpc_stats_counter_doc[GRPC_STATS_COUNTER_COUNT] = { +const char* grpc_stats_counter_doc[GRPC_STATS_COUNTER_COUNT] = { "Number of client side calls created by this process", "Number of server side calls created by this process", - "Number of completion queues created", "Number of client channels created", - "Number of client subchannels created", "Number of server channels created", + "Number of completion queues created", + "Number of client channels created", + "Number of client subchannels created", + "Number of server channels created", "Number of polling syscalls (epoll_wait, poll, etc) made by this process", "Number of sleeping syscalls made by this process", "How many polling wakeups were performed by the process (only valid for " @@ -154,7 +156,8 @@ const char *grpc_stats_counter_doc[GRPC_STATS_COUNTER_COUNT] = { "Number of batches containing receive initial metadata", "Number of batches containing receive message", "Number of batches containing receive trailing metadata", - "Number of settings frames sent", "Number of HTTP2 pings sent by process", + "Number of settings frames sent", + "Number of HTTP2 pings sent by process", "Number of HTTP2 writes initiated", "Number of HTTP2 writes offloaded to the executor from application threads", "Number of HTTP2 writes that finished seeing more data needed to be " @@ -241,7 +244,7 @@ const char *grpc_stats_counter_doc[GRPC_STATS_COUNTER_COUNT] = { "Number of times NULL was popped out of completion queue's event queue " "even though the event queue was not empty", }; -const char *grpc_stats_histogram_name[GRPC_STATS_HISTOGRAM_COUNT] = { +const char* grpc_stats_histogram_name[GRPC_STATS_HISTOGRAM_COUNT] = { "call_initial_size", "poll_events_returned", "tcp_write_size", @@ -256,7 +259,7 @@ const char *grpc_stats_histogram_name[GRPC_STATS_HISTOGRAM_COUNT] = { "http2_send_flowctl_per_write", "server_cqs_checked", }; -const char *grpc_stats_histogram_doc[GRPC_STATS_HISTOGRAM_COUNT] = { +const char* grpc_stats_histogram_doc[GRPC_STATS_HISTOGRAM_COUNT] = { "Initial size of the grpc_call arena created at call start", "How many events are called for each syscall_poll", "Number of bytes offered to each syscall_write", @@ -339,7 +342,7 @@ const uint8_t grpc_stats_table_7[102] = { 42, 42, 43, 44, 44, 45, 46, 46, 47, 48, 48, 49, 49, 50, 50, 51, 51}; const int grpc_stats_table_8[9] = {0, 1, 2, 4, 7, 13, 23, 39, 64}; const uint8_t grpc_stats_table_9[9] = {0, 0, 1, 2, 2, 3, 4, 4, 5}; -void grpc_stats_inc_call_initial_size(grpc_exec_ctx *exec_ctx, int value) { +void grpc_stats_inc_call_initial_size(grpc_exec_ctx* exec_ctx, int value) { value = GPR_CLAMP(value, 0, 262144); if (value < 6) { GRPC_STATS_INC_HISTOGRAM((exec_ctx), GRPC_STATS_HISTOGRAM_CALL_INITIAL_SIZE, @@ -364,7 +367,7 @@ void grpc_stats_inc_call_initial_size(grpc_exec_ctx *exec_ctx, int value) { grpc_stats_histo_find_bucket_slow( (exec_ctx), value, grpc_stats_table_0, 64)); } -void grpc_stats_inc_poll_events_returned(grpc_exec_ctx *exec_ctx, int value) { +void grpc_stats_inc_poll_events_returned(grpc_exec_ctx* exec_ctx, int value) { value = GPR_CLAMP(value, 0, 1024); if (value < 29) { GRPC_STATS_INC_HISTOGRAM((exec_ctx), @@ -390,7 +393,7 @@ void grpc_stats_inc_poll_events_returned(grpc_exec_ctx *exec_ctx, int value) { grpc_stats_histo_find_bucket_slow( (exec_ctx), value, grpc_stats_table_2, 128)); } -void grpc_stats_inc_tcp_write_size(grpc_exec_ctx *exec_ctx, int value) { +void grpc_stats_inc_tcp_write_size(grpc_exec_ctx* exec_ctx, int value) { value = GPR_CLAMP(value, 0, 16777216); if (value < 5) { GRPC_STATS_INC_HISTOGRAM((exec_ctx), GRPC_STATS_HISTOGRAM_TCP_WRITE_SIZE, @@ -415,7 +418,7 @@ void grpc_stats_inc_tcp_write_size(grpc_exec_ctx *exec_ctx, int value) { grpc_stats_histo_find_bucket_slow( (exec_ctx), value, grpc_stats_table_4, 64)); } -void grpc_stats_inc_tcp_write_iov_size(grpc_exec_ctx *exec_ctx, int value) { +void grpc_stats_inc_tcp_write_iov_size(grpc_exec_ctx* exec_ctx, int value) { value = GPR_CLAMP(value, 0, 1024); if (value < 13) { GRPC_STATS_INC_HISTOGRAM((exec_ctx), @@ -440,7 +443,7 @@ void grpc_stats_inc_tcp_write_iov_size(grpc_exec_ctx *exec_ctx, int value) { grpc_stats_histo_find_bucket_slow( (exec_ctx), value, grpc_stats_table_6, 64)); } -void grpc_stats_inc_tcp_read_size(grpc_exec_ctx *exec_ctx, int value) { +void grpc_stats_inc_tcp_read_size(grpc_exec_ctx* exec_ctx, int value) { value = GPR_CLAMP(value, 0, 16777216); if (value < 5) { GRPC_STATS_INC_HISTOGRAM((exec_ctx), GRPC_STATS_HISTOGRAM_TCP_READ_SIZE, @@ -465,7 +468,7 @@ void grpc_stats_inc_tcp_read_size(grpc_exec_ctx *exec_ctx, int value) { grpc_stats_histo_find_bucket_slow( (exec_ctx), value, grpc_stats_table_4, 64)); } -void grpc_stats_inc_tcp_read_offer(grpc_exec_ctx *exec_ctx, int value) { +void grpc_stats_inc_tcp_read_offer(grpc_exec_ctx* exec_ctx, int value) { value = GPR_CLAMP(value, 0, 16777216); if (value < 5) { GRPC_STATS_INC_HISTOGRAM((exec_ctx), GRPC_STATS_HISTOGRAM_TCP_READ_OFFER, @@ -490,7 +493,7 @@ void grpc_stats_inc_tcp_read_offer(grpc_exec_ctx *exec_ctx, int value) { grpc_stats_histo_find_bucket_slow( (exec_ctx), value, grpc_stats_table_4, 64)); } -void grpc_stats_inc_tcp_read_offer_iov_size(grpc_exec_ctx *exec_ctx, +void grpc_stats_inc_tcp_read_offer_iov_size(grpc_exec_ctx* exec_ctx, int value) { value = GPR_CLAMP(value, 0, 1024); if (value < 13) { @@ -517,7 +520,7 @@ void grpc_stats_inc_tcp_read_offer_iov_size(grpc_exec_ctx *exec_ctx, grpc_stats_histo_find_bucket_slow( (exec_ctx), value, grpc_stats_table_6, 64)); } -void grpc_stats_inc_http2_send_message_size(grpc_exec_ctx *exec_ctx, +void grpc_stats_inc_http2_send_message_size(grpc_exec_ctx* exec_ctx, int value) { value = GPR_CLAMP(value, 0, 16777216); if (value < 5) { @@ -545,7 +548,7 @@ void grpc_stats_inc_http2_send_message_size(grpc_exec_ctx *exec_ctx, (exec_ctx), value, grpc_stats_table_4, 64)); } void grpc_stats_inc_http2_send_initial_metadata_per_write( - grpc_exec_ctx *exec_ctx, int value) { + grpc_exec_ctx* exec_ctx, int value) { value = GPR_CLAMP(value, 0, 1024); if (value < 13) { GRPC_STATS_INC_HISTOGRAM( @@ -573,7 +576,7 @@ void grpc_stats_inc_http2_send_initial_metadata_per_write( grpc_stats_histo_find_bucket_slow((exec_ctx), value, grpc_stats_table_6, 64)); } -void grpc_stats_inc_http2_send_message_per_write(grpc_exec_ctx *exec_ctx, +void grpc_stats_inc_http2_send_message_per_write(grpc_exec_ctx* exec_ctx, int value) { value = GPR_CLAMP(value, 0, 1024); if (value < 13) { @@ -601,7 +604,7 @@ void grpc_stats_inc_http2_send_message_per_write(grpc_exec_ctx *exec_ctx, (exec_ctx), value, grpc_stats_table_6, 64)); } void grpc_stats_inc_http2_send_trailing_metadata_per_write( - grpc_exec_ctx *exec_ctx, int value) { + grpc_exec_ctx* exec_ctx, int value) { value = GPR_CLAMP(value, 0, 1024); if (value < 13) { GRPC_STATS_INC_HISTOGRAM( @@ -629,7 +632,7 @@ void grpc_stats_inc_http2_send_trailing_metadata_per_write( grpc_stats_histo_find_bucket_slow((exec_ctx), value, grpc_stats_table_6, 64)); } -void grpc_stats_inc_http2_send_flowctl_per_write(grpc_exec_ctx *exec_ctx, +void grpc_stats_inc_http2_send_flowctl_per_write(grpc_exec_ctx* exec_ctx, int value) { value = GPR_CLAMP(value, 0, 1024); if (value < 13) { @@ -656,7 +659,7 @@ void grpc_stats_inc_http2_send_flowctl_per_write(grpc_exec_ctx *exec_ctx, grpc_stats_histo_find_bucket_slow( (exec_ctx), value, grpc_stats_table_6, 64)); } -void grpc_stats_inc_server_cqs_checked(grpc_exec_ctx *exec_ctx, int value) { +void grpc_stats_inc_server_cqs_checked(grpc_exec_ctx* exec_ctx, int value) { value = GPR_CLAMP(value, 0, 64); if (value < 3) { GRPC_STATS_INC_HISTOGRAM((exec_ctx), @@ -685,13 +688,13 @@ const int grpc_stats_histo_buckets[13] = {64, 128, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 8}; const int grpc_stats_histo_start[13] = {0, 64, 192, 256, 320, 384, 448, 512, 576, 640, 704, 768, 832}; -const int *const grpc_stats_histo_bucket_boundaries[13] = { +const int* const grpc_stats_histo_bucket_boundaries[13] = { grpc_stats_table_0, grpc_stats_table_2, grpc_stats_table_4, grpc_stats_table_6, grpc_stats_table_4, grpc_stats_table_4, grpc_stats_table_6, grpc_stats_table_4, grpc_stats_table_6, grpc_stats_table_6, grpc_stats_table_6, grpc_stats_table_6, grpc_stats_table_8}; -void (*const grpc_stats_inc_histogram[13])(grpc_exec_ctx *exec_ctx, int x) = { +void (*const grpc_stats_inc_histogram[13])(grpc_exec_ctx* exec_ctx, int x) = { grpc_stats_inc_call_initial_size, grpc_stats_inc_poll_events_returned, grpc_stats_inc_tcp_write_size, diff --git a/src/core/lib/debug/stats_data.h b/src/core/lib/debug/stats_data.h index 031942df5c..fbfcce83ba 100644 --- a/src/core/lib/debug/stats_data.h +++ b/src/core/lib/debug/stats_data.h @@ -127,8 +127,8 @@ typedef enum { GRPC_STATS_COUNTER_CQ_EV_QUEUE_TRANSIENT_POP_FAILURES, GRPC_STATS_COUNTER_COUNT } grpc_stats_counters; -extern const char *grpc_stats_counter_name[GRPC_STATS_COUNTER_COUNT]; -extern const char *grpc_stats_counter_doc[GRPC_STATS_COUNTER_COUNT]; +extern const char* grpc_stats_counter_name[GRPC_STATS_COUNTER_COUNT]; +extern const char* grpc_stats_counter_doc[GRPC_STATS_COUNTER_COUNT]; typedef enum { GRPC_STATS_HISTOGRAM_CALL_INITIAL_SIZE, GRPC_STATS_HISTOGRAM_POLL_EVENTS_RETURNED, @@ -145,8 +145,8 @@ typedef enum { GRPC_STATS_HISTOGRAM_SERVER_CQS_CHECKED, GRPC_STATS_HISTOGRAM_COUNT } grpc_stats_histograms; -extern const char *grpc_stats_histogram_name[GRPC_STATS_HISTOGRAM_COUNT]; -extern const char *grpc_stats_histogram_doc[GRPC_STATS_HISTOGRAM_COUNT]; +extern const char* grpc_stats_histogram_name[GRPC_STATS_HISTOGRAM_COUNT]; +extern const char* grpc_stats_histogram_doc[GRPC_STATS_HISTOGRAM_COUNT]; typedef enum { GRPC_STATS_HISTOGRAM_CALL_INITIAL_SIZE_FIRST_SLOT = 0, GRPC_STATS_HISTOGRAM_CALL_INITIAL_SIZE_BUCKETS = 64, @@ -454,52 +454,52 @@ typedef enum { (exec_ctx), GRPC_STATS_COUNTER_CQ_EV_QUEUE_TRANSIENT_POP_FAILURES) #define GRPC_STATS_INC_CALL_INITIAL_SIZE(exec_ctx, value) \ grpc_stats_inc_call_initial_size((exec_ctx), (int)(value)) -void grpc_stats_inc_call_initial_size(grpc_exec_ctx *exec_ctx, int x); +void grpc_stats_inc_call_initial_size(grpc_exec_ctx* exec_ctx, int x); #define GRPC_STATS_INC_POLL_EVENTS_RETURNED(exec_ctx, value) \ grpc_stats_inc_poll_events_returned((exec_ctx), (int)(value)) -void grpc_stats_inc_poll_events_returned(grpc_exec_ctx *exec_ctx, int x); +void grpc_stats_inc_poll_events_returned(grpc_exec_ctx* exec_ctx, int x); #define GRPC_STATS_INC_TCP_WRITE_SIZE(exec_ctx, value) \ grpc_stats_inc_tcp_write_size((exec_ctx), (int)(value)) -void grpc_stats_inc_tcp_write_size(grpc_exec_ctx *exec_ctx, int x); +void grpc_stats_inc_tcp_write_size(grpc_exec_ctx* exec_ctx, int x); #define GRPC_STATS_INC_TCP_WRITE_IOV_SIZE(exec_ctx, value) \ grpc_stats_inc_tcp_write_iov_size((exec_ctx), (int)(value)) -void grpc_stats_inc_tcp_write_iov_size(grpc_exec_ctx *exec_ctx, int x); +void grpc_stats_inc_tcp_write_iov_size(grpc_exec_ctx* exec_ctx, int x); #define GRPC_STATS_INC_TCP_READ_SIZE(exec_ctx, value) \ grpc_stats_inc_tcp_read_size((exec_ctx), (int)(value)) -void grpc_stats_inc_tcp_read_size(grpc_exec_ctx *exec_ctx, int x); +void grpc_stats_inc_tcp_read_size(grpc_exec_ctx* exec_ctx, int x); #define GRPC_STATS_INC_TCP_READ_OFFER(exec_ctx, value) \ grpc_stats_inc_tcp_read_offer((exec_ctx), (int)(value)) -void grpc_stats_inc_tcp_read_offer(grpc_exec_ctx *exec_ctx, int x); +void grpc_stats_inc_tcp_read_offer(grpc_exec_ctx* exec_ctx, int x); #define GRPC_STATS_INC_TCP_READ_OFFER_IOV_SIZE(exec_ctx, value) \ grpc_stats_inc_tcp_read_offer_iov_size((exec_ctx), (int)(value)) -void grpc_stats_inc_tcp_read_offer_iov_size(grpc_exec_ctx *exec_ctx, int x); +void grpc_stats_inc_tcp_read_offer_iov_size(grpc_exec_ctx* exec_ctx, int x); #define GRPC_STATS_INC_HTTP2_SEND_MESSAGE_SIZE(exec_ctx, value) \ grpc_stats_inc_http2_send_message_size((exec_ctx), (int)(value)) -void grpc_stats_inc_http2_send_message_size(grpc_exec_ctx *exec_ctx, int x); +void grpc_stats_inc_http2_send_message_size(grpc_exec_ctx* exec_ctx, int x); #define GRPC_STATS_INC_HTTP2_SEND_INITIAL_METADATA_PER_WRITE(exec_ctx, value) \ grpc_stats_inc_http2_send_initial_metadata_per_write((exec_ctx), (int)(value)) void grpc_stats_inc_http2_send_initial_metadata_per_write( - grpc_exec_ctx *exec_ctx, int x); + grpc_exec_ctx* exec_ctx, int x); #define GRPC_STATS_INC_HTTP2_SEND_MESSAGE_PER_WRITE(exec_ctx, value) \ grpc_stats_inc_http2_send_message_per_write((exec_ctx), (int)(value)) -void grpc_stats_inc_http2_send_message_per_write(grpc_exec_ctx *exec_ctx, +void grpc_stats_inc_http2_send_message_per_write(grpc_exec_ctx* exec_ctx, int x); #define GRPC_STATS_INC_HTTP2_SEND_TRAILING_METADATA_PER_WRITE(exec_ctx, value) \ grpc_stats_inc_http2_send_trailing_metadata_per_write((exec_ctx), \ (int)(value)) void grpc_stats_inc_http2_send_trailing_metadata_per_write( - grpc_exec_ctx *exec_ctx, int x); + grpc_exec_ctx* exec_ctx, int x); #define GRPC_STATS_INC_HTTP2_SEND_FLOWCTL_PER_WRITE(exec_ctx, value) \ grpc_stats_inc_http2_send_flowctl_per_write((exec_ctx), (int)(value)) -void grpc_stats_inc_http2_send_flowctl_per_write(grpc_exec_ctx *exec_ctx, +void grpc_stats_inc_http2_send_flowctl_per_write(grpc_exec_ctx* exec_ctx, int x); #define GRPC_STATS_INC_SERVER_CQS_CHECKED(exec_ctx, value) \ grpc_stats_inc_server_cqs_checked((exec_ctx), (int)(value)) -void grpc_stats_inc_server_cqs_checked(grpc_exec_ctx *exec_ctx, int x); +void grpc_stats_inc_server_cqs_checked(grpc_exec_ctx* exec_ctx, int x); extern const int grpc_stats_histo_buckets[13]; extern const int grpc_stats_histo_start[13]; -extern const int *const grpc_stats_histo_bucket_boundaries[13]; -extern void (*const grpc_stats_inc_histogram[13])(grpc_exec_ctx *exec_ctx, +extern const int* const grpc_stats_histo_bucket_boundaries[13]; +extern void (*const grpc_stats_inc_histogram[13])(grpc_exec_ctx* exec_ctx, int x); #ifdef __cplusplus diff --git a/src/core/lib/debug/trace.cc b/src/core/lib/debug/trace.cc index 21b0d8c3a6..b1ae1fa185 100644 --- a/src/core/lib/debug/trace.cc +++ b/src/core/lib/debug/trace.cc @@ -25,13 +25,13 @@ #include #include "src/core/lib/support/env.h" -int grpc_tracer_set_enabled(const char *name, int enabled); +int grpc_tracer_set_enabled(const char* name, int enabled); typedef struct tracer { - grpc_tracer_flag *flag; - struct tracer *next; + grpc_tracer_flag* flag; + struct tracer* next; } tracer; -static tracer *tracers; +static tracer* tracers; #ifdef GRPC_THREADSAFE_TRACER #define TRACER_SET(flag, on) gpr_atm_no_barrier_store(&(flag).value, (on)) @@ -39,31 +39,31 @@ static tracer *tracers; #define TRACER_SET(flag, on) (flag).value = (on) #endif -void grpc_register_tracer(grpc_tracer_flag *flag) { - tracer *t = (tracer *)gpr_malloc(sizeof(*t)); +void grpc_register_tracer(grpc_tracer_flag* flag) { + tracer* t = (tracer*)gpr_malloc(sizeof(*t)); t->flag = flag; t->next = tracers; TRACER_SET(*flag, false); tracers = t; } -static void add(const char *beg, const char *end, char ***ss, size_t *ns) { +static void add(const char* beg, const char* end, char*** ss, size_t* ns) { size_t n = *ns; size_t np = n + 1; - char *s; + char* s; size_t len; GPR_ASSERT(end >= beg); len = (size_t)(end - beg); - s = (char *)gpr_malloc(len + 1); + s = (char*)gpr_malloc(len + 1); memcpy(s, beg, len); s[len] = 0; - *ss = (char **)gpr_realloc(*ss, sizeof(char **) * np); + *ss = (char**)gpr_realloc(*ss, sizeof(char**) * np); (*ss)[n] = s; *ns = np; } -static void split(const char *s, char ***ss, size_t *ns) { - const char *c = strchr(s, ','); +static void split(const char* s, char*** ss, size_t* ns) { + const char* c = strchr(s, ','); if (c == NULL) { add(s, s + strlen(s), ss, ns); } else { @@ -72,8 +72,8 @@ static void split(const char *s, char ***ss, size_t *ns) { } } -static void parse(const char *s) { - char **strings = NULL; +static void parse(const char* s) { + char** strings = NULL; size_t nstrings = 0; size_t i; split(s, &strings, &nstrings); @@ -94,14 +94,14 @@ static void parse(const char *s) { static void list_tracers() { gpr_log(GPR_DEBUG, "available tracers:"); - tracer *t; + tracer* t; for (t = tracers; t; t = t->next) { gpr_log(GPR_DEBUG, "\t%s", t->flag->name); } } -void grpc_tracer_init(const char *env_var) { - char *e = gpr_getenv(env_var); +void grpc_tracer_init(const char* env_var) { + char* e = gpr_getenv(env_var); if (e != NULL) { parse(e); gpr_free(e); @@ -110,14 +110,14 @@ void grpc_tracer_init(const char *env_var) { void grpc_tracer_shutdown(void) { while (tracers) { - tracer *t = tracers; + tracer* t = tracers; tracers = t->next; gpr_free(t); } } -int grpc_tracer_set_enabled(const char *name, int enabled) { - tracer *t; +int grpc_tracer_set_enabled(const char* name, int enabled) { + tracer* t; if (0 == strcmp(name, "all")) { for (t = tracers; t; t = t->next) { TRACER_SET(*t->flag, enabled); diff --git a/src/core/lib/debug/trace.h b/src/core/lib/debug/trace.h index 558ba942bb..7447d5d94a 100644 --- a/src/core/lib/debug/trace.h +++ b/src/core/lib/debug/trace.h @@ -39,7 +39,7 @@ typedef struct { #else bool value; #endif - const char *name; + const char* name; } grpc_tracer_flag; #ifdef GRPC_THREADSAFE_TRACER @@ -52,8 +52,8 @@ typedef struct { { (on), (name) } #endif -void grpc_register_tracer(grpc_tracer_flag *flag); -void grpc_tracer_init(const char *env_var_name); +void grpc_register_tracer(grpc_tracer_flag* flag); +void grpc_tracer_init(const char* env_var_name); void grpc_tracer_shutdown(void); #ifdef __cplusplus -- cgit v1.2.3