11#include <egt/detail/meta.h>
34 EGT_NODISCARD
inline double usage()
const {
return m_cpu_usage; }
45 size_t m_last_total_time{0};
46 size_t m_last_idle_time{0};
47 double m_cpu_usage{0};
77 m_start = std::chrono::steady_clock::now();
88 const auto now = std::chrono::steady_clock::now();
89 const auto diff = std::chrono::duration<double>(now - m_start).count();
92 m_fps = m_frames / diff;
101 EGT_NODISCARD
bool ready()
const {
return m_ready && m_frames > 0; }
115 std::chrono::time_point<std::chrono::steady_clock> m_start{};
118 uint64_t m_frames{0};
Monitor CPU usage of the system.
Definition tools.h:28
EGT_NODISCARD double usage() const
Get the total CPU usage as a percentage.
Definition tools.h:34
void update()
Update the CPU usage.
Calculate "frame-per-second" of something.
Definition tools.h:64
void end_frame()
Call at the end of every frame.
Definition tools.h:84
void start()
Start/reset the counter.
Definition tools.h:75
float fps()
Retrieve the current FPS value.
Definition tools.h:106
EGT_NODISCARD bool ready() const
Is any calculation ready?
Definition tools.h:101
FramesPerSecond() noexcept
Definition tools.h:67
EGT framework namespace.
Definition animation.h:24