Class UDPStats

Class Documentation

class UDPStats

Accumulate statistics for UDP based sockets. Providees information on data capture rates, data loss rates, interface errors.

Public Functions

UDPStats()

Construct a new UDPStats object.

~UDPStats() = default

Destroy the UDPStats object.

void configure(UDPFormat *format)

Configure the object from a UDPFormat. Extracts the UDPFormat’s packet_size and packet_data_size for use in calculating statistics.

Parameters

format – UDP format to use for configuration

void increment(uint64_t num_packets = 1)

Increment bytes_transmitted by the specified number of packets.

Parameters

num_packets – The number of packets to incremenet by.

void increment_bytes(uint64_t nbytes)

Increment bytes_transmitted by the specified number of bytes.

Parameters

nbytes – Number of bytes to increment by.

void dropped(uint64_t num_packets = 1)

Increment bytes_dropped by the specified number of packets.

Parameters

num_packets – The number of packets that were dropped.

void dropped_bytes(uint64_t nbytes)

Increment bytes_dropped by the specified amount.

Parameters

nbytes – Number of bytes to incremenet bytes_dropped.

void ignored(uint64_t num_packets = 1)

Incremenet the number of valid packets that were ignored due to PSN/timestamps.

Parameters

num_packets – The number of valid packets that were ignored

void sleeps(uint64_t num_sleeps = 1)

Increment the number of busy-wait sleeps by the specified amount.

Parameters

num_sleeps – Number of busy-wait sleeps

void malformed(uint64_t num_packets = 1)

Increment the number of malformed packets.

Parameters

num_packets

void misordered(uint64_t num_packets = 1)

Increment the number of misordered packets.

Parameters

num_packets

void misdirected(uint64_t num_packets = 1)

Increment the number of misdirected packets.

Parameters

num_packets

void discarded(uint64_t num_packets = 1)

Increment the number of discarded packets.

Parameters

num_packets

void reset()

Reset the internal counters.

inline uint64_t get_data_transmitted() const

Return the amount of data of data transmitted.

Returns

uint64_t Number of bytes transmitted.

uint64_t get_packets_transmitted() const

Return the number of packets transmitted.

Returns

uint64_t Number of packets transmitted

inline uint64_t get_data_dropped() const

Return the number of bytes dropped.

Returns

uint64_t Number of bytes dropped.

uint64_t get_packets_dropped() const

Return the number of packets dropped.

Returns

uint64_t Number of packets dropped.

inline uint64_t get_discarded() const

Get the number of discarded packets.

Returns

uint64_t Number of discarded packets

inline uint64_t get_nsleeps() const

Return the number of busy-wait sleeps.

Returns

uint64_t Number of busy-wait sleeps.

inline uint64_t get_ignored() const

Return the number of valid packets that were ignored.

Returns

uint64_t Number of ignored packets

inline uint64_t get_malformed() const

Return the number of malformed packets.

Returns

uint64_t Number of malformed packets

inline uint64_t get_misdirected() const

Get the number of misdirected packets.

Returns

uint64_t Number of misdirected packets

inline uint64_t get_misordered() const

Get the number of misordered packets.

Returns

uint64_t Number of misordered packets

void compute_rates()

Compute the instantaneous data rates.

double get_data_transmission_rate() const

Get the data transmission rate.

Returns

float data transmission rate in bytes per second.

double get_data_drop_rate() const

Get the data drop rate.

Returns

float data drop rate in bytes per second.

double get_sleep_rate() const

Get the number of busy-wait sleeps per second.

Returns

double busy wait sleeps per second.

void packet_receive_timeout()

Increment the number of packet timeout.

uint64_t get_packet_receive_timeouts() const

Get the packet receive timeouts object.

Returns

uint64_t returns packet_receive_timeouts

void set_packet_timeout_threshold(uint64_t threshold)

Set the packet timeout threshold object.

Parameters

threshold – timeout threshold between packets

void set_initial_packet_timeout_threshold(uint64_t threshold)

Set the initial packet timeout threshold object.

Parameters

threshold – Timeout threshold when waiting for the first packet

uint64_t get_packet_timeout_threshold()

Get the packet timeout threshold object.

Returns

uint64_t returns packet_timeout_threshold. Default value of 1

uint64_t get_initial_packet_timeout_threshold()

Get the initial packet timeout threshold object.

Returns

uint64_t returns initial_packet_timeout_threshold. Default value of 10