Skip to content

Commit 30201f8

Browse files
kv2019ilgirdwood
authored andcommitted
debug: debug_stream: log per-core utilization from idle thread load
Keep the per-thread stack and cpu LOG_DBG print and add a separate LOG_INF that fires only for the Zephyr idle thread. The info-level print reports per-core CPU utilization calculated as the inverse of the idle thread load percentage. Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
1 parent 60880b6 commit 30201f8

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

src/debug/debug_stream/Kconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,15 @@ config SOF_DEBUG_STREAM_THREAD_INFO_INTERVAL
4545
Decides how often thread info runs and checks execution cycle
4646
statistics and stack usage.
4747

48+
config SOF_DEBUG_STREAM_THREAD_INFO_TOTAL_CPU_LOAD_TO_LOG
49+
bool "Print summarized total CPU load to log subsystem"
50+
depends on SOF_DEBUG_STREAM_THREAD_INFO
51+
default y
52+
help
53+
In addition to printing thread statistics to debug stream,
54+
print the total CPU load (sum of all threads) to
55+
the logging system.
56+
4857
config SOF_DEBUG_STREAM_TEXT_MSG
4958
bool "Enable text message sending through Debug-Stream"
5059
help

src/debug/debug_stream/debug_stream_thread_info.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,13 @@ static void thread_info_cb(const struct k_thread *cthread, void *user_data)
225225
tinfo->name, tinfo->stack_usage * 100U / 255,
226226
tinfo->cpu_usage * 100U / 255);
227227

228+
/* .is_idle depends on CONFIG_SMP */
229+
#if defined(CONFIG_SOF_DEBUG_STREAM_THREAD_INFO_TOTAL_CPU_LOAD_TO_LOG) && defined(CONFIG_SMP)
230+
if (thread->base.is_idle)
231+
LOG_INF("core %u utilization %u%%", ud->core,
232+
100U - tinfo->cpu_usage * 100U / 255);
233+
#endif
234+
228235
ud->thread_count++;
229236
}
230237

0 commit comments

Comments
 (0)