From 7167ad45abf81847aa4cc8a2f719c7801e6b3290 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Tue, 20 Mar 2018 18:08:19 +0800 Subject: [PATCH] pm: improve debug output from esp_pm_dump_locks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - separate mode stats from lock stats by an extra comment line - add CPU frequency column to the mode stats - don’t print a row for light sleep if light sleep is not enabled --- components/esp32/pm_esp32.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/components/esp32/pm_esp32.c b/components/esp32/pm_esp32.c index 8a1005f43..5d422f3b8 100644 --- a/components/esp32/pm_esp32.c +++ b/components/esp32/pm_esp32.c @@ -426,9 +426,15 @@ void esp_pm_impl_dump_stats(FILE* out) time_in_mode[cur_mode] += now - last_mode_change_time; + fprintf(out, "Mode stats:\n"); for (int i = 0; i < PM_MODE_COUNT; ++i) { - fprintf(out, "%8s %12lld %2d%%\n", + 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 %6s %12lld %2d%%\n", s_mode_names[i], + s_freq_names[s_cpu_freq_by_mode[i]], time_in_mode[i], (int) (time_in_mode[i] * 100 / now)); }