Clean up Formatting + Better Skew Detection
This commit is contained in:
parent
ff4064fcc4
commit
6e98665d17
|
@ -57,16 +57,17 @@ fn main() {
|
||||||
);
|
);
|
||||||
let mut stdout = StandardStream::stdout(ColorChoice::Always);
|
let mut stdout = StandardStream::stdout(ColorChoice::Always);
|
||||||
for (party, stats) in party_stats.iter() {
|
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();
|
stdout.set_color(ColorSpec::new().set_fg(Some(Color::Red))).unwrap();
|
||||||
} else {
|
} else {
|
||||||
stdout.set_color(ColorSpec::new().set_fg(Some(Color::Green))).unwrap();
|
stdout.set_color(ColorSpec::new().set_fg(Some(Color::Green))).unwrap();
|
||||||
}
|
}
|
||||||
writeln!(
|
writeln!(
|
||||||
&mut stdout,
|
&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,
|
party,
|
||||||
stats.ideal_rate,
|
stats.ideal_rate,
|
||||||
|
stats.ideal_rate * (round_stats.num_messages as f64),
|
||||||
stats.observed_messages,
|
stats.observed_messages,
|
||||||
100.0 * stats.observed_rate,
|
100.0 * stats.observed_rate,
|
||||||
stats.observed_skew_messages,
|
stats.observed_skew_messages,
|
||||||
|
|
|
@ -89,8 +89,6 @@ impl SimulatedServer {
|
||||||
trivial_breaks,
|
trivial_breaks,
|
||||||
};
|
};
|
||||||
|
|
||||||
println!("{:?}", p_stats);
|
|
||||||
|
|
||||||
party_stats.insert(pub_key.id(), p_stats);
|
party_stats.insert(pub_key.id(), p_stats);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue