@@ -590,24 +590,21 @@ pub fn print_time_passes_entry(
590590 end_rss : Option < usize > ,
591591) {
592592 let rss_to_mb = |rss| ( rss as f64 / 1_000_000.0 ) . round ( ) as usize ;
593+ let rss_change_to_mb = |rss| ( rss as f64 / 1_000_000.0 ) . round ( ) as i128 ;
593594
594595 let mem_string = match ( start_rss, end_rss) {
595596 ( Some ( start_rss) , Some ( end_rss) ) => {
596- // It's tempting to add the change in RSS from start to end, but its somewhat confusing
597- // and misleading when looking at time-passes output. Consider two adjacent entries:
598- //
599- // time: 10.000; rss start: 1000MB, end: 1000MB, change: 0MB pass1
600- // time: 5.000; rss start: 2000MB, end: 2000MB, change: 0MB pass2
601- //
602- // If you're looking for jumps in RSS based on the change column, you miss the fact
603- // that a 1GB jump happened between pass1 and pass2 (supposing pass1 and pass2 actually
604- // occur sequentially and pass1 isn't just nested within pass2). It's easy to imagine
605- // someone missing this or being confused by the fact that the change is zero.
606-
607- format ! ( "; rss: {:>5}MB -> {:>5}MB" , rss_to_mb( start_rss) , rss_to_mb( end_rss) )
597+ let change_rss = end_rss as i128 - start_rss as i128 ;
598+
599+ format ! (
600+ "; rss: {:>4}MB -> {:>4}MB ({:>+5}MB)" ,
601+ rss_to_mb( start_rss) ,
602+ rss_to_mb( end_rss) ,
603+ rss_change_to_mb( change_rss) ,
604+ )
608605 }
609- ( Some ( start_rss) , None ) => format ! ( "; rss start: {:>5 }MB" , rss_to_mb( start_rss) ) ,
610- ( None , Some ( end_rss) ) => format ! ( "; rss end: {:5> }MB" , rss_to_mb( end_rss) ) ,
606+ ( Some ( start_rss) , None ) => format ! ( "; rss start: {:>4 }MB" , rss_to_mb( start_rss) ) ,
607+ ( None , Some ( end_rss) ) => format ! ( "; rss end: {:>4 }MB" , rss_to_mb( end_rss) ) ,
611608 ( None , None ) => String :: new ( ) ,
612609 } ;
613610
0 commit comments