pub struct SystemMetrics {Show 17 fields
pub threads_created: AtomicU64,
pub threads_destroyed: AtomicU64,
pub active_threads: AtomicU64,
pub total_context_switches: AtomicU64,
pub total_cpu_time_ns: AtomicU64,
pub system_uptime_ns: AtomicU64,
pub timer_interrupts: AtomicU64,
pub scheduler_decisions: AtomicU64,
pub load_balance_ops: AtomicU64,
pub pool_allocations: AtomicU64,
pub pool_deallocations: AtomicU64,
pub stack_overflows: AtomicU64,
pub priority_inversions: AtomicU64,
pub deadlocks_detected: AtomicU64,
pub system_start_time: Instant,
pub peak_memory_usage: AtomicU64,
pub current_memory_usage: AtomicU64,
}
Expand description
System-wide metrics.
Fields§
§threads_created: AtomicU64
Total number of threads created
threads_destroyed: AtomicU64
Total number of threads destroyed
active_threads: AtomicU64
Current number of active threads
total_context_switches: AtomicU64
Total context switches across all threads
total_cpu_time_ns: AtomicU64
Total CPU time across all threads (nanoseconds)
system_uptime_ns: AtomicU64
System uptime (nanoseconds)
timer_interrupts: AtomicU64
Timer interrupts processed
scheduler_decisions: AtomicU64
Scheduler decisions made
load_balance_ops: AtomicU64
Load balancing operations
pool_allocations: AtomicU64
Memory pool allocations
pool_deallocations: AtomicU64
Memory pool deallocations
stack_overflows: AtomicU64
Stack overflows detected
priority_inversions: AtomicU64
Priority inversions detected
deadlocks_detected: AtomicU64
Deadlocks detected
system_start_time: Instant
System start time
peak_memory_usage: AtomicU64
Peak memory usage (bytes)
current_memory_usage: AtomicU64
Current memory usage (bytes)
Implementations§
Source§impl SystemMetrics
impl SystemMetrics
Sourcepub fn record_thread_created(&self)
pub fn record_thread_created(&self)
Record thread creation.
Sourcepub fn record_thread_destroyed(&self)
pub fn record_thread_destroyed(&self)
Record thread destruction.
Sourcepub fn record_context_switch(&self)
pub fn record_context_switch(&self)
Record a context switch.
Sourcepub fn add_cpu_time(&self, duration: Duration)
pub fn add_cpu_time(&self, duration: Duration)
Add CPU time to system total.
Sourcepub fn record_timer_interrupt(&self)
pub fn record_timer_interrupt(&self)
Record timer interrupt.
Sourcepub fn record_scheduler_decision(&self)
pub fn record_scheduler_decision(&self)
Record scheduler decision.
Sourcepub fn update_memory_usage(&self, new_usage: u64)
pub fn update_memory_usage(&self, new_usage: u64)
Update memory usage.
Sourcepub fn system_cpu_utilization(&self) -> f64
pub fn system_cpu_utilization(&self) -> f64
Calculate system CPU utilization.
Sourcepub fn context_switches_per_second(&self) -> f64
pub fn context_switches_per_second(&self) -> f64
Get average context switches per second.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for SystemMetrics
impl RefUnwindSafe for SystemMetrics
impl Send for SystemMetrics
impl Sync for SystemMetrics
impl Unpin for SystemMetrics
impl UnwindSafe for SystemMetrics
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