#[non_exhaustive]
pub struct SocketStatistics {
Show 57 fields pub elapsed_time: Duration, pub tx_all_packets: u64, pub rx_all_packets: u64, pub tx_all_bytes: u64, pub rx_all_bytes: u64, pub tx_encrypted_data: u64, pub rx_decrypted_data: u64, pub rx_clock_adjustments: u64, pub rx_clock_drift_mean: i64, pub rx_clock_drift_stddev: i64, pub rx_ack2_errors: i64, pub tx_data: u64, pub rx_data: u64, pub tx_unique_data: u64, pub rx_unique_data: u64, pub tx_loss_data: u64, pub rx_loss_data: u64, pub tx_retransmit_data: u64, pub rx_retransmit_data: u64, pub tx_ack: u64, pub rx_ack: u64, pub tx_light_ack: u64, pub rx_light_ack: u64, pub tx_nak: u64, pub rx_nak: u64, pub tx_ack2: u64, pub rx_ack2: u64, pub tx_buffer_time: Duration, pub tx_dropped_data: u64, pub rx_dropped_data: u64, pub rx_decrypt_errors: u64, pub tx_bytes: u64, pub rx_bytes: u64, pub tx_unique_bytes: u64, pub rx_unique_bytes: u64, pub rx_loss_bytes: u64, pub tx_retransmit_bytes: u64, pub tx_dropped_bytes: u64, pub rx_dropped_bytes: u64, pub rx_decrypt_error_bytes: u64, pub tx_snd_period: Duration, pub tx_flow_window: u64, pub tx_unacknowledged_data: u64, pub tx_average_rtt: Duration, pub rx_average_rtt: Duration, pub tx_bandwidth: u64, pub rx_bandwidth: u64, pub tx_buffer_available_bytes: u64, pub rx_buffer_available_bytes: u64, pub tx_buffered_data: u64, pub tx_buffered_bytes: u64, pub tx_buffered_time: Duration, pub rx_acknowledged_data: u64, pub rx_acknowledged_bytes: u64, pub rx_acknowledged_time: Duration, pub rx_belated_data: u64, pub rx_belated_time: Duration,
}
Expand description

SRT provides a powerful set of statistical data on a socket. This data can be used to keep an eye on a socket’s health and track faulty behavior.

Statistics are calculated independently on each side (receiver and sender) and are not exchanged between peers unless explicitly stated.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§elapsed_time: Duration

The time elapsed, in milliseconds, since the SRT socket was created.

§tx_all_packets: u64§rx_all_packets: u64§tx_all_bytes: u64§rx_all_bytes: u64§tx_encrypted_data: u64§rx_decrypted_data: u64§rx_clock_adjustments: u64§rx_clock_drift_mean: i64§rx_clock_drift_stddev: i64§rx_ack2_errors: i64§tx_data: u64

The total number of sent DATA packets, including retransmissions (tx_retransmit_data).

§rx_data: u64

The total number of received DATA packets, including retransmissions (rx_retransmit_data).

§tx_unique_data: u64

The total number of sent unique DATA packets.

This value contains only unique original DATA packets. Retransmitted DATA packets (tx_retransmit_data) are not taken into account.

This value corresponds to the number of original DATA packets sent by the SRT sender. It counts every packet sent over the network for the first time, and can be calculated as follows: tx_unique_data = tx_data – tx_retransmit_data. The original DATA packets are sent only once.

§rx_unique_data: u64

The total number of received unique original, retransmitted or recovered DATA packets received in time, decrypted without errors and, as a result, scheduled for delivery to the upstream application by the SRT receiver.

Unique means “first arrived” DATA packets. There is no difference whether a packet is original or, in case of loss, retransmitted or recovered by the packet filter. Whichever packet comes first is taken into account.

This statistic doesn’t count

  • duplicate packets (retransmitted or sent several times by defective hardware/software),
  • arrived too late packets (retransmitted or original packets arrived out of order) that were already dropped by the TLPKTDROP mechanism (see tx_dropped_data statistic),
  • arrived in time packets, but decrypted with errors (see rx_decrypt_errors statistic), and, as a result, dropped by the TLPKTDROP mechanism (see tx_dropped_data statistic).
§tx_loss_data: u64

The total number of data packets considered or reported as lost at the sender side. Does not correspond to the packets detected as lost at the receiver side.

A packet is considered lost in two cases:

  1. Sender receives a loss report (NAK) from a receiver.
  2. Sender initiates retransmission after not receiving an ACK packet for a certain timeout. Refer to FASTREXMIT and LATEREXMIT algorithms.
§rx_loss_data: u64

The total number of SRT DATA packets detected as presently missing (either reordered or lost) at the receiver side.

The detection of presently missing packets is triggered by a newly received DATA packet with the sequence number s. If s is greater than the sequence number next_exp of the next expected packet (s > next_exp), the newly arrived packet s is considered in-order and there is a sequence discontinuity of size s - next_exp associated with this packet. The presence of sequence discontinuity means that some packets of the original sequence have not yet arrived (presently missing), either reordered or lost. Once the sequence discontinuity is detected, its size s - next_exp is added to rx_loss_data statistic. Refer to RFC 4737 - Packet Reordering Metrics for details.

