VLink  2.0.0
A high-performance communication middleware
vlink::CalculateSample Class Referencefinal

Tracks expected and lost sample counts grouped by sender GUID. More...

#include <calculate_sample.h>

Collaboration diagram for vlink::CalculateSample:

Public Member Functions

 CalculateSample () noexcept
 Constructs an empty counter. More...
 
 ~CalculateSample () noexcept
 Releases all per-sender state. More...
 
void update (uint64_t seq, uint64_t guid=0) noexcept
 Records a sequence number received from guid. More...
 
uint64_t get_total () const noexcept
 Returns the total number of expected samples across all senders. More...
 
uint64_t get_lost () const noexcept
 Returns the cumulative number of lost samples across all senders. More...
 

Detailed Description

Tracks expected and lost sample counts grouped by sender GUID.

One instance is created per subscriber / getter when latency-and-loss tracking is enabled. The guid parameter of update() lets a single receiver account for multiple senders without their streams interfering.

Constructor & Destructor Documentation

◆ CalculateSample()

vlink::CalculateSample::CalculateSample ( )
noexcept

Constructs an empty counter.

◆ ~CalculateSample()

vlink::CalculateSample::~CalculateSample ( )
noexcept

Releases all per-sender state.

Member Function Documentation

◆ get_lost()

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

Returns the cumulative number of lost samples across all senders.

Returns
Aggregate loss count since construction.

◆ get_total()

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

Returns the total number of expected samples across all senders.

Computed as the sum of (expected - first) over every tracked GUID. The value includes both received and lost samples.

Returns
Number of expected samples; 0 when no data has been observed yet.

◆ update()

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

Records a sequence number received from guid.

Updates the per-sender counters according to the algorithm described at file scope. Acquires the exclusive side of the shared mutex.

Parameters
seqSequence number reported by the transport.
guidSender identifier; pass 0 when there is exactly one source.

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