Merge pull request #1400 from ctiller/timers

Capure thread id with default timer implementation
pull/1411/head
Vijay Pai 10 years ago
commit 4434796073
  1. 5
      src/core/profiling/timers.c

@ -40,10 +40,12 @@
#include <grpc/support/log.h>
#include <grpc/support/time.h>
#include <grpc/support/sync.h>
#include <grpc/support/thd.h>
#include <stdio.h>
typedef struct grpc_timer_entry {
grpc_precise_clock tm;
gpr_thd_id thd;
const char* tag;
void* id;
const char* file;
@ -85,7 +87,7 @@ static void log_report_locked(grpc_timers_log* log) {
grpc_timer_entry* entry = &(log->log[i]);
fprintf(fp, "GRPC_LAT_PROF ");
grpc_precise_clock_print(&entry->tm, fp);
fprintf(fp, " %s %p %s %d\n", entry->tag, entry->id, entry->file,
fprintf(fp, " %p %s %p %s %d\n", (void*)(gpr_intptr)entry->thd, entry->tag, entry->id, entry->file,
entry->line);
}
@ -121,6 +123,7 @@ void grpc_timers_log_add(grpc_timers_log* log, const char* tag, void* id,
entry->id = id;
entry->file = file;
entry->line = line;
entry->thd = gpr_thd_currentid();
gpr_mu_unlock(&log->mu);
}

Loading…
Cancel
Save