pub struct AllocStats {
pub alloc_count: u64,
pub total_bytes: u64,
pub peak_bytes: u64,
pub current_bytes: u64,
pub live_count: u64,
pub peak_live_count: u64,
}Expand description
Snapshot of allocation statistics at a point in time.
Produced by ModAlloc::snapshot and Profiler::stop.
§Example
use mod_alloc::AllocStats;
let stats = AllocStats {
alloc_count: 10,
total_bytes: 1024,
peak_bytes: 512,
current_bytes: 256,
live_count: 4,
peak_live_count: 7,
};
assert_eq!(stats.alloc_count, 10);§Version note
live_count and peak_live_count were added in v0.9.4 to
support dhat-rs’s HeapStats shape via the dhat-compat
feature. Callers constructing AllocStats via struct literal
must initialise the new fields; callers that only consume
AllocStats via ModAlloc::snapshot or
Profiler::stop are unaffected.
Fields§
§alloc_count: u64Number of allocations performed.
total_bytes: u64Total bytes allocated across all allocations. Reallocations contribute the growth delta (or zero on shrink).
peak_bytes: u64Peak resident bytes (highest current_bytes ever observed).
current_bytes: u64Currently-allocated bytes (allocations minus deallocations).
live_count: u64Currently-alive allocation count (allocations minus
deallocations). Mirrors dhat::HeapStats::curr_blocks.
peak_live_count: u64Peak live allocation count (highest live_count ever
observed). Mirrors dhat::HeapStats::max_blocks.
Trait Implementations§
Source§impl Clone for AllocStats
impl Clone for AllocStats
Source§fn clone(&self) -> AllocStats
fn clone(&self) -> AllocStats
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 AllocStats
impl Debug for AllocStats
Source§impl PartialEq for AllocStats
impl PartialEq for AllocStats
Source§fn eq(&self, other: &AllocStats) -> bool
fn eq(&self, other: &AllocStats) -> bool
self and other values to be equal, and is used by ==.