Struct netem_trace::model::bw::NormalizedBw
source · pub struct NormalizedBw {
pub mean: Bandwidth,
pub std_dev: Bandwidth,
pub upper_bound: Option<Bandwidth>,
pub lower_bound: Option<Bandwidth>,
pub duration: Duration,
pub step: Duration,
pub seed: u64,
/* private fields */
}Expand description
The model of a bandwidth trace subjects to a normal distribution.
The bandwidth will subject to N(mean, std_dev), but bounded within [lower_bound, upper_bound] (optional)
Examples
A simple example without any bound on bandwidth:
let mut normal_bw = NormalizedBwConfig::new()
.mean(Bandwidth::from_mbps(12))
.std_dev(Bandwidth::from_mbps(1))
.duration(Duration::from_secs(1))
.step(Duration::from_millis(100))
.seed(42)
.build();
assert_eq!(normal_bw.next_bw(), Some((Bandwidth::from_bps(12069427), Duration::from_millis(100))));
assert_eq!(normal_bw.next_bw(), Some((Bandwidth::from_bps(12132938), Duration::from_millis(100))));A more complex example with bounds on bandwidth:
let mut normal_bw = NormalizedBwConfig::new()
.mean(Bandwidth::from_mbps(12))
.std_dev(Bandwidth::from_mbps(1))
.duration(Duration::from_secs(1))
.step(Duration::from_millis(100))
.seed(42)
.upper_bound(Bandwidth::from_kbps(12100))
.lower_bound(Bandwidth::from_kbps(11900))
.build();
assert_eq!(normal_bw.next_bw(), Some((Bandwidth::from_bps(12069427), Duration::from_millis(100))));
assert_eq!(normal_bw.next_bw(), Some((Bandwidth::from_bps(12100000), Duration::from_millis(100))));Fields§
§mean: Bandwidth§std_dev: Bandwidth§upper_bound: Option<Bandwidth>§lower_bound: Option<Bandwidth>§duration: Duration§step: Duration§seed: u64Implementations§
Trait Implementations§
source§impl Clone for NormalizedBw
impl Clone for NormalizedBw
source§fn clone(&self) -> NormalizedBw
fn clone(&self) -> NormalizedBw
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl RefUnwindSafe for NormalizedBw
impl Send for NormalizedBw
impl Sync for NormalizedBw
impl Unpin for NormalizedBw
impl UnwindSafe for NormalizedBw
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