SystemMetrics

Struct SystemMetrics 

Source
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

Source

pub const fn new() -> Self

Create new system metrics.

Source

pub fn init(&self)

Initialize system metrics with current time.

Source

pub fn record_thread_created(&self)

Record thread creation.

Source

pub fn record_thread_destroyed(&self)

Record thread destruction.

Source

pub fn record_context_switch(&self)

Record a context switch.

Source

pub fn add_cpu_time(&self, duration: Duration)

Add CPU time to system total.

Source

pub fn record_timer_interrupt(&self)

Record timer interrupt.

Source

pub fn record_scheduler_decision(&self)

Record scheduler decision.

Source

pub fn update_memory_usage(&self, new_usage: u64)

Update memory usage.

Source

pub fn system_cpu_utilization(&self) -> f64

Calculate system CPU utilization.

Source

pub fn context_switches_per_second(&self) -> f64

Get average context switches per second.

Trait Implementations§

Source§

impl Debug for SystemMetrics

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.