12#ifndef CD_TimerImplem_H
13#define CD_TimerImplem_H
28#include <CD_NamespaceHeader.H>
35 const auto currentTime = std::chrono::steady_clock::now();
64 if (m_events.find(
a_event) == m_events.end()) {
93 if (m_events.find(
a_event) != m_events.end()) {
105 std::cerr <<
"Timer::stopEvent -- event '" +
a_event +
"' has not been started\n";
121 <<
"| ---------------------------------------------------------------------------------------------------------|"
123 <<
"| " + m_processName +
" kernel report: " <<
"\n"
124 <<
"| ---------------------------------------------------------------------------------------------------------|"
134 <<
"| ---------------------------------------------------------------------------------------------------------|"
154 <<
"| ---------------------------------------------------------------------------------------------------------|"
158 <<
"| ---------------------------------------------------------------------------------------------------------|"
183 for (
const auto&
e : m_events) {
313 for (
const auto&
e : m_events) {
358 for (
const auto&
e : m_events) {
390 const int width = 12;
414#include <CD_NamespaceFooter.H>
Implementation of CD_Timer.H.
void stopEvent(const std::string a_event) noexcept
Stop an event.
Definition CD_TimerImplem.H:88
std::chrono::duration< Real > Duration
Duration in seconds.
Definition CD_Timer.H:46
~Timer()
Destructor.
Definition CD_TimerImplem.H:47
void startEvent(const std::string a_event) noexcept
Start an event.
Definition CD_TimerImplem.H:59
std::string m_processName
Process name. Used for input/output.
Definition CD_Timer.H:135
void writeReportToFile(const std::string a_fileName) const noexcept
Print all timed events to a file.
Definition CD_TimerImplem.H:339
std::chrono::steady_clock::time_point TimePoint
Point in time.
Definition CD_Timer.H:41
void printReportHeader(std::ostream &a_outputStream) const noexcept
Print report header.
Definition CD_TimerImplem.H:113
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:141
Timer()=default
Default constructor. This creates a timer without any timer events and without a name.
void printReportTail(std::ostream &a_outputStream, const std::pair< Real, Real > a_elapsedTime) const noexcept
Print report tail.
Definition CD_TimerImplem.H:145
static Real wallClock()
Static function which returns the time (in seconds) between now and an arbitrary time in the past.
Definition CD_TimerImplem.H:31
std::pair< Real, Real > computeTotalElapsedTime(const bool a_localReportOnly) const noexcept
Compute the total time for all finished events.
Definition CD_TimerImplem.H:307
void clear() noexcept
Clear all events.
Definition CD_TimerImplem.H:53
void eventReport(std::ostream &a_outputStream, const bool a_localReportOnly=false) const noexcept
Print all timed events to cout.
Definition CD_TimerImplem.H:169
Base class for a tracer particle solver. This solver can advance particles in a pre-defined velocity ...
Definition CD_TracerParticleSolver.H:37
TracerParticleSolver()
Default constructor.
Definition CD_TracerParticleSolverImplem.H:25