pub struct Bencher<R> { /* private fields */ }Expand description
A benchmarking harness.
Implementations§
Source§impl<R: Runtime> Bencher<R>
impl<R: Runtime> Bencher<R>
Sourcepub fn new(threads: usize, runtime: R) -> Self
pub fn new(threads: usize, runtime: R) -> Self
Create a new benchmark harness.
§Examples
use blueprint_benchmarking::{Bencher, TokioRuntime};
const THREADS: usize = 4;
let bencher = Bencher::new(THREADS, TokioRuntime);Sourcepub fn stop<N: ToString>(&self, name: N, job_id: u8) -> BenchmarkSummary
pub fn stop<N: ToString>(&self, name: N, job_id: u8) -> BenchmarkSummary
Ends the benchmark and returns a summary.
§Panics
This will panic in the event it cannot determine the process ID.
§Examples
use blueprint_benchmarking::{Bencher, TokioRuntime};
const THREADS: usize = 4;
let bencher = Bencher::new(THREADS, TokioRuntime);
bencher.block_on(async {
// Do some work...
});
let summary = bencher.stop("my_benchmark", 0);
println!("{}", summary);Trait Implementations§
Auto Trait Implementations§
impl<R> Freeze for Bencher<R>where
R: Freeze,
impl<R> RefUnwindSafe for Bencher<R>where
R: RefUnwindSafe,
impl<R> Send for Bencher<R>where
R: Send,
impl<R> Sync for Bencher<R>where
R: Sync,
impl<R> Unpin for Bencher<R>where
R: Unpin,
impl<R> UnwindSafe for Bencher<R>where
R: UnwindSafe,
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