Reset the latency stats when you change the shaper
When we change the qdisc on an interface we expect it to behave differently
after. So we should reset the history in order to get a new perspective.
@@ -63,12 +63,17 @@ impl RunningLatencyStats {
let avg = self.get_avg();
let std_dev = self.get_std_dev();
match (avg, std_dev) {
- (Some(avg), Some(std_dev)) => std_dev > avg * 4f32,
+ (Some(avg), Some(std_dev)) => std_dev > avg * 10f32,
(Some(_avg), None) => false,
(None, Some(_std_dev)) => false,
(None, None) => false,
}
}
+ pub fn reset(&mut self) {
+ self.count = 0u32;
+ self.mean = 0f32;
+ self.m2 = 0f32;
+ }
}
/// Due to the way babel communicates packet loss the fucntions here require slightly
@@ -289,6 +294,9 @@ fn observe_network(
TunnelManager::from_registry().do_send(GotBloat {
iface: iface.to_string(),
});
+ // reset the values for this entry because we have modified
+ // the qdisc and it's no longer an accurate representation
+ running_stats.reset();
}
(false, Some(key), Some(avg), Some(std_dev)) => info!(
"Neighbor {} is ok with AVG {} STDDEV {} and CV {}",