If the packet s is received out of order (s < next_exp), the statistic is not affected.

Note that only original (not retransmitted) SRT DATA packets are taken into account. Refer to rx_retransmit_data for the formula for obtaining the total number of lost retransmitted packets.

§tx_retransmit_data: u64

The total number of retransmitted packets sent by the SRT sender.

This statistic is not interchangeable with the receiver rx_retransmit_data statistic.

§rx_retransmit_data: u64

The total number of retransmitted packets registered at the receiver side.

This statistic is not interchangeable with the sender tx_retransmit_data statistic.

Note that the total number of lost retransmitted packets can be calculated as the total number of retransmitted packets sent by receiver minus the total number of retransmitted packets registered at the receiver side: tx_retransmit_data - rx_retransmit_data.

§tx_ack: u64

The total number of sent ACK (Acknowledgement) control packets.

§rx_ack: u64

The total number of received ACK (Acknowledgement) control packets.

§tx_light_ack: u64§rx_light_ack: u64§tx_nak: u64

The total number of sent NAK (Negative Acknowledgement) control packets.

§rx_nak: u64

The total number of received NAK (Negative Acknowledgement) control packets.

§tx_ack2: u64

The total number of sent ACK2 (Acknowledgement Acknowledgement) control packets.

§rx_ack2: u64

The total number of received ACK2 (Acknowledgement Acknowledgement) control packets.

§tx_buffer_time: Duration

The total accumulated time, during which the SRT sender has some data to transmit, including packets that have been sent, but not yet acknowledged. In other words, the total accumulated duration in microseconds when there was something to deliver (non-empty senders’ buffer).

§tx_dropped_data: u64

The total number of DATA packets dropped by the SRT sender that have no chance to be delivered in time (refer to TLPKTDROP mechanism).

Packets may be dropped conditionally when both SRTO_TSBPDMODE and SRTO_TLPKTDROP socket options are enabled, refer to SRT API Socket Options.

The delay before TLPKTDROP mechanism is triggered is calculated as follows SRTO_PEERLATENCY + SRTO_SNDDROPDELAY + 2 * interval between sending ACKs, where SRTO_PEERLATENCY is the configured SRT latency, SRTO_SNDDROPDELAY adds an extra to SRTO_PEERLATENCY delay, the default interval between sending ACKs is 10 milliseconds. The minimum delay is 1000 + 2 * interval between sending ACKs milliseconds.

§rx_dropped_data: u64

The total number of DATA packets dropped by the SRT receiver and, as a result, not delivered to the upstream application (refer to TLPKTDROP mechanism).

This statistic counts

  • arrived too late packets (retransmitted or original packets arrived out of order),
  • arrived in time packets, but decrypted with errors (see also rx_decrypt_errors statistic).
§rx_decrypt_errors: u64

The total number of packets that failed to be decrypted at the receiver side.

§tx_bytes: u64

Same as tx_data, but expressed in bytes, including payload and all the headers (20 bytes IPv4 + 8 bytes UDP + 16 bytes SRT).

§rx_bytes: u64

Same as rx_data, but expressed in bytes, including payload and all the headers (20 bytes IPv4 + 8 bytes UDP + 16 bytes SRT).

§tx_unique_bytes: u64

Same as tx_unique_data, but expressed in bytes, including payload and all the headers (20 bytes IPv4 + 8 bytes UDP + 16 bytes SRT).

§rx_unique_bytes: u64

Same as rx_unique_data, but expressed in bytes, including payload and all the headers (20 bytes IPv4 + 8 bytes UDP + 16 bytes SRT).

§rx_loss_bytes: u64

Same as rx_loss_data, but expressed in bytes, including payload and all the headers (20 bytes IPv4 + 8 bytes UDP + 16 bytes SRT). Bytes for the presently missing (either reordered or lost) packets’ payloads are estimated based on the average packet size.

§tx_retransmit_bytes: u64

Same as tx_retransmit_data, but expressed in bytes, including payload and all the headers (20 bytes IPv4 + 8 bytes UDP + 16 bytes SRT).

§tx_dropped_bytes: u64

Same as tx_dropped_data, but expressed in bytes, including payload and all the headers (20 bytes IPv4 + 8 bytes UDP + 16 bytes SRT).

§rx_dropped_bytes: u64

Same as rx_dropped_data, but expressed in bytes, including payload and all the headers (20 bytes IPv4 + 8 bytes UDP + 16 bytes SRT). Bytes for the dropped packets’ payloads are estimated based on the average packet size.

§rx_decrypt_error_bytes: u64

Same as rx_decrypt_errors, but expressed in bytes, including payload and all the headers (20 bytes IPv4 + 8 bytes UDP + 16 bytes SRT).

§tx_snd_period: Duration

