diff options
Diffstat (limited to 'src/swarm/stats.rs')
| -rw-r--r-- | src/swarm/stats.rs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/swarm/stats.rs b/src/swarm/stats.rs index 218d5e8..5cac16a 100644 --- a/src/swarm/stats.rs +++ b/src/swarm/stats.rs @@ -141,6 +141,13 @@ pub(crate) struct Relay { pub(crate) chunks_deflated: u64, pub(crate) chunk_bytes: u64, pub(crate) chunk_bytes_sent: u64, + /// Blob chunks fetched (`blob::fetch`): asked of another source as late, asked of a + /// second source at the end, come when held already, and come from a peer dropped + /// as a source meanwhile (kept, its hash being good). + pub(crate) chunks_timed_out: u64, + pub(crate) chunks_doubled: u64, + pub(crate) chunks_twice: u64, + pub(crate) chunks_from_dropped: u64, /// Sync messages received that carried changes, all of which we had already, and /// their payload's bytes: changes that came twice. Of those, how many came along a /// writer's tree (`SyncEnvelope::writer`), and how many were taken as delivered by @@ -277,6 +284,26 @@ impl NodeStats { inner.relay.chunk_bytes_sent += sent as u64; } + /// `count` blob chunks we fetch went to another source, as late. + pub(crate) fn chunks_timed_out(&self, count: usize) { + self.lock().relay.chunks_timed_out += count as u64; + } + + /// `count` blob chunks we fetch were asked of a second source, at the end. + pub(crate) fn chunks_doubled(&self, count: usize) { + self.lock().relay.chunks_doubled += count as u64; + } + + /// A blob chunk we fetch came when we held it already. + pub(crate) fn chunk_twice(&self) { + self.lock().relay.chunks_twice += 1; + } + + /// A blob chunk we fetch came from a peer no longer a source. + pub(crate) fn chunk_from_dropped(&self) { + self.lock().relay.chunks_from_dropped += 1; + } + /// A sync message of `from` bytes went out deflated to `to`. pub(crate) fn deflated(&self, from: usize, to: usize) { let mut inner = self.lock(); |
