|
VLink 2.0.0
A high-performance communication middleware
|
Per-GUID cumulative sample loss tracker for VLink subscribers. More...
Go to the source code of this file.
Classes | |
| class | vlink::CalculateSample |
| Thread-safe, per-GUID cumulative sample loss counter. More... | |
Namespaces | |
| namespace | vlink |
Per-GUID cumulative sample loss tracker for VLink subscribers.
CalculateSample maintains per-sender (GUID) sequence-number state to detect gaps in the message stream. It is used by DDS and other transports that carry monotonically-increasing sequence numbers with their messages.
first – the first sequence number seen from this sender.expected – the next sequence number expected.lost – cumulative count of skipped sequence numbers.On each update(seq, guid) call:
expected == 0 or the gap looks like a reset, the state is re-initialised (no loss recorded for the first message).lost is incremented by the difference (seq - expected), and expected is set to seq + 1.update() uses an exclusive lock and get_total() / get_lost() use a shared lock.UINT32_MAX between consecutive sequence numbers is treated as a counter reset rather than a loss event.get_total() returns the sum over all GUIDs of (expected - first), i.e. the number of expected messages.