Diffable

Trait Diffable 

Source
pub trait Diffable {
    type Val;

    // Required methods
    fn start(&mut self);
    fn stop(&mut self);
    fn current_value(&mut self) -> Self::Val;
    fn diff(current: &Self::Val, earlier: &Self::Val) -> u64;
    fn print_diff(val: u64);
}
Expand description

An abstraction over some changing values that we want to measure.

A Diffable object could be stateless (e.g. a timer that reads the wall clock), or stateful (e.g. holds reference to a perf event fd)

Required Associated Types§

Source

type Val

The type of each reading

Required Methods§

Source

fn start(&mut self)

Start the Diffable

Source

fn stop(&mut self)

Stop the Diffable

Source

fn current_value(&mut self) -> Self::Val

Read the current value

Source

fn diff(current: &Self::Val, earlier: &Self::Val) -> u64

Compute the difference between two readings

Source

fn print_diff(val: u64)

Print the difference in a specific format

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§