MetricsCollector

Struct MetricsCollector 

Source
pub struct MetricsCollector { /* private fields */ }
Expand description

Metrics collector that aggregates and manages all metrics.

Implementations§

Source§

impl MetricsCollector

Source

pub const fn new() -> Self

Create a new metrics collector.

Source

pub fn init(&self, interval_ms: u32) -> Result<(), &'static str>

Initialize the metrics collector.

Source

pub fn is_enabled(&self) -> bool

Check if metrics collection is enabled.

Source

pub fn register_thread(&self, thread_id: ThreadId)

Register a new thread for metrics tracking.

Source

pub fn unregister_thread(&self, thread_id: ThreadId)

Unregister a thread from metrics tracking.

Source

pub fn record_cpu_time( &self, thread_id: ThreadId, duration: Duration, user_mode: bool, )

Record CPU time for a thread.

Source

pub fn record_context_switch(&self, thread_id: ThreadId, voluntary: bool)

Record a context switch for a thread.

Source

pub fn update_stack_usage(&self, thread_id: ThreadId, usage: usize)

Update stack usage for a thread.

Source

pub fn get_thread_metrics(&self, thread_id: ThreadId) -> Option<ThreadMetrics>

Get metrics for a specific thread.

Source

pub fn get_system_metrics(&self) -> &SystemMetrics

Get system-wide metrics.

Source

pub fn get_all_thread_metrics(&self) -> Vec<ThreadMetrics>

Get all thread metrics.

Source

pub fn reset_metrics(&self)

Reset all metrics.

Source

pub fn generate_report(&self) -> MetricsReport

Generate a comprehensive metrics report.

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.