Measures cpu or wall time. Can be constructed as a dummy that is always stopped. More...
#include <Timer.h>
Public Types | |
| enum | Type { cpu , wall } |
Public Member Functions | |
| Timer (Type type, bool is_dummy) | |
| Timer (double cumulative_time, Type type, bool is_dummy) | |
| Construct Timer with initial cumulative time. More... | |
| Timer & | start () |
| start timing More... | |
| Timer & | stop () |
| Stops timing, storing time since creation in cumulative. More... | |
| void | operator+= (const Timer &other) |
| updates cumulative time More... | |
| double | start_time () const |
| double | stop_time () const |
| double | cumulative_time () const |
| Cumulative time over all start/stop periods. If active than it includes the time from start to current moment. More... | |
| bool | stopped () const |
| Timer is stopped and is not timing. More... | |
| bool | dummy () const |
| Timer is dummy and does nothing. More... | |
| void | reset () |
| Reset the timer erasing all data. More... | |
| Type | type () const |
| type of timer More... | |
Measures cpu or wall time. Can be constructed as a dummy that is always stopped.
The timer is started with start() and stopped with stop(). Repetitive calls to start() do not cause a restart, and the start time from the first call is kept.
Basic usage,
The timer measures cumulative time from all start/stop calls.
Calling cumulative_time() while the timer is running returns the cumulative time at this moment without stopping. For example,
| molpro::profiler::Timer::Timer | ( | Timer::Type | _type, |
| bool | is_dummy | ||
| ) |
| molpro::profiler::Timer::Timer | ( | double | cumulative_time, |
| Timer::Type | type, | ||
| bool | is_dummy | ||
| ) |
Construct Timer with initial cumulative time.
| double molpro::profiler::Timer::cumulative_time | ( | ) | const |
Cumulative time over all start/stop periods. If active than it includes the time from start to current moment.
|
inline |
Timer is dummy and does nothing.
| void molpro::profiler::Timer::operator+= | ( | const Timer & | other | ) |
updates cumulative time
| void molpro::profiler::Timer::reset | ( | ) |
Reset the timer erasing all data.
| Timer & molpro::profiler::Timer::start | ( | ) |
start timing
|
inline |
| Timer & molpro::profiler::Timer::stop | ( | ) |
Stops timing, storing time since creation in cumulative.
|
inline |
|
inline |
Timer is stopped and is not timing.
|
inline |
type of timer