diff options
| author | Tyson Nottingham <tgnottingham@gmail.com> | 2021-01-25 12:56:21 -0800 |
|---|---|---|
| committer | Tyson Nottingham <tgnottingham@gmail.com> | 2021-01-29 12:46:29 -0800 |
| commit | 849dc1a20cbccb069677566b88ca7b7e8586c997 (patch) | |
| tree | 3c562fab48be476194c3522be3aa6e555eb365f7 /compiler/rustc_codegen_ssa/src | |
| parent | b122908617436af187252572ed5db96850551380 (diff) | |
| download | rust-849dc1a20cbccb069677566b88ca7b7e8586c997.tar.gz rust-849dc1a20cbccb069677566b88ca7b7e8586c997.zip | |
Indicate both start and end of pass RSS in time-passes output
Previously, only the end of pass RSS was indicated. This could easily lead one to believe that the change in RSS from one pass to the next was attributable to the second pass, when in fact it occurred between the end of the first pass and the start of the second. Also, improve alignment of columns.
Diffstat (limited to 'compiler/rustc_codegen_ssa/src')
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/base.rs | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/compiler/rustc_codegen_ssa/src/base.rs b/compiler/rustc_codegen_ssa/src/base.rs index ca7d3d1d81b..604760af33d 100644 --- a/compiler/rustc_codegen_ssa/src/base.rs +++ b/compiler/rustc_codegen_ssa/src/base.rs @@ -12,7 +12,7 @@ use crate::{CachedModuleCodegen, CrateInfo, MemFlags, ModuleCodegen, ModuleKind} use rustc_attr as attr; use rustc_data_structures::fx::FxHashMap; -use rustc_data_structures::profiling::print_time_passes_entry; +use rustc_data_structures::profiling::{get_resident_set_size, print_time_passes_entry}; use rustc_data_structures::sync::{par_iter, ParallelIterator}; use rustc_hir as hir; use rustc_hir::def_id::{LocalDefId, LOCAL_CRATE}; @@ -595,6 +595,7 @@ pub fn codegen_crate<B: ExtraBackendMethods>( let mut cgu_reuse = Vec::new(); let mut pre_compiled_cgus: Option<FxHashMap<usize, _>> = None; let mut total_codegen_time = Duration::new(0, 0); + let start_rss = tcx.sess.time_passes().then(|| get_resident_set_size()); for (i, cgu) in codegen_units.iter().enumerate() { ongoing_codegen.wait_for_signal_to_codegen_item(); @@ -664,7 +665,16 @@ pub fn codegen_crate<B: ExtraBackendMethods>( // Since the main thread is sometimes blocked during codegen, we keep track // -Ztime-passes output manually. - print_time_passes_entry(tcx.sess.time_passes(), "codegen_to_LLVM_IR", total_codegen_time); + if tcx.sess.time_passes() { + let end_rss = get_resident_set_size(); + + print_time_passes_entry( + "codegen_to_LLVM_IR", + total_codegen_time, + start_rss.unwrap(), + end_rss, + ); + } ongoing_codegen.check_for_errors(tcx.sess); |
