diff options
Diffstat (limited to 'src/swarm/stats.rs')
| -rw-r--r-- | src/swarm/stats.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/swarm/stats.rs b/src/swarm/stats.rs index ed91db0..6332901 100644 --- a/src/swarm/stats.rs +++ b/src/swarm/stats.rs @@ -133,6 +133,10 @@ pub(crate) struct Relay { pub(crate) framed: u64, pub(crate) framing_bytes: u64, pub(crate) framing_id_bytes: u64, + /// Sync messages deflated (`compress`), their bytes before and after. + pub(crate) deflated: u64, + pub(crate) deflated_from: u64, + pub(crate) deflated_to: 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 @@ -254,6 +258,14 @@ impl NodeStats { self.lock().relay.tree_forwards += 1; } + /// A sync message of `from` bytes went out deflated to `to`. + pub(crate) fn deflated(&self, from: usize, to: usize) { + let mut inner = self.lock(); + inner.relay.deflated += 1; + inner.relay.deflated_from += from as u64; + inner.relay.deflated_to += to as u64; + } + /// A sync message went out whose envelope added `bytes` to its Automerge message, /// `ids` of them the epoch. pub(crate) fn sync_framing(&self, bytes: usize, ids: usize) { |
