Class which is used for run-time monitoring of events.
More...
#include <CD_Timer.H>
|
using | Clock = std::chrono::steady_clock |
| Clock implements.
|
|
using | TimePoint = std::chrono::steady_clock::time_point |
| Point in time.
|
|
using | Duration = std::chrono::duration< Real > |
| Duration in seconds.
|
|
|
| Timer ()=default |
| Default constructor. This creates a timer without any timer events and without a name.
|
|
| Timer (const std::string a_process) |
| Default constructor. This creates a timer without any timer events and without a name.
|
|
| ~Timer () |
| Destructor.
|
|
| Timer (const Timer &a_other)=default |
| Copy construction. More...
|
|
Timer & | operator= (const Timer &a_other)=default |
| Copy assignement. More...
|
|
void | startEvent (const std::string a_event) noexcept |
| Start an event. More...
|
|
void | stopEvent (const std::string a_event) noexcept |
| Stop an event. More...
|
|
void | eventReport (std::ostream &a_outputStream, const bool a_localReportOnly=false) const noexcept |
| Print all timed events to cout. More...
|
|
void | writeReportToFile (const std::string a_fileName) const noexcept |
| Print all timed events to a file. More...
|
|
void | clear () noexcept |
| Clear all events.
|
|
|
static Real | wallClock () |
| Static function which returns the time (in seconds) between now and an arbitrary time in the past.
|
|
|
enum | EventFields { StoppedEvent = 0
, StartClock = 1
, ElapsedTime = 2
} |
| Enum for indexing tuple. A rare case of where unscoped enums are useful.
|
|
|
void | printReportHeader (std::ostream &a_outputStream) const noexcept |
| Print report header.
|
|
void | printReportTail (std::ostream &a_outputStream, const std::pair< Real, Real > a_elapsedTime) const noexcept |
| Print report tail.
|
|
std::pair< Real, Real > | computeTotalElapsedTime (const bool a_localReportOnly) const noexcept |
| Compute the total time for all finished events. More...
|
|
Class which is used for run-time monitoring of events.
◆ Timer()
Timer::Timer |
( |
const Timer & |
a_other | ) |
|
|
default |
Copy construction.
- Parameters
-
◆ computeTotalElapsedTime()
std::pair< Real, Real > Timer::computeTotalElapsedTime |
( |
const bool |
a_localReportOnly | ) |
const |
|
inlineprotectednoexcept |
Compute the total time for all finished events.
- Returns
- First entry is the local time. Second entry is the global time.
◆ eventReport()
void Timer::eventReport |
( |
std::ostream & |
a_outputStream, |
|
|
const bool |
a_localReportOnly = false |
|
) |
| const |
|
inlinenoexcept |
Print all timed events to cout.
This routine prints a header, the timing report for the various event, and a tail. All events are included but unfinished ones are not counted towards the elapsed time.
- Parameters
-
[in] | a_localReportOnly | If true, no reduction over mpi |
◆ operator=()
Copy assignement.
- Parameters
-
◆ startEvent()
void Timer::startEvent |
( |
const std::string |
a_event | ) |
|
|
inlinenoexcept |
Start an event.
- Parameters
-
- Note
- This will give a run-time error if the event has already been started (i.e. startEvent(a_event) has not been called prior).
◆ stopEvent()
void Timer::stopEvent |
( |
const std::string |
a_event | ) |
|
|
inlinenoexcept |
Stop an event.
- Parameters
-
- Note
- This will give a run-time error if the event has not already been started (i.e. startEvent(a_event) has not been called prior).
◆ writeReportToFile()
void Timer::writeReportToFile |
( |
const std::string |
a_fileName | ) |
const |
|
inlinenoexcept |
Print all timed events to a file.
This routine prints a header row consisting of the event names. The remaining rows are the timings for the various ranks.
- Parameters
-
[in] | a_localReportOnly | If true, no reduction over mpi |
◆ m_events
Timer events. First entry is the name of the event.
The second is the identifier for the event
The documentation for this class was generated from the following files: