Class timer
template <typename now_fn, typename time_point, typename durationt>
a timer that times until the end of the code block ([RAII]). More...
#include <cpu_timer.hpp>
Public Functions
Type | Name |
---|---|
timer (const now_fn & now, durationt & _duration) |
|
~timer () |
Detailed Description
See [2] for how code-blocks are defined in C++.
now
can be any type that takes no arguments and returns a subtractable type.
Example usage:
{
// stuff that won't get timed.
std::chrono::nanoseconds ns;
timer<decltype((thread_cpu_time))> timer_obj {thread_cpu_time, ns};
// stuff that gets timed.
}
// stuff that won't get timed.
std::cout << ns.count() << std::endl;
Public Functions Documentation
function timer
inline timer::timer (
const now_fn & now,
durationt & _duration
)
function ~timer
inline timer::~timer ()
The documentation for this class was generated from the following file common/cpu_timer.hpp