Skip to main content

PresentStats

Struct PresentStats 

Source
pub struct PresentStats {
Show 17 fields pub presents: u64, pub wait_ns: u64, pub submit_ns: u64, pub gaps: u64, pub gap_sum_ns: u64, pub gap_max_ns: u64, pub last_gap_ns: u64, pub present_mode: &'static str, pub max_frame_latency: u32, pub present_path_cpu_ns: u64, pub redraw_cpu_ns: u64, pub last_present_path_cpu_ns: u64, pub last_redraw_cpu_ns: u64, pub frame_to_acquire_ns: u64, pub acquire_to_submit_ns: u64, pub last_frame_to_acquire_ns: u64, pub last_acquire_to_submit_ns: u64,
}

Fields§

§presents: u64

真 present 出去的帧数(被 Outdated / Occluded / 校验错误挡掉的那些不占号: 那几种情况下屏幕上没有新内容,把它们算进“节奏“就是把失败读成正常)。

§wait_ns: u64

累计“等 vsync“的时间(get_current_texture 阻塞那一段)。这是 FIFO 呈现的配额: 它涨说明我们在等显示,而不是在等 GPU。

§submit_ns: u64

累计 queue.present 调用本身的时间。

§gaps: u64

记过多少个“相邻两次 present 的间隔“。语义与 mgui_video::StageCounters::frames_measured 同源:没有前驱的那一次不许编出一个间隔,所以它最多等于 presents − 1。

§gap_sum_ns: u64§gap_max_ns: u64§last_gap_ns: u64

最近一个间隔(给“每帧读一次并自己组分布“的工具用,例如 showcase 的 cadence 运行器)。

§present_mode: &'static str

呈现模式的实际生效值(从 SurfaceConfiguration 读,不是文档里的默认)。 之所以回显它:节奏这件事的全部解释都依赖“到底是 FIFO 还是 IMMEDIATE、队列允许几深“, 读数与配置分两处写就一定分叉(本仓为这类分叉付过学费)。

空串的含义是“这一路没接线“(软件回退、或多窗口宿主的 slot 还没接上共享 context), 而不是“这台机器一次都没 present“。接线之后它一定是 Fifo / Mailbox 这类实际模式名, 所以 presents == 0 与 present_mode == "" 一起读才分得开“没量到“与“量了但没帧“。

§max_frame_latency: u32

desired_maximum_frame_latency 的实际值(同上)。

§present_path_cpu_ns: u64

累计 present_gpu_frame 入口 → queue.present 返回的 CPU 耗时(纳秒)。 不是完整端到端:不含 app.frame() / CPU paint / about_to_wait / 事件循环调度。

§redraw_cpu_ns: u64

累计 redraw 入口 → present 返回的 CPU 耗时(纳秒)。多窗口未接线时为 0。

§last_present_path_cpu_ns: u64

最近一次的两个耗时(给 cadence 逐帧采样用)。

§last_redraw_cpu_ns: u64§frame_to_acquire_ns: u64

A/B 2 必测项 1:累计 frame_start(redraw 入口)→ acquire 完成。 实验组这一格包含提前上传,机械变长不是退化,只作调用顺序的自证; CPU paint 与 vsync 等待在两组里都落在这一段,口径一致。

§acquire_to_submit_ns: u64

A/B 2 必测项 2:累计 acquire 完成 → queue.present 返回(含 Pass1/Pass2 submit)。 实验组上传被移出这一段,机械变短没有判别力(规格明确),不能单独拿来判胜负。

§last_frame_to_acquire_ns: u64§last_acquire_to_submit_ns: u64

Implementations§

Source§

impl PresentStats

Source

pub fn record( &mut self, wait_ns: u64, submit_ns: u64, gap: Option<Duration>, mode: &'static str, latency: u32, )

记一次成功的 present。gap = 与上一次 present 的间隔;第一次传 None。

分成这个方法而不是让调用方自己加字段,是为了把“第一帧不产生样本“这条家规放在一处 实现(另一处是 mgui_video::timing),调用方只需要回答“有没有前驱“。

Source

pub fn mean_gap_ns(&self) -> u64

间隔均值(纳秒)。没有样本时给 0 —— 调用方要读 Self::gaps,不是读这个数。

Trait Implementations§

Source§

impl Clone for PresentStats

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 PresentStats

Source§

impl Debug for PresentStats

Source§

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

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

impl Default for PresentStats

Source§

fn default() -> Self

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

impl Eq for PresentStats

Source§

impl PartialEq for PresentStats

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 PresentStats

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> Brush for T
where T: Clone + PartialEq + Default + Debug,

Source§

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

Source§

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

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> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> ErasedDestructor for T
where T: 'static,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

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

Source§

impl<T> WasmNotSendSync for T

Source§

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