Current minimum time interval between which consecutive packets are sent microseconds.

The tx_snd_period is the minimum time (sending period) that must be kept between two packets sent consecutively over the link used by an SRT socket. It is not the EXACT time interval between two consecutive packets. In the case where the time spent by an application between sending two consecutive packets exceeds tx_snd_period, the next packet will be sent faster, or even immediately, to preserve the average sending rate.

Note: Does not apply to probing packets.

§tx_flow_window: u64

The maximum number of packets that can be “in flight”. See also tx_unacknowledged_data.

The value retrieved on the sender side represents an estimation of the amount of free space in the buffer of the peer receiver. The actual amount of available space is periodically reported back by the receiver in ACK packets. When this value drops to zero, the next packet sent will be dropped by the receiver without processing. The receiver buffer contents should normally occupy no more than half of the buffer size (default 8192). If tx_flow_window value is less than that and becomes even less in the next reports, it means that the receiver application on the peer side cannot process the incoming stream fast enough and this may lead to a dropped connection.

§tx_unacknowledged_data: u64

The number of packets in flight, therefore tx_unacknowledged_data <= tx_flow_window.

This is the distance between the packet sequence number that was last reported by an ACK message and the sequence number of the latest packet sent (at the moment when the statistics are being read).

NOTE: ACKs are received periodically (at least every 10 ms). This value is most accurate just after receiving an ACK and becomes a little exaggerated over time until the next ACK arrives. This is because with a new packet sent, while the ACK number stays the same for a moment, the value of tx_unacknowledged_data increases. But the exact number of packets arrived since the last ACK report is unknown. A new statistic might be added which only reports the distance between the ACK sequence and the sent sequence at the moment when an ACK arrives, and isn’t updated until the next ACK arrives. The difference between this value and tx_unacknowledged_data would then reveal the number of packets with an unknown state at that moment.

§tx_average_rtt: Duration

Smoothed round-trip time (SRTT), an exponentially-weighted moving average (EWMA) of an endpoint’s RTT samples, in milliseconds.

See Section 4.10. Round-Trip Time Estimation of the SRT RFC and [RFC6298] Paxson, V., Allman, M., Chu, J., and M. Sargent, “Computing TCP’s Retransmission Timer” for more details.

§rx_average_rtt: Duration§tx_bandwidth: u64

Estimated bandwidth of the network link.

The bandwidth is estimated at the receiver. The estimation is based on the time between two probing DATA packets. Every 16th data packet is sent immediately after the previous data packet. By measuring the delay between probe packets on arrival, it is possible to estimate the maximum available transmission rate, which is interpreted as the bandwidth of the link. The receiver then sends back a running average calculation to the sender with an ACK message.

§rx_bandwidth: u64§tx_buffer_available_bytes: u64

The available space in the sender’s buffer.

This value decreases with data scheduled for sending by the application, and increases with every ACK received from the receiver, after the packets are sent over the UDP link.

§rx_buffer_available_bytes: u64

The available space in the receiver’s buffer, in bytes.

This value increases after the application extracts the data from the socket and decreases with every packet received from the sender over the UDP link.

§tx_buffered_data: u64§tx_buffered_bytes: u64§tx_buffered_time: Duration§rx_acknowledged_data: u64

The number of acknowledged packets in receiver’s buffer.

This measurement does not include received but not acknowledged packets, stored in the receiver’s buffer.

§rx_acknowledged_bytes: u64

Instantaneous (current) value of pktRcvBuf, expressed in bytes, including payload and all headers (SRT+UDP+IP).
20 bytes IPv4 + 8 bytes of UDP + 16 bytes SRT header.

§rx_acknowledged_time: Duration

The timespan of acknowledged packets in the receiver’s buffer.

A packet can be acknowledged, but not yet ready to play. This range includes all packets regardless of whether they are ready to play or not. TODO: also calculate average

§rx_belated_data: u64

The number of packets received but IGNORED due to having arrived too late.

Makes sense only if TSBPD and TLPKTDROP are enabled.

An offset between sequence numbers of the newly arrived DATA packet and latest acknowledged DATA packet is calculated. If the offset is negative, the packet is considered late, meaning that it was either already acknowledged or dropped by TSBPD as too late to be delivered.

Retransmitted packets can also be considered late.

§rx_belated_time: Duration

Accumulated difference between the current time and the time-to-play of a packet that is received late.

Implementations§

source§

impl SocketStatistics

source

pub fn new() -> Self

Trait Implementations§

source§

impl Clone for SocketStatistics

source§

fn clone(&self) -> SocketStatistics

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for SocketStatistics

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for SocketStatistics

source§

fn default() -> SocketStatistics

Returns the “default value” for a type. Read more
source§

impl PartialEq<SocketStatistics> for SocketStatistics

source§

fn eq(&self, other: &SocketStatistics) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for SocketStatistics

source§

impl StructuralEq for SocketStatistics

source§

impl StructuralPartialEq for SocketStatistics

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V