pub struct Counter {
pub count: AtomicU64,
pub ticks: AtomicU64,
}Expand description
The standard atomic counter implementation for timed_span!.
count records the number of timed spans, while ticks accumulates their
elapsed processor-counter ticks (or nanoseconds on unsupported architectures).
Use this type when a total, a count, and their derived average are sufficient.
Fields§
§count: AtomicU64§ticks: AtomicU64Implementations§
Trait Implementations§
Source§impl TimingCounter for Counter
Available on target_has_atomic=64 only.
impl TimingCounter for Counter
Available on
target_has_atomic=64 only.Source§const INITIAL: Self
const INITIAL: Self
The const value used to initialize each element of a static counter collection.
Source§fn increment_count(&self)
fn increment_count(&self)
Records one invocation of the timed operation, before the timed scope runs.
Source§fn add_elapsed_ticks(&self, ticks: u64)
fn add_elapsed_ticks(&self, ticks: u64)
Records the elapsed processor-counter ticks or nanoseconds when the scope ends.
Auto Trait Implementations§
impl !Freeze for Counter
impl RefUnwindSafe for Counter
impl Send for Counter
impl Sync for Counter
impl Unpin for Counter
impl UnsafeUnpin for Counter
impl UnwindSafe for Counter
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