Skip to main content

ClassCounters

Struct ClassCounters 

Source
pub(crate) struct ClassCounters {
    name: String,
    bytes_delivered: AtomicU64,
    bytes_dropped: AtomicU64,
    objects_delivered: AtomicU64,
    objects_dropped: AtomicU64,
    tokens_exhausted_episodes: AtomicU64,
    blocked_episodes: AtomicU64,
    starved_behind_other_class: AtomicU64,
}
Expand description

One class’s atomic counters — the storage behind one ClassStats.

name is immutable for the recorder’s lifetime, so it is a plain String rather than anything shared: the class list cannot change under a running session.

Fields§

§name: String§bytes_delivered: AtomicU64§bytes_dropped: AtomicU64§objects_delivered: AtomicU64§objects_dropped: AtomicU64§tokens_exhausted_episodes: AtomicU64§blocked_episodes: AtomicU64§starved_behind_other_class: AtomicU64

Implementations§

Source§

impl ClassCounters

Source

fn named(name: String) -> Self

An all-zero row labelled name.

Source

fn snapshot(&self) -> ClassStats

Read this row.

Source

fn reset(&self)

Zero every counter, keeping the row’s name.

Only ProxyRecorder resets: a session’s figures are the session’s for its whole life. Seven relaxed stores, and deliberately not one atomic swap of the whole row — there is no such primitive, and a reset that raced traffic would land between two fetch_adds whatever it was written with. What that costs is a snapshot straddling a reset that reports a row part-cleared, which is why the reset is a caller’s verb and not something this crate does on its own.

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.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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 = !

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

fn try_from(value: U) -> Result<T, !>

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

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more