From dcdc7d315e177d7c8ab21a9be3686345e4827e2e Mon Sep 17 00:00:00 2001 From: Krzysztof Sychla Date: Mon, 16 Jun 2025 13:18:22 +0200 Subject: [PATCH] tracing: Allow disabling idle traces This change allows for enabling/disabling the idle traces by setting the CONFIG_TRACING_IDLE config. Signed-off-by: Krzysztof Sychla --- subsys/tracing/Kconfig | 6 ++++++ subsys/tracing/ctf/ctf_top.c | 2 ++ subsys/tracing/sysview/sysview.c | 2 ++ subsys/tracing/test/tracing_string_format_test.c | 4 ++++ 4 files changed, 14 insertions(+) diff --git a/subsys/tracing/Kconfig b/subsys/tracing/Kconfig index bac360283b1..5e3d349345b 100644 --- a/subsys/tracing/Kconfig +++ b/subsys/tracing/Kconfig @@ -354,6 +354,12 @@ config TRACING_GPIO help Enable tracing GPIO. +config TRACING_IDLE + bool "Tracing Idle" + default y + help + Enable tracing Idle state. + endmenu # Tracing Configuration endif diff --git a/subsys/tracing/ctf/ctf_top.c b/subsys/tracing/ctf/ctf_top.c index 7acb422f3ef..753c1693111 100644 --- a/subsys/tracing/ctf/ctf_top.c +++ b/subsys/tracing/ctf/ctf_top.c @@ -189,7 +189,9 @@ void sys_trace_isr_exit_to_scheduler(void) void sys_trace_idle(void) { +#ifdef CONFIG_TRACING_IDLE ctf_top_idle(); +#endif if (IS_ENABLED(CONFIG_CPU_LOAD)) { cpu_load_on_enter_idle(); } diff --git a/subsys/tracing/sysview/sysview.c b/subsys/tracing/sysview/sysview.c index 660181e967e..42059fb0f5d 100644 --- a/subsys/tracing/sysview/sysview.c +++ b/subsys/tracing/sysview/sysview.c @@ -64,7 +64,9 @@ void sys_trace_isr_exit_to_scheduler(void) void sys_trace_idle(void) { +#ifdef CONFIG_TRACING_IDLE SEGGER_SYSVIEW_OnIdle(); +#endif if (IS_ENABLED(CONFIG_CPU_LOAD)) { cpu_load_on_enter_idle(); diff --git a/subsys/tracing/test/tracing_string_format_test.c b/subsys/tracing/test/tracing_string_format_test.c index 8a53e0bcdb8..c0ceb81114b 100644 --- a/subsys/tracing/test/tracing_string_format_test.c +++ b/subsys/tracing/test/tracing_string_format_test.c @@ -201,12 +201,16 @@ void sys_trace_isr_exit_to_scheduler(void) void sys_trace_idle(void) { +#ifdef CONFIG_TRACING_IDLE TRACING_STRING("%s\n", __func__); +#endif } void sys_trace_idle_exit(void) { +#ifdef CONFIG_TRACING_IDLE TRACING_STRING("%s\n", __func__); +#endif } void sys_trace_k_condvar_broadcast_enter(struct k_condvar *condvar)