Skip to content

Commit 233c31a

Browse files
authored
Unstable run uses 2nd highest throughput instead of max (#25)
1 parent 1c05854 commit 233c31a

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

hydro_optimize/src/deploy_and_analyze.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,15 @@ fn run_was_unstable(throughputs: &[usize]) -> bool {
5151
return false;
5252
}
5353
let window = &throughputs[START_MEASUREMENT_SECOND..=MEASUREMENT_SECOND];
54-
let max_all = throughputs.iter().copied().max().unwrap_or(0) as f64;
55-
if max_all == 0.0 {
56-
println!("Max throughput was 0, cannot determine stability");
54+
let mut sorted = throughputs.to_vec();
55+
sorted.sort_unstable_by(|a, b| b.cmp(a));
56+
let second_highest = sorted.get(1).copied().unwrap_or(0) as f64;
57+
if second_highest == 0.0 {
58+
println!("2nd highest throughput was 0, cannot determine stability");
5759
return false;
5860
}
5961
let min_window = window.iter().copied().min().unwrap_or(0) as f64;
60-
(max_all - min_window) / max_all > BIMODAL_CV_THRESHOLD
62+
(second_highest - min_window) / second_highest > BIMODAL_CV_THRESHOLD
6163
}
6264

6365
// Note: Ensure edits to the match arms are consistent with infer_counter_from_parent

0 commit comments

Comments
 (0)