pub struct MemoryMonitor {
pub active_timers: Arc<AtomicU64>,
pub active_tasks: Arc<AtomicU64>,
pub channel_depth: Arc<AtomicU64>,
pub messages_processed: Arc<AtomicU64>,
pub peak_memory_bytes: Arc<AtomicU64>,
}Expand description
Memory usage statistics and monitoring.
Fields§
§active_timers: Arc<AtomicU64>Number of active timers
active_tasks: Arc<AtomicU64>Number of spawned tasks
channel_depth: Arc<AtomicU64>Current channel buffer depth
messages_processed: Arc<AtomicU64>Total messages processed
peak_memory_bytes: Arc<AtomicU64>Peak memory usage (if available)
Implementations§
Source§impl MemoryMonitor
impl MemoryMonitor
Sourcepub fn timer_added(&self)
pub fn timer_added(&self)
Increment the timer count.
Sourcepub fn timer_removed(&self)
pub fn timer_removed(&self)
Decrement the timer count.
Sourcepub fn get_active_timers(&self) -> u64
pub fn get_active_timers(&self) -> u64
Get the current number of active timers.
Sourcepub fn task_spawned(&self)
pub fn task_spawned(&self)
Increment the task count.
Sourcepub fn task_completed(&self)
pub fn task_completed(&self)
Decrement the task count.
Sourcepub fn get_active_tasks(&self) -> u64
pub fn get_active_tasks(&self) -> u64
Get the current number of active tasks.
Sourcepub fn set_channel_depth(&self, depth: u64)
pub fn set_channel_depth(&self, depth: u64)
Update the channel depth.
Sourcepub fn get_channel_depth(&self) -> u64
pub fn get_channel_depth(&self) -> u64
Get the current channel depth.
Sourcepub fn message_processed(&self)
pub fn message_processed(&self)
Increment the message count.
Sourcepub fn get_messages_processed(&self) -> u64
pub fn get_messages_processed(&self) -> u64
Get the total number of messages processed.
Sourcepub fn update_peak_memory(&self, bytes: u64)
pub fn update_peak_memory(&self, bytes: u64)
Update peak memory usage (if tracking is enabled).
Sourcepub fn get_peak_memory_bytes(&self) -> u64
pub fn get_peak_memory_bytes(&self) -> u64
Get the peak memory usage.
Sourcepub fn snapshot(&self) -> MemorySnapshot
pub fn snapshot(&self) -> MemorySnapshot
Get a snapshot of all current metrics.
Sourcepub fn check_health(&self) -> MemoryHealth
pub fn check_health(&self) -> MemoryHealth
Check if any metrics indicate potential memory issues.
Trait Implementations§
Source§impl Clone for MemoryMonitor
impl Clone for MemoryMonitor
Source§fn clone(&self) -> MemoryMonitor
fn clone(&self) -> MemoryMonitor
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 MemoryMonitor
impl Debug for MemoryMonitor
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