diff --git a/src-tauri/src/capture.rs b/src-tauri/src/capture.rs index dd63fd2..d93bced 100644 --- a/src-tauri/src/capture.rs +++ b/src-tauri/src/capture.rs @@ -76,6 +76,9 @@ pub struct CaptureHandler { /// D3D11 device/context from the frame). Recreated on resize. pipeline: Option, frame_count: Arc, + /// TEMP DIAG: log per-frame timing for the first 10 frames. + timing_n: u32, + timing_start: Option, } /// Persistent D3D11 state for the HDR->SDR tonemap pass. Owns the render @@ -462,6 +465,8 @@ impl GraphicsCaptureApiHandler for CaptureHandler { height: setup.height, pipeline: None, frame_count: setup.frame_counter.clone(), + timing_n: 0, + timing_start: None, }) } @@ -470,6 +475,7 @@ impl GraphicsCaptureApiHandler for CaptureHandler { frame: &mut Frame<'_>, _capture_control: InternalCaptureControl, ) -> Result<(), Self::Error> { + let start = std::time::Instant::now(); let Some(stdin) = self.stdin.as_mut() else { return Ok(()); }; @@ -486,6 +492,13 @@ impl GraphicsCaptureApiHandler for CaptureHandler { let pipeline = self.pipeline.as_mut().expect("just initialized"); pipeline.process(device, context, src, stdin)?; + // TEMP DIAG: per-frame timing for the first 10 frames. + if self.timing_n < 10 { + let elapsed = start.elapsed().as_millis(); + tracing::warn!("DIAG-TIMING frame {}: {}ms", self.timing_n, elapsed); + self.timing_n += 1; + } + self.frame_count.fetch_add(1, std::sync::atomic::Ordering::Relaxed); Ok(()) }