aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/simtest/bench.rs11
-rw-r--r--src/swarm/stats.rs13
-rw-r--r--src/swarm/sync.rs2
3 files changed, 20 insertions, 6 deletions
diff --git a/src/simtest/bench.rs b/src/simtest/bench.rs
index 6bf3bd6..ecf44a5 100644
--- a/src/simtest/bench.rs
+++ b/src/simtest/bench.rs
@@ -233,6 +233,8 @@ impl Totals {
relay.delivered_bytes += stats.relay.delivered_bytes;
relay.nothing_new += stats.relay.nothing_new;
relay.nothing_new_bytes += stats.relay.nothing_new_bytes;
+ relay.nothing_new_along_trees += stats.relay.nothing_new_along_trees;
+ relay.nothing_new_delivered += stats.relay.nothing_new_delivered;
for (_, peer_state) in node.peers_snapshot().await {
totals.incidents.add(&peer_state.lock().await.incidents);
}
@@ -500,8 +502,13 @@ fn report(
);
let _ = writeln!(
out,
- " sync per write: {:.1} taken as delivered ({:.0} bytes each), {:.1} with only changes the receiver had ({:.0} bytes each)",
- delivered.0, delivered.1, nothing_new.0, nothing_new.1,
+ " sync per write: {:.1} taken as delivered ({:.0} bytes each), {:.1} with only changes the receiver had ({:.0} bytes each; {:.1} along trees, {:.1} taken as delivered)",
+ delivered.0,
+ delivered.1,
+ nothing_new.0,
+ nothing_new.1,
+ (r1.nothing_new_along_trees - r0.nothing_new_along_trees) as f64 / writes,
+ (r1.nothing_new_delivered - r0.nothing_new_delivered) as f64 / writes,
);
let (i0, i1) = (during.0.incidents, during.1.incidents);
let _ = writeln!(
diff --git a/src/swarm/stats.rs b/src/swarm/stats.rs
index da7544f..34542ff 100644
--- a/src/swarm/stats.rs
+++ b/src/swarm/stats.rs
@@ -115,9 +115,13 @@ pub(crate) struct Relay {
pub(crate) delivered: u64,
pub(crate) delivered_bytes: u64,
/// Sync messages received that carried changes, all of which we had already, and
- /// their payload's bytes: changes that came twice.
+ /// 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
+ /// their sender (`SyncEnvelope::delivered`).
pub(crate) nothing_new: u64,
pub(crate) nothing_new_bytes: u64,
+ pub(crate) nothing_new_along_trees: u64,
+ pub(crate) nothing_new_delivered: u64,
}
/// When the initial sync finished, and what it took.
@@ -219,11 +223,14 @@ impl NodeStats {
inner.relay.delivered_bytes += bytes as u64;
}
- /// A sync message of `bytes` payload carried changes, all of which we had already.
- pub(crate) fn nothing_new(&self, bytes: usize) {
+ /// A sync message of `bytes` payload carried changes, all of which we had already;
+ /// it came `along_tree`, or was `delivered`.
+ pub(crate) fn nothing_new(&self, bytes: usize, along_tree: bool, delivered: bool) {
let mut inner = self.lock();
inner.relay.nothing_new += 1;
inner.relay.nothing_new_bytes += bytes as u64;
+ inner.relay.nothing_new_along_trees += u64::from(along_tree);
+ inner.relay.nothing_new_delivered += u64::from(delivered);
}
/// A sync message of `bytes` arrived.
diff --git a/src/swarm/sync.rs b/src/swarm/sync.rs
index 3737f85..ab45b37 100644
--- a/src/swarm/sync.rs
+++ b/src/swarm/sync.rs
@@ -441,7 +441,7 @@ pub(crate) async fn handle_sync(
stats.heads_seen(heads_after.len());
let changed = heads_after != heads_before;
if carried && !changed {
- stats.nothing_new(payload_len);
+ stats.nothing_new(payload_len, writer.is_some(), delivered);
}
// Whose they are, to pass them on along their writers' trees, however they
// came (along a tree, with an answer, pulled).