Struct Counter

Source
pub struct Counter { /* private fields */ }
Expand description

A coz-counter which is either intended for throughput or begin/end points.

This is typically created by macros above via progress!(), begin!(), or end!(), but if necessary you can also create one of these manually in your own application for your own macros.

Implementations§

Source§

impl Counter

Source

pub const fn progress(name: &'static str) -> Counter

Creates a throughput coz counter with the given name.

Source

pub const fn begin(name: &'static str) -> Counter

Creates a latency coz counter with the given name, used for when an operation begins.

Note that this counter should be paired with an end counter of the same name.

Source

pub const fn end(name: &'static str) -> Counter

Creates a latency coz counter with the given name, used for when an operation ends.

Note that this counter should be paired with an begin counter of the same name.

Source

pub fn increment(&self)

Increment that an operation happened on this counter.

For throughput counters this should be called in a location where you want something to happen more often.

For latency-based counters this should be called before and after the operation you’d like to measure the latency of.

Auto Trait Implementations§

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> 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<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.