pub fn sample_peak_rss_mb_while(
duration: Duration,
poll_interval: Duration,
should_continue: impl FnMut() -> bool,
) -> f64Expand description
Like sample_peak_rss_mb, but stops early once should_continue returns
false. The predicate is checked before each sample, so a caller measuring a
burst can release the sampler as soon as the burst ends instead of waiting out
a worst-case timeout. Intended for blocking threads (e.g. spawn_blocking):
each poll is a syscall followed by thread::sleep, which must not run on a
Tokio worker.