41 if (devices[index] == active) {
58 if (at == std::string_view::npos) {
61 at = text.
find(
' ', at);
62 if (at == std::string_view::npos) {
87 while (!text.
empty()) {
95 if (digits == std::string_view::npos ||
108 if (dash == 0 || dash == std::string_view::npos ||
113 for (
int field = 0; field < 5; ++field) {
124 return kilobytes * 1024;
154 m_workTotal +=
static_cast<double>(workNanoseconds);
156 m_worstWork =
std::max(m_worstWork, workNanoseconds);
162 const auto interval = now - *m_previous;
164 m_intervalTotal +=
static_cast<double>(interval);
166 m_worstInterval =
std::max(m_worstInterval, interval);
167 if (now - m_start < 1000000000) {
171 static_cast<double>(m_intervals) * 1e9 /
static_cast<double>(now - m_start);
172 m_snapshot = {m_workTotal /
static_cast<double>(m_workCount) / 1e6,
173 m_intervalTotal /
static_cast<double>(m_intervals) / 1e6,
175 static_cast<double>(m_worstWork) / 1e6,
176 static_cast<double>(m_worstInterval) / 1e6,
177 m_snapshot ?
std::min(m_snapshot->worstFps, fps) : fps};
180 m_intervalTotal = 0.0;
198 double m_workTotal = 0.0;
200 double m_intervalTotal = 0.0;
One-second timing averages and worst values since collection began.
Definition performance.h:128
const std::optional< Snapshot > & Latest() const
Definition performance.h:190
bool Record(std::uint64_t workNanoseconds, std::uint64_t now)
Accumulate a frame and publish averages after at least one second of timestamp progress.
Definition performance.h:153
T find_first_not_of(T... args)
Definition assetimport.h:11
std::optional< std::uint64_t > StatmResidentPages(std::string_view text)
Definition performance.h:56
constexpr int FRAME_RATE_STATISTICS
The state of F in g_bShowFpsCounter that shows the statistics beside the frame rate.
Definition performance.h:25
std::optional< std::uint64_t > SmapsGamePssBytes(std::string_view text, std::string_view executable)
Definition performance.h:82
std::optional< std::size_t > UniqueGpuIndex(std::string_view active, std::span< const std::string > devices)
Match the active adapter to one provider device, rejecting absent and ambiguous identities.
Definition performance.h:34
constexpr int FRAME_RATE_STATES
The states of F in g_bShowFpsCounter: 0 for off, 1 for the frame rate, and 2 for both.
Definition performance.h:22
T remove_prefix(T... args)
Completed sampling interval averages and extrema since the first recorded frame.
Definition performance.h:131
double intervalMs
Mean interval between frame timestamps in milliseconds, including waits.
Definition performance.h:135
double worstWorkMs
Greatest recorded CPU work time in milliseconds since collection began.
Definition performance.h:139
double worstIntervalMs
Greatest recorded interval in milliseconds since collection began.
Definition performance.h:141
double worstFps
Lowest completed sampling interval frame rate since collection began.
Definition performance.h:143
double fps
Frame intervals per second over the completed sampling interval.
Definition performance.h:137
double workMs
Mean CPU work per frame in milliseconds, excluding presentation and pacing waits.
Definition performance.h:133