pub struct AllocationStats {
pub total_bytes: u64,
pub total_blocks: u64,
pub peak_bytes: u64,
pub peak_blocks: u64,
}Available on crate feature
alloc-tracking only.Expand description
Snapshot of allocation activity, captured from dhat::HeapStats.
Build via AllocationStats::snapshot inside a dhat::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 dhat::HeapStats into an AllocationStats.
MUST be called inside an active dhat::Profiler::new_heap()
scope. Outside that scope, dhat panics.
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
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
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
Tests for
self and other values to be equal, and is used by ==.impl Copy for AllocationStats
impl StructuralPartialEq for AllocationStats
Auto Trait Implementations§
impl Freeze for AllocationStats
impl RefUnwindSafe for AllocationStats
impl Send for AllocationStats
impl Sync for AllocationStats
impl Unpin for AllocationStats
impl UnsafeUnpin for AllocationStats
impl UnwindSafe for AllocationStats
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more