Skip to main content

Module profile

Module profile 

Source
Expand description

DWT-based framing instrumentation (enabled by the profile feature).

Accumulates cycle counts and byte counts for each COBS encode/decode operation in process_frame. The counters are stored in module-level statics so they survive across multiple poll() calls.

Call init_dwt once at startup (done automatically by [TelepathServer::new] when profile is enabled) to enable the Cortex-M DWT cycle counter.

Retrieve and atomically reset all counters by calling snapshot_and_reset, or equivalently by sending CmdID 0xFFFE (CMD_ID_METRICS) from the host.

Constants§

GET_METRICS_CMD

Functions§

cycles_now
Read the current DWT cycle counter value. Returns 0 on non-ARM targets (e.g. x86_64 host-pty-server).
init_dwt
Enable the Cortex-M DWT cycle counter.
snapshot_and_reset
Return the current metrics snapshot and atomically reset all counters.