Skip to main content

Module kernel_trace

Module kernel_trace 

Source
Expand description

Compile-time gated kernel tracing (plan #7).

Borrowed from MAX’s Trace, TraceLevel, trace_arg pattern. Tracing calls are baked into hot paths but the macro expands to either a stamped eprintln! (when the kernel-trace feature is on) or to nothing (default). The compiler eliminates the disabled branch entirely — production builds pay zero overhead.

Use it like:

rlx_runtime::ktrace!("matmul", "m={m} k={k} n={n}");

The macro takes a kind (op/section name) and a format string plus args. Output is namespaced with [ktrace:<kind>] and includes a monotonic timestamp from rlx_ir::Tick.