pub struct BatchingStats {
pub total_requests: usize,
pub total_batches: usize,
pub avg_batch_size: f64,
pub avg_wait_time: Duration,
pub avg_latency: Duration,
pub num_timeouts: usize,
pub num_overflows: usize,
pub current_queue_depth: usize,
}Expand description
Statistics for dynamic batching.
Fields§
§total_requests: usizeTotal requests processed
total_batches: usizeTotal batches formed
avg_batch_size: f64Average batch size
avg_wait_time: DurationAverage wait time
avg_latency: DurationAverage latency
num_timeouts: usizeNumber of timeouts
num_overflows: usizeNumber of queue overflows
current_queue_depth: usizeCurrent queue depth
Implementations§
Source§impl BatchingStats
impl BatchingStats
Sourcepub fn update_batch(
&mut self,
batch_size: usize,
wait_time: Duration,
latency: Duration,
)
pub fn update_batch( &mut self, batch_size: usize, wait_time: Duration, latency: Duration, )
Update statistics with a new batch.
Sourcepub fn record_timeout(&mut self)
pub fn record_timeout(&mut self)
Record a timeout.
Sourcepub fn record_overflow(&mut self)
pub fn record_overflow(&mut self)
Record a queue overflow.
Sourcepub fn throughput(&self) -> f64
pub fn throughput(&self) -> f64
Get throughput (requests per second).
Sourcepub fn efficiency(&self, max_batch_size: usize) -> f64
pub fn efficiency(&self, max_batch_size: usize) -> f64
Get batching efficiency (ratio of actual to max batch size).
Trait Implementations§
Source§impl Clone for BatchingStats
impl Clone for BatchingStats
Source§fn clone(&self) -> BatchingStats
fn clone(&self) -> BatchingStats
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 BatchingStats
impl Debug for BatchingStats
Source§impl Default for BatchingStats
impl Default for BatchingStats
Source§fn default() -> BatchingStats
fn default() -> BatchingStats
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for BatchingStats
impl<'de> Deserialize<'de> for BatchingStats
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for BatchingStats
impl RefUnwindSafe for BatchingStats
impl Send for BatchingStats
impl Sync for BatchingStats
impl Unpin for BatchingStats
impl UnwindSafe for BatchingStats
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