|
|
Measures the passed time between the construction or calling reset() and stop().
More...
#include <ArmarXCore/core/time/StopWatch.h>
Inheritance diagram for StopWatch:Public Member Functions | |
| bool | isStopped () const |
| Returns whether the timer is stopped or is actively measuring time. More... | |
| void | reset () |
| Resets the timer. More... | |
| DateTime | startingTime () const |
| Returns the date/time at starting the timer. More... | |
| Duration | stop () |
| Stops the timer and returns the measured duration. More... | |
| Duration | stopAndReset () |
| Stops and resets the timer. More... | |
| DateTime | stoppingTime () const |
| Returns the date/time at stopping the timer. More... | |
| StopWatch (ClockType clockType=ClockType::Virtual) | |
Constructs a StopWatch and starts it immediately. More... | |
| virtual | ~StopWatch () |
Destructs the StopWatch. More... | |
Static Public Member Functions | |
| static Duration | measure (std::function< void(void)> subjectToMeasure, ClockType clockType=ClockType::Virtual) |
| Measures the duration needed to execute the given lambda and returns it. More... | |
Measures the passed time between the construction or calling reset() and stop().
The StopWatch uses the system time by default, but it may use the virtual time provided by the time server as well. Also has a static method measure(), which takes a lambda, and returns the time it took to execute that lambda.
Code examples:
Definition at line 41 of file StopWatch.h.
| StopWatch | ( | ClockType | clockType = ClockType::Virtual | ) |
Constructs a StopWatch and starts it immediately.
| clockType | Clock type. |
Definition at line 19 of file StopWatch.cpp.
|
virtual |
Destructs the StopWatch.
Definition at line 25 of file StopWatch.cpp.
| bool isStopped | ( | ) | const |
Returns whether the timer is stopped or is actively measuring time.
Definition at line 53 of file StopWatch.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Measures the duration needed to execute the given lambda and returns it.
| subjectToMeasure | Lambda to be measured |
| clockType | Clock type. |
Definition at line 31 of file StopWatch.cpp.
| void reset | ( | ) |
Resets the timer.
Definition at line 46 of file StopWatch.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:| DateTime startingTime | ( | ) | const |
Returns the date/time at starting the timer.
Definition at line 59 of file StopWatch.cpp.
| Duration stop | ( | ) |
Stops the timer and returns the measured duration.
Definition at line 39 of file StopWatch.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:| Duration stopAndReset | ( | ) |
Stops and resets the timer.
It returns the date/time at stopping the timer.
| std::logic_error | When the timer was not stopped yet. |
Definition at line 76 of file StopWatch.cpp.
Here is the call graph for this function:| DateTime stoppingTime | ( | ) | const |
Returns the date/time at stopping the timer.
| std::logic_error | When the timer was not stopped yet. |
Definition at line 65 of file StopWatch.cpp.
Here is the call graph for this function: