Tracing Kernel Events
Sometimes the current state of system as inspected by the debugger is not enough to fully understand what happens and why it happens. For these rough days the kernel tracing infrastructure offers facility to track certain events as they happened.
If tracing infrastructure is enabled by CMake option then tracing infrastructure support is built into kernel. This infrastructure is called from certain places. As of now tracing is all or nothing. Once tracing is enabled all trace events currently present in the code are recorded if they happen.
Trace buffer is a circular buffer that overwrites oldest recorded entries if new events are traced and the buffer is not large enough to store them.
Enumeration
Unknown member type TraceEventID
Functions
bool trace_init(void *start_addr, void *end_addr)
Trace buffer is usually put outside of the allocated RAM so it can occupy otherwise unused and unallocated RAM space.
start_addr start address of the trace buffer
end_addr last usable address by the trace buffer true if trace buffer has been initialized. False is returned if trace buffer is already initialized.
- start_addr start address of the trace buffer
- end_addr last usable address by the trace buffer
Returns true if trace buffer has been initialized. False is returned if trace buffer is already initialized.
void trace_event(enum TraceEventID event, uint32_t arg)
This will trace event into trace buffer.
event The event that happened
arg optional argument to the event, event-specific If trace buffer was not initialized then this call does nothing. Please mind that even then the call happens and consumes CPU cycles.
- event The event that happened
- arg optional argument to the event, event-specific