Snapshot the rolling averages in a stable, CPU-time-descending order. Games call this once per overlay-draw frame and pull label/cpu/gpu out via the accessors below — HashMap iteration order would jitter the overlay otherwise.
(&mut self)
| 351 | /// label/cpu/gpu out via the accessors below — HashMap iteration |
| 352 | /// order would jitter the overlay otherwise. |
| 353 | pub fn snapshot(&mut self) -> Vec<(&'static str, f64, Option<f64>)> { |
| 354 | let mut v: Vec<(&'static str, f64, Option<f64>)> = self.rolling.iter() |
| 355 | .map(|(k, s)| (*k, s.avg_cpu(), s.avg_gpu())) |
| 356 | .collect(); |
| 357 | v.sort_by(|a, b| b.1.partial_cmp(&a.1).unwrap_or(std::cmp::Ordering::Equal)); |
| 358 | v |
| 359 | } |
| 360 | } |
| 361 | |
| 362 | #[cfg(test)] |
no test coverage detected