pub struct MemoryUsage {
pub allocated: u64,
pub peak: u64,
pub allocations: u64,
pub deallocations: u64,
pub fragmentation: f64,
pub updated_at: SystemTime,
}Expand description
Memory usage tracking
Fields§
§allocated: u64Current allocated memory in bytes
peak: u64Peak memory usage in bytes
allocations: u64Number of allocations
deallocations: u64Number of deallocations
fragmentation: f64Memory fragmentation ratio
updated_at: SystemTimeLast update timestamp
Implementations§
Source§impl MemoryUsage
impl MemoryUsage
Sourcepub fn update(&mut self, allocated: u64, allocations: u64, deallocations: u64)
pub fn update(&mut self, allocated: u64, allocations: u64, deallocations: u64)
Update memory statistics
Sourcepub fn utilization(&self, total_available: u64) -> f64
pub fn utilization(&self, total_available: u64) -> f64
Get current utilization ratio (0.0 - 1.0)
Sourcepub fn is_critical(&self, threshold: f64, total_available: u64) -> bool
pub fn is_critical(&self, threshold: f64, total_available: u64) -> bool
Check if memory usage is critical
Trait Implementations§
Source§impl Clone for MemoryUsage
impl Clone for MemoryUsage
Source§fn clone(&self) -> MemoryUsage
fn clone(&self) -> MemoryUsage
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 MemoryUsage
impl Debug for MemoryUsage
Auto Trait Implementations§
impl Freeze for MemoryUsage
impl RefUnwindSafe for MemoryUsage
impl Send for MemoryUsage
impl Sync for MemoryUsage
impl Unpin for MemoryUsage
impl UnwindSafe for MemoryUsage
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