Skip to main content

FrameTiming

Struct FrameTiming 

Source
pub struct FrameTiming {
    pub layout_time_ns: u64,
    pub paint_time_ns: u64,
    pub gpu_wait_time_ns: u64,
    pub total_time_ns: u64,
}
Expand description

Frame timing data for a single frame.

All times are in nanoseconds for consistent units.

§Example

use martensite_devtools::hud::FrameTiming;

let timing = FrameTiming {
    layout_time_ns: 500_000,
    paint_time_ns: 300_000,
    gpu_wait_time_ns: 100_000,
    total_time_ns: 900_000,
};
assert_eq!(timing.total_time_ns, 900_000);

Fields§

§layout_time_ns: u64

Time spent in layout passes (nanoseconds).

§paint_time_ns: u64

Time spent encoding the paint list (nanoseconds).

§gpu_wait_time_ns: u64

Time spent waiting for the GPU (nanoseconds).

§total_time_ns: u64

Total frame time (nanoseconds).

Implementations§

Source§

impl FrameTiming

Source

pub fn from_ms(layout: f64, paint: f64, gpu_wait: f64, total: f64) -> Self

Creates a FrameTiming from millisecond values.

§Example
use martensite_devtools::hud::FrameTiming;

let t = FrameTiming::from_ms(0.5, 0.3, 0.1, 0.9);
assert_eq!(t.layout_time_ns, 500_000);
Source

pub fn add(&self, other: &Self) -> Self

Adds two FrameTiming values component-wise.

Source

pub fn div(&self, n: u64) -> Self

Divides all components by a scalar.

Trait Implementations§

Source§

impl Clone for FrameTiming

Source§

fn clone(&self) -> FrameTiming

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for FrameTiming

Source§

impl Debug for FrameTiming

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for FrameTiming

Source§

fn default() -> FrameTiming

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

impl Eq for FrameTiming

Source§

impl PartialEq for FrameTiming

Source§

fn eq(&self, other: &FrameTiming) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for FrameTiming

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.