Skip to main content

euv_performance/ttff/
struct.rs

1use super::*;
2
3/// Per-stage cold-start Time-To-First-Frame (TTFF) latency breakdown in milliseconds.
4#[derive(Clone, Copy, Debug, Default, Deserialize, Getter, PartialEq, Serialize)]
5pub struct ColdStartTtffStages {
6    /// Stage 1 (`t0 -> t1`): `App` + `Renderer` + surface initialization duration in milliseconds.
7    #[get(type(copy))]
8    pub(crate) app_renderer_init_ms: f64,
9    /// Stage 2 (`t1 -> t2`): System font bind and initial default glyph readiness duration in milliseconds.
10    #[get(type(copy))]
11    pub(crate) font_ready_ms: f64,
12    /// Stage 3 (`t2 -> t3`): Initial showcase shell `SceneTree` mount duration in milliseconds.
13    #[get(type(copy))]
14    pub(crate) initial_mount_ms: f64,
15    /// Stage 4 (`t3 -> t4`): First `LayoutEngine::compute` pass duration in milliseconds.
16    #[get(type(copy))]
17    pub(crate) first_layout_ms: f64,
18    /// Stage 5 (`t4 -> t5`): First `PaintPass::build` display-list compilation duration in milliseconds.
19    #[get(type(copy))]
20    pub(crate) first_paint_ms: f64,
21    /// Stage 6 (`t5 -> t6`): First frame rasterization and presentation duration in milliseconds.
22    #[get(type(copy))]
23    pub(crate) first_present_ms: f64,
24    /// Cumulative elapsed milliseconds from `t0` boot to interactive mount ready (`t3 - t0`).
25    #[get(type(copy))]
26    pub(crate) ready_ms: f64,
27    /// Total elapsed milliseconds from `t0` boot to verified first presented frame (`t6 - t0`).
28    #[get(type(copy))]
29    pub(crate) total_ttff_ms: f64,
30    /// Number of scene nodes laid out during the first layout pass.
31    #[get(type(copy))]
32    pub(crate) layout_nodes: usize,
33    /// Number of display-list draw commands emitted during the first paint pass.
34    #[get(type(copy))]
35    pub(crate) paint_commands: usize,
36    /// Number of render draw batches executed for the first presented frame.
37    #[get(type(copy))]
38    pub(crate) draw_batches: usize,
39    /// Total heap allocation count executed across the full cold-start boot sequence.
40    #[get(type(copy))]
41    pub(crate) alloc_count: u64,
42    /// Total heap bytes allocated across the full cold-start boot sequence.
43    #[get(type(copy))]
44    pub(crate) bytes_allocated: u64,
45}
46
47/// Aggregated multi-run cold-start TTFF benchmark report with per-stage medians and tail totals.
48#[derive(Clone, Debug, Default, Deserialize, Getter, New, PartialEq, Serialize)]
49pub struct ColdStartTtffReport {
50    /// Number of independent cold-start iterations executed.
51    #[get(type(copy))]
52    pub(crate) iterations: usize,
53    /// Element-wise median per-stage breakdown across all cold-start runs.
54    #[get(type(copy))]
55    pub(crate) median: ColdStartTtffStages,
56    /// 95th percentile total TTFF latency in milliseconds.
57    #[get(type(copy))]
58    pub(crate) p95_total_ttff_ms: f64,
59    /// Maximum observed total TTFF latency in milliseconds.
60    #[get(type(copy))]
61    pub(crate) max_total_ttff_ms: f64,
62    /// Raw per-iteration stage measurements.
63    pub(crate) runs: Vec<ColdStartTtffStages>,
64}