pub struct AllocationStats {
pub total_allocations: u64,
pub total_bytes: u64,
pub avoidable_allocations: u64,
pub avoidable_bytes: u64,
pub small_allocations: u64,
pub medium_allocations: u64,
pub large_allocations: u64,
}Expand description
Allocation statistics for hot path analysis
Fields§
§total_allocations: u64Total allocations observed
total_bytes: u64Total bytes allocated
avoidable_allocations: u64Allocations that could have been avoided
avoidable_bytes: u64Bytes that could have been saved
small_allocations: u64Small allocations (< 64 bytes)
medium_allocations: u64Medium allocations (64-1024 bytes)
large_allocations: u64Large allocations (> 1024 bytes)
Implementations§
Source§impl AllocationStats
impl AllocationStats
Sourcepub fn record_allocation(&mut self, bytes: usize, avoidable: bool)
pub fn record_allocation(&mut self, bytes: usize, avoidable: bool)
Record an allocation
Sourcepub fn waste_percentage(&self) -> f64
pub fn waste_percentage(&self) -> f64
Calculate waste percentage
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 · 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 Default for AllocationStats
impl Default for AllocationStats
Source§fn default() -> AllocationStats
fn default() -> AllocationStats
Returns the “default value” for a type. Read more
impl Copy 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more