pub mod bench;
mod launcher;
mod session;
pub mod table;
mod threading;
#[cfg(target_os = "linux")]
pub use bench::LinuxPerfBackend;
pub use bench::backend::BenchSampleResult;
pub use bench::{
BenchContext, BenchmarkCaseOrder, BenchmarkRunner, BenchmarkRuntimeOptions,
ConcurrentBenchContext, ConcurrentBenchControl, ConcurrentBenchmarkGroup, ConcurrentSampleInfo,
ConcurrentSampleLifecycle, ConcurrentSamplePhase, ConcurrentWorker, ConcurrentWorkerResult,
CounterValue, DiagnosticError, DiagnosticResult, MeasurementBackend, MeasurementDomain,
MetricFormat, MetricValue, NoContext, Throughput, WallClockBackend,
};
#[cfg(feature = "cuda")]
pub use bench::{CudaError, CudaEvent, CudaEventBackend, CudaResult};
#[cfg(feature = "gpu-counters")]
pub use bench::{
DEFAULT_NVIDIA_GPU_COUNTERS, GpuCounterCollector, GpuCounterError, GpuCounterMetric,
GpuCounterResult,
};
pub use launcher::{
BenchmarkMainOptions, OUTPUT_PATH_ENVIRONMENT, benchmark_filter_from_args,
benchmark_filter_from_env, benchmark_options_with_default_suite, run_benchmark_main,
};
pub use table::{Alignment, BorderColor, TableFormatter};
#[cfg(target_os = "linux")]
pub use bench::PerfCounters;
pub use session::{
BenchmarkKind, BenchmarkReport, BenchmarkResult, BenchmarkStats, ComparisonPolicy,
REPORT_SCHEMA_VERSION, SampleMetric, SampleMetricSet, WorkerCounterSummary, WorkerSummary,
};
pub use std::hint::black_box;
pub use std::time::Instant;
#[cfg(target_os = "linux")]
pub use perf_event;
#[macro_export]
macro_rules! benchmark_main {
(|$runner:ident| $body:block) => {
fn main() {
let options = $crate::benchmark_options_with_default_suite(
$crate::BenchmarkMainOptions::default(),
env!("CARGO_CRATE_NAME"),
);
let _ = $crate::run_benchmark_main(options, |$runner| $body);
}
};
($options:expr, |$runner:ident| $body:block) => {
fn main() {
let options =
$crate::benchmark_options_with_default_suite($options, env!("CARGO_CRATE_NAME"));
let _ = $crate::run_benchmark_main(options, |$runner| $body);
}
};
}