diff options
Diffstat (limited to 'src/simtest/bench.rs')
| -rw-r--r-- | src/simtest/bench.rs | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/src/simtest/bench.rs b/src/simtest/bench.rs index dac7a48..f8d8123 100644 --- a/src/simtest/bench.rs +++ b/src/simtest/bench.rs @@ -868,14 +868,33 @@ pub(super) fn eager_links( let mut pushes: HashMap<String, Vec<String>> = HashMap::new(); // The round trips of eager and of lazy links, as each node measured them. let (mut eager_rtts, mut lazy_rtts) = (Vec::new(), Vec::new()); + // How many each node holds lazy, and of those how many aren't its neighbours (any + // more); how many neighbours have a round trip fresh enough to count. + let (mut lazy_held, mut lazy_strangers, mut neighbours_timed, mut neighbours_all) = + (0usize, 0usize, 0usize, 0usize); for node in nodes { let Some(lazy) = node.dissemination().lazy() else { return; }; - let (eager, others): (Vec<String>, Vec<String>) = - crate::swarm::topology::our_neighbours(node) - .into_iter() - .partition(|peer| !lazy.contains(peer)); + let neighbours = crate::swarm::topology::our_neighbours(node); + lazy_held += lazy.len(); + lazy_strangers += lazy + .iter() + .filter(|peer| !neighbours.contains(*peer)) + .count(); + { + let rtt = node.lock_rtt(); + let now = tokio::time::Instant::now(); + let fresh = node.timing.rtt_fresh_for(); + neighbours_all += neighbours.len(); + neighbours_timed += neighbours + .iter() + .filter(|peer| rtt.effective(peer, now, fresh).is_some()) + .count(); + } + let (eager, others): (Vec<String>, Vec<String>) = neighbours + .into_iter() + .partition(|peer| !lazy.contains(peer)); { let rtt = node.lock_rtt(); let now = tokio::time::Instant::now(); @@ -937,6 +956,12 @@ pub(super) fn eager_links( eager_rtts.iter().filter(|rtt| **rtt > SLOW_LINK_MS).count(), mean(&lazy_rtts), ); + let _ = writeln!( + out, + " PlumTree's lazy sets: {:.1} held per node, {lazy_strangers} of them not neighbours; \ + {neighbours_timed} of {neighbours_all} neighbours with a fresh round trip", + lazy_held as f64 / count, + ); // From each member, the fastest path to every other along eager links (Dijkstra, // by the net's mean one-way delays), and its hops. let ids: Vec<&String> = pushes.keys().collect(); |
