[−][src]Struct devtimer::ComplexTimer
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]
&mut self,
timer_name: &'static str
) -> Result<(), &'static str>
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]
&mut self,
timer_name: &'static str
) -> Result<(), &'static str>
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]
&mut self,
timer_name: &'static str
) -> Result<(), &'static str>
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]
&mut self,
timer_name: &'static str
) -> Result<(), &'static str>
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
// Assume some `ComplexTimer` instanc `dt` exists let mut dt = DevTime::new_complex(); for (name, timer) in dt.iter() { println!("Timer: {} took {} ns", name, timer.time_in_nanos()); }
Auto Trait Implementations
impl RefUnwindSafe for ComplexTimer
impl Send for ComplexTimer
impl Sync for ComplexTimer
impl Unpin for ComplexTimer
impl UnwindSafe for ComplexTimer
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,
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, 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.
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>,