pub struct MemoryTracker {
pub total_allocated: AtomicU64,
pub peak_usage: AtomicU64,
pub allocation_count: AtomicU64,
}Expand description
Memory usage tracker for monitoring allocation patterns.
Fields§
§total_allocated: AtomicU64Total bytes allocated
peak_usage: AtomicU64Peak memory usage in bytes
allocation_count: AtomicU64Current allocation count
Implementations§
Source§impl MemoryTracker
impl MemoryTracker
Sourcepub fn record_allocation(&self, size: u64)
pub fn record_allocation(&self, size: u64)
Record an allocation of the specified size.
Sourcepub fn record_deallocation(&self, size: u64)
pub fn record_deallocation(&self, size: u64)
Record a deallocation of the specified size.
Sourcepub fn get_stats(&self) -> MemoryStats
pub fn get_stats(&self) -> MemoryStats
Get current memory usage statistics.
Trait Implementations§
Source§impl Debug for MemoryTracker
impl Debug for MemoryTracker
Source§impl Default for MemoryTracker
impl Default for MemoryTracker
Source§fn default() -> MemoryTracker
fn default() -> MemoryTracker
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !Freeze for MemoryTracker
impl RefUnwindSafe for MemoryTracker
impl Send for MemoryTracker
impl Sync for MemoryTracker
impl Unpin for MemoryTracker
impl UnsafeUnpin for MemoryTracker
impl UnwindSafe for MemoryTracker
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