pub struct MemoryMonitor { /* private fields */ }Expand description
Memory monitor for network components
Implementations§
Source§impl MemoryMonitor
impl MemoryMonitor
Sourcepub fn new(config: MemoryMonitorConfig) -> Result<Self, MemoryMonitorError>
pub fn new(config: MemoryMonitorConfig) -> Result<Self, MemoryMonitorError>
Create a new memory monitor
Sourcepub fn record_usage(
&self,
component: &str,
bytes: usize,
) -> Result<(), MemoryMonitorError>
pub fn record_usage( &self, component: &str, bytes: usize, ) -> Result<(), MemoryMonitorError>
Record memory usage for a component
Sourcepub fn get_usage(&self, component: &str) -> Result<usize, MemoryMonitorError>
pub fn get_usage(&self, component: &str) -> Result<usize, MemoryMonitorError>
Get current memory usage for a component
Sourcepub fn total_usage(&self) -> usize
pub fn total_usage(&self) -> usize
Get total memory usage
Sourcepub fn needs_cleanup(&self) -> bool
pub fn needs_cleanup(&self) -> bool
Check if cleanup is needed
Sourcepub fn detect_leak(&self) -> Option<f64>
pub fn detect_leak(&self) -> Option<f64>
Detect memory leaks based on growth rate
Sourcepub fn stats(&self) -> MemoryStats
pub fn stats(&self) -> MemoryStats
Get memory statistics
Sourcepub fn mark_cleanup(&self)
pub fn mark_cleanup(&self)
Mark that cleanup was performed
Sourcepub fn reset_stats(&self)
pub fn reset_stats(&self)
Reset statistics
Sourcepub fn component_names(&self) -> Vec<String>
pub fn component_names(&self) -> Vec<String>
Get component names
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<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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