pub struct PayloadTracker { /* private fields */ }Expand description
Tracks payload sizes for adaptive buffer sizing.
Implementations§
Source§impl PayloadTracker
impl PayloadTracker
Sourcepub fn total_bytes(&self) -> u64
pub fn total_bytes(&self) -> u64
Get the total bytes recorded.
Sourcepub fn average_size(&self) -> f64
pub fn average_size(&self) -> f64
Get the average payload size.
Sourcepub fn std_deviation(&self) -> f64
pub fn std_deviation(&self) -> f64
Calculate the standard deviation of payload sizes.
Sourcepub fn percentile(&self, p: f64) -> usize
pub fn percentile(&self, p: f64) -> usize
Get the percentile payload size (approximate via histogram).
Sourcepub fn recommended_buffer_size(&self) -> usize
pub fn recommended_buffer_size(&self) -> usize
Get the recommended buffer size based on traffic patterns.
This uses P90 (90th percentile) to size buffers so that 90% of payloads fit without reallocation.
Sourcepub fn update_cached_size(&self)
pub fn update_cached_size(&self)
Update cached recommended size (call periodically).
Sourcepub fn cached_recommended_size(&self) -> usize
pub fn cached_recommended_size(&self) -> usize
Get cached recommended size (faster than recalculating).
Sourcepub fn needs_recalc(&self, interval: Duration) -> bool
pub fn needs_recalc(&self, interval: Duration) -> bool
Check if recalculation is needed.
Trait Implementations§
Source§impl Debug for PayloadTracker
impl Debug for PayloadTracker
Auto Trait Implementations§
impl !Freeze for PayloadTracker
impl RefUnwindSafe for PayloadTracker
impl Send for PayloadTracker
impl Sync for PayloadTracker
impl Unpin for PayloadTracker
impl UnwindSafe for PayloadTracker
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> Injectable for T
impl<T> Injectable for T
Source§fn type_id_of() -> TypeIdwhere
Self: Sized,
fn type_id_of() -> TypeIdwhere
Self: Sized,
Returns the TypeId of this type (for internal use)
Source§fn type_name_of() -> &'static strwhere
Self: Sized,
fn type_name_of() -> &'static strwhere
Self: Sized,
Returns the type name for debugging