cuprate_benchmark_lib

Trait Benchmark

Source
pub trait Benchmark {
    type Input;

    const SETUP: fn() -> Self::Input;
    const MAIN: fn(_: Self::Input);
    const PRE_SLEEP_DURATION: Duration = _;
    const POST_SLEEP_DURATION: Duration = _;

    // Provided method
    fn name() -> &'static str { ... }
}
Expand description

A benchmarking function and its inputs.

Required Associated Constants§

Source

const SETUP: fn() -> Self::Input

Setup function to generate the input.

This function is not timed.

Source

const MAIN: fn(_: Self::Input)

The main function to benchmark.

The start of the timer begins right before this function is called and ends after the function returns.

Provided Associated Constants§

Source

const PRE_SLEEP_DURATION: Duration = _

cuprate-benchmark will sleep for this Duration after creating the Self::Input, but before starting Self::MAIN.

1 second by default.

Source

const POST_SLEEP_DURATION: Duration = _

cuprate-benchmark will sleep for this Duration after Self::MAIN.

1 second by default.

Required Associated Types§

Source

type Input

Input to the main benchmarking function.

This is passed to Self::MAIN.

Provided Methods§

Source

fn name() -> &'static str

The benchmark’s name.

This is automatically implemented as the name of the Self type.

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§