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

Method summary

native/shared/src/profiler.rs:315–336  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

313 }
314
315 pub fn summary(&self) -> String {
316 if !self.enabled {
317 return String::from("profiler: disabled\n");
318 }
319 let mut entries: Vec<(&&str, &RollingStats)> = self.rolling.iter()
320 .map(|(k, v)| (k, v))
321 .collect();
322 entries.sort_by(|a, b| b.1.avg_cpu().partial_cmp(&a.1.avg_cpu()).unwrap_or(std::cmp::Ordering::Equal));
323
324 let mut out = String::new();
325 out.push_str(&format!(
326 "profiler (avg over last {} frames, gpu={}):\n",
327 ROLLING_FRAMES.min(entries.first().map(|(_,s)| s.filled).unwrap_or(0)),
328 if self.gpu_enabled { "yes" } else { "no" },
329 ));
330 out.push_str(" phase cpu us gpu us\n");
331 for (label, stats) in entries {
332 let gpu = stats.avg_gpu().map(|v| format!("{:>9.1}", v)).unwrap_or_else(|| " -".to_string());
333 out.push_str(&format!(" {:<28} {:>9.1} {}\n", label, stats.avg_cpu(), gpu));
334 }
335 out
336 }
337
338 /// Average total CPU frame time across the rolling window (sum of
339 /// all phases). Useful for a single headline number.

Callers 2

Calls 3

iterMethod · 0.80
avg_cpuMethod · 0.80
avg_gpuMethod · 0.80

Tested by

no test coverage detected