Struct mnemos_alloc::heap::stats::State
source · #[non_exhaustive]pub struct State {
pub allocating: u16,
pub deallocating: u16,
pub is_oom: bool,
pub total_bytes: usize,
pub allocated_bytes: usize,
pub alloc_success_count: usize,
pub alloc_oom_count: usize,
pub dealloc_count: usize,
}
stats
only.Expand description
A snapshot of the current state of the heap.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.allocating: u16
A count of the total number of concurrently executing calls to
alloc()
.
If this is 0, no CPU cores are currently allocating.
deallocating: u16
A count of the total number of concurrently executing calls to
dealloc()
.
If this is 0, no CPU cores are currently allocating.
is_oom: bool
If this is true
, an allocation request could not be satisfied
because there was insufficient memory. That allocation request may
be queued.
total_bytes: usize
The total size of the heap, in bytes. This includes memory that is currently allocated.
allocated_bytes: usize
The amount of memory currently allocated, in bytes.
alloc_success_count: usize
The total number of times an allocation attempt has succeeded, over the lifetime of this heap.
alloc_oom_count: usize
The total number of times an allocation attempt could not be fulfilled because there was insufficient space, over the lifetime of this heap.
dealloc_count: usize
The total number of times an allocation has been freed, over the lifetime of this heap.
Implementations§
source§impl State
impl State
sourcepub fn free_bytes(&self) -> usize
pub fn free_bytes(&self) -> usize
Returns the current amount of free space in the heap, in bytes.
This is calculated by subtracting [self.allocated_bytes
] from
[self.total_bytes
].
sourcepub fn alloc_attempt_count(&self) -> usize
pub fn alloc_attempt_count(&self) -> usize
Returns the total number of allocation attempts that have been requested from this heap (successes or failures).
This is the sum of [self.alloc_success_count
] and
[self.alloc_oom_count
].
sourcepub fn live_alloc_count(&self) -> usize
pub fn live_alloc_count(&self) -> usize
Returns the number of currently “live” allocations at the current point in time.
This is calculated by subtracting [self.dealloc_count
] (the number
of allocations which have been freed) from
[self.alloc_success_count
] (the total number of allocations).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for State
impl RefUnwindSafe for State
impl Send for State
impl Sync for State
impl Unpin for State
impl UnwindSafe for State
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)