8#ifndef SRC_IO_TIMERPROFILER_H_
9#define SRC_IO_TIMERPROFILER_H_
16#include "utils/Timer.h"
31 enum class Displaymode {
63 void setDisplayMode(Displaymode mode) { _displayMode = mode; }
64 Displaymode getDisplayMode() {
return _displayMode; }
189 ++_numElapsedIterations;
198 return _numElapsedIterations;
216 bool _checkTimer(
std::string timerName,
bool checkActive=
true);
237 std::vector<std::string>childTimerNames={}, std::vector<std::string>parentTimerNames={},
239 _timer(timer), _childTimerNames(childTimerNames), _parentTimerNames(parentTimerNames),
240 _outputString(outputString), _timerName(timerName) {}
246 std::unique_ptr<Timer> _timer;
252 std::vector<std::string> _childTimerNames;
258 std::vector<std::string> _parentTimerNames;
280 std::map<std::string, _Timer> _timers;
282 unsigned long _numElapsedIterations;
284 Displaymode _displayMode;
Class for managing timers across the simulation.
Definition: TimerProfiler.h:28
void start(std::string timerName)
Starts the timer "timerName".
Definition: TimerProfiler.cpp:110
Timer * getTimer(std::string timerName)
Gets a pointer to the timer with name "timerName".
Definition: TimerProfiler.cpp:46
double getTime(std::string timerName)
Gets the time collected by timer "timerName".
Definition: TimerProfiler.cpp:257
unsigned long getNumElapsedIterations() const
get the number of iterations since the last resetting of all timers.
Definition: TimerProfiler.h:197
void setSyncTimer(std::string timerName, bool sync)
Sets sync mode of the timer "timerName".
Definition: TimerProfiler.cpp:81
void incrementTimerTimestepCounter()
Increment the timestep-counter.
Definition: TimerProfiler.h:188
void resetTimers(std::string timerName=_baseTimerName)
Resets the timer "timerName" and all of its descendants.
Definition: TimerProfiler.cpp:145
void setOutputString(std::string timerName, std::string outputString)
Sets the output string for the timer output.
Definition: TimerProfiler.cpp:240
void readXML(XMLfileUnits &xmlconfig)
Read in XML configuration for TimerProfiler.
Definition: TimerProfiler.cpp:27
void readInitialTimersFromFile(std::string fileName)
Sets up initial configuration of the timers during the simulation.
Definition: TimerProfiler.cpp:157
void activateTimer(std::string timerName)
Activates the timer "timerName".
Definition: TimerProfiler.cpp:71
void printTimers(std::string timerName=_baseTimerName, std::string outputPrefix="")
Prints time collected by timer "timerName" and the time from all of its descendants.
Definition: TimerProfiler.cpp:99
void registerTimer(std::string timerName, std::vector< std::string > parentTimerNames, Timer *timer=nullptr, bool activate=true)
Adds a timer in the container.
Definition: TimerProfiler.cpp:54
TimerProfiler()
Constructor of TimerProfiler.
Definition: TimerProfiler.cpp:22
void deactivateTimer(std::string timerName)
Deactivates the timer "timerName".
Definition: TimerProfiler.cpp:76
This class is used to measure times in sequential and parallel versions.
Definition: Timer.h:59
XML file with unit attributes abstraction.
Definition: xmlfileUnits.h:25
::xsd::cxx::tree::string< char, simple_type > string
C++ type corresponding to the string XML Schema built-in type.
Definition: vtk-punstructured.h:270