Skip to main content

StageTimes

Struct StageTimes 

Source
pub struct StageTimes {
Show 17 fields pub event_dispatch: Option<Duration>, pub layout: Option<Duration>, pub after_frame: Option<Duration>, pub render_prepare: Option<Duration>, pub command_gen: Option<Duration>, pub cpu_raster: Option<Duration>, pub upload: Option<Duration>, pub backend_submit: Option<Duration>, pub pixel_convert: Option<Duration>, pub image_alloc: Option<Duration>, pub pixel_copy: Option<Duration>, pub canvas_blit: Option<Duration>, pub present_blocking: Option<Duration>, pub after_present: Option<Duration>, pub gpu_execute: Option<Duration>, pub compositor: Option<Duration>, pub total_frame: Option<Duration>,
}
Expand description

各阶段的测量值。

None = 本帧没有测量结果(统计关闭、或该路径本帧未经过)。 它不等于 Some(Duration::ZERO) —— 后者表示“测了,就是 0“。

Fields§

§event_dispatch: Option<Duration>

事件分发。

§layout: Option<Duration>

布局。

§after_frame: Option<Duration>

after_frame。

§render_prepare: Option<Duration>

渲染准备。

§command_gen: Option<Duration>

命令生成。

§cpu_raster: Option<Duration>

CPU 光栅化。

§upload: Option<Duration>

上传。

§backend_submit: Option<Duration>

后端提交。

§pixel_convert: Option<Duration>

BGRA→RGBA。

§image_alloc: Option<Duration>

ImageData 分配。

§pixel_copy: Option<Duration>

像素拷贝。

§canvas_blit: Option<Duration>

Canvas 上屏调用。

§present_blocking: Option<Duration>

阻塞式上屏。

§after_present: Option<Duration>

after_present。

§gpu_execute: Option<Duration>

GPU 执行(本阶段恒为 None,见 BackendKind::capability)。

§compositor: Option<Duration>

合成器(恒为 None)。

§total_frame: Option<Duration>

整帧。

Implementations§

Source§

impl StageTimes

Source

pub fn set(&mut self, id: StageId, value: Duration)

写入某阶段。

覆盖写而不是累加:一个阶段在一帧内只应有一个区间, 累加会让“重复打点“这种 bug 静默变成更大的数字。

Source

pub fn get(&self, id: StageId) -> Option<Duration>

读取某阶段。

Source

pub fn clear(&mut self)

清空所有阶段(跨帧复用同一个 RenderStats 时用,避免上一帧残留)。

Trait Implementations§

Source§

impl Clone for StageTimes

Source§

fn clone(&self) -> Self

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 StageTimes

Source§

impl Debug for StageTimes

Source§

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

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

impl Default for StageTimes

Source§

fn default() -> Self

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

impl Eq for StageTimes

Source§

impl PartialEq for StageTimes

Source§

fn eq(&self, other: &Self) -> 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 StageTimes

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.