Skip to main content

euv_performance/suite/
struct.rs

1use super::*;
2
3/// Timing, throughput, and steady-state allocation telemetry for a single micro- or macro-benchmark.
4#[derive(Clone, Debug, Deserialize, Getter, New, PartialEq, Serialize)]
5pub struct BenchMetric {
6    /// Canonical benchmark name.
7    pub(crate) name: String,
8    /// Number of measured iterations.
9    #[get(type(copy))]
10    pub(crate) iterations: usize,
11    /// Total elapsed wall time in microseconds.
12    #[get(type(copy))]
13    pub(crate) total_micros: u64,
14    /// Average nanoseconds per iteration.
15    #[get(type(copy))]
16    pub(crate) ns_per_op: f64,
17    /// Throughput in operations per second.
18    #[get(type(copy))]
19    pub(crate) ops_per_sec: f64,
20    /// Additional benchmark-specific verification metadata.
21    pub(crate) detail: String,
22    /// Total heap allocation count recorded across all measured iterations.
23    #[get(type(copy))]
24    #[new(skip)]
25    #[serde(default)]
26    pub(crate) alloc_count: u64,
27    /// Total heap bytes allocated across all measured iterations.
28    #[get(type(copy))]
29    #[new(skip)]
30    #[serde(default)]
31    pub(crate) bytes_allocated: u64,
32    /// Mean heap allocations per measured iteration.
33    #[get(type(copy))]
34    #[new(skip)]
35    #[serde(default)]
36    pub(crate) allocs_per_op: f64,
37    /// Mean heap bytes allocated per measured iteration.
38    #[get(type(copy))]
39    #[new(skip)]
40    #[serde(default)]
41    pub(crate) bytes_per_op: f64,
42}
43
44/// Complete serialized report produced by `run_full_benchmark_suite`.
45#[derive(Clone, Debug, Deserialize, Getter, New, PartialEq, Serialize)]
46pub struct BenchReport {
47    /// Ordered benchmark results.
48    pub(crate) metrics: Vec<BenchMetric>,
49}
50
51/// Named benchmark descriptor pairing a canonical metric ID with its runner function.
52#[derive(Clone, Copy, Debug)]
53pub(crate) struct BenchCase {
54    /// Canonical benchmark metric name.
55    pub(crate) name: &'static str,
56    /// Function executing the benchmark and returning its `BenchMetric`.
57    pub(crate) runner: fn() -> BenchMetric,
58}