25 #ifndef Common_Stopwatch_h
26 #define Common_Stopwatch_h
67 elapsed_time = std::chrono::steady_clock::duration::zero();
78 std::chrono::steady_clock::duration::period::num) /
79 (
double)std::chrono::steady_clock::duration::period::den;
89 return std::chrono::duration_cast<std::chrono::milliseconds>(
elapsed_time).count();
107 #endif // Common_Stopwatch_h
double elapsed()
Returns the elapsed time.
std::chrono::steady_clock::time_point start_time
The start time.
std::chrono::steady_clock::duration elapsed_time
The elapsed time.
void start()
Starts the Stopwatch.
int64_t elapsed_millis()
Returns elapsed time in milliseconds.
void reset()
Resets the Stopwatch.
The Stopwatch class measures elapsed time between instantiation (or a call to start) and a call to st...
bool m_running
Flag whether the Stopwatch is currently running.
Stopwatch(bool start_running=true)
Constructor; if start_running is true then the Stopwatch is started immediately.
void stop()
Stops the Stopwatch.