Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for `-Ztimings` to `x.py` #65088

Open
nnethercote opened this issue Oct 4, 2019 · 4 comments

Comments

@nnethercote
Copy link
Contributor

commented Oct 4, 2019

Cargo's new experimental -Ztimings flag is really cool. See here for sample output. It would be great to add support for this to x.py. It would help a lot with #65031.

I tried and failed to get -Ztimings working with rustc, according to some instructions here. One complication is that rustc normally builds with a beta version of Cargo, but -Ztimings is nightly only.

@ehuss : what steps did you take to get the rustc measurements? Thanks!

@ehuss

This comment has been minimized.

Copy link
Contributor

commented Oct 7, 2019

I didn't run it against rustc, that was Alex. You have to edit config.toml and set build.cargo to a nightly version of cargo (like from the .rustup directory, or build it yourself). Then edit the cargo function to add -Ztimings. It looks like someone has made a PR to make that read from an env.

@nnethercote

This comment has been minimized.

Copy link
Contributor Author

commented Oct 7, 2019

You have to edit config.toml and set build.cargo to a nightly version of cargo

@alexcrichton: can you give the exact steps here? I tried to do this but failed. Thanks!

@ehuss

This comment has been minimized.

Copy link
Contributor

commented Oct 7, 2019

What kind of error did you run into? Here's what my rust config.toml looks like (adjust for your setup):

[build]
cargo = "/Users/eric/.rustup/toolchains/nightly-x86_64-apple-darwin/bin/cargo"

And here's what the diff might look like:

diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs
index 5d586f0c461..ef01c18eaa0 100644
--- a/src/bootstrap/builder.rs
+++ b/src/bootstrap/builder.rs
@@ -776,7 +776,8 @@ impl<'a> Builder<'a> {
         cargo
             .env("CARGO_TARGET_DIR", out_dir)
             .arg(cmd)
-            .arg("-Zconfig-profile");
+            .arg("-Zconfig-profile")
+            .arg("-Ztimings");

         let profile_var = |name: &str| {
             let profile = if self.config.rust_optimize {

I have nightly 2019-10-02, which seems to work. Sometimes bootstrapping won't work on the latest cargo because the bootstrap code needs updating, but it seems to be working at this point in time.

@alexcrichton

This comment has been minimized.

Copy link
Member

commented Oct 7, 2019

@nnethercote oh I didn't actually add support to ./x.py when I generated my graphs, I literally just did:

$ cd src/rustc
$ cargo +nightly build -Z timings

and then fixed any missing env vars that the crates reported. I would expect that @ehuss's patch would work as expected, although it may also require a temporary check for if stage != 0 somewhere

Centril added a commit to Centril/rust that referenced this issue Oct 9, 2019
make it possible to add args to cargo in x.py

eg. make it easier to test -Ztimings for rustc

cc rust-lang#65088
bors added a commit that referenced this issue Oct 10, 2019
make it possible to add args to cargo in x.py

eg. make it easier to test -Ztimings for rustc

cc #65088
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.