pub struct StressRun { /* private fields */ }Expand description
Configuration for a stress run.
§Example
use dev_stress::StressRun;
let run = StressRun::new("hot_path").iterations(1_000).threads(4);
assert_eq!(run.iterations_planned(), 1_000);
assert_eq!(run.threads_planned(), 4);Implementations§
Source§impl StressRun
impl StressRun
Sourcepub fn iterations(self, n: usize) -> Self
pub fn iterations(self, n: usize) -> Self
Total iterations across all threads.
Sourcepub fn track_latency(self, rate: usize) -> Self
pub fn track_latency(self, rate: usize) -> Self
Track per-operation latency, sampling 1 of every rate iterations.
rate = 1 records every iteration; rate = 100 records 1% of
iterations. Lower rates lower memory and overhead at the cost
of percentile precision.
§Example
use dev_stress::StressRun;
let run = StressRun::new("hot").iterations(10_000).threads(2)
.track_latency(10); // 10% sample rate
assert_eq!(run.iterations_planned(), 10_000);Sourcepub fn iterations_planned(&self) -> usize
pub fn iterations_planned(&self) -> usize
The configured iteration count.
Sourcepub fn threads_planned(&self) -> usize
pub fn threads_planned(&self) -> usize
The configured thread count.
Auto Trait Implementations§
impl Freeze for StressRun
impl RefUnwindSafe for StressRun
impl Send for StressRun
impl Sync for StressRun
impl Unpin for StressRun
impl UnsafeUnpin for StressRun
impl UnwindSafe for StressRun
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