Stride Reference Manual
- generated for commit 9643b11
|
Provides a stopwatch interface to time: it accumulates time between start/stop pairs. More...
#include <Stopwatch.h>
Public Types | |
using | TClock = T |
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 35 of file Stopwatch.h.
using stride::util::Stopwatch< T >::TClock = T |
Definition at line 38 of file Stopwatch.h.
|
inlineexplicit |
Constructor initializes stopwatch.
Definition at line 41 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 50 of file Stopwatch.h.
References stride::util::Stopwatch< T >::m_last_start, and stride::util::Stopwatch< T >::m_running.
Referenced by stride::SimRunner::Run(), stride::SimRunner::SimRunner(), and stride::ControlHelper::~ControlHelper().
|
inline |
Stops the stopwatch if it was running.
Definition at line 60 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.
Referenced by stride::SimRunner::Run(), and stride::ControlHelper::Shutdown().
|
inline |
Resets stopwatch i.e. stopwatch is stopped and time accumulator is cleared.
Definition at line 70 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 78 of file Stopwatch.h.
References stride::util::Stopwatch< T >::m_running.
|
inline |
Return name of this stopwatch.
Definition at line 81 of file Stopwatch.h.
References stride::util::Stopwatch< T >::m_name.
|
inline |
Returns the accumulated value without altering the stopwatch state.
Definition at line 84 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.
Referenced by stride::util::Stopwatch< T >::ToString().
|
inline |
Returns string representation of readout.
Definition at line 94 of file Stopwatch.h.
References stride::util::Stopwatch< T >::Get(), and stride::util::TimeToString::ToColonString().
Referenced by stride::ControlHelper::Shutdown().
|
private |
Definition at line 115 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 116 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 117 of file Stopwatch.h.
Referenced by stride::util::Stopwatch< T >::GetName().
|
private |
Definition at line 118 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().