Skip to main content

AllocatorStats

Struct AllocatorStats 

Source
pub struct AllocatorStats {
    pub total_allocations: AtomicU64,
    pub total_deallocations: AtomicU64,
    pub bytes_allocated: AtomicUsize,
    pub peak_bytes_allocated: AtomicUsize,
    pub allocation_failures: AtomicU64,
    pub slab_hits: AtomicU64,
    pub slab_misses: AtomicU64,
}
Expand description

Statistics for allocator performance tracking

Fields§

§total_allocations: AtomicU64

Total number of allocations

§total_deallocations: AtomicU64

Total number of deallocations

§bytes_allocated: AtomicUsize

Current bytes allocated

§peak_bytes_allocated: AtomicUsize

Peak bytes allocated

§allocation_failures: AtomicU64

Number of allocation failures

§slab_hits: AtomicU64

Number of slab hits

§slab_misses: AtomicU64

Number of slab misses

Implementations§

Source§

impl AllocatorStats

Source

pub fn new() -> Self

Create new statistics

Source

pub fn record_allocation(&self, size: usize)

Record an allocation

Source

pub fn record_deallocation(&self, size: usize)

Record a deallocation

Source

pub fn record_failure(&self)

Record an allocation failure

Source

pub fn record_slab_hit(&self)

Record a slab hit

Source

pub fn record_slab_miss(&self)

Record a slab miss

Source

pub fn current_allocations(&self) -> u64

Get current allocation count

Source

pub fn slab_hit_rate(&self) -> f64

Get slab hit rate

Trait Implementations§

Source§

impl Debug for AllocatorStats

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for AllocatorStats

Source§

fn default() -> AllocatorStats

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.