Struct trench::TimedBench
[−]
[src]
pub struct TimedBench<Global, Local> { /* fields omitted */ }
Methods
impl<Global, Local> TimedBench<Global, Local> where
Global: 'static + Default + Send + Sync,
Local: 'static + Default,
[src]
Global: 'static + Default + Send + Sync,
Local: 'static + Default,
pub fn with_threads(num_threads: usize) -> Self
[src]
pub fn with_local_state<F>(&self, f: F) where
F: 'static + Fn(&mut Local) + Send + Clone,
[src]
F: 'static + Fn(&mut Local) + Send + Clone,
Have each thread initialize their local state. This function is executed by all threads.
pub fn with_global_state<F>(&self, f: F) where
F: 'static + Fn(&Global) + Send + Clone,
[src]
F: 'static + Fn(&Global) + Send + Clone,
Have all threads run the closure on the global state. Useful for initializing the global state, eg. for prefilling of data structures.
pub fn with_global_state_current_thread<F>(&self, f: F) where
F: Fn(&mut Global),
[src]
F: Fn(&mut Global),
Initailize the global state, but do it single threaded.
pub fn sync(&self)
[src]
Finish all pending work on all spawned threads.
pub fn run_for(
&self,
duration: Duration,
f: fn(_: &Global, _: &mut Local)
) -> BenchResult
[src]
&self,
duration: Duration,
f: fn(_: &Global, _: &mut Local)
) -> BenchResult
Trait Implementations
impl<Global, Local> Drop for TimedBench<Global, Local>
[src]
Auto Trait Implementations
impl<Global, Local> Send for TimedBench<Global, Local> where
Global: Send + Sync,
Local: Send,
Global: Send + Sync,
Local: Send,