show count of aborted trips in scoreboard too

This commit is contained in:
Dustin Carlino 2019-09-29 19:19:51 -07:00
parent 909ce857fb
commit 2e5649bf7e
3 changed files with 14 additions and 0 deletions

View File

@ -43,6 +43,12 @@ impl Scoreboard {
Line(prettyprint_usize(t2.unfinished_trips)).fg(Color::CYAN),
Line(" unfinished trips"),
]);
summary.add_appended(vec![
Line(prettyprint_usize(t1.aborted_trips)).fg(Color::RED),
Line(" | "),
Line(prettyprint_usize(t2.aborted_trips)).fg(Color::CYAN),
Line(" aborted trips"),
]);
summary.add_appended(vec![
Line("faster (better)").fg(Color::GREEN),
Line(" / "),

View File

@ -36,6 +36,10 @@ impl Scoreboard {
Line(prettyprint_usize(t.unfinished_trips)).fg(Color::CYAN),
Line(" unfinished trips"),
]);
summary.add_appended(vec![
Line(prettyprint_usize(t.aborted_trips)).fg(Color::CYAN),
Line(" aborted trips"),
]);
for (mode, trips) in &t
.finished_trips

View File

@ -463,6 +463,7 @@ impl TripManager {
pub fn get_finished_trips(&self) -> FinishedTrips {
let mut result = FinishedTrips {
unfinished_trips: self.unfinished_trips,
aborted_trips: 0,
finished_trips: Vec::new(),
};
for t in &self.trips {
@ -470,6 +471,8 @@ impl TripManager {
result
.finished_trips
.push((t.id, t.mode, end - t.spawned_at));
} else if t.aborted {
result.aborted_trips += 1;
}
}
result
@ -579,6 +582,7 @@ pub enum TripLeg {
// As of a moment in time, not necessarily the end of the simulation
pub struct FinishedTrips {
pub unfinished_trips: usize,
pub aborted_trips: usize,
// (..., ..., time to complete trip)
pub finished_trips: Vec<(TripID, TripMode, Duration)>,
}