Struct fine_grained::Stopwatch
[−]
[src]
pub struct Stopwatch { /* fields omitted */ }
A stopwatch with lap functionality and nanosecond resolution.
Methods
impl Stopwatch
[src]
fn new() -> Stopwatch
Initialize a new stopwatch without starting it.
fn start_new() -> Stopwatch
Initialize a new stopwatch and start it.
fn start(&mut self)
Start the stopwatch.
fn lap(&mut self) -> u64
Start a new lap. Save the last lap's time and return it.
fn stop(&mut self)
Stop the stopwatch, without updating the total time.
This will not reset the stopwatch, i.e. the total time and the laps will be preserved.
fn reset(&mut self)
Re-initialize the stopwatch without restarting it.
fn restart(&mut self)
Re-initialize the stopwatch and start it.
fn total_time(&self) -> u64
Get the total time the stopwatch has been running.
If the stopwatch is still running, the total time is the time from starting the stopwatch until now. Otherwise, it is the sum of all laps.
fn laps(&self) -> &Vec<u64>
Get the list of all measured lap times in the order the laps were timed.
fn number_of_laps(&self) -> usize
Get the number of measured laps.
fn is_running(&self) -> bool
Determine if the stopwatch is currently running.
Trait Implementations
impl Clone for Stopwatch
[src]
fn clone(&self) -> Stopwatch
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more