Struct pconvert_rust::benchmark::Benchmark[][src]

pub struct Benchmark { /* fields omitted */ }
Expand description

Holds the times for read, write and blend operations.

Implementations

Creates a new instance of the Benchmark struct with counters set to zero.

Returns the total time (in milliseconds), i.e., the sum of read, write and blend times.

Executes the function to benchmark and adds the time spent to a certain counter with the given target_fn.

use pconvert_rust::benchmark::Benchmark;
use pconvert_rust::utils::read_png_from_file;

let mut benchmark = Benchmark::new();
let demultiply = false;
let path = "path/to/file.png".to_owned();
let top = benchmark.execute(Benchmark::add_read_png_time, || {
   read_png_from_file(path, demultiply)
}).unwrap();

Adds time spent blending to the blend time counter.

Adds time spent reading to the read time counter.

Adds time spent writing to the write time counter.

Trait Implementations

The resulting type after applying the + operator.

Performs the + operation. Read more

Returns the “default value” for a type. Read more

Formats the value using the given formatter. Read more

The resulting type after applying the - operator.

Performs the - operation. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.