QtCraft API C++ classes QML types Handbook

QcLagReport Class

Lag spikes in the server's log (decision E-834): a tick longer than 50 ms becomes a line with its duration and its longest phases. More...

Header: #include <server/tick/QcLagReport.h>

Public Functions

std::optional<QString> check(const QcTickPhaseTimer::Durations &phases, qint64 nowNs)
std::optional<QString> flush()

Static Public Members

const qint64 quietNs
const int shownPhases
const qint64 thresholdNs

Detailed Description

At most one line per ten seconds; the spikes in between are counted into the next line with the longest of them, so a slow phase cannot flood the log.

Member Function Documentation

std::optional<QString> QcLagReport::check(const QcTickPhaseTimer::Durations &phases, qint64 nowNs)

Returns the line for the tick that ended at nowNs with the phase durations phases; std::nullopt when it was no spike or a line was written less than quietNs before.

std::optional<QString> QcLagReport::flush()

Returns the line for the spikes counted since the last line, at the end (server stop); std::nullopt when there were none.

Member Variable Documentation

const qint64 QcLagReport::quietNs

At most one line per this long (ten seconds).

const int QcLagReport::shownPhases

Phases named in a line at most, the longest first.

const qint64 QcLagReport::thresholdNs

A tick longer than this is a spike (50 ms).