aboutsummaryrefslogtreecommitdiffstats
path: root/src/simtest/bench.rs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-04 20:36:04 +0100
committertv <tv@krebsco.de>2026-11-04 20:36:04 +0100
commit8b6d55b61b0a3f49dd146385a6eaa8e5f393cdae (patch)
treefdd63b6cf565ac454635f761a69ac7e75a1947cb /src/simtest/bench.rs
parentcd0c1ef47070059f7223aa86471576988727f167 (diff)
benchmark delivered and twice
Diffstat (limited to 'src/simtest/bench.rs')
-rw-r--r--src/simtest/bench.rs28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/simtest/bench.rs b/src/simtest/bench.rs
index 2640381..6bf3bd6 100644
--- a/src/simtest/bench.rs
+++ b/src/simtest/bench.rs
@@ -229,6 +229,10 @@ impl Totals {
relay.pulls += stats.relay.pulls;
relay.pulls_queued += stats.relay.pulls_queued;
relay.tree_forwards += stats.relay.tree_forwards;
+ relay.delivered += stats.relay.delivered;
+ relay.delivered_bytes += stats.relay.delivered_bytes;
+ relay.nothing_new += stats.relay.nothing_new;
+ relay.nothing_new_bytes += stats.relay.nothing_new_bytes;
for (_, peer_state) in node.peers_snapshot().await {
totals.incidents.add(&peer_state.lock().await.incidents);
}
@@ -475,6 +479,30 @@ fn report(
(r1.pulls_queued - r0.pulls_queued) as f64 / writes,
(r1.tree_forwards - r0.tree_forwards) as f64 / writes,
);
+ let per = |count: u64, bytes: u64| {
+ let count = count as f64;
+ (
+ count / writes,
+ if count > 0.0 {
+ bytes as f64 / count
+ } else {
+ 0.0
+ },
+ )
+ };
+ let delivered = per(
+ r1.delivered - r0.delivered,
+ r1.delivered_bytes - r0.delivered_bytes,
+ );
+ let nothing_new = per(
+ r1.nothing_new - r0.nothing_new,
+ r1.nothing_new_bytes - r0.nothing_new_bytes,
+ );
+ 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,
+ );
let (i0, i1) = (during.0.incidents, during.1.incidents);
let _ = writeln!(
out,