Skip to main content

euv_performance/stress/
struct.rs

1use super::*;
2
3/// Per-iteration latency percentile distribution, frame-budget misses, and damage telemetry.
4#[derive(Clone, Copy, Debug, Default, Deserialize, Getter, PartialEq, Serialize)]
5pub struct LatencyDistribution {
6    /// Number of measured iterations included in this distribution.
7    #[get(type(copy))]
8    pub(crate) iterations: usize,
9    /// Median (50th percentile) per-iteration latency in microseconds.
10    #[get(type(copy))]
11    pub(crate) p50_us: f64,
12    /// 95th percentile per-iteration latency in microseconds.
13    #[get(type(copy))]
14    pub(crate) p95_us: f64,
15    /// 99th percentile per-iteration latency in microseconds.
16    #[get(type(copy))]
17    pub(crate) p99_us: f64,
18    /// Maximum single-iteration latency in microseconds.
19    #[get(type(copy))]
20    pub(crate) max_us: f64,
21    /// Arithmetic mean per-iteration latency in microseconds.
22    #[get(type(copy))]
23    pub(crate) mean_us: f64,
24    /// Number of iterations exceeding the 144Hz frame budget (`6.94ms`).
25    #[get(type(copy))]
26    pub(crate) over_6_94ms_count: usize,
27    /// Number of iterations exceeding the 60Hz frame budget (`16.67ms`).
28    #[get(type(copy))]
29    pub(crate) over_16_67ms_count: usize,
30    /// Arithmetic mean `FrameTelemetry::dirty_area_ratio` across measured frames (`0.0` when not applicable).
31    #[get(type(copy))]
32    pub(crate) mean_dirty_area_ratio: f64,
33    /// Count of measured frames that promoted to full-viewport redraw (`FullRedrawReason != None`).
34    #[get(type(copy))]
35    pub(crate) full_redraw_count: usize,
36}
37
38/// Single scenario entry recorded inside a `StressMatrixReport`.
39#[derive(Clone, Debug, Deserialize, Getter, New, PartialEq, Serialize)]
40pub struct StressMatrixEntry {
41    /// Canonical stress scenario identifier.
42    pub(crate) name: String,
43    /// Recorded per-iteration latency distribution and frame-budget telemetry.
44    #[get(type(copy))]
45    pub(crate) latency: LatencyDistribution,
46    /// Human-readable verification metadata and scenario invariants.
47    pub(crate) detail: String,
48}
49
50/// Interleaved A/B comparison validating P1 surgical partial-layout damage against full redraw.
51#[derive(Clone, Debug, Deserialize, Getter, PartialEq, Serialize)]
52pub struct PartialDamageAbSummary {
53    /// Canonical A/B scenario identifier.
54    pub(crate) name: String,
55    /// Distribution captured with `app.set_partial_layout_damage(false)`.
56    #[get(type(copy))]
57    pub(crate) baseline_full_redraw: LatencyDistribution,
58    /// Distribution captured with `app.set_partial_layout_damage(true)`.
59    #[get(type(copy))]
60    pub(crate) candidate_partial_damage: LatencyDistribution,
61    /// Percentage latency reduction at p50 (`> 0.0` means partial damage is faster).
62    #[get(type(copy))]
63    pub(crate) p50_speedup_pct: f64,
64    /// Percentage latency reduction at p95 (`> 0.0` means partial damage is faster).
65    #[get(type(copy))]
66    pub(crate) p95_speedup_pct: f64,
67    /// Percentage latency reduction at p99 (`> 0.0` means partial damage is faster).
68    #[get(type(copy))]
69    pub(crate) p99_speedup_pct: f64,
70    /// Percentage reduction in mean `dirty_area_ratio` from full redraw to surgical partial damage.
71    #[get(type(copy))]
72    pub(crate) dirty_area_ratio_drop_pct: f64,
73    /// `true` when every single measured frame produced bit-exact RGBA framebuffer parity.
74    #[get(type(copy))]
75    pub(crate) bit_exact_parity: bool,
76    /// Number of interleaved A/B frames verified for hash parity.
77    #[get(type(copy))]
78    pub(crate) verified_steps: usize,
79    /// Concise summary of resolution, parity, and dirty-area telemetry.
80    pub(crate) detail: String,
81}
82
83/// Complete serialized report produced by `run_stress_matrix` / `run_filtered_stress_matrix`.
84#[derive(Clone, Debug, Deserialize, Getter, New, PartialEq, Serialize)]
85pub struct StressMatrixReport {
86    /// Ordered stress scenario results.
87    pub(crate) entries: Vec<StressMatrixEntry>,
88    /// Optional structured interleaved A/B partial-layout damage comparison when that scenario ran.
89    #[get(skip)]
90    pub(crate) partial_damage_ab: Option<PartialDamageAbSummary>,
91}