summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorMica White <botahamec@outlook.com>2026-07-03 16:17:35 -0400
committerMica White <botahamec@outlook.com>2026-07-03 16:19:17 -0400
commitf31fda79035077a9dab8dee07a11d71fac3ba791 (patch)
treea3c8eb295fd18831cb7ff803c984c32b5a823c2b /src/main.rs
parentbb7525206da1782fd9af49621aa52d87bd227838 (diff)
Profiling
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs6
1 files changed, 6 insertions, 0 deletions
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();