use std::time::Duration; use performance_profiler::{change_profiler_settings, time_event_mac}; fn main() { change_profiler_settings(|s| { s.active = true; s.update_interval_sec = 1.0; }); performance_profiler::spawn_profiler_window(); loop { update(); } } #[no_mangle] #[performance_profiler::main_event_loop("MAIN")] pub fn update() { sm(32); display(); logic(); } #[performance_profiler::time_event("DISPLAY")] fn display() { sm(8); ui(); image(); } #[performance_profiler::time_event("UI")] fn ui() { sm(4); } #[performance_profiler::time_event("IMAGE")] fn image() { sm(18); } #[performance_profiler::time_event("LOGIC")] fn logic() { input(); physics(); // time_event_mac!("APPLY_INPUT", { // sm(3); // time_event_mac!("INNER_1", { // sm(3); // time_event_mac!("INNER_2", { // sm(3); // }); // }); // }); } #[performance_profiler::time_event("INPUT")] fn input() { sm(9); } #[performance_profiler::time_event("PHYSICS")] fn physics() { sm(19); } // small delay fn sm(mills: u64) { std::thread::sleep(Duration::from_millis(mills)); }