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.
This commit is contained in:
Tyson Nottingham 2021-01-25 12:56:21 -08:00
parent e67b72de2e
commit 2b8f2acd5f

View File

@ -6,7 +6,7 @@ extern crate rustc_interface;
extern crate rustc_session;
extern crate rustc_target;
use rustc_data_structures::profiling::print_time_passes_entry;
use rustc_data_structures::profiling::{get_resident_set_size, print_time_passes_entry};
use rustc_interface::interface;
use rustc_session::config::ErrorOutputType;
use rustc_session::early_error;
@ -39,7 +39,8 @@ impl rustc_driver::Callbacks for CraneliftPassesCallbacks {
}
fn main() {
let start = std::time::Instant::now();
let start_time = std::time::Instant::now();
let start_rss = get_resident_set_size();
rustc_driver::init_rustc_env_logger();
let mut callbacks = CraneliftPassesCallbacks::default();
rustc_driver::install_ice_hook();
@ -61,7 +62,11 @@ fn main() {
})));
run_compiler.run()
});
// The extra `\t` is necessary to align this label with the others.
print_time_passes_entry(callbacks.time_passes, "\ttotal", start.elapsed());
if callbacks.time_passes {
let end_rss = get_resident_set_size();
print_time_passes_entry("total", start_time.elapsed(), start_rss, end_rss);
}
std::process::exit(exit_code)
}