Struct ResponseTime

Source
pub struct ResponseTime<H: Histogram = AtomicHdrHistogram, T: Instant = StdInstant>(pub H, _);
Expand description

A metric measuring the response time of an expression, that is the duration the expression needed to complete.

Because it retrieves the current time before calling the expression, computes the elapsed duration and registers it to an histogram, this is a rather heavy-weight metric better applied at entry-points.

By default, ResponseTime uses an atomic hdr histogram and a synchronized time source, which work better in multithread scenarios. Non-threaded applications can gain performance by using unsynchronized structures instead.

Tuple Fields§

§0: H

Trait Implementations§

Source§

impl<H: Histogram, T: Instant> Clear for ResponseTime<H, T>

Source§

fn clear(&self)

Requests to clear self.
Source§

impl<H: Clone + Histogram, T: Clone + Instant> Clone for ResponseTime<H, T>

Source§

fn clone(&self) -> ResponseTime<H, T>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<H: Histogram + Debug, T: Instant> Debug for ResponseTime<H, T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<H: Histogram, T: Instant> Default for ResponseTime<H, T>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<H: Histogram, T: Instant> Deref for ResponseTime<H, T>

Source§

type Target = H

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<H: Histogram, T: Instant> Enter for ResponseTime<H, T>

Source§

type E = T

The type returned by the enter function and carried to OnResult
Source§

fn enter(&self) -> T

enter is called when entering in an aspect Read more
Source§

impl<H: Histogram, T: Instant, R> OnResult<R> for ResponseTime<H, T>

Source§

fn leave_scope(&self, enter: T) -> Advice

Called when an expression has exited, but the return value isn’t known. This can happen because of a panic, or if control flow bypasses a macro. This is also called by the default implementation of on_result.
Source§

fn on_result(&self, enter: Self::E, _result: &R) -> Advice

Called when an expression has returned. Read more
Source§

impl<H: Histogram + Serialize, T: Instant> Serialize for ResponseTime<H, T>

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<H: Histogram, T: Instant, R> Metric<R> for ResponseTime<H, T>

Auto Trait Implementations§

§

impl<H, T> Freeze for ResponseTime<H, T>
where H: Freeze,

§

impl<H, T> RefUnwindSafe for ResponseTime<H, T>

§

impl<H, T> Send for ResponseTime<H, T>
where H: Send, T: Send,

§

impl<H, T> Sync for ResponseTime<H, T>
where H: Sync, T: Sync,

§

impl<H, T> Unpin for ResponseTime<H, T>
where H: Unpin, T: Unpin,

§

impl<H, T> UnwindSafe for ResponseTime<H, T>
where H: UnwindSafe, T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<R, A> OnResultMut<R> for A
where A: OnResult<R>,

Source§

fn on_result(&self, enter: <A as Enter>::E, result: &mut R) -> Advice

Called when an expression has returned. Read more
Source§

fn leave_scope(&self, enter: <A as Enter>::E) -> Advice

Called when an expression has exited, but the return value isn’t known. This can happen because of a panic, or if control flow bypasses a macro. This is also called by the default implementation of on_result.
Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.