Stride Reference Manual
1.0
|
Provides a stopwatch interface to time: it accumulates time between start/stop pairs. More...
#include <Stopwatch.h>
Public Types | |
typedef T | TClock |
Public Member Functions | |
Stopwatch (std::string name="stopwatch", bool running=false) | |
Constructor initializes stopwatch. More... | |
Stopwatch & | start () |
Starts stopwatch if it was stopped. More... | |
Stopwatch & | stop () |
Stops the stopwatch if it was running. More... | |
Stopwatch & | reset () |
Resets stopwatch i.e. stopwatch is stopped and time accumulator is cleared. More... | |
bool | isRunning () const |
Reports whether stopwatch has been started. More... | |
std::string | getName () const |
Return name of this stopwatch. More... | |
T::duration | get () const |
Returns the accumulated value without altering the stopwatch state. More... | |
std::string | toString () const |
Returns string representation of readout. More... | |
Private Attributes | |
T::duration | m_accumulated |
T::time_point | m_last_start |
std::string | m_name |
bool | m_running |
Provides a stopwatch interface to time: it accumulates time between start/stop pairs.
Definition at line 33 of file Stopwatch.h.
typedef T stride::util::Stopwatch< T >::TClock |
Definition at line 35 of file Stopwatch.h.
|
inline |
Constructor initializes stopwatch.
Definition at line 38 of file Stopwatch.h.
References stride::util::Stopwatch< T >::m_last_start, and stride::util::Stopwatch< T >::m_running.
|
inline |
Starts stopwatch if it was stopped.
Definition at line 46 of file Stopwatch.h.
References stride::util::Stopwatch< T >::m_last_start, and stride::util::Stopwatch< T >::m_running.
|
inline |
Stops the stopwatch if it was running.
Definition at line 55 of file Stopwatch.h.
References stride::util::Stopwatch< T >::m_accumulated, stride::util::Stopwatch< T >::m_last_start, and stride::util::Stopwatch< T >::m_running.
|
inline |
Resets stopwatch i.e. stopwatch is stopped and time accumulator is cleared.
Definition at line 64 of file Stopwatch.h.
References stride::util::Stopwatch< T >::m_accumulated, and stride::util::Stopwatch< T >::m_running.
|
inline |
Reports whether stopwatch has been started.
Definition at line 71 of file Stopwatch.h.
References stride::util::Stopwatch< T >::m_running.
|
inline |
Return name of this stopwatch.
Definition at line 76 of file Stopwatch.h.
References stride::util::Stopwatch< T >::m_name.
|
inline |
Returns the accumulated value without altering the stopwatch state.
Definition at line 81 of file Stopwatch.h.
References stride::util::Stopwatch< T >::m_accumulated, stride::util::Stopwatch< T >::m_last_start, and stride::util::Stopwatch< T >::m_running.
|
inline |
Returns string representation of readout.
Definition at line 90 of file Stopwatch.h.
References stride::util::TimeToString::toColonString().
|
private |
Definition at line 110 of file Stopwatch.h.
Referenced by stride::util::Stopwatch< T >::get(), stride::util::Stopwatch< T >::reset(), and stride::util::Stopwatch< T >::stop().
|
private |
Definition at line 111 of file Stopwatch.h.
Referenced by stride::util::Stopwatch< T >::get(), stride::util::Stopwatch< T >::start(), stride::util::Stopwatch< T >::stop(), and stride::util::Stopwatch< T >::Stopwatch().
|
private |
Definition at line 112 of file Stopwatch.h.
Referenced by stride::util::Stopwatch< T >::getName().
|
private |
Definition at line 113 of file Stopwatch.h.
Referenced by stride::util::Stopwatch< T >::get(), stride::util::Stopwatch< T >::isRunning(), stride::util::Stopwatch< T >::reset(), stride::util::Stopwatch< T >::start(), stride::util::Stopwatch< T >::stop(), and stride::util::Stopwatch< T >::Stopwatch().