5 #ifndef COAL_TIMINGS_FWD_H
6 #define COAL_TIMINGS_FWD_H
10 #ifdef COAL_WITH_CXX11_SUPPORT
32 #ifdef COAL_WITH_CXX11_SUPPORT
33 typedef std::chrono::steady_clock clock_type;
34 typedef clock_type::duration duration_type;
41 Timer(
const bool start_on_construction =
true) : m_is_stopped(true) {
46 if (m_is_stopped)
return m_times;
49 #ifdef COAL_WITH_CXX11_SUPPORT
50 std::chrono::time_point<std::chrono::steady_clock> current_clock =
51 std::chrono::steady_clock::now();
52 current.
user +=
static_cast<double>(
53 std::chrono::duration_cast<std::chrono::nanoseconds>(
54 current_clock - m_start)
61 #ifdef COAL_WITH_CXX11_SUPPORT
62 duration_type duration()
const {
return (m_end - m_start); }
70 #ifdef COAL_WITH_CXX11_SUPPORT
71 m_start = std::chrono::steady_clock::now();
77 if (m_is_stopped)
return;
80 #ifdef COAL_WITH_CXX11_SUPPORT
81 m_end = std::chrono::steady_clock::now();
82 m_times.user +=
static_cast<double>(
83 std::chrono::duration_cast<std::chrono::nanoseconds>(
91 #ifdef COAL_WITH_CXX11_SUPPORT
93 m_start = std::chrono::steady_clock::now();
105 #ifdef COAL_WITH_CXX11_SUPPORT
106 std::chrono::time_point<std::chrono::steady_clock> m_start, m_end;
#define COAL_DLLAPI
Definition: config.hh:88
Main namespace.
Definition: broadphase_bruteforce.h:44
double user
Definition: timings.h:18
double wall
Definition: timings.h:17
CPUTimes()
Definition: timings.h:21
double system
Definition: timings.h:19
void clear()
Definition: timings.h:23
This class mimics the way "boost/timer/timer.hpp" operates while using the modern std::chrono library...
Definition: timings.h:31
void resume()
Definition: timings.h:90
Timer(const bool start_on_construction=true)
Default constructor for the timer.
Definition: timings.h:41
void stop()
Definition: timings.h:76
bool m_is_stopped
Definition: timings.h:103
CPUTimes m_times
Definition: timings.h:102
bool is_stopped() const
Definition: timings.h:99
void start()
Definition: timings.h:65
CPUTimes elapsed() const
Definition: timings.h:45