ILLIXR: Illinois Extended Reality Testbed
Public Member Functions | List of all members
timer< now_fn, time_point, durationt > Class Template Reference

a timer that times until the end of the code block ([RAII]). More...

#include <cpu_timer.hpp>

Public Member Functions

 timer (const now_fn &now, durationt &_duration)
 

Detailed Description

template<typename now_fn, typename time_point = decltype(std::declval<now_fn>()()), typename durationt = decltype(std::declval<time_point>() - std::declval<time_point>())>
class timer< now_fn, time_point, durationt >

a timer that times until the end of the code block ([RAII]).

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;
a timer that times until the end of the code block ([RAII]).
Definition: cpu_timer.hpp:80

The documentation for this class was generated from the following file: