vmm_sys_util::metric

Trait Metric

Source
pub trait Metric {
    // Required methods
    fn add(&self, value: u64);
    fn count(&self) -> u64;
    fn reset(&self);
    fn set(&self, value: u64);

    // Provided method
    fn inc(&self) { ... }
}
Expand description

Abstraction over the common metric operations.

An object implementing Metric is expected to have an inner counter that can be incremented and reset. The Metric trait can be used for implementing a metric system backend (or an aggregator).

Required Methods§

Source

fn add(&self, value: u64)

Adds value to the current counter.

Source

fn count(&self) -> u64

Returns current value of the counter.

Source

fn reset(&self)

Resets the metric counter.

Source

fn set(&self, value: u64)

Set the metric counter value.

Provided Methods§

Source

fn inc(&self)

Increments by 1 unit the current counter.

Implementations on Foreign Types§

Source§

impl Metric for AtomicU64

Source§

fn add(&self, value: u64)

Adds value to the current counter.

According to fetch_add documentation, in case of an integer overflow, the counter starts over from 0.

Source§

fn count(&self) -> u64

Returns current value of the counter.

Source§

fn reset(&self)

Resets the metric counter to 0.

Source§

fn set(&self, value: u64)

Set the metric counter value.

Implementors§