pub struct OwdTrendDetector { /* private fields */ }Expand description
OWD trend detector using linear regression over a ring buffer.
Stores (sequence, owd_us) samples and computes the slope via least-squares regression. The slope (µs/s) indicates whether queuing delay is increasing (congestion) or stable.
Implementations§
Source§impl OwdTrendDetector
impl OwdTrendDetector
pub fn new(capacity: usize) -> Self
Sourcepub fn push(&mut self, seq: u32, owd_us: i64)
pub fn push(&mut self, seq: u32, owd_us: i64)
Add an OWD sample.
seq is a monotonic sequence number (e.g., truncated frame counter).
owd_us is the relative one-way delay in microseconds (R_i - S_i).
Sourcepub fn trend_us_per_sec(&self) -> i32
pub fn trend_us_per_sec(&self) -> i32
Compute the OWD trend as a slope in µs/second.
Uses simple linear regression: slope = Σ((x-x̄)(y-ȳ)) / Σ((x-x̄)²) where x = sequence number and y = owd_us.
Returns 0 if fewer than 2 samples.
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Auto Trait Implementations§
impl Freeze for OwdTrendDetector
impl RefUnwindSafe for OwdTrendDetector
impl Send for OwdTrendDetector
impl Sync for OwdTrendDetector
impl Unpin for OwdTrendDetector
impl UnsafeUnpin for OwdTrendDetector
impl UnwindSafe for OwdTrendDetector
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more