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

pub struct Benchmark { /* fields omitted */ }

Holds the times for read, write and blend operations.

Implementations

impl Benchmark[src]

pub fn new() -> Self[src]

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

pub fn total(&self) -> u128[src]

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

pub fn execute<F, T, H>(&mut self, update_fn: H, target_fn: F) -> T where
    F: FnOnce() -> T,
    H: FnOnce(&mut Self, u128), 
[src]

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();

pub fn add_blend_time(benchmark: &mut Benchmark, blend_time: u128)[src]

Adds time spent blending to the blend time counter.

pub fn add_read_png_time(benchmark: &mut Benchmark, read_png_time: u128)[src]

Adds time spent reading to the read time counter.

pub fn add_write_png_time(benchmark: &mut Benchmark, write_png_time: u128)[src]

Adds time spent writing to the write time counter.

Trait Implementations

impl Add<Benchmark> for Benchmark[src]

type Output = Self

The resulting type after applying the + operator.

impl Default for Benchmark[src]

impl Display for Benchmark[src]

impl Sub<Benchmark> for Benchmark[src]

type Output = Self

The resulting type after applying the - operator.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pointable for T

type Init = T

The type for initializers.

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.