diff options
| author | Mara Bos <m-ou.se@m-ou.se> | 2021-02-05 12:26:08 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-02-05 12:26:08 +0100 |
| commit | 08d8fc14beef6708f04cafda6cd99425cf145b04 (patch) | |
| tree | f2e9b5460fc9a8a06282e3571318a430cecf76df /compiler/rustc_data_structures/src | |
| parent | e077dffaeca017dcc961b3ca7ed4c5d9e349dd05 (diff) | |
| parent | 4253919f1d579f453aaeb76e5824b11207b52ee0 (diff) | |
| download | rust-08d8fc14beef6708f04cafda6cd99425cf145b04.tar.gz rust-08d8fc14beef6708f04cafda6cd99425cf145b04.zip | |
Rollup merge of #81771 - tgnottingham:time-passes-rss-delta, r=oli-obk
Indicate change in RSS from start to end of pass in time-passes output Previously, this was omitted because it could be misleading, but the functionality seems too useful not to include. r? ``@oli-obk``
Diffstat (limited to 'compiler/rustc_data_structures/src')
| -rw-r--r-- | compiler/rustc_data_structures/src/profiling.rs | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/compiler/rustc_data_structures/src/profiling.rs b/compiler/rustc_data_structures/src/profiling.rs index 9a85b9d02c9..f0b413c795e 100644 --- a/compiler/rustc_data_structures/src/profiling.rs +++ b/compiler/rustc_data_structures/src/profiling.rs @@ -590,24 +590,21 @@ pub fn print_time_passes_entry( end_rss: Option<usize>, ) { let rss_to_mb = |rss| (rss as f64 / 1_000_000.0).round() as usize; + let rss_change_to_mb = |rss| (rss as f64 / 1_000_000.0).round() as i128; let mem_string = match (start_rss, end_rss) { (Some(start_rss), Some(end_rss)) => { - // It's tempting to add the change in RSS from start to end, but its somewhat confusing - // and misleading when looking at time-passes output. Consider two adjacent entries: - // - // time: 10.000; rss start: 1000MB, end: 1000MB, change: 0MB pass1 - // time: 5.000; rss start: 2000MB, end: 2000MB, change: 0MB pass2 - // - // If you're looking for jumps in RSS based on the change column, you miss the fact - // that a 1GB jump happened between pass1 and pass2 (supposing pass1 and pass2 actually - // occur sequentially and pass1 isn't just nested within pass2). It's easy to imagine - // someone missing this or being confused by the fact that the change is zero. - - format!("; rss: {:>5}MB -> {:>5}MB", rss_to_mb(start_rss), rss_to_mb(end_rss)) + let change_rss = end_rss as i128 - start_rss as i128; + + format!( + "; rss: {:>4}MB -> {:>4}MB ({:>+5}MB)", + rss_to_mb(start_rss), + rss_to_mb(end_rss), + rss_change_to_mb(change_rss), + ) } - (Some(start_rss), None) => format!("; rss start: {:>5}MB", rss_to_mb(start_rss)), - (None, Some(end_rss)) => format!("; rss end: {:5>}MB", rss_to_mb(end_rss)), + (Some(start_rss), None) => format!("; rss start: {:>4}MB", rss_to_mb(start_rss)), + (None, Some(end_rss)) => format!("; rss end: {:>4}MB", rss_to_mb(end_rss)), (None, None) => String::new(), }; |
