Skip to main content

PoolStats

Struct PoolStats 

Source
pub struct PoolStats {
    pub total_allocations: AtomicU64,
    pub total_deallocations: AtomicU64,
    pub cache_hits: AtomicU64,
    pub cache_misses: AtomicU64,
    pub bytes_in_pool: AtomicUsize,
    pub peak_bytes: AtomicUsize,
    pub compactions: AtomicU64,
}
Expand description

Pool statistics

Fields§

§total_allocations: AtomicU64

Total allocations from pool

§total_deallocations: AtomicU64

Total deallocations to pool

§cache_hits: AtomicU64

Cache hits (allocated from pool)

§cache_misses: AtomicU64

Cache misses (allocated from system)

§bytes_in_pool: AtomicUsize

Current bytes in pool

§peak_bytes: AtomicUsize

Peak bytes in pool

§compactions: AtomicU64

Number of compactions

Implementations§

Source§

impl PoolStats

Source

pub fn new() -> Self

Create new statistics

Source

pub fn record_allocation(&self, from_pool: bool)

Record an allocation

Source

pub fn record_deallocation(&self, size: usize)

Record a deallocation

Source

pub fn record_compaction(&self, bytes_freed: usize)

Record a compaction

Source

pub fn hit_rate(&self) -> f64

Get cache hit rate

Source

pub fn current_size(&self) -> usize

Get current pool size

Trait Implementations§

Source§

impl Debug for PoolStats

Source§

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

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

impl Default for PoolStats

Source§

fn default() -> PoolStats

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.