8#ifndef SRC_INCLUDE_CHRONO_HPP_
9#define SRC_INCLUDE_CHRONO_HPP_
38 , m_running(false) {};
46 return m_wallTime + (m_running ? wallTimeSinceHack() : WallTimeDuration::zero());
52 m_wallTime = WallTimeDuration::zero();
63 return m_cpuTime + (m_running ? cpuTimeSinceHack() : 0);
67 inline int ticks()
const {
return m_ticks; };
69 inline bool running()
const {
return m_running; };
79 m_wallHack = std::chrono::high_resolution_clock::now();
80 m_cpuHack = std::clock();
93 m_wallTime += wallTimeSinceHack();
94 m_cpuTime += cpuTimeSinceHack();
131 return static_cast<CpuTimeDuration>(std::clock() - m_cpuHack) / CLOCKS_PER_SEC;
136 return std::chrono::duration_cast<WallTimeDuration>(
137 std::chrono::high_resolution_clock::now() - m_wallHack);
A class providing a timer.
void extraWallTime(const WallTimeDuration &extraTime)
Adds an externally determined increment to the wall clock.
std::chrono::high_resolution_clock::duration WallTimeDuration
Type of a time duration on the wall clock.
void stop()
Stops the timer.
WallTimeDuration wallTime() const
Returns the current cumulative wall clock time.
void reset()
Resets all of the chronometer counters.
int ticks() const
Returns the current number of activation ticks.
std::chrono::high_resolution_clock::time_point WallTimePoint
Type of a point in time for the wall clock.
std::clock_t CpuTimePoint
Type of a point in time for the CPU clock.
void extraCpuTime(const CpuTimeDuration &extraTime)
Adds an externally determined increment to the CPU clock.
CpuTimeDuration cpuTime() const
Returns the current cumulative CPU clock timer.
WallTimePoint wallHack() const
Returns the current time on the wall clock.
CpuTimePoint cpuHack() const
Returns the current time on the CPU clock.
Chrono()
Default constructor of a chronometer, zeroing all of the counters.
double CpuTimeDuration
Type of a time duration on the CPU clock.
void extraTicks(int extraTicks)
Adds an externally determined increment to the activation count.
void start()
Starts the timer.
bool running() const
Returns whether this chronometer is running.