3#ifndef _TIME_SHIELD_CPU_TICK_TIMER_HPP_INCLUDED
4#define _TIME_SHIELD_CPU_TICK_TIMER_HPP_INCLUDED
30 if (is_start_immediately) {
58 [[nodiscard]]
double elapsed() const noexcept {
107 return std::numeric_limits<double>::quiet_NaN();
double average_ticks() const noexcept
Get average CPU ticks per sample.
double last_sample_ticks() const noexcept
Get ticks collected during the last recorded sample.
void accumulate_ticks(double sample_ticks) noexcept
double total_ticks() const noexcept
Get total recorded CPU ticks across samples.
void reset_samples() noexcept
Reset collected samples without touching running state.
void stop() noexcept
Stop measuring CPU time and freeze elapsed ticks.
double m_last_sample_ticks
double record_sample() noexcept
Record sample using elapsed ticks and restart timer.
CpuTickTimer(bool is_start_immediately=true) noexcept
Construct timer and optionally start it immediately.
double elapsed() const noexcept
Get elapsed CPU ticks since the last start.
double m_total_compensation
void restart() noexcept
Restart timer and reset collected statistics.
std::size_t sample_count() const noexcept
Get the number of recorded samples.
std::size_t m_sample_count
void start() noexcept
Start measuring CPU time.
double get_cpu_time() noexcept
Get the CPU time used by the current process.
Main namespace for the Time Shield library.
Header file with time-related utility functions.