Get idle duration in milliseconds.
(&self)
| 332 | |
| 333 | /// Get idle duration in milliseconds. |
| 334 | pub fn get_idle_duration_ms(&self) -> u64 { |
| 335 | let last = self.last_activity.load(Ordering::Relaxed); |
| 336 | let now = std::time::SystemTime::now() |
| 337 | .duration_since(std::time::UNIX_EPOCH) |
| 338 | .unwrap() |
| 339 | .as_millis() as u64; |
| 340 | now.saturating_sub(last) |
| 341 | } |
| 342 | |
| 343 | /// Check if agent is idle and create idle event if threshold exceeded. |
| 344 | pub fn check_idle(&self) -> Option<IdleEvent> { |