13#ifndef CD_TIMERIMPLEM_H
14#define CD_TIMERIMPLEM_H
29#include <CD_NamespaceHeader.H>
36 const auto currentTime = std::chrono::steady_clock::now();
65 if (m_events.find(
a_event) == m_events.end()) {
94 if (m_events.find(
a_event) != m_events.end()) {
106 std::cerr <<
"Timer::stopEvent -- event '" +
a_event +
"' has not been started\n";
122 <<
"| ---------------------------------------------------------------------------------------------------------|"
124 <<
"| " + m_processName +
" kernel report: " <<
"\n"
125 <<
"| ---------------------------------------------------------------------------------------------------------|"
135 <<
"| ---------------------------------------------------------------------------------------------------------|"
155 <<
"| ---------------------------------------------------------------------------------------------------------|"
159 <<
"| ---------------------------------------------------------------------------------------------------------|"
184 for (
const auto&
e : m_events) {
314 for (
const auto&
e : m_events) {
359 for (
const auto&
e : m_events) {
391 const int width = 12;
415#include <CD_NamespaceFooter.H>
Implementation of CD_Timer.H.
std::chrono::duration< Real > Duration
Duration in seconds.
Definition CD_Timer.H:47
~Timer()
Destructor.
Definition CD_TimerImplem.H:48
std::string m_processName
Process name. Used for input/output.
Definition CD_Timer.H:140
void startEvent(const std::string &a_event) noexcept
Start an event.
Definition CD_TimerImplem.H:60
std::chrono::steady_clock::time_point TimePoint
Point in time.
Definition CD_Timer.H:42
void printReportHeader(std::ostream &a_outputStream) const noexcept
Print report header.
Definition CD_TimerImplem.H:114
std::map< std::string, std::tuple< bool, TimePoint, Duration > > m_events
Timer events. First entry is the name of the event.
Definition CD_Timer.H:146
Timer()=default
Default constructor. This creates a timer without any timer events and without a name.
void writeReportToFile(const std::string &a_fileName) const noexcept
Print all timed events to a file.
Definition CD_TimerImplem.H:340
void printReportTail(std::ostream &a_outputStream, const std::pair< Real, Real > a_elapsedTime) const noexcept
Print report tail.
Definition CD_TimerImplem.H:146
static Real wallClock()
Static function which returns the time (in seconds) between now and an arbitrary time in the past.
Definition CD_TimerImplem.H:32
std::pair< Real, Real > computeTotalElapsedTime(const bool a_localReportOnly) const noexcept
Compute the total time for all finished events.
Definition CD_TimerImplem.H:308
void clear() noexcept
Clear all events.
Definition CD_TimerImplem.H:54
void eventReport(std::ostream &a_outputStream, const bool a_localReportOnly=false) const noexcept
Print all timed events to cout.
Definition CD_TimerImplem.H:170
void stopEvent(const std::string &a_event) noexcept
Stop an event.
Definition CD_TimerImplem.H:89
Base class for a tracer particle solver. This solver can advance particles in a pre-defined velocity ...
Definition CD_TracerParticleSolver.H:38
TracerParticleSolver()
Default constructor.
Definition CD_TracerParticleSolverImplem.H:26