Skip to content

Commit

Permalink
samples: tracing: add usage example for sys_trace_user_event
Browse files Browse the repository at this point in the history
Add usage example for sys_trace_user_event, to demonstrate how users
could add tracing functionality to their application.

Signed-off-by: Daniel DeGrasse <[email protected]>
  • Loading branch information
danieldegrasse committed Oct 3, 2024
1 parent ba42c6d commit 99816b3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions samples/subsys/tracing/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
/* delay between greetings (in ms) */
#define SLEEPTIME 500

static uint32_t counter;

/*
* @param my_name thread identification string
Expand All @@ -42,6 +43,10 @@ void helloLoop(const char *my_name,
/* take my semaphore */
k_sem_take(my_sem, K_FOREVER);

/* Provide a named trace, with the counter value */
sys_trace_named_event("counter_value", counter, 0);
counter++;

/* say "hello" */
tname = k_thread_name_get(k_current_get());
if (tname == NULL) {
Expand Down

0 comments on commit 99816b3

Please sign in to comment.