A simple stop watch.
More...
#include <dune/common/timer.hh>
|
| | Timer (bool startImmediately=true) noexcept |
| | A new timer, create and reset.
|
| void | reset () noexcept |
| | Reset timer while keeping the running/stopped state.
|
| void | start () noexcept |
| | Start the timer and continue measurement if it is not running. Otherwise do nothing.
|
| double | elapsed () const noexcept |
| | Get elapsed user-time from last reset until now/last stop in seconds.
|
| double | lastElapsed () const noexcept |
| | Get elapsed user-time from last start until now/last stop in seconds.
|
| double | stop () noexcept |
| | Stop the timer and return elapsed().
|
A simple stop watch.
This class reports the elapsed real time, i.e. time elapsed after Timer::reset(). It does not measure the time spent computing, i.e. time spend in concurrent threads is not added up while time measurements include the time elapsed while sleeping.
The class is basically a wrapper around std::chrono::high_resolution_clock::now().
◆ Timer()
| Dune::Timer::Timer |
( |
bool | startImmediately = true | ) |
|
|
inlinenoexcept |
A new timer, create and reset.
- Parameters
-
| startImmediately | If true (default) the timer starts counting immediately |
◆ elapsed()
| double Dune::Timer::elapsed |
( |
| ) |
const |
|
inlinenoexcept |
Get elapsed user-time from last reset until now/last stop in seconds.
◆ lastElapsed()
| double Dune::Timer::lastElapsed |
( |
| ) |
const |
|
inlinenoexcept |
Get elapsed user-time from last start until now/last stop in seconds.
◆ reset()
| void Dune::Timer::reset |
( |
| ) |
|
|
inlinenoexcept |
Reset timer while keeping the running/stopped state.
◆ start()
| void Dune::Timer::start |
( |
| ) |
|
|
inlinenoexcept |
Start the timer and continue measurement if it is not running. Otherwise do nothing.
◆ stop()
| double Dune::Timer::stop |
( |
| ) |
|
|
inlinenoexcept |
The documentation for this class was generated from the following file: