pub struct ThroughputTracker { /* private fields */ }Expand description
Throughput tracker for monitoring performance over time.
Provides time-windowed throughput calculations for records, bytes, and transactions. Maintains sliding windows of recent performance data for real-time monitoring and trend analysis.
§Examples
use crate::backend::native::v2::wal::metrics::aggregation::ThroughputTracker;
let mut tracker = ThroughputTracker::new();
tracker.record_write_operation(1024);
tracker.record_transaction();
let (records, bytes, tx) = tracker.get_current_throughput();
assert!(records > 0.0);Implementations§
Source§impl ThroughputTracker
impl ThroughputTracker
Sourcepub fn new() -> Self
pub fn new() -> Self
Create new throughput tracker with default settings.
Initializes with a 60-second time window and maximum of 300 samples (5 minutes of historical data) for comprehensive trend analysis.
§Returns
A new ThroughputTracker instance ready for operation tracking
Sourcepub fn record_write_operation(&mut self, bytes: usize)
pub fn record_write_operation(&mut self, bytes: usize)
Record a write operation.
Adds a write operation to the throughput tracking, updating both record and byte throughput metrics.
§Arguments
bytes- Number of bytes written in the operation
Sourcepub fn record_read_operation(&mut self, bytes: usize)
pub fn record_read_operation(&mut self, bytes: usize)
Record a read operation.
Adds a read operation to the throughput tracking for performance monitoring and capacity planning.
§Arguments
bytes- Number of bytes read in the operation
Sourcepub fn record_transaction(&mut self)
pub fn record_transaction(&mut self)
Record a transaction.
Tracks transaction completion rates for monitoring transaction throughput and system performance under load.
Sourcepub fn get_current_throughput(&self) -> (f64, f64, f64)
pub fn get_current_throughput(&self) -> (f64, f64, f64)
Get current throughput metrics.
Calculates current throughput rates based on the accumulated data within the configured time window.
§Returns
Tuple containing (records_per_sec, bytes_per_sec, transactions_per_sec)
Trait Implementations§
Source§impl Clone for ThroughputTracker
impl Clone for ThroughputTracker
Source§fn clone(&self) -> ThroughputTracker
fn clone(&self) -> ThroughputTracker
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ThroughputTracker
impl Debug for ThroughputTracker
Auto Trait Implementations§
impl Freeze for ThroughputTracker
impl RefUnwindSafe for ThroughputTracker
impl Send for ThroughputTracker
impl Sync for ThroughputTracker
impl Unpin for ThroughputTracker
impl UnwindSafe for ThroughputTracker
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more