From 296d10e67536ae68d2a7a10df9ba76b8d9b32c0d Mon Sep 17 00:00:00 2001 From: Sachin Parekh Date: Mon, 18 Jan 2021 21:25:11 +0530 Subject: [PATCH] esp_timer: Label each column of timer dump --- components/esp_timer/src/esp_timer.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/components/esp_timer/src/esp_timer.c b/components/esp_timer/src/esp_timer.c index a636c14590..60082b74ee 100644 --- a/components/esp_timer/src/esp_timer.c +++ b/components/esp_timer/src/esp_timer.c @@ -433,17 +433,17 @@ static void print_timer_info(esp_timer_handle_t t, char** dst, size_t* dst_size) size_t cb; // name is optional, might be missed. if (t->name) { - cb = snprintf(*dst, *dst_size, "%-12s ", t->name); + cb = snprintf(*dst, *dst_size, "%-20.20s ", t->name); } else { - cb = snprintf(*dst, *dst_size, "timer@%p ", t); + cb = snprintf(*dst, *dst_size, "timer@%-10p ", t); } - cb += snprintf(*dst + cb, *dst_size + cb, "%12lld %12lld %9d %9d %6d %12lld\n", + cb += snprintf(*dst + cb, *dst_size + cb, "%-10lld %-12lld %-12d %-12d %-12d %-12lld\n", (uint64_t)t->period, t->alarm, t->times_armed, t->times_triggered, t->times_skipped, t->total_callback_run_time); /* keep this in sync with the format string, used in esp_timer_dump */ #define TIMER_INFO_LINE_LEN 90 #else - size_t cb = snprintf(*dst, *dst_size, "timer@%p %12lld %12lld\n", t, (uint64_t)t->period, t->alarm); + size_t cb = snprintf(*dst, *dst_size, "timer@%-14p %-10lld %-12lld\n", t, (uint64_t)t->period, t->alarm); #define TIMER_INFO_LINE_LEN 46 #endif *dst += cb; @@ -498,6 +498,14 @@ esp_err_t esp_timer_dump(FILE* stream) #endif timer_list_unlock(); + fprintf(stream, "Timer stats:\n"); +#if WITH_PROFILING + fprintf(stream, "%-20s %-10s %-12s %-12s %-12s %-12s %-12s\n", + "Name", "Period", "Alarm", "Times_armed", "Times_trigg", "Times_skip", "Cb_exec_time"); +#else + fprintf(stream, "%-20s %-10s %-12s\n", "Name", "Period", "Alarm"); +#endif + /* Print the buffer */ fputs(print_buf, stream);