From 82bbcc7586e648f7442e66018745ae92e86f9912 Mon Sep 17 00:00:00 2001 From: Jeremy Goldberg Date: Mon, 23 Nov 2026 19:21:40 -0500 Subject: [PATCH] fix(gpu): average copy statistics over the full reporting interval --- crates/victory-gpu/src/host.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/crates/victory-gpu/src/host.rs b/crates/victory-gpu/src/host.rs index d89159e..b06be74 100644 --- a/crates/victory-gpu/src/host.rs +++ b/crates/victory-gpu/src/host.rs @@ -1376,6 +1376,8 @@ struct Presenter { struct Meter { since: std::time::Instant, frames: u32, + #[cfg(feature = "diagnostics")] + copy_stats_frames: u64, drawn: u64, logged: std::time::Instant, /// The caption the window had, once read. @@ -1388,6 +1390,8 @@ impl Meter { Meter { since: now, frames: 0, + #[cfg(feature = "diagnostics")] + copy_stats_frames: 0, drawn: crate::draw::drawn(), logged: now, caption: None, @@ -1399,6 +1403,10 @@ impl Meter { #[cfg(feature = "diagnostics")] tracing::debug!(target: "victory_gpu::frame", token = crate::frame::current(), "present"); self.frames += 1; + #[cfg(feature = "diagnostics")] + { + self.copy_stats_frames += 1; + } let elapsed = self.since.elapsed(); if elapsed < std::time::Duration::from_secs(1) { return; @@ -1437,7 +1445,7 @@ impl Meter { ); #[cfg(feature = "diagnostics")] { - crate::copystat::log(frames); + crate::copystat::log(std::mem::take(&mut self.copy_stats_frames) as f64); for (why, n) in drops.iter().take(40) { tracing::info!( "dropped {:.1}/frame without a host pipeline: {why}",