#include <CpuTimer.hpp>
|
using | time_point = std::chrono::time_point< std::chrono::high_resolution_clock > |
|
Definition at line 30 of file CpuTimer.hpp.
Enumerator |
---|
kSeconds |
|
kMilliseconds |
|
kMicroseconds |
|
kNanoseconds |
|
Definition at line 34 of file CpuTimer.hpp.
34 { kSeconds, kMilliseconds, kMicroseconds, kNanoseconds };
CpuTimer::CpuTimer |
( |
const std::string & |
label | ) |
|
|
inline |
CpuTimer::CpuTimer |
( |
const std::string & |
label, |
|
|
const int64_t |
nest_level |
|
) |
| |
|
inline |
void CpuTimer::end_event_timer |
( |
| ) |
|
|
inline |
void CpuTimer::finalize |
( |
| ) |
|
|
inlineprivate |
void CpuTimer::initialize |
( |
| ) |
|
|
inlineprivate |
void CpuTimer::print_timings |
( |
| ) |
|
|
inlineprivate |
Definition at line 115 of file CpuTimer.hpp.
References event_timers_, finalize(), report::header, nest_level_, timer_label_, timers_end_, and timers_start_.
Referenced by ~CpuTimer().
120 const std::string header_underline{std::string(
header.size(),
'=')};
121 const std::string nest_spaces{std::string(
nest_level_ * 2,
' ')};
122 std::cout << std::endl
123 << nest_spaces <<
header << std::endl
124 << nest_spaces << header_underline << std::endl;
126 const size_t timings_left_margin{50};
129 const int64_t ms_elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(
130 event_timer.end_time - event_timer.start_time)
132 const int64_t total_ms_elapsed =
133 std::chrono::duration_cast<std::chrono::milliseconds>(event_timer.end_time -
136 const size_t label_width{event_timer.event_label.size()};
137 const size_t margin_calc{
138 label_width < timings_left_margin ? timings_left_margin - label_width : 0};
140 std::cout << nest_spaces << event_timer.event_label <<
": "
141 << std::setw(margin_calc) << std::fixed << std::setprecision(4)
142 << ms_elapsed <<
" ms elapsed, " << total_ms_elapsed <<
" ms total"
145 if (event_timer.nested_event_timer !=
nullptr) {
146 event_timer.nested_event_timer->print_timings();
147 std::cout << std::endl;
150 const int64_t total_ms_elapsed =
153 std::cout << nest_spaces <<
timer_label_ <<
" total elapsed: " << std::fixed
154 << std::setprecision(4) << total_ms_elapsed <<
" ms" << std::endl;
const std::string timer_label_
std::vector< EventTimer > event_timers_
void CpuTimer::start_event_timer |
( |
const std::string & |
event_label | ) |
|
|
inline |
EventTimer& CpuTimer::start_event_timer_impl |
( |
const std::string & |
event_label, |
|
|
const bool |
make_nested |
|
) |
| |
|
inlineprivate |
std::shared_ptr<CpuTimer> CpuTimer::start_nested_event_timer |
( |
const std::string & |
event_label | ) |
|
|
inline |
Definition at line 54 of file CpuTimer.hpp.
References start_event_timer_impl().
56 return event_timer.nested_event_timer;
EventTimer & start_event_timer_impl(const std::string &event_label, const bool make_nested)
const size_t CpuTimer::nest_level_ |
|
private |
const std::string CpuTimer::timer_label_ |
|
private |
The documentation for this class was generated from the following file:
- /home/jenkins-slave/workspace/core-os-doxygen/QueryEngine/TableFunctions/SystemFunctions/os/Shared/CpuTimer.hpp