A simple Timer class to measure execution time.
More...
#include </home/docs/checkouts/readthedocs.org/user_builds/axom/checkouts/feature-whitlock-mir_update/src/axom/core/utilities/Timer.hpp>
A simple Timer class to measure execution time.
- Note
- We might want to extend the functionality of the timer class by making HighPrecisionTimer a template parameter. API requirements for HighPrecisionTimer class – must be default constructible – timing functions: void start() void stop() void reset() – elapsed time functions: double elapsedTimeInSec() double elapsedTimeInMilliSec() double elapsedTimeInMicroSec()
-
We might want to add support for pausing and resuming the timer while accumulating the time differences
Example Usage:
utilities::Timer t;
t.start();
t.stop();
std::cout << "Elapsed Time: << t.elapsed() << std::endl;
t.reset();
◆ Timer()
axom::utilities::Timer::Timer |
( |
bool |
startRunning = false | ) |
|
|
inline |
Default constructor.
- Parameters
-
startRunning | Indicates whether to start the timer during construction (default is false) |
References start().
◆ start()
void axom::utilities::Timer::start |
( |
| ) |
|
|
inline |
Starts the timer.Sets the start time of this Timer instance.
◆ stop()
void axom::utilities::Timer::stop |
( |
| ) |
|
|
inline |
Stops the timer. Sets the end time of this Timer instance.
◆ elapsed()
double axom::utilities::Timer::elapsed |
( |
| ) |
|
|
inline |
Returns the elapsed time in seconds.
- Returns
- t the elapsed time in seconds.
References elapsedTimeInSec().
◆ elapsedTimeInSec()
double axom::utilities::Timer::elapsedTimeInSec |
( |
| ) |
|
|
inline |
Returns the elapsed time in seconds.
- Returns
- t the elapsed time in seconds.
References stop().
◆ elapsedTimeInMilliSec()
double axom::utilities::Timer::elapsedTimeInMilliSec |
( |
| ) |
|
|
inline |
Returns the elapsed time in milliseconds.
- Returns
- t the elapsed time in milliseconds.
References stop().
◆ elapsedTimeInMicroSec()
double axom::utilities::Timer::elapsedTimeInMicroSec |
( |
| ) |
|
|
inline |
Returns the elapsed time in microseconds.
- Returns
- t the elapsed time in microseconds.
References stop().
◆ reset()
void axom::utilities::Timer::reset |
( |
| ) |
|
|
inline |
Resets the timer.
- Postcondition
- this->elapsed()==0.0
The documentation for this class was generated from the following file:
- /home/docs/checkouts/readthedocs.org/user_builds/axom/checkouts/feature-whitlock-mir_update/src/axom/core/utilities/Timer.hpp