Skip to main content

FrameProfile

Struct FrameProfile 

Source
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

Source

pub fn new() -> Self

Source

pub fn with_capacity(capacity: usize, report_interval: Duration) -> Self

Source

pub fn record(&mut self, paint_us: u32)

阶段 B3:记录一帧 CPU paint 耗时

Source

pub fn maybe_report(&mut self) -> Option<FrameReport>

阶段 B3:每秒触发一次,返回这 1 秒的聚合报告;报告后清空窗口

调用时机:每帧 paint 末尾调一次;返回 Some = 到了 report 时刻。

Trait Implementations§

Source§

impl Default for FrameProfile

Source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl Forget for FrameProfile

§

impl Freeze for FrameProfile
where *const u8 is !null: Freeze, PhantomData<u32>: Freeze,

§

impl Move for FrameProfile

§

impl RefUnwindSafe for FrameProfile

§

impl Send for FrameProfile
where RawVecInner: Send,

§

impl Sync for FrameProfile
where RawVecInner: Sync,

§

impl Unpin for FrameProfile
where *const u8 is !null: Unpin,

§

impl UnsafeUnpin for FrameProfile

§

impl UnwindSafe for FrameProfile
where RawVecInner: UnwindSafe,

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

Source§

fn downcast(&self) -> &T

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, 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,