Skip to main content

scirs2_core/profiling/
continuousmonitoring.rs

1//! Continuous monitoring functionality
2
3use std::sync::atomic::{AtomicBool, Ordering};
4use std::sync::Arc;
5use std::time::Duration;
6
7/// Continuous monitoring system
8pub struct ContinuousMonitor {
9    running: Arc<AtomicBool>,
10    interval: Duration,
11}
12
13impl ContinuousMonitor {
14    /// Create new continuous monitor
15    pub fn new(interval: Duration) -> Self {
16        Self {
17            running: Arc::new(AtomicBool::new(false)),
18            interval,
19        }
20    }
21
22    /// Start monitoring
23    pub fn start(&self) {
24        self.running.store(true, Ordering::SeqCst);
25    }
26
27    /// Stop monitoring
28    pub fn stop(&self) {
29        self.running.store(false, Ordering::SeqCst);
30    }
31
32    /// Check if running
33    pub fn is_running(&self) -> bool {
34        self.running.load(Ordering::SeqCst)
35    }
36}