1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-31 13:50:04 -04:00

Much more accurate cpu_usage timing (#3913)

`frame.info.cpu_usage` now includes time for tessellation and rendering,
but excludes vsync and context switching.
This commit is contained in:
Emil Ernerfeldt
2024-01-29 19:12:16 +01:00
committed by GitHub
parent 6a94f4f5f0
commit ab39420c29
12 changed files with 123 additions and 63 deletions

View File

@@ -30,11 +30,16 @@ fn paint_if_needed(runner: &mut AppRunner) {
// running the logic, as the logic could cause it to be set again.
runner.needs_repaint.clear();
let mut stopwatch = crate::stopwatch::Stopwatch::new();
stopwatch.start();
// Run user code…
runner.logic();
// …and paint the result.
runner.paint();
runner.report_frame_time(stopwatch.total_time_sec());
}
}
runner.auto_save_if_needed();