VLink 2.0.0
A high-performance communication middleware
Loading...
Searching...
No Matches
vlink::CalculateSample Class Referencefinal

Thread-safe, per-GUID cumulative sample loss counter. More...

#include <calculate_sample.h>

Collaboration diagram for vlink::CalculateSample:

Public Member Functions

 CalculateSample () noexcept
 Default constructor.
 ~CalculateSample () noexcept
 Destructor.
void update (uint64_t seq, uint64_t guid=0) noexcept
 Processes an incoming sequence number for the given sender.
uint64_t get_total () const noexcept
 Returns the total number of expected samples across all senders.
uint64_t get_lost () const noexcept
 Returns the cumulative number of lost samples across all senders.

Detailed Description

Thread-safe, per-GUID cumulative sample loss counter.

Instantiated once per SubscriberImpl or GetterImpl that has latency/loss tracking enabled. The guid parameter allows a single subscriber to track messages from multiple publishers independently.

Constructor & Destructor Documentation

◆ CalculateSample()

vlink::CalculateSample::CalculateSample ( )
noexcept

Default constructor.

Here is the caller graph for this function:

◆ ~CalculateSample()

vlink::CalculateSample::~CalculateSample ( )
noexcept

Destructor.

Here is the call graph for this function:

Member Function Documentation

◆ get_lost()

uint64_t vlink::CalculateSample::get_lost ( ) const
nodiscardnoexcept

Returns the cumulative number of lost samples across all senders.

Accumulated from every gap detected since the last reset.

Returns
Total lost sample count.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_total()

uint64_t vlink::CalculateSample::get_total ( ) const
nodiscardnoexcept

Returns the total number of expected samples across all senders.

Computed as the sum of (expected - first) for every tracked GUID. This includes both successfully delivered and lost samples.

Returns
Total expected sample count, or 0 if no data has been received.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ update()

void vlink::CalculateSample::update ( uint64_t seq,
uint64_t guid = 0 )
noexcept

Processes an incoming sequence number for the given sender.

Detects gaps in the sequence and accumulates the loss count. Out-of-order or wrap-around sequences larger than UINT32_MAX are treated as resets and do not increment the loss counter.

Parameters
seqSequence number of the received message.
guidSender identifier (GUID). Use 0 for single-sender streams.
Here is the call graph for this function:
Here is the caller graph for this function:

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