Skip to content
Permalink
Browse files

Add a RUSTC_TIME env var to time rust crates during bootstrap

  • Loading branch information...
Zoxc committed Feb 16, 2019
1 parent 55cee44 commit a0c7984fb97b6864352028b848c3240ae5b3554e
Showing with 16 additions and 4 deletions.
  1. +16 −4 src/bootstrap/bin/rustc.rs
@@ -93,6 +93,21 @@ fn main() {
env::join_paths(&dylib_path).unwrap());
let mut maybe_crate = None;

// Get the name of the crate we're compiling, if any.
let maybe_crate_name = args.windows(2)
.find(|a| &*a[0] == "--crate-name")
.map(|crate_name| &*crate_name[1]);

if let Some(current_crate) = maybe_crate_name {
if let Some(target) = env::var_os("RUSTC_TIME") {
if target == "all" ||
target.into_string().unwrap().split(",").any(|c| c.trim() == current_crate)
{
cmd.arg("-Ztime");
}
}
}

// Non-zero stages must all be treated uniformly to avoid problems when attempting to uplift
// compiler libraries and such from stage 1 to 2.
if stage == "0" {
@@ -152,10 +167,7 @@ fn main() {
cmd.arg(format!("-Clinker={}", target_linker));
}

let crate_name = args.windows(2)
.find(|a| &*a[0] == "--crate-name")
.unwrap();
let crate_name = &*crate_name[1];
let crate_name = maybe_crate_name.unwrap();
maybe_crate = Some(crate_name);

// If we're compiling specifically the `panic_abort` crate then we pass

0 comments on commit a0c7984

Please sign in to comment.
You can’t perform that action at this time.