File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments