pub struct OveruseDetector { /* private fields */ }Expand description
Turns a filtered delay trend into a Usage, with hysteresis.
§Why the debounce
The trend crossing the threshold once means very little — the filter is still noisy, and a
single video frame arriving late will do it. Overuse is only declared when the trend stays
outside and has not decreased since the last reading and at least two readings agree.
Upstream does the same (overuse_detector.go); it is what stops the estimate sawtoothing.
Coming back has no such delay: Normal and Under are declared immediately, because being
slow to notice that a path has recovered wastes capacity for as long as it takes to notice.
Implementations§
Source§impl OveruseDetector
impl OveruseDetector
Sourcepub fn with_threshold_time_base(self, time_base: ThresholdTimeBase) -> Self
pub fn with_threshold_time_base(self, time_base: ThresholdTimeBase) -> Self
The time step the threshold adapts over (ThresholdTimeBase).
Sourcepub fn update_with_arrival(
&mut self,
now: Instant,
arrival: Duration,
estimate_ms: f64,
) -> Usage
pub fn update_with_arrival( &mut self, now: Instant, arrival: Duration, estimate_ms: f64, ) -> Usage
As update, with the arrival time of the reading’s group on the
receiver’s clock, which ThresholdTimeBase::Arrival adapts the threshold over.
Sourcepub fn threshold_ms(&self) -> f64
pub fn threshold_ms(&self) -> f64
The threshold the trend is being compared against, in milliseconds.