#![warn(missing_docs)]
mod allocator;
mod bencher;
mod measure;
mod worker;
pub use allocator::{TrackingAllocator, current_allocation, reset_allocation_counter};
pub use bencher::{Bencher, BenchmarkResult, IterationMode, run_benchmark_loop};
pub use measure::HAS_CYCLE_COUNTER;
pub use measure::Instant;
pub use measure::Timer;
pub use worker::WorkerMain;
#[derive(Debug, Clone)]
pub struct BenchmarkDef {
pub id: &'static str,
pub name: &'static str,
pub group: &'static str,
pub severity: Severity,
pub threshold: f64,
pub budget_ns: Option<u64>,
pub tags: &'static [&'static str],
pub runner_fn: fn(&mut Bencher),
pub file: &'static str,
pub line: u32,
pub module_path: &'static str,
pub warmup_ns: Option<u64>,
pub measurement_ns: Option<u64>,
pub samples: Option<u64>,
pub min_iterations: Option<u64>,
pub max_iterations: Option<u64>,
pub depends_on: &'static [&'static str],
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum Severity {
Critical,
Warning,
Info,
}
#[derive(Debug, Clone)]
pub struct GroupDef {
pub id: &'static str,
pub description: &'static str,
pub tags: &'static [&'static str],
pub parent: Option<&'static str>,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum ChartType {
Violin,
Bar,
Scatter,
Line,
Histogram,
}
#[derive(Debug, Clone)]
pub struct ChartDef {
pub title: &'static str,
pub chart_type: ChartType,
pub position: (u32, u32),
pub items: &'static [&'static str],
pub target_line: Option<f64>,
}
#[derive(Debug, Clone)]
pub struct ReportDef {
pub title: &'static str,
pub layout: (u32, u32),
pub charts: &'static [ChartDef],
}
#[derive(Debug, Clone)]
pub struct CompareDef {
pub id: &'static str,
pub title: &'static str,
pub benchmarks: &'static [&'static str],
pub baseline: Option<&'static str>,
pub metric: &'static str,
pub group: Option<&'static str>,
pub x: Option<&'static str>,
pub series: Option<&'static [&'static str]>,
}
inventory::collect!(BenchmarkDef);
inventory::collect!(GroupDef);
inventory::collect!(ReportDef);
inventory::collect!(CompareDef);
#[used]
#[doc(hidden)]
pub static REGISTRY_ANCHOR: fn() = || {
for _ in inventory::iter::<BenchmarkDef> {}
for _ in inventory::iter::<GroupDef> {}
for _ in inventory::iter::<ReportDef> {}
for _ in inventory::iter::<CompareDef> {}
};