31 #include "timemory/components/timing/backends.hpp"
56 return tim::get_clock_system_now<int64_t, ratio_t>();
58 TIMEMORY_NODISCARD
double get() const noexcept
61 return static_cast<double>(val /
static_cast<double>(ratio_t::den) *
68 value = (
record() - value);
88 return tim::get_clock_user_now<int64_t, ratio_t>();
90 TIMEMORY_NODISCARD
double get() const noexcept
93 return static_cast<double>(val /
static_cast<double>(ratio_t::den) *
100 value = (
record() - value);
119 return "Total CPU time spent in both user- and kernel-mode";
123 return tim::get_clock_cpu_now<int64_t, ratio_t>();
125 TIMEMORY_NODISCARD
double get() const noexcept
128 return static_cast<double>(val /
static_cast<double>(ratio_t::den) *
135 value = (
record() - value);
153 return "Wall-clock timer which will continue to increment even while the system "
158 return tim::get_clock_monotonic_now<int64_t, ratio_t>();
160 TIMEMORY_NODISCARD
double get() const noexcept
163 return static_cast<double>(val /
static_cast<double>(ratio_t::den) *
170 value = (
record() - value);
189 return "Wall-clock timer unaffected by frequency or time adjustments in system "
194 return tim::get_clock_monotonic_raw_now<int64_t, ratio_t>();
196 TIMEMORY_NODISCARD
double get() const noexcept
199 return static_cast<double>(val /
static_cast<double>(ratio_t::den) *
206 value = (
record() - value);
227 return tim::get_clock_thread_now<int64_t, ratio_t>();
229 TIMEMORY_NODISCARD
double get() const noexcept
232 return static_cast<double>(val /
static_cast<double>(ratio_t::den) *
239 value = (
record() - value);
259 return "CPU-clock timer for the calling process (all threads)";
263 return tim::get_clock_process_now<int64_t, ratio_t>();
265 TIMEMORY_NODISCARD
double get() const noexcept
268 return static_cast<double>(val /
static_cast<double>(ratio_t::den) *
275 value = (
record() - value);
296 return "Percentage of CPU-clock time divided by wall-clock time";
302 TIMEMORY_NODISCARD
double get() const noexcept
304 const auto& _data =
load();
305 double denom = (_data.second > 0) ? _data.second : 1;
306 double numer = (_data.second > 0) ? _data.first : 0;
307 return 100.0 *
static_cast<double>(numer) /
static_cast<double>(denom);
323 value = (
record() - value);
359 if(m_derive && wc && cc)
361 value.first = cc->get_value();
362 value.second = wc->get_value();
372 if(m_derive && wc && uc && sc)
374 value.first = uc->get_value() + sc->get_value();
375 value.second = wc->get_value();
382 TIMEMORY_NODISCARD
bool is_derived() const noexcept {
return m_derive; }
385 bool m_derive =
false;
404 return "Percentage of CPU-clock time divided by wall-clock time for calling "
405 "process (all threads)";
411 TIMEMORY_NODISCARD
double get() const noexcept
413 const auto& _data =
load();
414 double denom = (_data.second > 0) ? _data.second : 1;
415 double numer = (_data.second > 0) ? _data.first : 0;
416 return 100.0 *
static_cast<double>(numer) /
static_cast<double>(denom);
430 value = (
record() - value);
458 if(m_derive && wc && cc)
460 value.first = cc->get_value();
461 value.second = wc->get_value();
468 TIMEMORY_NODISCARD
bool is_derived() const noexcept {
return m_derive; }
471 bool m_derive =
false;
490 return "Percentage of CPU-clock time divided by wall-clock time for calling "
497 TIMEMORY_NODISCARD
double get() const noexcept
499 const auto& _data =
load();
500 double denom = (_data.second > 0) ? _data.second : 1;
501 double numer = (_data.second > 0) ? _data.first : 0;
502 return 100.0 *
static_cast<double>(numer) /
static_cast<double>(denom);
516 value = (
record() - value);
544 if(m_derive && wc && cc)
546 value.first = cc->get_value();
547 value.second = wc->get_value();
554 TIMEMORY_NODISCARD
bool is_derived() const noexcept {
return m_derive; }
557 bool m_derive =
false;
tim::mpl::apply< std::string > string
static int64_t get_unit()
this component extracts only the CPU time spent in both user- and kernel- mode. Only relevant as a ti...
double get() const noexcept
static std::string description()
static value_type record() noexcept
static std::string label()
double get_display() const noexcept
this computes the CPU utilization percentage for the calling process and child processes....
double get_display() const noexcept
this_type & operator-=(const this_type &rhs) noexcept
this_type & operator+=(const this_type &rhs) noexcept
bool derive(const wall_clock *wc, const user_clock *uc, const system_clock *sc) noexcept
static std::string label()
static std::string description()
static value_type record()
bool is_derived() const noexcept
std::pair< int64_t, int64_t > value_type
bool assemble(const wall_clock *wc, const cpu_clock *cc) noexcept
bool assemble(const wall_clock *wc, const user_clock *uc, const system_clock *sc) noexcept
bool derive(const wall_clock *wc, const cpu_clock *cc) noexcept
double serialization() const noexcept
double get() const noexcept
clock that increments monotonically, tracking the time since an arbitrary point, and will continue to...
double get() const noexcept
static value_type record()
double get_display() const noexcept
static std::string label()
static std::string description()
clock that increments monotonically, tracking the time since an arbitrary point like CLOCK_MONOTONIC....
static std::string label()
double get() const noexcept
static value_type record()
double get_display() const noexcept
static std::string description()
this clock measures the CPU time within the current process (excludes child processes)....
static std::string description()
static value_type record() noexcept
static std::string label()
double get() const noexcept
double get_display() const noexcept
this computes the CPU utilization percentage for ONLY the calling process (excludes child processes)....
double get_display() const noexcept
double serialization() const noexcept
bool is_derived() const noexcept
static value_type record()
double get() const noexcept
static std::string label()
std::pair< int64_t, int64_t > value_type
bool assemble(const wall_clock *wc, const process_cpu_clock *cc) noexcept
this_type & operator-=(const this_type &rhs) noexcept
bool derive(const wall_clock *wc, const process_cpu_clock *cc) noexcept
this_type & operator+=(const this_type &rhs) noexcept
static std::string description()
this component extracts only the CPU time spent in kernel-mode. Only relevant as a time when a differ...
static value_type record() noexcept
static std::string label()
double get() const noexcept
double get_display() const noexcept
static std::string description()
this clock measures the CPU time within the current thread (excludes sibling/child threads)....
double get() const noexcept
double get_display() const noexcept
static value_type record() noexcept
static std::string label()
static std::string description()
this computes the CPU utilization percentage for ONLY the calling thread (excludes sibling and child ...
double get_display() const noexcept
std::pair< int64_t, int64_t > value_type
bool derive(const wall_clock *wc, const thread_cpu_clock *cc) noexcept
bool is_derived() const noexcept
double get() const noexcept
double serialization() const noexcept
this_type & operator-=(const this_type &rhs) noexcept
static value_type record()
static std::string description()
static std::string label()
this_type & operator+=(const this_type &rhs) noexcept
bool assemble(const wall_clock *wc, const thread_cpu_clock *cc) noexcept
this component extracts only the CPU time spent in user-mode. Only relevant as a time when a differen...
double get_display() const noexcept
static value_type record() noexcept
static std::string description()
double get() const noexcept
static std::string label()
static value_type record() noexcept