Struct Timer

Struct Documentation

struct Timer

This class mimics the way “boost/timer/timer.hpp” operates while using the modern std::chrono library. Importantly, this class will only have an effect for C++11 and more.

Public Types

typedef std::chrono::steady_clock clock_type
typedef clock_type::duration duration_type

Public Functions

inline Timer(const bool start_on_construction = true)

Default constructor for the timer.

Parameters:

start_on_construction[in] if true, the timer will be run just after the object is created

inline CPUTimes elapsed() const
inline duration_type duration() const
inline void start()
inline void stop()
inline void resume()
inline bool is_stopped() const

Protected Attributes

CPUTimes m_times
bool m_is_stopped
std::chrono::time_point<std::chrono::steady_clock> m_start
std::chrono::time_point<std::chrono::steady_clock> m_end