diff options
Diffstat (limited to 'src/swarm/stats.rs')
| -rw-r--r-- | src/swarm/stats.rs | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/src/swarm/stats.rs b/src/swarm/stats.rs index 34542ff..905e668 100644 --- a/src/swarm/stats.rs +++ b/src/swarm/stats.rs @@ -122,6 +122,13 @@ pub(crate) struct Relay { pub(crate) nothing_new_bytes: u64, pub(crate) nothing_new_along_trees: u64, pub(crate) nothing_new_delivered: u64, + /// Sync messages received that carried changes, the bytes of those changes, and of + /// their bloom filters; and the same of those with nothing new. + pub(crate) carrying: u64, + pub(crate) carrying_change_bytes: u64, + pub(crate) carrying_bloom_bytes: u64, + pub(crate) nothing_new_change_bytes: u64, + pub(crate) nothing_new_bloom_bytes: u64, } /// When the initial sync finished, and what it took. @@ -224,13 +231,29 @@ impl NodeStats { } /// A sync message of `bytes` payload carried changes, all of which we had already; - /// it came `along_tree`, or was `delivered`. - pub(crate) fn nothing_new(&self, bytes: usize, along_tree: bool, delivered: bool) { + /// it came `along_tree`, or was `delivered`; `sizes`: of its changes and blooms. + pub(crate) fn nothing_new( + &self, + bytes: usize, + along_tree: bool, + delivered: bool, + sizes: (usize, usize), + ) { let mut inner = self.lock(); inner.relay.nothing_new += 1; inner.relay.nothing_new_bytes += bytes as u64; inner.relay.nothing_new_along_trees += u64::from(along_tree); inner.relay.nothing_new_delivered += u64::from(delivered); + inner.relay.nothing_new_change_bytes += sizes.0 as u64; + inner.relay.nothing_new_bloom_bytes += sizes.1 as u64; + } + + /// A sync message carrying changes arrived; `sizes`: of its changes and blooms. + pub(crate) fn carrying(&self, sizes: (usize, usize)) { + let mut inner = self.lock(); + inner.relay.carrying += 1; + inner.relay.carrying_change_bytes += sizes.0 as u64; + inner.relay.carrying_bloom_bytes += sizes.1 as u64; } /// A sync message of `bytes` arrived. |
