Skip to content

Commit 2b8f2ac

Browse files
committed
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.
1 parent e67b72d commit 2b8f2ac

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/bin/cg_clif.rs

+9-4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ extern crate rustc_interface;
66
extern crate rustc_session;
77
extern crate rustc_target;
88

9-
use rustc_data_structures::profiling::print_time_passes_entry;
9+
use rustc_data_structures::profiling::{get_resident_set_size, print_time_passes_entry};
1010
use rustc_interface::interface;
1111
use rustc_session::config::ErrorOutputType;
1212
use rustc_session::early_error;
@@ -39,7 +39,8 @@ impl rustc_driver::Callbacks for CraneliftPassesCallbacks {
3939
}
4040

4141
fn main() {
42-
let start = std::time::Instant::now();
42+
let start_time = std::time::Instant::now();
43+
let start_rss = get_resident_set_size();
4344
rustc_driver::init_rustc_env_logger();
4445
let mut callbacks = CraneliftPassesCallbacks::default();
4546
rustc_driver::install_ice_hook();
@@ -61,7 +62,11 @@ fn main() {
6162
})));
6263
run_compiler.run()
6364
});
64-
// The extra `\t` is necessary to align this label with the others.
65-
print_time_passes_entry(callbacks.time_passes, "\ttotal", start.elapsed());
65+
66+
if callbacks.time_passes {
67+
let end_rss = get_resident_set_size();
68+
print_time_passes_entry("total", start_time.elapsed(), start_rss, end_rss);
69+
}
70+
6671
std::process::exit(exit_code)
6772
}

0 commit comments

Comments
 (0)