1
0
mirror of https://github.com/emilk/egui.git synced 2026-06-26 22:53:14 -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

@@ -93,12 +93,6 @@ impl eframe::App for MyApp {
.store(show_deferred_viewport, Ordering::Relaxed);
});
{
// Sleep a bit to emulate some work:
puffin::profile_scope!("small_sleep");
std::thread::sleep(std::time::Duration::from_millis(10));
}
if self.show_immediate_viewport {
ctx.show_viewport_immediate(
egui::ViewportId::from_hash_of("immediate_viewport"),
@@ -121,12 +115,6 @@ impl eframe::App for MyApp {
// Tell parent viewport that we should not show next frame:
self.show_immediate_viewport = false;
}
{
// Sleep a bit to emulate some work:
puffin::profile_scope!("small_sleep");
std::thread::sleep(std::time::Duration::from_millis(10));
}
},
);
}
@@ -153,12 +141,6 @@ impl eframe::App for MyApp {
// Tell parent to close us.
show_deferred_viewport.store(false, Ordering::Relaxed);
}
{
// Sleep a bit to emulate some work:
puffin::profile_scope!("small_sleep");
std::thread::sleep(std::time::Duration::from_millis(10));
}
},
);
}