From 5b3d9cbd1bba986b06978bef0100d349b33e74c7 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 3 Nov 2026 03:26:15 +0100 Subject: add eager link counters --- src/swarm/stats.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/swarm/stats.rs') diff --git a/src/swarm/stats.rs b/src/swarm/stats.rs index 04f41b2..dd56bb0 100644 --- a/src/swarm/stats.rs +++ b/src/swarm/stats.rs @@ -102,6 +102,12 @@ pub(crate) struct Relay { pub(crate) pulls: u64, /// Announcements of heads we lacked that had to wait for the pull in progress. pub(crate) pulls_queued: u64, + /// Links made eager (a pull brought changes over them) and lazy again (changes came + /// over them that another path brought first). + pub(crate) grafts: u64, + pub(crate) prunes: u64, + /// Changes forwarded over eager links: a sync message asked for per neighbour. + pub(crate) eager_forwards: u64, } /// When the initial sync finished, and what it took. @@ -184,6 +190,18 @@ impl NodeStats { self.lock().relay.pulls_queued += 1; } + pub(crate) fn link_grafted(&self) { + self.lock().relay.grafts += 1; + } + + pub(crate) fn link_pruned(&self) { + self.lock().relay.prunes += 1; + } + + pub(crate) fn eager_forward(&self) { + self.lock().relay.eager_forwards += 1; + } + /// A sync message of `bytes` arrived. pub(crate) fn sync_received(&self, bytes: usize) { let mut inner = self.lock(); -- cgit v1.3.1