Skip to main content

euv_performance/observability/
enum.rs

1use super::*;
2
3/// Supported target platforms enumerated in `schemas/report-v1.schema.json`.
4#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
5#[serde(rename_all = "lowercase")]
6pub enum ObservabilityPlatform {
7    /// Browser Web / WASM host.
8    Web,
9    /// Android mobile host.
10    Android,
11    /// Apple iOS phone host.
12    Ios,
13    /// Apple iPadOS tablet host.
14    Ipados,
15    /// Microsoft Windows desktop host.
16    Windows,
17    /// Apple macOS desktop host.
18    Macos,
19    /// Linux desktop/server host.
20    Linux,
21    /// Huawei HarmonyOS / OpenHarmony host.
22    Harmonyos,
23    /// Wearable watch/band host.
24    Wearable,
25    /// MiniApp container host.
26    Miniapp,
27    /// QuickApp container host.
28    Quickapp,
29    /// Terminal PTY / CLI host.
30    Terminal,
31}
32
33/// Execution environment honesty tag for an observability report.
34#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
35#[serde(rename_all = "snake_case")]
36pub enum ObservabilityExecutionKind {
37    /// Physical target device or real OS desktop session.
38    RealDevice,
39    /// Android/HarmonyOS/Wearable emulator.
40    Emulator,
41    /// Apple iOS/iPadOS simulator.
42    Simulator,
43    /// In-process headless software renderer.
44    Headless,
45    /// Pseudo-terminal (PTY) character grid host.
46    Pty,
47    /// Piped stdin/stdout CLI host.
48    CliPipe,
49}
50
51/// Four-state observability report verdict (`pass`, `fail`, `inconclusive`, `unsupported`).
52#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
53#[serde(rename_all = "snake_case")]
54pub enum ObservabilityStatus {
55    /// Every required scope measured, every threshold met, and zero blocking findings.
56    Pass,
57    /// Confirmed regression, threshold breach, or confirmed leak.
58    Fail,
59    /// Required coverage missing, permission denied, or insufficient samples.
60    Inconclusive,
61    /// Target platform or metric family not supported by the active backend.
62    Unsupported,
63}
64
65/// Per-scope measurement coverage classification.
66#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
67#[serde(rename_all = "snake_case")]
68pub enum ObservabilityCoverageStatus {
69    /// Scope was actively collected and verified.
70    Measured,
71    /// Scope could not be collected on this run.
72    Missing,
73    /// Scope is not supported on this platform/host.
74    Unsupported,
75    /// Scope does not apply to this platform/backend.
76    NotApplicable,
77}
78
79/// Per-metric measurement availability classification.
80#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
81#[serde(rename_all = "snake_case")]
82pub enum ObservabilityMetricStatus {
83    /// Metric was validly measured from a direct hardware, compositor, or instrumented source.
84    Measured,
85    /// Metric was measured via a proxy source (such as frame callbacks or submission timestamps) rather than compositor proof.
86    Proxy,
87    /// Metric is explicitly unobservable on this host/backend and MUST serialize numeric slots as `null`.
88    Unobservable,
89    /// Metric was not measured (numeric fields must be null).
90    Unmeasured,
91    /// Metric is unsupported on this host.
92    Unsupported,
93    /// Metric is not applicable to this platform/backend.
94    NotApplicable,
95    /// OS or container permissions blocked collection.
96    PermissionDenied,
97    /// Too few samples collected for a statistically valid result.
98    InsufficientSamples,
99}
100
101/// Canonical metric units allowed by `schemas/report-v1.schema.json`.
102#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
103#[serde(rename_all = "snake_case")]
104pub enum ObservabilityUnit {
105    /// Raw byte count.
106    Bytes,
107    /// Discrete dimensionless count.
108    Count,
109    /// Milliseconds.
110    Ms,
111    /// Microseconds.
112    Us,
113    /// Percentage in `[0.0, 100.0]`.
114    Percent,
115    /// Frequency in Hertz.
116    Hz,
117    /// Throughput in bytes per second.
118    BytesPerSec,
119    /// Ratio in `[0.0, 1.0]`.
120    Ratio,
121    /// Temperature in degrees Celsius.
122    Celsius,
123}
124
125/// Canonical summary statistic tag for an observability metric sample.
126#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
127#[serde(rename_all = "snake_case")]
128pub enum ObservabilityStatistic {
129    /// Point scalar observation.
130    Value,
131    /// Median (50th percentile).
132    P50,
133    /// 95th percentile.
134    P95,
135    /// 99th percentile.
136    P99,
137    /// Maximum observed value.
138    Max,
139    /// Arithmetic mean.
140    Mean,
141    /// Minimum observed value.
142    Min,
143    /// Event rate over window.
144    Rate,
145    /// Live object/allocation count.
146    LiveCount,
147    /// Cumulative window total.
148    Total,
149    /// Linear slope per lifecycle cycle.
150    Slope,
151}
152
153/// Threshold evaluation rule attached to a metric.
154#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
155#[serde(rename_all = "snake_case")]
156pub enum ObservabilityThresholdRule {
157    /// Observed scalar value must be `<= threshold`.
158    Max,
159    /// Observed scalar value must be `>= threshold`.
160    Min,
161    /// Observed `slope_per_cycle` must be `<= threshold`.
162    MaxSlopePerCycle,
163    /// Observed destroyed-owner `after_drain` count must be `<= threshold`.
164    MaxDestroyedOwnerCount,
165    /// Observed `after_drain` value must be `<= threshold`.
166    MaxAfterDrain,
167    /// Observed value must match `threshold` within tolerance.
168    Exact,
169}
170
171/// Forensic classification for an entry in `findings`.
172#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
173#[serde(rename_all = "snake_case")]
174pub enum ObservabilityFindingClass {
175    /// Intentionally retained bounded cache or frozen page within budget.
176    ExpectedRetained,
177    /// Confirmed resource or memory leak attributed to an owner.
178    UnexpectedLeak,
179    /// Performance or parity budget violation.
180    BudgetViolation,
181    /// Monotonic resource growth lacking owner attribution.
182    UnattributedGrowth,
183}