File cpu_timer.hpp
FileList > illixr > cpu_timer.hpp
Go to the source code of this file
#include "error_util.hpp"#include <chrono>#include <cstring>#include <functional>#include <iostream>#include <spdlog/spdlog.h>#include <string>#include <thread>#include <utility>
Classes
| Type | Name |
|---|---|
| class | print_timer <typename Now_func, typename Time_point, typename Duration> Like timer, but prints the output. |
| class | print_timer2 |
| class | should_profile_class |
| class | timer <typename Now_func, typename Time_point, typename Duration> a timer that times until the end of the code block ([RAII]). |
Public Static Attributes
| Type | Name |
|---|---|
| should_profile_class | should_profile |
Public Functions
| Type | Name |
|---|---|
| std::enable_if< std::is_integral< Out >::value, Out >::type | count_duration (Duration t) |
| std::enable_if< std::is_integral< Duration >::value, Duration >::type | count_duration (Duration t) |
| std::thread | timed_thread (const std::string & account_name, Function && f, Args &&... args) Use this in place of std::thread(...) to print times. |
Public Static Functions
| Type | Name |
|---|---|
| std::chrono::nanoseconds | cpp_clock_get_time (clockid_t clock_id) A C++ translation of clock_gettime __ |
| std::size_t | gen_serial_no () |
| std::chrono::nanoseconds | thread_cpu_time () Gets the CPU time for the calling thread. |
Macros
| Type | Name |
|---|---|
| define | PRINT_CPU_TIME_FOR_THIS_BLOCK (name) [**print\_timer**](classprint__timer.md)<decltype(([**thread\_cpu\_time**](cpu__timer_8hpp.md#function-thread_cpu_time)))> PRINT\_CPU\_TIME\_FOR\_THIS\_BLOCK{name, [**thread\_cpu\_time**](cpu__timer_8hpp.md#function-thread_cpu_time)}; |
| define | PRINT_RECORD_FOR_THIS_BLOCK (name) [**print\_timer2**](classprint__timer2.md) PRINT\_RECORD\_FOR\_THIS\_BLOCK\_timer{name}; |
| define | PRINT_WALL_TIME_FOR_THIS_BLOCK (name) /* multi line expression */ |
Public Static Attributes Documentation
variable should_profile
should_profile_class should_profile;
Public Functions Documentation
function count_duration
template<typename Duration, typename Out>
std::enable_if< std::is_integral< Out >::value, Out >::type count_duration (
Duration t
)
function count_duration
template<typename Duration>
std::enable_if< std::is_integral< Duration >::value, Duration >::type count_duration (
Duration t
)
function timed_thread
Use this in place of std::thread(...) to print times.
template<class Function, class... Args>
std::thread timed_thread (
const std::string & account_name,
Function && f,
Args &&... args
)
Public Static Functions Documentation
function cpp_clock_get_time
A C++ translation of clock_gettime __
static inline std::chrono::nanoseconds cpp_clock_get_time (
clockid_t clock_id
)
function gen_serial_no
static std::size_t gen_serial_no ()
function thread_cpu_time
Gets the CPU time for the calling thread.
static inline std::chrono::nanoseconds thread_cpu_time ()
Macro Definition Documentation
define PRINT_CPU_TIME_FOR_THIS_BLOCK
#define PRINT_CPU_TIME_FOR_THIS_BLOCK (
name
) `print_timer <decltype(( thread_cpu_time ))> PRINT_CPU_TIME_FOR_THIS_BLOCK{name, thread_cpu_time };`
define PRINT_RECORD_FOR_THIS_BLOCK
#define PRINT_RECORD_FOR_THIS_BLOCK (
name
) `print_timer2 PRINT_RECORD_FOR_THIS_BLOCK_timer{name};`
define PRINT_WALL_TIME_FOR_THIS_BLOCK
#define PRINT_WALL_TIME_FOR_THIS_BLOCK (
name
) `/* multi line expression */`
The documentation for this class was generated from the following file /home/friedel/devel/ILLIXR/illixr_release/ILLIXR/include/illixr/cpu_timer.hpp