Skip to content
This repository has been archived by the owner on Jun 25, 2021. It is now read-only.

Commit

Permalink
feat(stress test): improve output
Browse files Browse the repository at this point in the history
  • Loading branch information
madadam committed Jan 18, 2021
1 parent 97d8266 commit 33eac1b
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions examples/stress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -536,9 +536,9 @@ impl Network {
);
println!(
"{:18} {}",
self.theme.label.paint("sections:"),
self.theme.label.paint("section members:"),
sections
.into_iter()
.iter()
.format_with(", ", |(prefix, count), f| f(&format_args!(
"({:b}): {}",
prefix,
Expand All @@ -551,6 +551,7 @@ impl Network {
self.theme.label.paint("section health:"),
self.probe_tracker
.status()
.filter(|(prefix, ..)| sections.contains_key(prefix))
.format_with(", ", |(prefix, delivered, sent), f| {
let percent = percent(delivered, sent);

Expand All @@ -559,7 +560,7 @@ impl Network {
prefix,
self.theme
.health(percent)
.paint(format_args!("{:.1}%", percent)),
.paint(format_args!("{:.0}%", percent)),
))
})
);
Expand All @@ -575,12 +576,12 @@ impl Network {
self.theme.label.paint("churn:"),
self.theme.value.paint(self.stats.join_attempts),
self.theme.value.paint(format_args!(
"{} ({:.1}%)",
"{} ({:.0}%)",
self.stats.join_successes,
percent(self.stats.join_successes, self.stats.join_attempts)
)),
failure_style.paint(format_args!(
"{} ({:.1}%)",
"{} ({:.0}%)",
self.stats.join_failures,
percent(self.stats.join_failures, self.stats.join_attempts)
)),
Expand All @@ -592,7 +593,7 @@ impl Network {
self.theme.label.paint("relocations:"),
self.theme.value.paint(self.stats.relocation_attempts),
self.theme.value.paint(format_args!(
"{} ({:.1}%)",
"{} ({:.0}%)",
self.stats.relocation_successes,
percent(
self.stats.relocation_successes,
Expand Down

0 comments on commit 33eac1b

Please sign in to comment.