diff options
Diffstat (limited to 'src/swarm')
| -rw-r--r-- | src/swarm/stats.rs | 12 | ||||
| -rw-r--r-- | src/swarm/sync.rs | 3 |
2 files changed, 15 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(); diff --git a/src/swarm/sync.rs b/src/swarm/sync.rs index 04d06de..4bb6ba5 100644 --- a/src/swarm/sync.rs +++ b/src/swarm/sync.rs @@ -469,6 +469,9 @@ pub(crate) async fn handle_sync( .into_iter() .map(|time| now_ms - time) .collect(); + if writer.is_none() { + stats.off_tree(&delays); + } stats.propagated(delays); } |
