pub struct Wire(/* private fields */);Expand description
One connection’s cumulative wire counters, which its transport updates as it sends and receives: its bytes, its sender’s losses and waits on the congestion controller and on the peer’s connection-level credit, and its receiver’s holds on a spent receive window.
Clones share the counters, so stats read them without polling the session or keeping the connection alive, and the final totals stay readable after it closes. Each counter is independent: a transport records the ones it tracks, and the rest stay zero.
A transport whose counts live outside it, such as a TCP socket’s in the kernel, builds its
counters with Wire::from_source instead of pushing them as it carries traffic.
Implementations§
Source§impl Wire
impl Wire
Sourcepub fn from_source(source: impl WireSource) -> Self
pub fn from_source(source: impl WireSource) -> Self
Create counters that start at zero and that source refreshes whenever stats read them.
Sourcepub fn sent_bytes(&self) -> u64
pub fn sent_bytes(&self) -> u64
The bytes sent so far, including transport framing and retransmissions.
Sourcepub fn received_bytes(&self) -> u64
pub fn received_bytes(&self) -> u64
The bytes received so far, including transport framing.
Sourcepub fn set_sent_bytes(&self, total: u64)
pub fn set_sent_bytes(&self, total: u64)
Record the cumulative bytes sent so far.
Sourcepub fn set_received_bytes(&self, total: u64)
pub fn set_received_bytes(&self, total: u64)
Record the cumulative bytes received so far.
Sourcepub fn lost_bytes(&self) -> u64
pub fn lost_bytes(&self) -> u64
The sent bytes declared lost so far, part of Self::sent_bytes.
Sourcepub fn set_lost_bytes(&self, total: u64)
pub fn set_lost_bytes(&self, total: u64)
Record the cumulative sent bytes declared lost so far.
Sourcepub fn cwnd_blocked(&self) -> Duration
pub fn cwnd_blocked(&self) -> Duration
How long data ready to send waited on a full congestion window.
Sourcepub fn pacing_blocked(&self) -> Duration
pub fn pacing_blocked(&self) -> Duration
How long data ready to send waited on the pacer.
Sourcepub fn set_congestion_blocked(&self, cwnd: Duration, pacing: Duration)
pub fn set_congestion_blocked(&self, cwnd: Duration, pacing: Duration)
Record the cumulative time data ready to send waited on the congestion controller: on a
full cwnd, or on the pacing that spreads sends at its rate.
Sourcepub fn credit_stalls(&self) -> u64
pub fn credit_stalls(&self) -> u64
How many times the sender blocked with all the peer’s connection credit (MAX_DATA) spent.
Sourcepub fn credit_stalled(&self) -> Duration
pub fn credit_stalled(&self) -> Duration
How long the sender spent blocked on the peer’s connection credit.
Sourcepub fn set_credit_stalls(&self, stalls: u64, stalled: Duration)
pub fn set_credit_stalls(&self, stalls: u64, stalled: Duration)
Record the cumulative episodes and time the sender spent blocked on the peer’s connection credit. An episode starts when a write blocks with every credited byte sent, and ends when the peer grants more; a write held by the local send window is not one.
Sourcepub fn credit_held_readers(&self) -> Duration
pub fn credit_held_readers(&self) -> Duration
How long the peer had this side’s whole receive window spent while a reader had data it had not looked at yet: a reader behind holding the window.
Sourcepub fn credit_held_evicted(&self) -> Duration
pub fn credit_held_evicted(&self) -> Duration
How long the peer had this side’s whole receive window spent while an evicted reader had not stopped its stream.
Sourcepub fn set_credit_held(&self, readers: Duration, evicted: Duration)
pub fn set_credit_held(&self, readers: Duration, evicted: Duration)
Record the cumulative time the peer had the whole receive window spent while eviction
waited on readers behind or on evicted readers yet to stop their streams.