Skip to content

Commit

Permalink
Generalize UdpStats::transmits to ios
Browse files Browse the repository at this point in the history
Since this field exists for both tx and rx, we might as well make use
of it.
  • Loading branch information
Ralith committed Sep 2, 2023
1 parent a516c2b commit 13d173d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
5 changes: 3 additions & 2 deletions quinn-proto/src/connection/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ impl Connection {

builder.finish(self, &mut buf);
self.stats.udp_tx.datagrams += 1;
self.stats.udp_tx.transmits += 1;
self.stats.udp_tx.ios += 1;
self.stats.udp_tx.bytes += buf.len() as u64;
return Some(Transmit {
destination,
Expand Down Expand Up @@ -912,7 +912,7 @@ impl Connection {

self.stats.udp_tx.datagrams += num_datagrams as u64;
self.stats.udp_tx.bytes += buf.len() as u64;
self.stats.udp_tx.transmits += 1;
self.stats.udp_tx.ios += 1;

Some(Transmit {
destination: self.path.remote,
Expand Down Expand Up @@ -2071,6 +2071,7 @@ impl Connection {
packet: Option<Packet>,
stateless_reset: bool,
) {
self.stats.udp_rx.ios += 1;
if let Some(ref packet) = packet {
trace!(
"got {:?} packet ({} bytes) from {} using id {}",
Expand Down
7 changes: 3 additions & 4 deletions quinn-proto/src/connection/stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@ pub struct UdpStats {
pub datagrams: u64,
/// The total amount of bytes which have been transferred inside UDP datagrams
pub bytes: u64,
/// The amount of transmit calls which have been performed
/// The amount of I/O operations executed
///
/// This can mismatch the amount of datagrams in case GSO is utilized for
/// transmitting data.
pub transmits: u64,
/// Can be less than `datagrams` when GSO, GRO, and/or batched system calls are in use.
pub ios: u64,
}

/// Number of frames transmitted of each frame type
Expand Down

0 comments on commit 13d173d

Please sign in to comment.