class Tessell::App::PerfCollector

Defined in:

tessell/app/perf.cr

Constant Summary

SAMPLE_CAP = 256

有界样本容量:约 4 秒 @60fps 的帧样本,环形覆盖。

SEGMENT_COUNT = 5

Constructors

Instance Method Summary

Constructor Detail

def self.new(enabled : Bool = false) #

[View source]

Instance Method Detail

def enabled=(v : Bool) : Nil #

[View source]
def enabled? : Bool #

[View source]
def frame_count : Int32 #

[View source]
def frame_end(frame_ms : Float32) : Nil #

帧收口(frame_ms 来自宿主钟差,由宿主传入)。 失效→呈现延迟(帧粒度):失效帧 lag=0;此后每过一个未 present 的 帧累加 1;present 帧归零并清除 pending。


[View source]
def frame_start : Nil #

[View source]
def hop_count : Int32 #

[View source]
def idle_last_frame? : Bool #

静止画面判定:最近一帧五段全零 op(无多余提交的验收口径)。


[View source]
def latest : FrameSample | Nil #

[View source]
def mark_invalidated(dirty_nodes : Int32) : Nil #

失效标记:本帧有节点进入 dirty(帧粒度)。


[View source]
def percentile(segment : Segment, p : Float32) : Float32 #

分位数:取指定段的帧样本值排序后线性插值。仅人工定位读取面。


[View source]
def percentile_frame_ms(p : Float32) : Float32 #

[View source]
def record(segment : Segment, ops : Int32, start_ms : Int64, end_ms : Int64) : Nil #

段计时入口(宿主钟毫秒差;由宿主驱动,collector 不取钟)。


[View source]
def record_hop : Nil #

跨 Isolated context 提交(engine→UI hop;只计数,不做跨钟差)。


[View source]
def record_ops(segment : Segment, ops : Int32) : Nil #

仅计数(无钟):适合纯 op 流分段。


[View source]
def sample(index : Int32) : FrameSample | Nil #

[View source]
def sample_size : Int32 #

最近样本数(≤ SAMPLE_CAP)。


[View source]
def to_json(io : IO) : Nil #

离线 JSON(人工 bench 管道读取;不进门禁)。


[View source]
def to_json_string : String #

[View source]