Timer API¶
-
template<class Duration = std::chrono::nanoseconds, class Clock = std::chrono::high_resolution_clock>
class Timer¶ The Timer class template implements a timer designed for minimal overhead, ad-hoc timing of code regions including micro-timing down to single machine instructions.
Public Functions
-
template<class Code>
inline Timer &run(size_t n, Code &&code)¶ Run the supplied
code
in a loopn
times.
-
inline void start()¶
Start the timer.
-
inline auto stop(size_t n = 1)¶
Stop the timer indicating
n
operations.
-
inline auto elapsed_per_iteration() const¶
Return the average number of nanoseconds per operation.
-
inline auto elapsed() const¶
Return the elapsed duration.
-
template<class Code>