mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'debug_prints' into 'master'
Label columns of timer and pm lock dumps See merge request espressif/esp-idf!12047
This commit is contained in:
commit
deac2fbeb9
@ -645,15 +645,17 @@ void esp_pm_impl_dump_stats(FILE* out)
|
||||
|
||||
time_in_mode[cur_mode] += now - last_mode_change_time;
|
||||
|
||||
fprintf(out, "Mode stats:\n");
|
||||
fprintf(out, "\nMode stats:\n");
|
||||
fprintf(out, "%-8s %-10s %-10s %-10s\n", "Mode", "CPU_freq", "Time(us)", "Time(%)");
|
||||
for (int i = 0; i < PM_MODE_COUNT; ++i) {
|
||||
if (i == PM_MODE_LIGHT_SLEEP && !s_light_sleep_en) {
|
||||
/* don't display light sleep mode if it's not enabled */
|
||||
continue;
|
||||
}
|
||||
fprintf(out, "%8s %3dM %12lld %2d%%\n",
|
||||
fprintf(out, "%-8s %-3dM%-7s %-10lld %-2d%%\n",
|
||||
s_mode_names[i],
|
||||
s_cpu_freq_by_mode[i].freq_mhz,
|
||||
"", //Empty space to align columns
|
||||
time_in_mode[i],
|
||||
(int) (time_in_mode[i] * 100 / now));
|
||||
}
|
||||
|
@ -168,10 +168,16 @@ esp_err_t esp_pm_dump_locks(FILE* stream)
|
||||
|
||||
_lock_acquire(&s_list_lock);
|
||||
#ifdef WITH_PROFILING
|
||||
fprintf(stream, "Time: %lld\n", cur_time);
|
||||
fprintf(stream, "Time since bootup: %lld us\n", cur_time);
|
||||
#endif
|
||||
|
||||
fprintf(stream, "Lock stats:\n");
|
||||
#ifdef WITH_PROFILING
|
||||
fprintf(stream, "%-15s %-14s %-5s %-8s %-13s %-8s %-8s\n",
|
||||
"Name", "Type", "Arg", "Active", "Total_count", "Time(us)", "Time(%)");
|
||||
#else
|
||||
fprintf(stream, "%-15s %-14s %-5s %-8s\n", "Name", "Type", "Arg", "Active");
|
||||
#endif
|
||||
esp_pm_lock_t* it;
|
||||
char line[80];
|
||||
SLIST_FOREACH(it, &s_list, next) {
|
||||
@ -193,12 +199,12 @@ esp_err_t esp_pm_dump_locks(FILE* stream)
|
||||
if (it->count > 0) {
|
||||
time_held += cur_time - it->last_taken;
|
||||
}
|
||||
snprintf(buf, len, "%14s %3d %3d %9d %12lld %3lld%%\n",
|
||||
snprintf(buf, len, "%-14s %-5d %-8d %-13d %-8lld %-3lld%%\n",
|
||||
s_lock_type_names[it->type], it->arg,
|
||||
it->count, it->times_taken, time_held,
|
||||
(time_held + cur_time_d100 - 1) / cur_time_d100);
|
||||
#else
|
||||
snprintf(buf, len, "%14s %3d %3d\n", s_lock_type_names[it->type], it->arg, it->count);
|
||||
snprintf(buf, len, "%-14s %-5d %-8d\n", s_lock_type_names[it->type], it->arg, it->count);
|
||||
#endif // WITH_PROFILING
|
||||
portEXIT_CRITICAL(&it->spinlock);
|
||||
fputs(line, stream);
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user