aboutsummaryrefslogtreecommitdiffstats
path: root/src/simtest
diff options
context:
space:
mode:
Diffstat (limited to 'src/simtest')
-rw-r--r--src/simtest/bench.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/simtest/bench.rs b/src/simtest/bench.rs
index 6729c7d..6e216a9 100644
--- a/src/simtest/bench.rs
+++ b/src/simtest/bench.rs
@@ -577,6 +577,7 @@ async fn run(seed: u64, scenario: &'static Scenario) -> String {
converged,
);
trees(&mut out, &nodes, &sim.net).await;
+ sent_kept(&mut out, &nodes).await;
if let Some(writer) = writer {
slowest(&mut out, &nodes, &nodes[writer], &sim.net).await;
}
@@ -662,6 +663,29 @@ async fn trees(out: &mut String, nodes: &[AppState], net: &crate::transport::sim
);
}
+/// How many changes each session counts as sent to its peer (`SyncSession::sent_hashes_len`),
+/// after the workload: the most, and on average. Kept until the peer's next message
+/// says it has them; a session whose peer never sends one (along a tree, with one
+/// writer) keeps all.
+async fn sent_kept(out: &mut String, nodes: &[AppState]) {
+ let mut most = 0;
+ let mut sum = 0;
+ let mut sessions = 0;
+ for node in nodes {
+ for (_, peer_state) in node.peers_snapshot().await {
+ let kept = peer_state.lock().await.sync.sent_hashes_len();
+ most = most.max(kept);
+ sum += kept;
+ sessions += 1;
+ }
+ }
+ let _ = writeln!(
+ out,
+ " changes counted as sent, per session: {most} at most, {:.1} on average",
+ sum as f64 / f64::from(sessions.max(1)),
+ );
+}
+
/// Whether the nodes' views of the writers' trees agree: each member's parent as the
/// member chose it (`swarm::tree::own_parent`) against what that parent and the
/// others plan (`swarm::tree::plan`: their children, the neighbours they count as