pub struct PeakMemorySampler { /* private fields */ }Expand description
Tracks the peak resident set size (RSS) of the current process across a profiling run.
Engines call sample at chunk/batch boundaries and
sample_now once at the end; the peak observed feeds
ExecutionMetadata::memory_peak_mb. The reading is the
whole-process RSS, so on embedded surfaces (e.g. the Python extension) it
includes host-process memory — it is an upper bound on what profiling used,
suitable for verifying the bounded-memory claim, not an exact attribution.
Implementations§
Source§impl PeakMemorySampler
impl PeakMemorySampler
Sourcepub fn sample(&mut self)
pub fn sample(&mut self)
Sample unless the previous sample is less than [MIN_SAMPLE_INTERVAL]
old. For per-chunk calls inside a loop.
Sourcepub fn sample_now(&mut self)
pub fn sample_now(&mut self)
Refresh the process RSS and fold it into the running peak, whatever the interval. For the final reading of a run, so the reported peak covers the work done after the last throttled sample.