Dune Core Modules (2.5.0)
Dune::Timer Class Reference
A simple stop watch. More...
#include <dune/common/timer.hh>
Public Member Functions | |
Timer (bool startImmediately=true) throw (TimerError) | |
A new timer, create and reset. More... | |
void | reset () throw (TimerError) |
Reset timer while keeping the running/stopped state. | |
void | start () throw (TimerError) |
Start the timer and continue measurement if it is not running. Otherwise do nothing. | |
double | elapsed () const throw (TimerError) |
Get elapsed user-time from last reset until now/last stop in seconds. | |
double | lastElapsed () const throw (TimerError) |
Get elapsed user-time from last start until now/last stop in seconds. | |
double | stop () throw (TimerError) |
Stop the timer and return elapsed(). | |
Detailed Description
A simple stop watch.
This class reports the elapsed user-time, i.e. time spent computing, after the last call to Timer::reset(). The results are seconds and fractional seconds. Note that the resolution of the timing depends on your OS kernel which should be somewhere in the milisecond range.
The class is basically a wrapper for the libc-function getrusage()
- Warning
- In a multi-threading situation, this class does NOT return wall-time! Instead, the run time for all threads will be added up. For example, if you have four threads running in parallel taking one second each, then the Timer class will return an elapsed time of four seconds.
Constructor & Destructor Documentation
◆ Timer()
|
inline |
A new timer, create and reset.
- Parameters
-
startImmediately If true (default) the timer starts counting immediately
References reset().
The documentation for this class was generated from the following file:
- dune/common/timer.hh
|
Legal Statements / Impressum |
Hosted by TU Dresden |
generated with Hugo v0.111.3
(Nov 23, 23:29, 2024)