QtCraft API C++ classes QML types Handbook

QcPhaseWindow Class

Mean and maximum of a few series of times (milliseconds) over the latest samples, for the debug display (decision E-225): one sample per server tick or per frame, each with one value per series. More...

Header: #include <common/core/QcPhaseWindow.h>

Public Functions

void add(std::span<const float> values)
int capacity() const
void clear()
QList<float> history(int series, int count) const
float latest(int series) const
double max(int series) const
double mean(int series) const
int seriesCount() const
int size() const

Detailed Description

The memory is taken once in the constructor; adding a sample neither allocates nor scans, the mean keeps running sums and the maximum is looked up when asked for. Not thread-safe.

Member Function Documentation

void QcPhaseWindow::add(std::span<const float> values)

One sample; values must hold one value per series (missing ones count as 0, extra ones are ignored). The oldest sample leaves once the window is full.

int QcPhaseWindow::capacity() const

Returns the most samples held.

void QcPhaseWindow::clear()

Drops all samples.

QList<float> QcPhaseWindow::history(int series, int count) const

Returns up to count values of series, oldest first (graphs).

float QcPhaseWindow::latest(int series) const

Returns the newest value of series; 0 without samples.

double QcPhaseWindow::max(int series) const

Returns the maximum of series over the samples held; 0 without samples.

double QcPhaseWindow::mean(int series) const

Returns the mean of series over the samples held; 0 without samples.

int QcPhaseWindow::seriesCount() const

Returns the number of series.

int QcPhaseWindow::size() const

Returns the samples held, at most the capacity.