pub struct BatchController { /* private fields */ }Expand description
Adaptive batch window controller based on M/G/1 queueing model.
Estimates arrival rate λ and service time E[S] from observations, then computes the optimal batch window τ to maintain stability (ρ < 1) while minimizing latency.
Implementations§
Source§impl BatchController
impl BatchController
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new controller with sensible defaults.
alpha: EMA smoothing (default 0.2)tau_min: minimum batch window (default 1ms)tau_max: maximum batch window (default 50ms)headroom: stability margin (default 2.0, keeps ρ ≤ 0.5)
Sourcepub fn observe_arrival(&mut self, now: Instant)
pub fn observe_arrival(&mut self, now: Instant)
Record an event arrival, updating the inter-arrival estimate.
Sourcepub fn observe_service(&mut self, duration: Duration)
pub fn observe_service(&mut self, duration: Duration)
Record a service (render) time observation.
Sourcepub fn lambda_est(&self) -> f64
pub fn lambda_est(&self) -> f64
Estimated arrival rate λ (events/second).
Sourcepub fn service_est_s(&self) -> f64
pub fn service_est_s(&self) -> f64
Estimated service time E[S] (seconds).
Sourcepub fn tau_s(&self) -> f64
pub fn tau_s(&self) -> f64
Compute the optimal batch window τ (seconds).
τ = clamp(E[S] × headroom, τ_min, τ_max)
When ρ approaches 1, τ increases to maintain stability.
Sourcepub fn observations(&self) -> u64
pub fn observations(&self) -> u64
Number of observations recorded.
Trait Implementations§
Source§impl Clone for BatchController
impl Clone for BatchController
Source§fn clone(&self) -> BatchController
fn clone(&self) -> BatchController
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BatchController
impl Debug for BatchController
Auto Trait Implementations§
impl Freeze for BatchController
impl RefUnwindSafe for BatchController
impl Send for BatchController
impl Sync for BatchController
impl Unpin for BatchController
impl UnwindSafe for BatchController
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