Skip to main content

FrameStats

Struct FrameStats 

Source
pub struct FrameStats { /* private fields */ }
Expand description

Pure rolling frame-time accumulator. Fed explicit deltas (seconds); holds no clock, so it is fully unit-testable. Fixed capacity — no per-frame alloc.

Implementations§

Source§

impl FrameStats

Source

pub fn new() -> Self

An empty accumulator.

Source

pub fn record(&mut self, dt_secs: f32)

Record one frame’s duration (seconds) into the ring and bump the total.

Source

pub fn record_dropped(&mut self)

Count a frame the renderer could not present (surface acquire skip).

Source

pub fn fps(&self) -> f32

Frames per second over the retained window (0 until the first sample).

Source

pub fn frame_ms_avg(&self) -> f32

Mean frame time over the window, in milliseconds.

Source

pub fn frame_ms_p99(&self) -> f32

99th-percentile frame time over the window, in milliseconds.

Source

pub fn frame_ms_p50(&self) -> f32

Median frame time over the window, in milliseconds.

The pair with frame_ms_p99 is what makes a frame-time reading legible: the median says what a typical frame costs and the p99 says what the worst ones do, and a mean sits between them saying neither. Native-only, like the analysis snapshot beside it — it is not on Metrics, which mirrors the C ABI’s RlxMetrics and cannot grow a field without widening that surface (ADR-0052’s split).

Source

pub fn frames_total(&self) -> u64

Frames recorded since creation.

Source

pub fn frames_dropped(&self) -> u64

Frames the renderer skipped.

Source§

impl FrameStats

Source

pub fn samples(&self) -> impl Iterator<Item = f32> + '_

The retained frame durations (seconds), oldest first, for the overlay’s sparkline. Borrows the ring in chronological order without allocating.

Trait Implementations§

Source§

impl Default for FrameStats

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

§

impl<T> WasmNotSend for T
where T: Send,

§

impl<T> WasmNotSendSync for T
where T: WasmNotSend + WasmNotSync,

§

impl<T> WasmNotSync for T
where T: Sync,