pub struct RttEma {
pub srtt_ns: u64,
pub rttvar_ns: u64,
pub sample_count: u64,
}Expand description
Jacobson/Karels RTT EMA: smoothed SRTT + smoothed RTTVAR with sample-count tracking. Mirrors RFC 6298 §2 with α = 1/8 and β = 1/4.
The deadline-derivation formula SRTT + 4·RTTVAR follows the
canonical Karn/Partridge recommendation for retransmission
timeout. Self::is_warm gates the per-tier fallback so cold
EMAs (fewer than three samples) fall through to coarser priors.
Fields§
§srtt_ns: u64Smoothed round-trip time, nanoseconds.
rttvar_ns: u64Smoothed round-trip-time variance, nanoseconds.
sample_count: u64Count of samples observed.
Implementations§
Source§impl RttEma
impl RttEma
Sourcepub fn observe(&mut self, sample_ns: u64)
pub fn observe(&mut self, sample_ns: u64)
Observe a round-trip sample. Updates SRTT + RTTVAR using Jacobson’s α = 1/8 / β = 1/4 weights.
Sourcepub fn observe_with_alpha_beta(
&mut self,
sample_ns: u64,
alpha_shift: u8,
beta_shift: u8,
)
pub fn observe_with_alpha_beta( &mut self, sample_ns: u64, alpha_shift: u8, beta_shift: u8, )
Observe a round-trip sample with a smaller learning rate. Used by the global prior to dampen the influence of any one peer’s bursty samples on the cross-runtime estimate.
alpha_shift = log2(1/α), beta_shift = log2(1/β). Values
of (3, 2) match the Jacobson recommendation (α=1/8, β=1/4);
larger shifts (e.g. (6, 5)) make the EMA more conservative.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RttEma
impl RefUnwindSafe for RttEma
impl Send for RttEma
impl Sync for RttEma
impl Unpin for RttEma
impl UnsafeUnpin for RttEma
impl UnwindSafe for RttEma
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedComponent for T
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request