A minimal timer class.
More...
#include <basic_timer.h>
|
| DurationType | get_elapsed_time () const |
| | Get the total time spent between starts and stops. Only call while the timer is stopped. More...
|
| |
| void | reset () |
| | Set the elapsed time to 0. Only call while the timer is stopped. More...
|
| |
| template<class IOContext > |
| void | serialize (IOContext &io) const |
| | serialize this. More...
|
| |
| void | start () |
| | Start the timer. Must be followed by exactly one stop. More...
|
| |
| void | stop () |
| | Stop the timer and update the elapsed time. After calling stop, the timer may be started again. More...
|
| |
| | ~BasicTimer () |
| |
|
| void | set_running (bool new_state) |
| | In Debug builds, set whether the timer is running or not. More...
|
| |
| void | should_be_running (bool expected, const std::string_view function) const |
| | In Debug builds, check that the state of m_is_running is as expected. Log an error if not. More...
|
| |
◆ ~BasicTimer()
| mio::timing::BasicTimer::~BasicTimer |
( |
| ) |
|
|
inline |
◆ deserialize()
template<class IOContext >
◆ get_elapsed_time()
| DurationType mio::timing::BasicTimer::get_elapsed_time |
( |
| ) |
const |
|
inline |
Get the total time spent between starts and stops. Only call while the timer is stopped.
◆ reset()
| void mio::timing::BasicTimer::reset |
( |
| ) |
|
|
inline |
Set the elapsed time to 0. Only call while the timer is stopped.
◆ serialize()
template<class IOContext >
| void mio::timing::BasicTimer::serialize |
( |
IOContext & |
io | ) |
const |
|
inline |
◆ set_running()
| void mio::timing::BasicTimer::set_running |
( |
bool |
new_state | ) |
|
|
private |
In Debug builds, set whether the timer is running or not.
◆ should_be_running()
| void mio::timing::BasicTimer::should_be_running |
( |
bool |
expected, |
|
|
const std::string_view |
function |
|
) |
| const |
|
private |
In Debug builds, check that the state of m_is_running is as expected. Log an error if not.
◆ start()
| void mio::timing::BasicTimer::start |
( |
| ) |
|
|
inline |
Start the timer. Must be followed by exactly one stop.
◆ stop()
| void mio::timing::BasicTimer::stop |
( |
| ) |
|
|
inline |
Stop the timer and update the elapsed time. After calling stop, the timer may be started again.
◆ m_elapsed_time
The total time spent between starts and stops.
◆ m_is_running
| bool mio::timing::BasicTimer::m_is_running = false |
|
private |
In Debug builds, tracks whether the timer is running.
◆ m_start_time
| TimeType mio::timing::BasicTimer::m_start_time |
|
private |
The last time point at which start() was called.