MCPcopy Create free account
hub / github.com/Bloom-Engine/engine / snapshot

Method snapshot

native/shared/src/profiler.rs:353–359  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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)]

Calls 3

iterMethod · 0.80
avg_cpuMethod · 0.80
avg_gpuMethod · 0.80

Tested by

no test coverage detected