Clean up Formatting + Better Skew Detection

This commit is contained in:
Sarah Jamie Lewis 2021-02-01 15:56:07 -08:00
parent ff4064fcc4
commit 6e98665d17
2 changed files with 3 additions and 4 deletions

View File

@ -57,16 +57,17 @@ fn main() {
);
let mut stdout = StandardStream::stdout(ColorChoice::Always);
for (party, stats) in party_stats.iter() {
if stats.trivial_breaks > 0 || stats.observed_skew > (if_uniform * stats.ideal_rate) {
if stats.trivial_breaks > 0 || (stats.observed_messages > 2 && stats.observed_skew > (if_uniform * stats.ideal_rate)) {
stdout.set_color(ColorSpec::new().set_fg(Some(Color::Red))).unwrap();
} else {
stdout.set_color(ColorSpec::new().set_fg(Some(Color::Green))).unwrap();
}
writeln!(
&mut stdout,
"Party {} | Ideal: {} | Observed: {} ({:.2}) | Skew: {} ({}) | Trivial Attributions this Round: {}",
"Party {} | Ideal: {:>8.2} {:>8.2} | Observed: {:>8.2} ({:>6.2}) | Skew: {:>8.2} ({:>6.2}) | Trivial Attributions this Round: {}",
party,
stats.ideal_rate,
stats.ideal_rate * (round_stats.num_messages as f64),
stats.observed_messages,
100.0 * stats.observed_rate,
stats.observed_skew_messages,

View File

@ -89,8 +89,6 @@ impl SimulatedServer {
trivial_breaks,
};
println!("{:?}", p_stats);
party_stats.insert(pub_key.id(), p_stats);
}