pub struct PoolStats {
pub hits: u64,
pub misses: u64,
pub returns: u64,
pub drops: u64,
}Expand description
Statistics for monitoring TracePool usage and efficiency.
PoolStats tracks cache hits/misses and provides metrics to optimize memory pool performance in inference algorithms.
Example:
let mut pool = TracePool::new(5);
// Generate some cache activity
let trace1 = pool.get(); // miss
let trace2 = pool.get(); // miss
pool.return_trace(trace1);
let trace3 = pool.get(); // hit (reuses trace1)
// Check performance metrics
let stats = pool.stats();
println!("Hit ratio: {:.1}%", stats.hit_ratio());
println!("Total operations: {}", stats.total_gets());
assert_eq!(stats.hits, 1);
assert_eq!(stats.misses, 2);Fields§
§hits: u64Number of successful gets from the pool (cache hits).
misses: u64Number of gets that required new allocation (cache misses).
returns: u64Number of traces returned to the pool.
drops: u64Number of traces dropped due to pool being full.
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PoolStats
impl RefUnwindSafe for PoolStats
impl Send for PoolStats
impl Sync for PoolStats
impl Unpin for PoolStats
impl UnwindSafe for PoolStats
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