Skip to main content

CacheStats

Struct CacheStats 

Source
pub struct CacheStats {
    pub layer_hits: u32,
    pub layer_misses: u32,
    pub texture_recreates: u32,
    pub invalidations: [u32; 9],
    pub vram_bytes: u64,
    pub vram_high_watermark_bytes: u64,
    pub recovery_ns: u64,
    pub key_ns: u64,
    pub content_skips: u32,
}
Expand description

单帧 cache 统计。所有字段在采集关闭时恒 0。

Fields§

§layer_hits: u32

本帧命中持久 resolve texture 且无需重画的 layer 数

§layer_misses: u32

本帧未命中(新建 / 尺寸重建 / dirty 重画)的 layer 数

§texture_recreates: u32

resolve texture 因尺寸变化重建的次数

§invalidations: [u32; 9]

各归因的本帧失效次数,顺序同 CacheInvalidationReason::ALL

§vram_bytes: u64

本帧估算的 GPU 常驻字节数(layer + atlas + 图片 + scratch)

§vram_high_watermark_bytes: u64

会话内显存高水位

§recovery_ns: u64

本帧从最近一次失效记录到本帧完成提交的恢复耗时(ns)

§key_ns: u64

本帧计算 layer 内容 key 的 CPU 耗时(ns)。关闭增量 key 时恒 0。

§content_skips: u32

本帧「被标脏但内容 key 未变、因此跳过重画」的 layer 数。

Implementations§

Source§

impl CacheStats

Source

pub fn invalidation(&self, reason: CacheInvalidationReason) -> u32

Source

pub fn invalidation_summary(&self) -> String

UI / trace 用的紧凑摘要;未发生的归因不会输出。

Source

pub fn note_invalidation(&mut self, reason: CacheInvalidationReason)

采集侧累加一次失效归因(由 renderer 的宿主入口调用)。

Trait Implementations§

Source§

impl Clone for CacheStats

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 CacheStats

Source§

impl Debug for CacheStats

Source§

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

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

impl Default for CacheStats

Source§

fn default() -> Self

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

impl Eq for CacheStats

Source§

impl PartialEq for CacheStats

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 CacheStats

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.