QcLatencyProbe Class
The client's measurement of the round trip to the server (decision E-886): every half second a LatencyProbe, answered by the server at once with a LatencyEcho; the round trips go into a QcRoundTripStats of the last ten seconds. More...
| Header: | #include <clientcore/tick/QcLatencyProbe.h> |
Public Types
Public Functions
| QcLatencyProbe(QcLatencyProbe::Clock clock = {}) | |
| std::optional<QcMsg::LatencyProbe> | due() |
| void | echoed(quint32 nonce) |
| void | reset() |
| std::optional<QcRoundTripSummary> | summary() const |
Static Public Members
| const qint64 | intervalNs |
| const qint64 | lostAfterNs |
Detailed Description
Times come from its own steady clock (a QElapsedTimer, or the clock a test hands in), not from the session's tick clock, which tests replace. Probes and echoes come from the thread that ticks the session (QcSessionCore), summary() from any thread; every access takes the mutex.
Member Type Documentation
[alias] QcLatencyProbe::Clock
Nanoseconds of a steady clock.
Member Function Documentation
[explicit] QcLatencyProbe::QcLatencyProbe(QcLatencyProbe::Clock clock = {})
Measures with clock; without a clock the probe measures with its own QElapsedTimer.
std::optional<QcMsg::LatencyProbe> QcLatencyProbe::due()
Returns the probe to send now, or std::nullopt while the last one is not due or still on its way.
void QcLatencyProbe::echoed(quint32 nonce)
The server answered the probe nonce; an echo of an older or lost probe is ignored.
void QcLatencyProbe::reset()
Forgets the round trips so far; the echo of a probe on its way is ignored, the next probe follows at the usual interval.
std::optional<QcRoundTripSummary> QcLatencyProbe::summary() const
Returns the round trips so far, with the age of a late probe (QcRoundTripSummary::pendingMs); std::nullopt before the first echo.