pub struct MemoryMonitor { /* private fields */ }Expand description
Memory monitor for tracking system memory usage
Implementations§
Source§impl MemoryMonitor
impl MemoryMonitor
Sourcepub fn new(config: MemoryMonitorConfig) -> Self
pub fn new(config: MemoryMonitorConfig) -> Self
Create a new memory monitor
Sourcepub fn current_usage(&self) -> MemoryUsage
pub fn current_usage(&self) -> MemoryUsage
Get current memory usage
Sourcepub fn usage_history(&self) -> Vec<MemoryUsage>
pub fn usage_history(&self) -> Vec<MemoryUsage>
Get memory usage history
Sourcepub fn add_callback(&self, callback: Box<dyn Fn(&MemoryUsage) + Send + Sync>)
pub fn add_callback(&self, callback: Box<dyn Fn(&MemoryUsage) + Send + Sync>)
Add memory event callback
Sourcepub fn is_above_threshold(&self, threshold: f64) -> bool
pub fn is_above_threshold(&self, threshold: f64) -> bool
Check if memory usage is above threshold
Sourcepub fn get_statistics(&self) -> MemoryStatistics
pub fn get_statistics(&self) -> MemoryStatistics
Get memory statistics summary
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MemoryMonitor
impl !RefUnwindSafe for MemoryMonitor
impl Send for MemoryMonitor
impl Sync for MemoryMonitor
impl Unpin for MemoryMonitor
impl !UnwindSafe for MemoryMonitor
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> 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