Zephyr API Documentation 4.2.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
instrumentation.h File Reference
#include <zephyr/kernel.h>

Go to the source code of this file.

Data Structures

struct  instr_header
 Header for the event records. More...
struct  instr_event_context
 Context-specific data of an event. More...
struct  instr_record
 Event records and associated payloads. More...

Enumerations

enum  instr_event_types {
  INSTR_EVENT_ENTRY = 0 , INSTR_EVENT_EXIT , INSTR_EVENT_PROFILE , INSTR_EVENT_SCHED_IN ,
  INSTR_EVENT_SCHED_OUT , INSTR_EVENT_NUM , INSTR_EVENT_INVALID
}
 Instrumentation event record types. More...

Functions

bool instr_tracing_supported (void)
 Checks if tracing feature is available.
bool instr_profiling_supported (void)
 Checks if profiling feature is available.
bool instr_fundamentals_initialized (void)
 Checks if subsystem is ready to be initialized.
int instr_init (void)
 Performs initialisation required by the system.
bool instr_initialized (void)
 Tells if instrumentation subsystem is properly initialized.
bool instr_enabled (void)
 Tells if instrumentation is enabled, i.e.
int instr_enable (void)
 Enables instrumentation.
int instr_disable (void)
 Disables instrumentation.
int instr_turn_on (void)
 Turns on instrumentation (start recording events).
int instr_turn_off (void)
 Turns off instrumentation (stop recording events).
bool instr_turned_on (void)
 Tells if instrumentation is turned on.
bool instr_trace_enabled (void)
 Tells if instrumentation can collect traces.
bool instr_profile_enabled (void)
 Tells if instrumentation can collect profile info.
void instr_dump_buffer_uart (void)
 Dumps the buffered contents via UART (tracing).
void instr_dump_deltas_uart (void)
 Dumps the delta accumulator array via UART (profiling).
void instr_event_handler (enum instr_event_types opcode, void *func, void *caller)
 Shared callback handler to process entry/exit events.
void instr_set_trigger_func (void *callee)
 Given a function address, set it as the trigger function, i.e.
void instr_set_stop_func (void *callee)
 Given a function address, set it as the stopper function, i.e.
void * instr_get_trigger_func (void)
 Get the trigger function address.
void * instr_get_stop_func (void)
 Get the stopper function address.

Enumeration Type Documentation

◆ instr_event_types

Instrumentation event record types.

Enumerator
INSTR_EVENT_ENTRY 

Callee entry event record, followed by instr_event.

INSTR_EVENT_EXIT 

Callee exit event record, followed by instr_event.

INSTR_EVENT_PROFILE 

Profile events.

INSTR_EVENT_SCHED_IN 

Thread switched in scheduler event.

INSTR_EVENT_SCHED_OUT 

Thread switched out scheduler event.

INSTR_EVENT_NUM 

Add more events above this one.

INSTR_EVENT_INVALID 

Invalid or no event generated after promotion.

Function Documentation

◆ instr_disable()

int instr_disable ( void )

Disables instrumentation.

◆ instr_dump_buffer_uart()

void instr_dump_buffer_uart ( void )

Dumps the buffered contents via UART (tracing).

◆ instr_dump_deltas_uart()

void instr_dump_deltas_uart ( void )

Dumps the delta accumulator array via UART (profiling).

◆ instr_enable()

int instr_enable ( void )

Enables instrumentation.

◆ instr_enabled()

bool instr_enabled ( void )

Tells if instrumentation is enabled, i.e.

can be turned on.

◆ instr_event_handler()

void instr_event_handler ( enum instr_event_types opcode,
void * func,
void * caller )

Shared callback handler to process entry/exit events.

Parameters
opcodeThe type of event to process.
funcAddress of the function being called.
callerAddress of the function caller.

◆ instr_fundamentals_initialized()

bool instr_fundamentals_initialized ( void )

Checks if subsystem is ready to be initialized.

Must called be before instr_init().

◆ instr_get_stop_func()

void * instr_get_stop_func ( void )

Get the stopper function address.

◆ instr_get_trigger_func()

void * instr_get_trigger_func ( void )

Get the trigger function address.

◆ instr_init()

int instr_init ( void )

Performs initialisation required by the system.

◆ instr_initialized()

bool instr_initialized ( void )

Tells if instrumentation subsystem is properly initialized.

◆ instr_profile_enabled()

bool instr_profile_enabled ( void )

Tells if instrumentation can collect profile info.

◆ instr_profiling_supported()

bool instr_profiling_supported ( void )

Checks if profiling feature is available.

◆ instr_set_stop_func()

void instr_set_stop_func ( void * callee)

Given a function address, set it as the stopper function, i.e.

when the function exits it will turn off the instrumentation.

Parameters
calleeThe function address

◆ instr_set_trigger_func()

void instr_set_trigger_func ( void * callee)

Given a function address, set it as the trigger function, i.e.

when the function is called it will turn on the instrumentation.

Parameters
calleeThe function address

◆ instr_trace_enabled()

bool instr_trace_enabled ( void )

Tells if instrumentation can collect traces.

◆ instr_tracing_supported()

bool instr_tracing_supported ( void )

Checks if tracing feature is available.

◆ instr_turn_off()

int instr_turn_off ( void )

Turns off instrumentation (stop recording events).

◆ instr_turn_on()

int instr_turn_on ( void )

Turns on instrumentation (start recording events).

◆ instr_turned_on()

bool instr_turned_on ( void )

Tells if instrumentation is turned on.