Skip to main content

Diag

Struct Diag 

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

The render-side diagnostics state: the pure FrameStats, the gated clock, the GPU-byte / draw-call figures, and the two flags that control collection and the on-screen overlay.

Implementations§

Source§

impl Diag

Source

pub fn new() -> Self

A fresh diagnostics state: not collecting, overlay off.

Source

pub fn set_collecting(&mut self, on: bool)

Enable or disable rolling frame-time collection (the gated clock read). Toggling resets the delta chain so a re-enable does not record a spurious long frame across the disabled gap.

Source

pub fn collecting(&self) -> bool

Whether frame-time collection is currently enabled.

Source

pub fn set_overlay(&mut self, on: bool)

Enable or disable painting the on-screen overlay.

Source

pub fn overlay_enabled(&self) -> bool

Whether the overlay should be painted this frame.

Source

pub fn record_frame(&mut self)

Record a presented frame. Reads the monotonic clock (only while collecting) and feeds the delta since the previous present to the stats.

Source

pub fn record_dropped(&mut self)

Count a frame the renderer could not present. Breaks the delta chain so the next present’s delta excludes the skipped interval.

Source

pub fn set_gpu_bytes(&mut self, bytes: u64)

Set the core-tracked GPU resource byte estimate (fed from the render context each frame — dominated by the swapchain).

Source

pub fn set_draw_calls(&mut self, n: u32)

Set the draw/render-pass count issued on the last frame.

Source

pub fn frame_ms_p50(&self) -> f32

The current rolling snapshot. Median frame time over the window, in milliseconds — the native-only half of the frame-time pair (see FrameStats::frame_ms_p50).

Source

pub fn metrics(&self) -> Metrics

The current rolling snapshot.

Source

pub fn set_analysis(&mut self, frame: &AnalysisFrame)

Take this frame’s analysis snapshot. Called once per drawn frame from the render seam, which is the one place that holds the AnalysisFrame.

Source

pub fn analysis(&self) -> AnalysisMetrics

The latest analysis snapshot — the native-only companion to metrics. See AnalysisMetrics for why it is separate.

Source

pub fn stats(&self) -> &FrameStats

Read-only view of the rolling stats (the overlay reads this to draw the frame-time sparkline).

Trait Implementations§

Source§

impl Default for Diag

Source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl Freeze for Diag

§

impl RefUnwindSafe for Diag

§

impl Send for Diag

§

impl Sync for Diag

§

impl Unpin for Diag

§

impl UnsafeUnpin for Diag

§

impl UnwindSafe for Diag

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,