pub struct MetricsCollector { /* private fields */ }
Expand description
Metrics collector that aggregates and manages all metrics.
Implementations§
Source§impl MetricsCollector
impl MetricsCollector
Sourcepub fn init(&self, interval_ms: u32) -> Result<(), &'static str>
pub fn init(&self, interval_ms: u32) -> Result<(), &'static str>
Initialize the metrics collector.
Sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
Check if metrics collection is enabled.
Sourcepub fn register_thread(&self, thread_id: ThreadId)
pub fn register_thread(&self, thread_id: ThreadId)
Register a new thread for metrics tracking.
Sourcepub fn unregister_thread(&self, thread_id: ThreadId)
pub fn unregister_thread(&self, thread_id: ThreadId)
Unregister a thread from metrics tracking.
Sourcepub fn record_cpu_time(
&self,
thread_id: ThreadId,
duration: Duration,
user_mode: bool,
)
pub fn record_cpu_time( &self, thread_id: ThreadId, duration: Duration, user_mode: bool, )
Record CPU time for a thread.
Sourcepub fn record_context_switch(&self, thread_id: ThreadId, voluntary: bool)
pub fn record_context_switch(&self, thread_id: ThreadId, voluntary: bool)
Record a context switch for a thread.
Sourcepub fn update_stack_usage(&self, thread_id: ThreadId, usage: usize)
pub fn update_stack_usage(&self, thread_id: ThreadId, usage: usize)
Update stack usage for a thread.
Sourcepub fn get_thread_metrics(&self, thread_id: ThreadId) -> Option<ThreadMetrics>
pub fn get_thread_metrics(&self, thread_id: ThreadId) -> Option<ThreadMetrics>
Get metrics for a specific thread.
Sourcepub fn get_system_metrics(&self) -> &SystemMetrics
pub fn get_system_metrics(&self) -> &SystemMetrics
Get system-wide metrics.
Sourcepub fn get_all_thread_metrics(&self) -> Vec<ThreadMetrics>
pub fn get_all_thread_metrics(&self) -> Vec<ThreadMetrics>
Get all thread metrics.
Sourcepub fn reset_metrics(&self)
pub fn reset_metrics(&self)
Reset all metrics.
Sourcepub fn generate_report(&self) -> MetricsReport
pub fn generate_report(&self) -> MetricsReport
Generate a comprehensive metrics report.
Auto Trait Implementations§
impl !Freeze for MetricsCollector
impl !RefUnwindSafe for MetricsCollector
impl Send for MetricsCollector
impl Sync for MetricsCollector
impl Unpin for MetricsCollector
impl UnwindSafe for MetricsCollector
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