pub struct FrameProfile { /* private fields */ }Expand description
阶段 B3:FrameProfile — 每秒聚合 CPU paint 耗时
窗口模型(不是 ring buffer):每次 maybe_report 把当前 samples 全清,
frames 就是这 1 秒内的真实帧数。这样 fps 永远 = samples.len(),不会随时间涨。
之前用 ring buffer 是错的:程序跑 ~17s 后 samples 满到 1024,fps 永远显示 1024。
Implementations§
Source§impl FrameProfile
impl FrameProfile
pub fn new() -> Self
pub fn with_capacity(capacity: usize, report_interval: Duration) -> Self
Sourcepub fn maybe_report(&mut self) -> Option<FrameReport>
pub fn maybe_report(&mut self) -> Option<FrameReport>
阶段 B3:每秒触发一次,返回这 1 秒的聚合报告;报告后清空窗口
调用时机:每帧 paint 末尾调一次;返回 Some = 到了 report 时刻。
Trait Implementations§
Auto Trait Implementations§
impl Forget for FrameProfile
impl Freeze for FrameProfile
impl Move for FrameProfile
impl RefUnwindSafe for FrameProfile
impl Send for FrameProfile
impl Sync for FrameProfile
impl Unpin for FrameProfile
impl UnsafeUnpin for FrameProfile
impl UnwindSafe for FrameProfile
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
Mutably borrows from an owned value. Read more