[−][src]Struct pconvert_rust::benchmark::Benchmark
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]
F: FnOnce() -> T,
H: FnOnce(&mut Self, u128),
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.
pub fn add(self, other: Self) -> Self[src]
impl Default for Benchmark[src]
impl Display for Benchmark[src]
impl Sub<Benchmark> for Benchmark[src]
Auto Trait Implementations
impl RefUnwindSafe for Benchmark[src]
impl Send for Benchmark[src]
impl Sync for Benchmark[src]
impl Unpin for Benchmark[src]
impl UnwindSafe for Benchmark[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToString for T where
T: Display + ?Sized, [src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,