Note: this is documentation for an old release. View the latest documentation at docs.fenicsproject.org/dolfinx/v0.9.0/cpp/doxygen/d4/d40/classdolfinx_1_1common_1_1Timer.html
DOLFINx 0.7.3
DOLFINx C++ interface
Loading...
Searching...
No Matches
Public Member Functions | List of all members
Timer Class Reference

A timer can be used for timing tasks. The basic usage is. More...

#include <Timer.h>

Public Member Functions

 Timer ()
 Create timer without logging.
 
 Timer (const std::string &task)
 Create timer with logging.
 
 ~Timer ()
 Destructor.
 
void start ()
 Zero and start timer.
 
void resume ()
 Resume timer. Not well-defined for logging timer.
 
double stop ()
 Stop timer, return wall time elapsed and store timing data into logger.
 
std::array< double, 3 > elapsed () const
 Return wall, user and system time in seconds.
 

Detailed Description

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

list_timings();


The documentation for this class was generated from the following files: