diff options
Diffstat (limited to 'src/swarm/stats.rs')
| -rw-r--r-- | src/swarm/stats.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/swarm/stats.rs b/src/swarm/stats.rs index 905e668..74076a4 100644 --- a/src/swarm/stats.rs +++ b/src/swarm/stats.rs @@ -129,6 +129,10 @@ pub(crate) struct Relay { pub(crate) carrying_bloom_bytes: u64, pub(crate) nothing_new_change_bytes: u64, pub(crate) nothing_new_bloom_bytes: u64, + /// Changes from elsewhere that came not along a writer's tree (pulled, with an + /// answer, sent again), and their delays summed (as `Propagation`). + pub(crate) off_tree: u64, + pub(crate) off_tree_ms: u64, } /// When the initial sync finished, and what it took. @@ -248,6 +252,14 @@ impl NodeStats { inner.relay.nothing_new_bloom_bytes += sizes.1 as u64; } + /// Changes from elsewhere were applied, `delays_ms` after they were committed, that + /// came not along a writer's tree. + pub(crate) fn off_tree(&self, delays_ms: &[i64]) { + let mut inner = self.lock(); + inner.relay.off_tree += delays_ms.len() as u64; + inner.relay.off_tree_ms += delays_ms.iter().map(|ms| ms.max(&0)).sum::<i64>() 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(); |
