aboutsummaryrefslogtreecommitdiffstats
path: root/src/swarm/stats.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/swarm/stats.rs')
-rw-r--r--src/swarm/stats.rs14
1 files changed, 14 insertions, 0 deletions
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();