From 0536a8260e7d0bc4f050b310b8bb4902da16fa59 Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 4 Nov 2026 21:40:54 +0100 Subject: benchmark delays by path --- src/swarm/stats.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/swarm/stats.rs') 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::() 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(); -- cgit v1.3.1