| 709 | } |
| 710 | |
| 711 | fn rate_per_second( |
| 712 | previous_value: Option<u64>, |
| 713 | current_value: Option<u64>, |
| 714 | previous: Option<&RawCounterSnapshot>, |
| 715 | current: &RawCounterSnapshot, |
| 716 | ) -> Option<f64> { |
| 717 | let previous = previous?; |
| 718 | let previous_value = previous_value?; |
| 719 | let current_value = current_value?; |
| 720 | let elapsed = current |
| 721 | .timestamp_ms |
| 722 | .saturating_sub(previous.timestamp_ms) |
| 723 | .max(1) as f64 |
| 724 | / 1000.0; |
| 725 | Some((current_value.saturating_sub(previous_value) as f64) / elapsed) |
| 726 | } |
| 727 | |
| 728 | fn hang_status( |
| 729 | tracker: &mut HangTracker, |