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, benchmark_filter_from_args, benchmark_filter_from_env, 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,
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 _ =
$crate::run_benchmark_main($crate::BenchmarkMainOptions::default(), |$runner| {
$body
});
}
};
($options:expr, |$runner:ident| $body:block) => {
fn main() {
let _ = $crate::run_benchmark_main($options, |$runner| $body);
}
};
}