DOLFINx 0.9.0
DOLFINx C++ interface
|
#include <Timer.h>
Public Member Functions | |
Timer (std::optional< std::string > task=std::nullopt) | |
~Timer () | |
Destructor. | |
void | start () |
Zero and start timer. | |
void | resume () |
Resume timer. Not well-defined for logging timer. | |
double | stop () |
std::array< double, 3 > | elapsed () const |
Return wall, user and system time in seconds. | |
A timer can be used for timing tasks. The basic usage is
Timer timer("Assembling over cells");
The timer is started at construction and timing ends when the timer is destroyed (goes out of scope). It is also possible to start and stop a timer explicitly by
timer.start(); timer.stop();
Timings are stored globally and a summary may be printed by calling
Timer | ( | std::optional< std::string > | task = std::nullopt | ) |
Create timer
If a task name is provided this enables logging to logger, otherwise (i.e. no task provided) nothing gets logged.
double stop | ( | ) |
Stop timer, return wall time elapsed and store timing data into logger