From 68c9845b416d9e002b852b5ce37cb82532b7ed96 Mon Sep 17 00:00:00 2001 From: Peter Mitsis Date: Tue, 14 Dec 2021 22:32:55 -0500 Subject: [PATCH] shell: report thread runtime stats Updates the kernel service to display the extended thread runtime stats when the following shell command is issued. kernel threads Signed-off-by: Peter Mitsis --- subsys/shell/modules/kernel_service.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/subsys/shell/modules/kernel_service.c b/subsys/shell/modules/kernel_service.c index c6a881bb39d..62b4e2649dc 100644 --- a/subsys/shell/modules/kernel_service.c +++ b/subsys/shell/modules/kernel_service.c @@ -103,17 +103,24 @@ static void shell_tdata_dump(const struct k_thread *cthread, void *user_data) * so it won't increase RAM/ROM usage too much on 32-bit * targets. */ -#ifdef CONFIG_64BIT - shell_print(shell, "\tTotal execution cycles: %" PRIu64 " (%u %%)", - (uint64_t)rt_stats_thread.execution_cycles, - pcnt); -#else shell_print(shell, "\tTotal execution cycles: %u (%u %%)", (uint32_t)rt_stats_thread.execution_cycles, pcnt); +#ifdef CONFIG_SCHED_THREAD_USAGE_ANALYSIS + shell_print(shell, "\tCurrent execution cycles: %u", + (uint32_t)rt_stats_thread.current_cycles); + shell_print(shell, "\tPeak execution cycles: %u", + (uint32_t)rt_stats_thread.peak_cycles); + shell_print(shell, "\tAverage execution cycles: %u", + (uint32_t)rt_stats_thread.average_cycles); #endif } else { shell_print(shell, "\tTotal execution cycles: ? (? %%)"); +#ifdef CONFIG_SCHED_THREAD_USAGE_ANALYSIS + shell_print(shell, "\tCurrent execution cycles: ?"); + shell_print(shell, "\tPeak execution cycles: ?"); + shell_print(shell, "\tAverage execution cycles: ?"); +#endif } #endif