Skip to main content

Module probe

Module probe 

Source
Expand description

Optional probe instrumentation. With the probe feature off this is a tiny module of no-op stubs and pays zero cost. Optional fine-grained timing + RSS instrumentation.

Behind the probe feature flag every [Probe::span] returns a guard that records the elapsed wall-clock on Drop, and [Probe::sample_rss] records a labelled RSS checkpoint. Events are buffered in a per-thread Vec and drained by the consumer with [Probe::drain].

With the feature off every method is a #[inline(always)] no-op so release builds without the feature pay zero cost.

Consumer (e.g. servo-shot) groups drained events by name to produce the per-phase averages / p99s in its trace report.

Structs§

Event
Drained probe event. Vec<Event> is what consumers walk to render trace summaries; the order is the order events fired in.
Probe
Probe API. All methods are no-ops without the probe feature.
Span
Re-exported guard. Held by the caller of Probe::span.

Enums§

EventKind

Functions§

detail_enabled
emit_phase_heap
emit_phase_heap_extra
hint_purge_allocator
Ask the active global allocator to return freed pages to the OS.
malloc_heap_bytes
monotonic_now_nanos
Same monotonic clock used by font::parsed::monotonic_now_nanos for LRU stamping. Re-exported here so any caller that wants raw nanos without going through a span guard has one source of truth.
print_drained_events
Format drained probe events as a per-phase timing table to stderr.
reset_peak
sample_peak_rss
Convenience wrapper: sample the process’s current resident set (not peak) via task_info on macOS / /proc/self/statm on Linux and push it into the probe event buffer under the given label.
sample_phase_peak