5 #ifndef HPP_FCL_TIMINGS_FWD_H 6 #define HPP_FCL_TIMINGS_FWD_H 10 #ifdef HPP_FCL_WITH_CXX11_SUPPORT 24 void clear() { wall = user = system = 0; }
33 #ifdef HPP_FCL_WITH_CXX11_SUPPORT 42 Timer(
const bool start_on_construction =
true) : m_is_stopped(true) {
47 if (m_is_stopped)
return m_times;
50 #ifdef HPP_FCL_WITH_CXX11_SUPPORT 51 std::chrono::time_point<std::chrono::steady_clock> current_clock =
52 std::chrono::steady_clock::now();
53 current.
user +=
static_cast<double>(
54 std::chrono::duration_cast<std::chrono::nanoseconds>(
55 current_clock - m_start)
62 #ifdef HPP_FCL_WITH_CXX11_SUPPORT 63 duration_type duration()
const {
return (m_end - m_start); }
71 #ifdef HPP_FCL_WITH_CXX11_SUPPORT 72 m_start = std::chrono::steady_clock::now();
78 if (m_is_stopped)
return;
81 #ifdef HPP_FCL_WITH_CXX11_SUPPORT 82 m_end = std::chrono::steady_clock::now();
83 m_times.user +=
static_cast<double>(
84 std::chrono::duration_cast<std::chrono::nanoseconds>(
92 #ifdef HPP_FCL_WITH_CXX11_SUPPORT 94 m_start = std::chrono::steady_clock::now();
106 #ifdef HPP_FCL_WITH_CXX11_SUPPORT 107 std::chrono::time_point<std::chrono::steady_clock> m_start, m_end;
114 #endif // ifndef HPP_FCL_TIMINGS_FWD_H
clock_type::duration duration_type
This class mimics the way "boost/timer/timer.hpp" operates while using the modern std::chrono library...
std::chrono::high_resolution_clock clock_type
Timer(const bool start_on_construction=true)
Default constructor for the timer.