From 0310f13fd95e44ba95b2424caea33be513681d57 Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Mon, 13 Apr 2015 13:07:36 -0700 Subject: [PATCH] clang-format results --- src/core/profiling/timers.c | 30 +++++++++++------------- src/core/profiling/timers.h | 12 ++++++---- src/core/profiling/timers_preciseclock.h | 1 - test/core/profiling/timers_test.c | 6 ++--- 4 files changed, 24 insertions(+), 25 deletions(-) diff --git a/src/core/profiling/timers.c b/src/core/profiling/timers.c index 74da10bf91b..4814930a79a 100644 --- a/src/core/profiling/timers.c +++ b/src/core/profiling/timers.c @@ -56,12 +56,12 @@ struct grpc_timers_log { int num_entries; int capacity; int capacity_limit; - FILE *fp; + FILE* fp; }; grpc_timers_log* grpc_timers_log_global = NULL; -grpc_timers_log* grpc_timers_log_create(int capacity_limit, FILE *dump) { +grpc_timers_log* grpc_timers_log_create(int capacity_limit, FILE* dump) { grpc_timers_log* log = gpr_malloc(sizeof(*log)); /* TODO (vpai): Allow allocation below limit */ @@ -78,22 +78,22 @@ grpc_timers_log* grpc_timers_log_create(int capacity_limit, FILE *dump) { return log; } -static void log_report_locked(grpc_timers_log *log) { - FILE *fp = log->fp; +static void log_report_locked(grpc_timers_log* log) { + FILE* fp = log->fp; int i; - for (i=0;inum_entries;i++) { + for (i = 0; i < log->num_entries; i++) { grpc_timer_entry* entry = &(log->log[i]); fprintf(fp, "GRPC_LAT_PROF "); grpc_precise_clock_print(&entry->tm, fp); - fprintf(fp, " %s#%d,%s:%d\n", entry->tag, entry->seq, - entry->file, entry->line); + fprintf(fp, " %s#%d,%s:%d\n", entry->tag, entry->seq, entry->file, + entry->line); } /* Now clear out the log */ - log->num_entries=0; + log->num_entries = 0; } -void grpc_timers_log_destroy(grpc_timers_log *log) { +void grpc_timers_log_destroy(grpc_timers_log* log) { gpr_mu_lock(&log->mu); log_report_locked(log); gpr_mu_unlock(&log->mu); @@ -104,8 +104,8 @@ void grpc_timers_log_destroy(grpc_timers_log *log) { gpr_free(log); } -void grpc_timers_log_add(grpc_timers_log *log, const char *tag, int seq, - const char *file, int line) { +void grpc_timers_log_add(grpc_timers_log* log, const char* tag, int seq, + const char* file, int line) { grpc_timer_entry* entry; /* TODO (vpai) : Improve concurrency */ @@ -132,9 +132,7 @@ void grpc_timers_log_global_init(void) { void grpc_timers_log_global_destroy(void) { grpc_timers_log_destroy(grpc_timers_log_global); } -#else /* !GRPC_LATENCY_PROFILER */ -void grpc_timers_log_global_init(void) { -} -void grpc_timers_log_global_destroy(void) { -} +#else /* !GRPC_LATENCY_PROFILER */ +void grpc_timers_log_global_init(void) {} +void grpc_timers_log_global_destroy(void) {} #endif /* GRPC_LATENCY_PROFILER */ diff --git a/src/core/profiling/timers.h b/src/core/profiling/timers.h index f3a87752ce4..ef4cad112ae 100644 --- a/src/core/profiling/timers.h +++ b/src/core/profiling/timers.h @@ -44,18 +44,20 @@ extern "C" { typedef struct grpc_timers_log grpc_timers_log; -grpc_timers_log* grpc_timers_log_create(int capacity_limit, FILE *dump); +grpc_timers_log *grpc_timers_log_create(int capacity_limit, FILE *dump); void grpc_timers_log_add(grpc_timers_log *, const char *tag, int seq, - const char *file, int line); + const char *file, int line); void grpc_timers_log_destroy(grpc_timers_log *); extern grpc_timers_log *grpc_timers_log_global; -#define GRPC_TIMER_MARK(x, s) grpc_timers_log_add(grpc_timers_log_global, #x, \ - s, __FILE__, __LINE__) +#define GRPC_TIMER_MARK(x, s) \ + grpc_timers_log_add(grpc_timers_log_global, #x, s, __FILE__, __LINE__) #else /* !GRPC_LATENCY_PROFILER */ -#define GRPC_TIMER_MARK(x, s) do {} while (0) +#define GRPC_TIMER_MARK(x, s) \ + do { \ + } while (0) #endif /* GRPC_LATENCY_PROFILER */ void grpc_timers_log_global_init(void); diff --git a/src/core/profiling/timers_preciseclock.h b/src/core/profiling/timers_preciseclock.h index c39596709aa..bf4a0eab8a4 100644 --- a/src/core/profiling/timers_preciseclock.h +++ b/src/core/profiling/timers_preciseclock.h @@ -53,5 +53,4 @@ static void grpc_precise_clock_print(const grpc_precise_clock* clk, FILE* fp) { } #endif /* GRPC_TIMERS_RDTSC */ - #endif /* GRPC_CORE_PROFILING_TIMERS_PRECISECLOCK_H */ diff --git a/test/core/profiling/timers_test.c b/test/core/profiling/timers_test.c index b7219d7859f..55e59c969e8 100644 --- a/test/core/profiling/timers_test.c +++ b/test/core/profiling/timers_test.c @@ -38,7 +38,7 @@ void test_log_events(int num_seqs) { int start = 0; int *state; - state = calloc(num_seqs,sizeof(state[0])); + state = calloc(num_seqs, sizeof(state[0])); while (start < num_seqs) { int i; int row; @@ -48,10 +48,10 @@ void test_log_events(int num_seqs) { } row = rand() % 10; /* how many in a row */ - for (i = start; (i < start+row) && (i < num_seqs); i++) { + for (i = start; (i < start + row) && (i < num_seqs); i++) { int j; int advance = 1 + rand() % 3; /* how many to advance by */ - for (j=0; j