From 19461552f88e8b82a24c63c00a6591996ae8f45d Mon Sep 17 00:00:00 2001 From: tv Date: Fri, 6 Nov 2026 06:58:48 +0100 Subject: trees at runtime --- src/swarm/stats.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/swarm/stats.rs') diff --git a/src/swarm/stats.rs b/src/swarm/stats.rs index 5cac16a..ed12888 100644 --- a/src/swarm/stats.rs +++ b/src/swarm/stats.rs @@ -124,6 +124,13 @@ pub(crate) struct Relay { /// Changes passed on along writers' trees (`swarm::tree`): a sync message asked for /// per child. pub(crate) tree_forwards: u64, + /// Whether the trees work, from what arrives (`tree::note_arrival`): sync messages + /// along a writer's tree, carrying changes, from a peer other than our parent in it + /// (a double send, or views of the tree that differ); and changes of writers in + /// whose trees we have a parent that came another way (pulled, with an answer, in + /// a delta: the tree didn't bring them). + pub(crate) tree_from_others: u64, + pub(crate) tree_missed: u64, /// Sync messages sent taken as delivered (`SyncSession::assume_delivered`), and their /// payload's bytes. pub(crate) delivered: u64, @@ -275,6 +282,16 @@ impl NodeStats { self.lock().relay.tree_forwards += 1; } + /// A sync message along a writer's tree came from a peer other than our parent in it. + pub(crate) fn tree_from_other(&self) { + self.lock().relay.tree_from_others += 1; + } + + /// `count` changes of a writer in whose tree we have a parent came another way. + pub(crate) fn tree_missed(&self, count: usize) { + self.lock().relay.tree_missed += count as u64; + } + /// A blob chunk of `bytes` was served as `sent` bytes (fewer if deflated). pub(crate) fn chunk_served(&self, bytes: usize, sent: usize) { let mut inner = self.lock(); -- cgit v1.3.1