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
impl Counter
Sourcepub const fn progress(name: &'static str) -> Counter
pub const fn progress(name: &'static str) -> Counter
Creates a throughput coz counter with the given name.
Sourcepub const fn begin(name: &'static str) -> Counter
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.
Sourcepub const fn end(name: &'static str) -> Counter
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.
Sourcepub fn increment(&self)
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.