pub struct Probe { /* private fields */ }Expand description
A measurement-in-progress for a single operation.
§Lifecycle
use congestion::{MetadataOp, Probe, Side};
let probe = Probe::start_metadata(Side::Source, MetadataOp::Stat);
// ... perform the syscall or operation ...
probe.complete_ok(0);Forgetting to call Probe::complete / Probe::complete_ok drops the
probe without recording anything. This is intentional: error paths that
bail out early should not produce misleading latency samples.
Implementations§
Source§impl Probe
impl Probe
Sourcepub fn start(kind: ResourceKind) -> Self
pub fn start(kind: ResourceKind) -> Self
Begin measuring an operation of the given kind.
Sourcepub fn start_metadata(side: Side, op: MetadataOp) -> Self
pub fn start_metadata(side: Side, op: MetadataOp) -> Self
Shorthand for Probe::start(ResourceKind::Metadata(side, op)).
Use this to bracket a single per-file metadata syscall.
Sourcepub fn start_read() -> Self
pub fn start_read() -> Self
Shorthand for Probe::start(ResourceKind::DataRead).
Sourcepub fn start_write() -> Self
pub fn start_write() -> Self
Shorthand for Probe::start(ResourceKind::DataWrite).
Sourcepub fn complete_ok(self, bytes: u64)
pub fn complete_ok(self, bytes: u64)
Complete the probe with outcome Outcome::Ok and the given byte
count (use 0 for metadata ops).
Auto Trait Implementations§
impl Freeze for Probe
impl RefUnwindSafe for Probe
impl Send for Probe
impl Sync for Probe
impl Unpin for Probe
impl UnsafeUnpin for Probe
impl UnwindSafe for Probe
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