Skip to main content

Workload

Trait Workload 

Source
pub trait Workload: Send + Sync {
    // Required method
    fn run_once(&self);
}
Expand description

A workload that can be executed many times under stress.

Implementations MUST be safe to call concurrently from multiple threads (Send + Sync) and MUST be cheap to clone, since each thread receives an Arc<Self>.

§Example

use dev_stress::Workload;

#[derive(Clone)]
struct Noop;
impl Workload for Noop {
    fn run_once(&self) {
        std::hint::black_box(1 + 1);
    }
}

Required Methods§

Source

fn run_once(&self)

Execute one unit of work. MUST be safe to call concurrently from multiple threads.

Implementors§