|
chombo-discharge
|
Class which is used for run-time monitoring of events. More...
#include <CD_Timer.H>
Public Types | |
| 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. | |
Public Member Functions | |
| 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 assignement. | |
| 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 Public Member Functions | |
| static Real | wallClock () |
| Static function which returns the time (in seconds) between now and an arbitrary time in the past. | |
Protected Types | |
| enum | EventFields { StoppedEvent = 0 , StartClock = 1 , ElapsedTime = 2 } |
| Enum for indexing tuple. A rare case of where unscoped enums are useful. | |
Protected Member Functions | |
| 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. | |
Protected Attributes | |
| 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.
|
inlineprotectednoexcept |
Compute the total time for all finished events.
|
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.
| [in] | a_localReportOnly | If true, no reduction over mpi |
Copy assignement.
| [in] | a_other | Other Timer |
|
inlinenoexcept |
Start an event.
| [in] | a_event | Event name |
|
inlinenoexcept |
Stop an event.
| [in] | a_event | Event name |
|
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.
| [in] | a_localReportOnly | If true, no reduction over mpi |
|
protected |
Timer events. First entry is the name of the event.
The second is the identifier for the event