7#ifndef ZEPHYR_INCLUDE_INSTRUMENTATION_INSTRUMENTATION_H_
8#define ZEPHYR_INCLUDE_INSTRUMENTATION_INSTRUMENTATION_H_
16#if !defined(__no_instrumentation__)
17#error "No toolchain support for __no_instrumentation__"
51#ifdef CONFIG_THREAD_NAME
53 char thread_name[CONFIG_THREAD_MAX_NAME_LEN];
void instr_set_stop_func(void *callee)
Given a function address, set it as the stopper function, i.e.
int instr_turn_off(void)
Turns off instrumentation (stop recording events).
void instr_dump_deltas_uart(void)
Dumps the delta accumulator array via UART (profiling).
bool instr_enabled(void)
Tells if instrumentation is enabled, i.e.
void instr_dump_buffer_uart(void)
Dumps the buffered contents via UART (tracing).
void * instr_get_stop_func(void)
Get the stopper function address.
bool instr_profile_enabled(void)
Tells if instrumentation can collect profile info.
bool instr_tracing_supported(void)
Checks if tracing feature is available.
instr_event_types
Instrumentation event record types.
Definition instrumentation.h:23
@ INSTR_EVENT_SCHED_OUT
Thread switched out scheduler event.
Definition instrumentation.h:28
@ INSTR_EVENT_NUM
Add more events above this one.
Definition instrumentation.h:29
@ INSTR_EVENT_INVALID
Invalid or no event generated after promotion.
Definition instrumentation.h:30
@ INSTR_EVENT_PROFILE
Profile events.
Definition instrumentation.h:26
@ INSTR_EVENT_EXIT
Callee exit event record, followed by instr_event.
Definition instrumentation.h:25
@ INSTR_EVENT_SCHED_IN
Thread switched in scheduler event.
Definition instrumentation.h:27
@ INSTR_EVENT_ENTRY
Callee entry event record, followed by instr_event.
Definition instrumentation.h:24
int instr_turn_on(void)
Turns on instrumentation (start recording events).
bool instr_initialized(void)
Tells if instrumentation subsystem is properly initialized.
bool instr_trace_enabled(void)
Tells if instrumentation can collect traces.
void instr_event_handler(enum instr_event_types opcode, void *func, void *caller)
Shared callback handler to process entry/exit events.
void * instr_get_trigger_func(void)
Get the trigger function address.
int instr_disable(void)
Disables instrumentation.
bool instr_fundamentals_initialized(void)
Checks if subsystem is ready to be initialized.
void instr_set_trigger_func(void *callee)
Given a function address, set it as the trigger function, i.e.
int instr_enable(void)
Enables instrumentation.
int instr_init(void)
Performs initialisation required by the system.
bool instr_profiling_supported(void)
Checks if profiling feature is available.
bool instr_turned_on(void)
Tells if instrumentation is turned on.
__UINT64_TYPE__ uint64_t
Definition stdint.h:91
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
Context-specific data of an event.
Definition instrumentation.h:44
void * thread_id
Thread ID (correlate values with thread lookup table).
Definition instrumentation.h:50
uint8_t mode
Arch-specific mode indicator (thread mode, interrupt mode, etc.).
Definition instrumentation.h:46
uint8_t cpu
CPU number.
Definition instrumentation.h:48
Event records and associated payloads.
Definition instrumentation.h:61
struct instr_event_context context
Definition instrumentation.h:67
void * caller
Definition instrumentation.h:64
uint64_t timestamp
Definition instrumentation.h:65
struct instr_header header
Definition instrumentation.h:62
void * callee
Definition instrumentation.h:63