Skip to main content

sample

Function sample 

Source
pub fn sample() -> Option<usize>
Expand description

Records the calling thread’s current depth and returns it.

This is the cheap, always-available way to feed the aggregates: a handful of relaxed atomic operations, every one of them on the calling thread’s own cache lines. Put it wherever a program already has a natural tick — a request handler, a scheduler loop, an event dispatch — and the depth distribution and per-thread peaks follow from it.