[][src]Struct devtimer::ComplexTimer

pub struct ComplexTimer { /* fields omitted */ }

Complex Timer

A complex timer wraps around a map of timer names and their corresponding SimpleTimer instances.

Implementations

impl ComplexTimer[src]

pub fn new() -> Self[src]

Return a new ComplexTimer instance

pub fn create_timer(
    &mut self,
    timer_name: &'static str
) -> Result<(), &'static str>
[src]

Create a new timer tag. If the timer tag already exists, then this function returns an error.

pub fn start_timer(
    &mut self,
    timer_name: &'static str
) -> Result<(), &'static str>
[src]

Start a timer with tag timer_name. If this timer tag doesn't exist, then it returns an error

pub fn stop_timer(
    &mut self,
    timer_name: &'static str
) -> Result<(), &'static str>
[src]

Stop a timer with tag timer_name. If this timer tag doesn't exist, then it returns an error

pub fn time_in_secs(&self, timer_name: &'static str) -> Option<u64>[src]

Get the time in seconds for a timer with tag timer_name

pub fn time_in_millis(&self, timer_name: &'static str) -> Option<u128>[src]

Get the time in milliseconds for a timer with tag timer_name

pub fn time_in_micros(&self, timer_name: &'static str) -> Option<u128>[src]

Get the time in microseconds for a timer with tag timer_name

pub fn time_in_nanos(&self, timer_name: &'static str) -> Option<u128>[src]

Get the time in nanoseconds for a timer with tag timer_name

pub fn delete_timer(
    &mut self,
    timer_name: &'static str
) -> Result<(), &'static str>
[src]

Delete a timer with tag timer_name

pub fn clear_timers(&mut self)[src]

Delete all set timers

pub fn print_results(&self)[src]

Print all results in the following format:

timerx - 120 ns
timery - 1233 ns
...

pub fn iter(&self) -> Iter<'_, &'static str, SimpleTimer>[src]

Returns an iterator of timer tags and the corresponding SimpleTimer instances

Example

use devtimer::DevTime;
fn main() {
    let mut dt = DevTime::new_complex();
    for (name, timer) in dt.iter() {
        println!("Timer: {} took {} ns", name, timer.time_in_nanos().unwrap());
    }
}

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, 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.