From 9f9015a35b591043ebaf6e306f967ffc62cd07f5 Mon Sep 17 00:00:00 2001 From: tv Date: Thu, 5 Nov 2026 03:37:48 +0100 Subject: measure sync envelopes --- src/swarm/stats.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/swarm/stats.rs') diff --git a/src/swarm/stats.rs b/src/swarm/stats.rs index 191f4e9..371fe42 100644 --- a/src/swarm/stats.rs +++ b/src/swarm/stats.rs @@ -128,6 +128,11 @@ pub(crate) struct Relay { /// payload's bytes. pub(crate) delivered: u64, pub(crate) delivered_bytes: u64, + /// Sync messages sent (not offers), the bytes the envelope added to their + /// Automerge messages, and of those the swarm ID's and the epoch's. + pub(crate) framed: u64, + pub(crate) framing_bytes: u64, + pub(crate) framing_id_bytes: u64, /// Sync messages received that carried changes, all of which we had already, and /// their payload's bytes: changes that came twice. Of those, how many came along a /// writer's tree (`SyncEnvelope::writer`), and how many were taken as delivered by @@ -249,6 +254,15 @@ impl NodeStats { self.lock().relay.tree_forwards += 1; } + /// A sync message went out whose envelope added `bytes` to its Automerge message, + /// `ids` of them the swarm ID and the epoch. + pub(crate) fn sync_framing(&self, bytes: usize, ids: usize) { + let mut inner = self.lock(); + inner.relay.framed += 1; + inner.relay.framing_bytes += bytes as u64; + inner.relay.framing_id_bytes += ids as u64; + } + /// A sync message taken as delivered went out, of `bytes` payload. pub(crate) fn delivered_sent(&self, bytes: usize) { let mut inner = self.lock(); -- cgit v1.3.1