From a993d241f33deb7ff776e2c209390f20db6b16c5 Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Mon, 10 Jun 2024 19:57:31 +0000 Subject: [PATCH] samples: tracing: add usage example for sys_trace_user_event Add usage example for sys_trace_user_event, to demonstrate how users could add tracing functionality to their application. Signed-off-by: Daniel DeGrasse --- samples/subsys/tracing/src/main.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/samples/subsys/tracing/src/main.c b/samples/subsys/tracing/src/main.c index 58523d9ff092a63..28606b12199d3ad 100644 --- a/samples/subsys/tracing/src/main.c +++ b/samples/subsys/tracing/src/main.c @@ -27,6 +27,7 @@ /* delay between greetings (in ms) */ #define SLEEPTIME 500 +static uint32_t counter; /* * @param my_name thread identification string @@ -42,6 +43,10 @@ void helloLoop(const char *my_name, /* take my semaphore */ k_sem_take(my_sem, K_FOREVER); + /* Provide a user-defined trace, with the counter value */ + sys_trace_user_event("counter_value", counter, 0); + counter++; + /* say "hello" */ tname = k_thread_name_get(k_current_get()); if (tname == NULL) {