pub struct IoStats(/* private fields */);Expand description
A shareable, cloneable handle to a set of cumulative I/O counters.
All clones share the same underlying counters. This serves two purposes:
- It backs each
ScanScheduler’s own running totals. - It can be attached to an individual
FileScheduler(viaFileScheduler::with_io_stats) as a secondary sink, so a caller can measure the exact bytes/IOPS performed through that file handle for a bounded scope (e.g. a single query) without disturbing the scheduler’s global totals. Read the result back withIoStats::snapshot.
Implementations§
Source§impl IoStats
impl IoStats
pub fn new() -> Self
Sourcepub fn record_request(&self, request: &[Range<u64>])
pub fn record_request(&self, request: &[Range<u64>])
Record a single completed request. request holds the byte ranges as
actually submitted to storage (post coalescing/splitting), so the counts
reflect physical I/O.
Sourcepub fn snapshot(&self) -> ScanStats
pub fn snapshot(&self) -> ScanStats
Take an immutable snapshot of the current cumulative counters.
Sourcepub fn recorder(&self) -> Arc<dyn IoStatsRecorder>
pub fn recorder(&self) -> Arc<dyn IoStatsRecorder>
Return this handle as a type-erased IoStatsRecorder, suitable for
attaching to a file reader (e.g. FileReader::with_io_stats). The
returned recorder shares the same underlying counters as self.
Sourcepub fn add_scan_stats(&self, stats: &ScanStats)
pub fn add_scan_stats(&self, stats: &ScanStats)
Add a snapshot of already-aggregated statistics into this sink. Used to fold in I/O measured on a separate scheduler (e.g. the one-time reads performed while opening an index).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for IoStats
impl RefUnwindSafe for IoStats
impl Send for IoStats
impl Sync for IoStats
impl Unpin for IoStats
impl UnsafeUnpin for IoStats
impl UnwindSafe for IoStats
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
Converts
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>
Converts
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 moreCreates a shared type from an unshared type.