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.
|
| |
| Timer & | operator= (const Timer &a_other)=default |
| | Copy assignment.
|
| |
| void | startEvent (const std::string &a_event) noexcept |
| | Start an event.
|
| |
| void | stopEvent (const std::string &a_event) noexcept |
| | Stop an event.
|
| |
| void | eventReport (std::ostream &a_outputStream, const bool a_localReportOnly=false) const noexcept |
| | Print all timed events to cout.
|
| |
| void | writeReportToFile (const std::string &a_fileName) const noexcept |
| | Print all timed events to a file.
|
| |
|
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.
|
| |
|
|
std::string | m_processName |
| | Process name. Used for input/output.
|
| |
| std::map< std::string, std::tuple< bool, TimePoint, Duration > > | m_events |
| | Timer events. First entry is the name of the event.
|
| |
Class which is used for run-time monitoring of events.
◆ Timer() [1/2]
| Timer::Timer |
( |
const std::string & |
a_process | ) |
|
|
inline |
Default constructor. This creates a timer without any timer events and without a name.
- Parameters
-
◆ Timer() [2/2]
| 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.
- Parameters
-
| [in] | a_localReportOnly | Description |
◆ 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 |
| [in] | a_outputStream | Description |
◆ operator=()
Copy assignment.
- Parameters
-
- Returns
- Return value
◆ printReportHeader()
| void Timer::printReportHeader |
( |
std::ostream & |
a_outputStream | ) |
const |
|
inlineprotectednoexcept |
Print report header.
- Parameters
-
| [in,out] | a_outputStream | Description |
◆ printReportTail()
| void Timer::printReportTail |
( |
std::ostream & |
a_outputStream, |
|
|
const std::pair< Real, Real > |
a_elapsedTime |
|
) |
| const |
|
inlineprotectednoexcept |
Print report tail.
- Parameters
-
| [in,out] | a_outputStream | Description |
| [in] | a_elapsedTime | Description |
◆ 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).
◆ wallClock()
| Real Timer::wallClock |
( |
| ) |
|
|
inlinestatic |
Static function which returns the time (in seconds) between now and an arbitrary time in the past.
- Returns
- Return value
◆ 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
-
◆ 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: