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

Object Safety§

This trait is not object safe.

Implementors§