aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/lib/profiling/basic_timers.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/lib/profiling/basic_timers.cc')
-rw-r--r--src/core/lib/profiling/basic_timers.cc58
1 files changed, 29 insertions, 29 deletions
diff --git a/src/core/lib/profiling/basic_timers.cc b/src/core/lib/profiling/basic_timers.cc
index 0ae7d7f600..3ec6280e6b 100644
--- a/src/core/lib/profiling/basic_timers.cc
+++ b/src/core/lib/profiling/basic_timers.cc
@@ -36,8 +36,8 @@ typedef enum { BEGIN = '{', END = '}', MARK = '.' } marker_type;
typedef struct gpr_timer_entry {
gpr_timespec tm;
- const char *tagstr;
- const char *file;
+ const char* tagstr;
+ const char* file;
short line;
char type;
uint8_t important;
@@ -48,21 +48,21 @@ typedef struct gpr_timer_entry {
typedef struct gpr_timer_log {
size_t num_entries;
- struct gpr_timer_log *next;
- struct gpr_timer_log *prev;
+ struct gpr_timer_log* next;
+ struct gpr_timer_log* prev;
gpr_timer_entry log[MAX_COUNT];
} gpr_timer_log;
typedef struct gpr_timer_log_list {
- gpr_timer_log *head;
+ gpr_timer_log* head;
/* valid iff head!=NULL */
- gpr_timer_log *tail;
+ gpr_timer_log* tail;
} gpr_timer_log_list;
-static __thread gpr_timer_log *g_thread_log;
+static __thread gpr_timer_log* g_thread_log;
static gpr_once g_once_init = GPR_ONCE_INIT;
-static FILE *output_file;
-static const char *output_filename_or_null = NULL;
+static FILE* output_file;
+static const char* output_filename_or_null = NULL;
static pthread_mutex_t g_mu;
static pthread_cond_t g_cv;
static gpr_timer_log_list g_in_progress_logs;
@@ -73,7 +73,7 @@ static __thread int g_thread_id;
static int g_next_thread_id;
static int g_writing_enabled = 1;
-static const char *output_filename() {
+static const char* output_filename() {
if (output_filename_or_null == NULL) {
output_filename_or_null = gpr_getenv("LATENCY_TRACE");
if (output_filename_or_null == NULL ||
@@ -84,7 +84,7 @@ static const char *output_filename() {
return output_filename_or_null;
}
-static int timer_log_push_back(gpr_timer_log_list *list, gpr_timer_log *log) {
+static int timer_log_push_back(gpr_timer_log_list* list, gpr_timer_log* log) {
if (list->head == NULL) {
list->head = list->tail = log;
log->next = log->prev = NULL;
@@ -98,8 +98,8 @@ static int timer_log_push_back(gpr_timer_log_list *list, gpr_timer_log *log) {
}
}
-static gpr_timer_log *timer_log_pop_front(gpr_timer_log_list *list) {
- gpr_timer_log *out = list->head;
+static gpr_timer_log* timer_log_pop_front(gpr_timer_log_list* list) {
+ gpr_timer_log* out = list->head;
if (out != NULL) {
list->head = out->next;
if (list->head != NULL) {
@@ -111,7 +111,7 @@ static gpr_timer_log *timer_log_pop_front(gpr_timer_log_list *list) {
return out;
}
-static void timer_log_remove(gpr_timer_log_list *list, gpr_timer_log *log) {
+static void timer_log_remove(gpr_timer_log_list* list, gpr_timer_log* log) {
if (log->prev == NULL) {
list->head = log->next;
if (list->head != NULL) {
@@ -130,13 +130,13 @@ static void timer_log_remove(gpr_timer_log_list *list, gpr_timer_log *log) {
}
}
-static void write_log(gpr_timer_log *log) {
+static void write_log(gpr_timer_log* log) {
size_t i;
if (output_file == NULL) {
output_file = fopen(output_filename(), "w");
}
for (i = 0; i < log->num_entries; i++) {
- gpr_timer_entry *entry = &(log->log[i]);
+ gpr_timer_entry* entry = &(log->log[i]);
if (gpr_time_cmp(entry->tm, gpr_time_0(entry->tm.clock_type)) < 0) {
entry->tm = gpr_time_0(entry->tm.clock_type);
}
@@ -149,8 +149,8 @@ static void write_log(gpr_timer_log *log) {
}
}
-static void writing_thread(void *unused) {
- gpr_timer_log *log;
+static void writing_thread(void* unused) {
+ gpr_timer_log* log;
pthread_mutex_lock(&g_mu);
for (;;) {
while ((log = timer_log_pop_front(&g_done_logs)) == NULL && !g_shutdown) {
@@ -169,8 +169,8 @@ static void writing_thread(void *unused) {
}
}
-static void flush_logs(gpr_timer_log_list *list) {
- gpr_timer_log *log;
+static void flush_logs(gpr_timer_log_list* list) {
+ gpr_timer_log* log;
while ((log = timer_log_pop_front(list)) != NULL) {
write_log(log);
free(log);
@@ -196,7 +196,7 @@ static void finish_writing(void) {
}
}
-void gpr_timers_set_log_filename(const char *filename) {
+void gpr_timers_set_log_filename(const char* filename) {
output_filename_or_null = filename;
}
@@ -209,7 +209,7 @@ static void init_output() {
static void rotate_log() {
/* Using malloc here, as this code could end up being called by gpr_malloc */
- gpr_timer_log *log = static_cast<gpr_timer_log *>(malloc(sizeof(*log)));
+ gpr_timer_log* log = static_cast<gpr_timer_log*>(malloc(sizeof(*log)));
gpr_once_init(&g_once_init, init_output);
log->num_entries = 0;
pthread_mutex_lock(&g_mu);
@@ -226,9 +226,9 @@ static void rotate_log() {
g_thread_log = log;
}
-static void gpr_timers_log_add(const char *tagstr, marker_type type,
- int important, const char *file, int line) {
- gpr_timer_entry *entry;
+static void gpr_timers_log_add(const char* tagstr, marker_type type,
+ int important, const char* file, int line) {
+ gpr_timer_entry* entry;
if (!g_writing_enabled) {
return;
@@ -250,17 +250,17 @@ static void gpr_timers_log_add(const char *tagstr, marker_type type,
}
/* Latency profiler API implementation. */
-void gpr_timer_add_mark(const char *tagstr, int important, const char *file,
+void gpr_timer_add_mark(const char* tagstr, int important, const char* file,
int line) {
gpr_timers_log_add(tagstr, MARK, important, file, line);
}
-void gpr_timer_begin(const char *tagstr, int important, const char *file,
+void gpr_timer_begin(const char* tagstr, int important, const char* file,
int line) {
gpr_timers_log_add(tagstr, BEGIN, important, file, line);
}
-void gpr_timer_end(const char *tagstr, int important, const char *file,
+void gpr_timer_end(const char* tagstr, int important, const char* file,
int line) {
gpr_timers_log_add(tagstr, END, important, file, line);
}
@@ -277,7 +277,7 @@ void gpr_timers_global_init(void) {}
void gpr_timers_global_destroy(void) {}
-void gpr_timers_set_log_filename(const char *filename) {}
+void gpr_timers_set_log_filename(const char* filename) {}
void gpr_timer_set_enabled(int enabled) {}
#endif /* GRPC_BASIC_PROFILER */