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.rs17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/swarm/stats.rs b/src/swarm/stats.rs
index 8a00629..9d32baa 100644
--- a/src/swarm/stats.rs
+++ b/src/swarm/stats.rs
@@ -98,6 +98,11 @@ pub(crate) struct SavedSize {
pub(crate) struct Relay {
/// Announcement rounds (each a STATUS to the neighbours).
pub(crate) announce_rounds: u64,
+ /// Of those, quick rounds to all neighbours, as some change came with no writer's
+ /// tree to go along (pulled, a delta, from a node with no part in it), and slow rounds
+ /// after changes that did (`swarm::relay`).
+ pub(crate) treeless_rounds: u64,
+ pub(crate) slow_rounds: u64,
/// Pulls started.
pub(crate) pulls: u64,
/// Announcements of heads we lacked that had to wait for the pull in progress.
@@ -175,8 +180,16 @@ impl NodeStats {
self.lock().stale_hello_replies += 1;
}
- pub(crate) fn announce_round(&self) {
- self.lock().relay.announce_rounds += 1;
+ /// An announcement round: `treeless` (quick, to all), `slow`, or else quick to
+ /// those writers' trees leave out.
+ pub(crate) fn announce_round(&self, treeless: bool, slow: bool) {
+ let mut inner = self.lock();
+ inner.relay.announce_rounds += 1;
+ if slow {
+ inner.relay.slow_rounds += 1;
+ } else if treeless {
+ inner.relay.treeless_rounds += 1;
+ }
}
pub(crate) fn pull_started(&self) {