PerformanceTracker

Struct PerformanceTracker 

Source
pub struct PerformanceTracker<T = f32> { /* private fields */ }
Expand description

Tracks performance metrics over time to identify trends

Implementations§

Source§

impl<T> PerformanceTracker<T>

Source

pub fn new() -> Self
where T: Default,

Create a new performance tracker

Source

pub fn record_metrics(&mut self, metrics: ResourceMetrics<T>)
where T: Clone + FromPrimitive,

Record a new set of metrics

Source

pub fn record_indicator( &mut self, name: &str, timestamp: Timestamp<u64>, value: T, )

Record an individual indicator

Source

pub fn record_event(&mut self, event: &str, value: Option<T>)

Record a significant performance event

Source

pub fn get_trend(&self, indicator: &str) -> Option<T>
where T: Copy + FromPrimitive + Num,

Get the trend for a specific indicator

Source

pub fn get_indicator_history( &self, indicator: &str, ) -> Option<&VecDeque<(Timestamp<u64>, T)>>

Get the full history of an indicator

Source

pub fn latest_metrics(&self) -> Option<&ResourceMetrics<T>>

Get the most recent metrics

Source

pub fn recent_events( &self, count: usize, ) -> Vec<(Timestamp<u64>, String, Option<T>)>
where T: Clone,

Get recent performance events

Source

pub fn generate_trend_report(&self) -> String
where T: Copy + FromPrimitive + Num + PartialOrd + Display + Neg<Output = T>,

Generate a performance trend report