pub struct BenchmarkSuite { /* private fields */ }Expand description
A suite of benchmarks that can be run and recorded as a receipt.
Implementations§
Source§impl BenchmarkSuite
impl BenchmarkSuite
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new benchmark suite with auto-detected commit hash and machine fingerprint.
Sourcepub fn with_commit_hash(commit_hash: impl Into<String>) -> Self
pub fn with_commit_hash(commit_hash: impl Into<String>) -> Self
Create a new suite with explicit commit hash.
Sourcepub fn register(
&mut self,
name: impl Into<String>,
bench: impl Fn() -> Result<BenchmarkResult, String> + Send + Sync + 'static,
)
pub fn register( &mut self, name: impl Into<String>, bench: impl Fn() -> Result<BenchmarkResult, String> + Send + Sync + 'static, )
Register a benchmark with a name and callable.
The callable should perform the actual benchmark work and return a result with the measured elapsed time and iteration count.
Sourcepub fn run(&self) -> Result<BenchmarkReceipt, BenchError>
pub fn run(&self) -> Result<BenchmarkReceipt, BenchError>
Run all registered benchmarks and return a receipt.
Sourcepub fn run_one(&self, name: &str) -> Result<BenchmarkResult, BenchError>
pub fn run_one(&self, name: &str) -> Result<BenchmarkResult, BenchError>
Run a specific named benchmark and return just that result.
Sourcepub fn benchmark_names(&self) -> Vec<&String>
pub fn benchmark_names(&self) -> Vec<&String>
Get the list of registered benchmark names.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for BenchmarkSuite
impl !UnwindSafe for BenchmarkSuite
impl Freeze for BenchmarkSuite
impl Send for BenchmarkSuite
impl Sync for BenchmarkSuite
impl Unpin for BenchmarkSuite
impl UnsafeUnpin for BenchmarkSuite
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more