aboutsummaryrefslogtreecommitdiffstats
path: root/src/swarm/stats.rs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-04 21:40:54 +0100
committertv <tv@krebsco.de>2026-11-04 21:40:54 +0100
commit0536a8260e7d0bc4f050b310b8bb4902da16fa59 (patch)
tree1bb2d7b1fe93140875f86566a22e2bc813b7a8cf /src/swarm/stats.rs
parent95fb8698528dc4149056f7cb6e9e1b67fe2d4cc9 (diff)
benchmark delays by path
Diffstat (limited to 'src/swarm/stats.rs')
-rw-r--r--src/swarm/stats.rs12
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();