Introduce a ZED_MEASUREMENTS env var and use it to measure frame time

This commit is contained in:
Antonio Scandurra 2024-01-22 11:37:14 +01:00
parent 10ca33ce02
commit de64de22a3
3 changed files with 37 additions and 6 deletions

View file

@ -34,7 +34,7 @@ use std::{
Arc,
},
};
use util::ResultExt;
use util::{measure, ResultExt};
mod element_cx;
pub use element_cx::*;
@ -310,7 +310,9 @@ impl Window {
platform_window.on_request_frame(Box::new({
let mut cx = cx.to_async();
move || {
handle.update(&mut cx, |_, cx| cx.draw()).log_err();
measure("frame duration", || {
handle.update(&mut cx, |_, cx| cx.draw()).log_err();
})
}
}));
platform_window.on_resize(Box::new({