Struct trench::Bencher
[−]
[src]
pub struct Bencher<State, Sp: Spawner = StdThread<()>> { /* fields omitted */ }
A Bencher
is the struct the user uses to make a benchmark. The State
type is a user chosen
type that the benchmarking function is given a reference to.
Methods
impl<St, Sp> Bencher<St, Sp> where
St: 'static,
Sp: Spawner,
Sp::Return: Send + Default + 'static,
[src]
St: 'static,
Sp: Spawner,
Sp::Return: Send + Default + 'static,
pub fn new(state: St, n_threads: usize) -> Self
[src]
Construct a new Bencher
. The initial state and the number of threads is given.
pub fn bench(&mut self, f: fn(_: &St))
[src]
Start a threaded benchmark. All threads will run the function given. The state passed in is shared between all threads.
pub fn before<F: 'static + Fn(&mut St)>(&mut self, f: F)
[src]
Set the closure that is ran before each benchmark iteration.
pub fn after<F: 'static + Fn(&mut St)>(&mut self, f: F)
[src]
Set the closure that is ran afetr each benchmark iteration.
pub fn into_stats<S>(self, name: S) -> BenchStats where
S: Into<String>,
[src]
S: Into<String>,
Convert the Becnher into BenchStats
for statistics reporting.