evan 2026.1.4
Evan
Loading...
Searching...
No Matches
evan::PhaseStats Struct Reference

One accumulated CPU phase, in nanoseconds. More...

#include <headers/evan/FrameStats.hpp>

Public Member Functions

void add (uint64_t ns) noexcept
 Records one sample.
 
void resetWindow () noexcept
 Starts a new window.
 
uint64_t averageNs () const noexcept
 Average duration of the window.
 

Public Attributes

uint64_t lastNs = 0
 Most recent sample, in nanoseconds.
 
uint64_t totalNs = 0
 Sum of the samples of the current window, in nanoseconds.
 
uint32_t samples = 0
 Number of samples of the current window.
 

Detailed Description

One accumulated CPU phase, in nanoseconds.

Samples are added per frame; the report window keeps the most recent value, the sum and the sample count so the average can be computed when the window is reported.

Definition at line 26 of file FrameStats.hpp.

Member Function Documentation

◆ add()

void evan::PhaseStats::add ( uint64_t  ns)
inlinenoexcept

Records one sample.

Parameters
nsDuration of the sample, in nanoseconds.

Definition at line 47 of file FrameStats.hpp.

Here is the caller graph for this function:

◆ averageNs()

uint64_t evan::PhaseStats::averageNs ( ) const
inlinenoexcept

Average duration of the window.

Returns
The average in nanoseconds, or 0 when the window has no sample.

Definition at line 72 of file FrameStats.hpp.

◆ resetWindow()

void evan::PhaseStats::resetWindow ( )
inlinenoexcept

Starts a new window.

Keeps lastNs (the most recent value stays readable) and clears the sum and the sample count.

Definition at line 60 of file FrameStats.hpp.

Member Data Documentation

◆ lastNs

uint64_t evan::PhaseStats::lastNs = 0

Most recent sample, in nanoseconds.

Definition at line 30 of file FrameStats.hpp.

◆ samples

uint32_t evan::PhaseStats::samples = 0

Number of samples of the current window.

Definition at line 40 of file FrameStats.hpp.

◆ totalNs

uint64_t evan::PhaseStats::totalNs = 0

Sum of the samples of the current window, in nanoseconds.

Definition at line 35 of file FrameStats.hpp.


The documentation for this struct was generated from the following file: