1 #ifndef COSMO_UTILS_TIMER_H 2 #define COSMO_UTILS_TIMER_H 17 Timer() : m_secs(0) {}
19 inline double time()
const {
return m_secs; }
21 inline void start() { clock_gettime(CLOCK_MONOTONIC, &m_starttime); }
30 struct timespec m_starttime;
31 struct timespec m_stoptime;
43 std::string getStateString();
45 inline Timer& operator[](std::string key) {
return m_timers[key]; }
47 friend std::ostream& operator<<(std::ostream &ostr,
TimerManager T);
50 std::map<std::string, Timer> m_timers;
Individual timer classes used by the TimerManager class.
Definition: Timer.h:14
void stop()
Stop timer.
Definition: Timer.cc:26
TimerManager class containing multiple timers; access individual timers via, eg, TM["my_timer"].start()
Definition: Timer.h:38
void reset()
Reset timer.
Definition: Timer.cc:36