oveRTOS C API
Embedded RTOS framework — build system, configuration, and portable C API
Loading...
Searching...
No Matches
Macros | Enumerations | Functions
trace.h File Reference

Thread-state / sync-primitive trace stream. More...

#include <stdint.h>
#include "ove_config.h"
Include dependency graph for trace.h:

Go to the source code of this file.

Macros

#define OVE_TRACE_MARK(thread, prim, act, obj)    ove_trace_emit_mark((uintptr_t)(thread), (prim), (act), (uintptr_t)(obj))
 
#define OVE_TRACE_MARK_CURRENT(prim, act, obj)    ove_trace_emit_mark(ove_backend_thread_current_handle(), (prim), (act), (uintptr_t)(obj))
 

Enumerations

enum  { OVE_TRACE_KIND_STATE = 1 , OVE_TRACE_KIND_MARK = 2 }
 
enum  {
  OVE_TRACE_PRIM_MUTEX = 1 , OVE_TRACE_PRIM_SEM = 2 , OVE_TRACE_PRIM_EVENT = 3 , OVE_TRACE_PRIM_CV = 4 ,
  OVE_TRACE_PRIM_QUEUE = 5 , OVE_TRACE_PRIM_USER = 15
}
 
enum  { OVE_TRACE_ACT_WAIT_ENTER = 1 , OVE_TRACE_ACT_WAIT_EXIT = 2 , OVE_TRACE_ACT_POST = 3 , OVE_TRACE_ACT_USER = 4 }
 

Functions

void ove_trace_emit_state (uintptr_t thread_handle, int old_state, int new_state)
 Emit a thread state transition.
 
void ove_trace_emit_mark (uintptr_t thread_handle, uint8_t prim, uint8_t act, uintptr_t object)
 Emit a sync-primitive marker.
 
uintptr_t ove_backend_thread_current_handle (void)
 Return the current thread's stable handle, or 0 if none.
 

Detailed Description

Thread-state / sync-primitive trace stream.

When CONFIG_OVE_TRACE_STREAM is enabled, every thread state transition is pushed into a lock-free ring and drained by the sim transport, which forwards it to the dashboard as a swimlane. CONFIG_OVE_TRACE_MARKERS additionally emits point markers at sync-primitive entry/exit.

Thread identity is the low 32 bits of the backend thread handle. The dashboard resolves these to names via descriptor records emitted periodically by the sim plugin.

Function Documentation

◆ ove_trace_emit_state()

void ove_trace_emit_state ( uintptr_t  thread_handle,
int  old_state,
int  new_state 
)

Emit a thread state transition.

Called from backend thread code that already knows the current thread handle.

Parameters
[in]thread_handleStable backend handle of the thread changing state.
[in]old_statePrevious state, using the ove_thread_state_t encoding.
[in]new_stateNew state, using the ove_thread_state_t encoding.

◆ ove_trace_emit_mark()

void ove_trace_emit_mark ( uintptr_t  thread_handle,
uint8_t  prim,
uint8_t  act,
uintptr_t  object 
)

Emit a sync-primitive marker.

Parameters
[in]thread_handleStable backend handle of the emitting thread.
[in]primOne of OVE_TRACE_PRIM_*.
[in]actOne of OVE_TRACE_ACT_*.
[in]objectAddress of the primitive (low 16 bits survive into the record).

◆ ove_backend_thread_current_handle()

uintptr_t ove_backend_thread_current_handle ( void  )

Return the current thread's stable handle, or 0 if none.

Supplied by the thread backend (posix_thread.c, wasm_thread.c). Used by OVE_TRACE_MARK_CURRENT to tag markers emitted from sync-primitive code that doesn't otherwise have the thread pointer in scope.

Returns
Stable backend handle of the calling thread, or 0 if unavailable.