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: u32desired_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: u64A/B 2 必测项 1:累计 frame_start(redraw 入口)→ acquire 完成。
实验组这一格包含提前上传,机械变长不是退化,只作调用顺序的自证;
CPU paint 与 vsync 等待在两组里都落在这一段,口径一致。
acquire_to_submit_ns: u64A/B 2 必测项 2:累计 acquire 完成 → queue.present 返回(含 Pass1/Pass2 submit)。
实验组上传被移出这一段,机械变短没有判别力(规格明确),不能单独拿来判胜负。
last_frame_to_acquire_ns: u64§last_acquire_to_submit_ns: u64Implementations§
Source§impl PresentStats
impl PresentStats
Sourcepub fn record(
&mut self,
wait_ns: u64,
submit_ns: u64,
gap: Option<Duration>,
mode: &'static str,
latency: u32,
)
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),调用方只需要回答“有没有前驱“。
Sourcepub fn mean_gap_ns(&self) -> u64
pub fn mean_gap_ns(&self) -> u64
间隔均值(纳秒)。没有样本时给 0 —— 调用方要读 Self::gaps,不是读这个数。
Trait Implementations§
Source§impl Clone for PresentStats
impl Clone for PresentStats
impl Copy for PresentStats
Source§impl Debug for PresentStats
impl Debug for PresentStats
Source§impl Default for PresentStats
impl Default for PresentStats
impl Eq for PresentStats
Source§impl PartialEq for PresentStats
impl PartialEq for PresentStats
impl StructuralPartialEq for PresentStats
Auto Trait Implementations§
impl Forget for PresentStats
impl Freeze for PresentStats
impl Move for PresentStats
impl RefUnwindSafe for PresentStats
impl Send for PresentStats
impl Sync for PresentStats
impl Unpin for PresentStats
impl UnsafeUnpin for PresentStats
impl UnwindSafe for PresentStats
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<T> Brush for T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.