#[path = "type_guard.rs"]
mod guard;
use crate::descriptor::{EncodeRefusal, NamespacedName};
use crate::identity::{DomainTag, IdentityProfileVersion};
use std::num::NonZeroU32;
pub const BENCH_ROW_KEY_TAG: DomainTag =
DomainTag::declared("bench-row-key", IdentityProfileVersion::declared(1));
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct WorkloadRef(NamespacedName);
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct PreflightRef(NamespacedName);
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct PlantedWorseRef(NamespacedName);
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct ComplexityClaimRef(NamespacedName);
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct WorkObservationRef(NamespacedName);
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct BenchTableName(NamespacedName);
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct InputSizeAxis(Vec<u64>);
#[must_use = "a refusal is the reason an input-size axis was not admitted"]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum InputSizeAxisRefusal {
TooShort {
found: usize,
},
DuplicateSize {
size: u64,
first: usize,
duplicate: usize,
},
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct ExactRatio {
numerator: u64,
denominator: u64,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct DeclaredBudgets {
samples: NonZeroU32,
warmups: u32,
ratio: ExactRatio,
}
#[must_use = "a refusal is the reason benchmark budgets were not admitted"]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum DeclaredBudgetsRefusal {
NoSamples,
ZeroRatioNumerator,
ZeroRatioDenominator,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum ContentionPosture {
NoDeclaredContention,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct WorkFormula {
bytes: Vec<u8>,
}
#[must_use = "a refusal is the reason a work formula was not admitted"]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum WorkFormulaRefusal {
Empty,
}
crate::identity::content_address_reference! {
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct BenchRowKey;
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct BenchReferences {
workload: WorkloadRef,
preflight: PreflightRef,
planted_worse: PlantedWorseRef,
complexity: ComplexityClaimRef,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct BenchMeasurement {
input_sizes: InputSizeAxis,
budgets: DeclaredBudgets,
contention: ContentionPosture,
formula: Option<WorkFormula>,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct BenchRow {
references: BenchReferences,
measurement: BenchMeasurement,
key: BenchRowKey,
}
#[must_use = "a refusal is the reason a benchmark row was not built"]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum BenchRowRefusal {
Encoding(EncodeRefusal),
}