Skip to main content

LossClassSensor

Struct LossClassSensor 

Source
pub struct LossClassSensor { /* private fields */ }
Expand description

Stateful loss differentiator. observe_interarrival / observe_owd feed it the running timing; classify runs the hybrid on a detected loss.

Implementations§

Source§

impl LossClassSensor

Source

pub fn new() -> Self

A fresh sensor with no timing baseline yet.

Source

pub fn observe_interarrival(&mut self, ia_us: f64)

Record one packet inter-arrival (microseconds) to update T_min. Zero or negative spacings (duplicate / reordered arrivals) are ignored.

Source

pub fn observe_owd(&mut self, owd_us: f64)

Record one relative one-way trip time (microseconds) to update the RTprop baseline and the recent-floor congestion detector.

Source

pub fn classify(&mut self, gap: u32, interarrival_us: f64) -> LossClass

Classify a loss of gap consecutive packets given the inter-arrival (microseconds) measured across it. mBiaz calls it wireless when the spacing fits the gap’s wireless window; Spike calls it wireless when the path is not in a congestion spike; the hybrid is wireless only when both agree, else congestion.

Source

pub fn recent_owd_spread_us(&self) -> f64

Spread (max - min, microseconds) of the recent ROTT window - the path’s current delay variation, which bounds how late a reordered packet can arrive. A consumer uses it to set a reorder-tolerant retransmit grace so jitter is not mistaken for loss. Zero before two samples.

Source

pub fn congestion_fraction(&self) -> f32

Share of recent loss classified congestion (0..=1); 0 before any loss.

Source

pub fn class_code(&self) -> u8

2-bit class code for the Loss frame: 0 = no loss yet, 1 = wireless, 2 = congestion, 3 = mixed (recent loss split between the two).

Trait Implementations§

Source§

impl Debug for LossClassSensor

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for LossClassSensor

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.