pub struct AllocationStats {
pub total_bytes: u64,
pub total_blocks: u64,
pub peak_bytes: u64,
pub peak_blocks: u64,
}alloc-tracking only.Expand description
Snapshot of allocation activity, captured from
mod_alloc::dhat_compat::HeapStats (drop-in for
dhat::HeapStats).
Build via AllocationStats::snapshot inside a
mod_alloc::dhat_compat::Profiler scope.
Fields§
§total_bytes: u64Total bytes allocated across the profiled scope (cumulative).
total_blocks: u64Total number of allocations across the profiled scope.
peak_bytes: u64Peak bytes resident at any one time.
peak_blocks: u64Peak number of blocks resident at any one time.
Implementations§
Source§impl AllocationStats
impl AllocationStats
Sourcepub fn snapshot() -> Self
pub fn snapshot() -> Self
Capture the current HeapStats into an AllocationStats.
SHOULD be called inside an active
mod_alloc::dhat_compat::Profiler::new_heap() scope so the
profiler’s drop-time JSON write captures the same data. The
snapshot itself works outside a Profiler scope (returns
zeros if no global allocator is installed); the historical
dhat-rs panic is no longer present.
Sourcepub fn compare_against_baseline(
&self,
name: &str,
baseline: Option<AllocationStats>,
pct_threshold: f64,
) -> CheckResult
pub fn compare_against_baseline( &self, name: &str, baseline: Option<AllocationStats>, pct_threshold: f64, ) -> CheckResult
Compare this snapshot against a baseline.
pct_threshold is the maximum tolerated growth in
total_bytes over the baseline. A regression beyond the
threshold yields Fail (Warning). No baseline yields Skip.
Trait Implementations§
Source§impl Clone for AllocationStats
impl Clone for AllocationStats
Source§fn clone(&self) -> AllocationStats
fn clone(&self) -> AllocationStats
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AllocationStats
impl Debug for AllocationStats
Source§impl PartialEq for AllocationStats
impl PartialEq for AllocationStats
Source§fn eq(&self, other: &AllocationStats) -> bool
fn eq(&self, other: &AllocationStats) -> bool
self and other values to be equal, and is used by ==.