added estimated frame response time

This commit is contained in:
2025-05-06 23:38:07 +02:00
parent 42ef932f5e
commit 7aa8c0d139

View File

@@ -268,6 +268,7 @@ fn main() {
let p_detect = multi_stats.add(ProgressBar::new(100).with_prefix("Detect").with_style(p_style.clone()));
let p_max = multi_stats.add(ProgressBar::new(100).with_prefix("Pipeline load").with_style(ProgressStyle::default_bar().template("{prefix:15} {bar:50.red/white} {percent:>3}%").unwrap()));
let p_avg_ms = multi_stats.add(ProgressBar::new(100).with_prefix("Pipeline delay").with_style(ProgressStyle::default_bar().template("{prefix:15} {bar:50.cyan/white} {pos:>3} ms").unwrap()));
let p_framerate = multi_stats.add(ProgressBar::new(150).with_prefix("Framerate").with_style(ProgressStyle::default_bar().template("{prefix:15} {bar:50.blue/white} {pos:>3} FPS").unwrap()));
let window = create_window("image", Default::default()).unwrap();
@@ -297,7 +298,9 @@ fn main() {
p_detect.set_position((u_detect / u_total * 100.0) as u64);
p_max.set_position((100.0 * *u_vec.iter().max_by(|a, b| a.partial_cmp(b).unwrap()).unwrap()) as u64);
p_framerate.set_position((t.iter().map(|d| 1.0 / d.as_secs_f64()).sum::<f64>() / t.len() as f64) as u64);
let frame_s = t.iter().map(|d| d.as_secs_f64()).sum::<f64>() / t.len() as f64;
p_avg_ms.set_position((frame_s * 1000.0 * u_total) as u64);
p_framerate.set_position((1.0 / frame_s) as u64);
let mut rgb_image = RgbImage::new(800, 800);