pub struct PerformanceMonitor {
pub metrics_history: Arc<Mutex<VecDeque<PerformanceMetrics>>>,
pub resource_usage: Arc<Mutex<VecDeque<ResourceUsage>>>,
pub worker_metrics: HashMap<usize, WorkerMetrics>,
pub config: MonitoringConfig,
pub alert_thresholds: AlertThresholds,
pub start_time: Instant,
}Expand description
Performance monitoring coordinator
Fields§
§metrics_history: Arc<Mutex<VecDeque<PerformanceMetrics>>>§resource_usage: Arc<Mutex<VecDeque<ResourceUsage>>>§worker_metrics: HashMap<usize, WorkerMetrics>§config: MonitoringConfig§alert_thresholds: AlertThresholds§start_time: InstantImplementations§
Source§impl PerformanceMonitor
impl PerformanceMonitor
Sourcepub fn new(config: MonitoringConfig) -> Self
pub fn new(config: MonitoringConfig) -> Self
Create new performance monitor
Sourcepub fn register_worker(&mut self, workerid: usize)
pub fn register_worker(&mut self, workerid: usize)
Register worker for monitoring
Sourcepub fn record_performance_metrics(
&self,
metrics: PerformanceMetrics,
) -> Result<()>
pub fn record_performance_metrics( &self, metrics: PerformanceMetrics, ) -> Result<()>
Record performance metrics
Sourcepub fn record_resource_usage(&self, usage: ResourceUsage) -> Result<()>
pub fn record_resource_usage(&self, usage: ResourceUsage) -> Result<()>
Record resource usage metrics
Sourcepub fn update_worker_metrics(
&mut self,
worker_id: usize,
cpu_usage: f64,
memory_usage: f64,
throughput: f64,
latency: f64,
) -> Result<()>
pub fn update_worker_metrics( &mut self, worker_id: usize, cpu_usage: f64, memory_usage: f64, throughput: f64, latency: f64, ) -> Result<()>
Update worker metrics
Sourcepub fn check_alerts(&self) -> Result<Vec<PerformanceAlert>>
pub fn check_alerts(&self) -> Result<Vec<PerformanceAlert>>
Check for performance alerts
Sourcepub fn analyze_system_efficiency(&self) -> Result<EfficiencyAnalysis>
pub fn analyze_system_efficiency(&self) -> Result<EfficiencyAnalysis>
Perform comprehensive system analysis
Sourcepub fn generate_report(&self) -> MonitoringReport
pub fn generate_report(&self) -> MonitoringReport
Generate monitoring report
Sourcepub fn export_metrics_csv(&self, filepath: &str) -> Result<()>
pub fn export_metrics_csv(&self, filepath: &str) -> Result<()>
Export metrics for external analysis
Sourcepub fn get_worker_metrics(&self) -> &HashMap<usize, WorkerMetrics>
pub fn get_worker_metrics(&self) -> &HashMap<usize, WorkerMetrics>
Get current worker metrics
Sourcepub fn get_config(&self) -> &MonitoringConfig
pub fn get_config(&self) -> &MonitoringConfig
Get monitoring configuration
Sourcepub fn get_uptime(&self) -> Duration
pub fn get_uptime(&self) -> Duration
Get system uptime
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PerformanceMonitor
impl RefUnwindSafe for PerformanceMonitor
impl Send for PerformanceMonitor
impl Sync for PerformanceMonitor
impl Unpin for PerformanceMonitor
impl UnwindSafe for PerformanceMonitor
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.