pub struct PacingDiagnostics { /* private fields */ }Expand description
Accumulates presented-frame timestamps into cadence diagnostics.
Feed every presented frame in presentation order through Self::record_presented (or
Self::record_untimed_presented when presentation completed without a display time), then
read summaries with Self::report.
Implementations§
Source§impl PacingDiagnostics
impl PacingDiagnostics
Sourcepub fn with_window(window: usize) -> Self
pub fn with_window(window: usize) -> Self
Creates diagnostics summarizing at most window recent presented intervals.
A zero window is treated as a window of one interval.
Sourcepub fn record_presented(&mut self, presented_at: Instant)
pub fn record_presented(&mut self, presented_at: Instant)
Records one presented frame with the display time the backend reported for it.
A timestamp not later than its predecessor contributes no interval; the frame is still counted.
Sourcepub fn record_untimed_presented(&mut self)
pub fn record_untimed_presented(&mut self)
Records one frame whose presentation completed without a reported display time, such as while the window is off screen.
Sourcepub fn estimated_cadence(&self) -> Option<Duration>
pub fn estimated_cadence(&self) -> Option<Duration>
Estimates the display cadence as the median of the recent presented intervals.
Returns None until enough intervals have been observed to estimate responsibly.
Sourcepub fn report(&self) -> PacingReport
pub fn report(&self) -> PacingReport
Summarizes everything recorded so far.