From f31fda79035077a9dab8dee07a11d71fac3ba791 Mon Sep 17 00:00:00 2001 From: Mica White Date: Fri, 3 Jul 2026 16:17:35 -0400 Subject: Profiling --- src/main.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index 81fffcf..14e3925 100644 --- a/src/main.rs +++ b/src/main.rs @@ -22,6 +22,7 @@ fn init_first_frame<'a>(_: &mut ScriptContext<'a>, state: &mut Box<[u8]>) { } fn render_frame_rate<'a>(ctx: &mut ScriptContext<'a>, state: &mut Box<[u8]>) { + puffin::profile_function!(); ctx.buffer.cells.clear(); let end = get_timestamp(); let last_frame_start = u128::from_ne_bytes(*state.as_array().unwrap()); @@ -47,6 +48,7 @@ fn render_frame_rate<'a>(ctx: &mut ScriptContext<'a>, state: &mut Box<[u8]>) { } fn exit_on_escape(ctx: &mut ScriptContext, _: &mut Box<[u8]>) { + puffin::profile_function!(); if ctx.input.is_key_pressed_this_frame(KeyCode::Esc) { ctx.exit(); } @@ -88,6 +90,9 @@ fn main() { manifest.first_scene, ); + let server_addr = format!("127.0.0.1:{}", puffin_http::DEFAULT_PORT); + let _puffin_server = puffin_http::Server::new(&server_addr).unwrap(); + puffin::set_scopes_on(true); buffer .render_loop(|buffer, event| match event { Event::Key(event) => { @@ -102,6 +107,7 @@ fn main() { }; scripts.run_scripts(&mut context); input.reset_next_frame(); + puffin::GlobalProfiler::lock().new_frame(); } }) .unwrap(); -- cgit v1.2.3