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

option to print total crate build time #5046

Closed
matthiaskrgr opened this issue Feb 16, 2018 · 7 comments
Closed

option to print total crate build time #5046

matthiaskrgr opened this issue Feb 16, 2018 · 7 comments

Comments

@matthiaskrgr
Copy link
Member

matthiaskrgr commented Feb 16, 2018

Using RUSTFLAGS="-Z time-passes" it is possible to see how long a crate needs to build but when building all the dependencies the total build time of a dependency is not shown.
I would be neat to have cargo print the time it took to build a single crate with some debug option maybe.
There's something similar already for rustc bootstrap on travis:

Building stage2 compiler artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[00:51:16]   Compiling version_check v0.1.4
[00:51:16]   Compiling nodrop v0.1.12
[00:51:16]   Compiling cfg-if v0.1.5
[00:51:16]   Compiling void v1.0.2
[00:51:16] [RUSTC-TIMING] cfg_if test:false 0.092
[00:51:16]   Compiling memoffset v0.2.1
[00:51:16] [RUSTC-TIMING] nodrop test:false 0.126
[00:51:16]   Compiling scopeguard v0.3.3
[00:51:16] [RUSTC-TIMING] void test:false 0.139
[00:51:16]   Compiling stable_deref_trait v1.1.0
[00:51:16] [RUSTC-TIMING] memoffset test:false 0.102
[00:51:16]   Compiling libc v0.2.43
[00:51:16] [RUSTC-TIMING] stable_deref_trait test:false 0.130
[00:51:16] [RUSTC-TIMING] scopeguard test:false 0.156
[00:51:16]   Compiling rustc-rayon-core v0.1.1
[00:51:16]   Compiling rand_core v0.2.1
[00:51:17] [RUSTC-TIMING] rand_core test:false 1.035
[00:51:17]   Compiling either v1.5.0
[00:51:17]   Compiling byteorder v1.2.3
[00:51:18] [RUSTC-TIMING] either test:false 0.391
[00:51:18]   Compiling bitflags v1.0.4
[00:51:18] [RUSTC-TIMING] bitflags test:false 0.110
[00:51:18]   Compiling unicode-width v0.1.5
[00:51:18] [RUSTC-TIMING] unicode_width test:false 0.211
[00:51:18]   Compiling cc v1.0.22
[00:51:18] [RUSTC-TIMING] libc test:false 2.072
[00:51:18]   Compiling rustc_target v0.0.0 (file:///checkout/src/librustc_target)
[00:51:19] [RUSTC-TIMING] byteorder test:false 1.130
[00:51:19]   Compiling scoped-tls v0.1.2
[00:51:19]   Compiling syntax v0.0.0 (file:///checkout/src/libsyntax)
[00:51:19] [RUSTC-TIMING] scoped_tls test:false 0.314
[00:51:19]   Compiling termcolor v1.0.2
[00:51:19]   Compiling lazy_static v0.2.11
[00:51:19]   Compiling rustc-demangle v0.1.9
[00:51:19] [RUSTC-TIMING] lazy_static test:false 0.167
[00:51:19]   Compiling remove_dir_all v0.5.1
[00:51:20] [RUSTC-TIMING] remove_dir_all test:false 0.107
[00:51:20]   Compiling rustc v0.0.0 (file:///checkout/src/librustc)
[00:51:20]   Compiling datafrog v0.1.0
[00:51:21] [RUSTC-TIMING] datafrog test:false 0.587
[00:51:22]   Compiling fmt_macros v0.0.0 (file:///checkout/src/libfmt_macros)
[00:51:23] [RUSTC-TIMING] termcolor test:false 3.567
[00:51:23] [RUSTC-TIMING] rustc_demangle test:false 4.023
[00:51:23]   Compiling graphviz v0.0.0 (file:///checkout/src/libgraphviz)
[00:51:24] [RUSTC-TIMING] fmt_macros test:false 2.046
[00:51:24]   Compiling rustc_fs_util v0.0.0 (file:///checkout/src/librustc_fs_util)
[00:51:25] [RUSTC-TIMING] graphviz test:false 1.742
[00:51:25] [RUSTC-TIMING] rustc_fs_util test:false 0.769
@matthiaskrgr matthiaskrgr changed the title optiont to print total crate build time option to print total crate build time Feb 16, 2018
@lukaslueg
Copy link
Contributor

You mean for dependencies? The current build can be thoroughly examined by time(1).

@matthiaskrgr
Copy link
Member Author

Yeah, for every dependency seperately.
I was looking at rust-lang/rust#48257 and trying to find which crate takes how much time while having several codegen do their thing was impossible for me because all the outputs are already interleaved.

@ishanjain28
Copy link

-Z flag requires nightly compiler. I think, it would be pretty cool if cargo prints total compile time of each crate even when using stable compiler.

Currently, It prints "Compiling ", It can be changed to print "Compiling " or there can be one more message for each crate that prints "Compiled ".

@matthiaskrgr
Copy link
Member Author

Maybe this could be implemented under cargo -vvvv or similar.

@stale
Copy link

stale bot commented Sep 16, 2018

As there hasn't been any activity here in over 6 months I've marked this as stale and if no further activity happens for 7 days I will close it.

I'm a bot so this may be in error! If this issue should remain open, could someone (the author, a team member, or any interested party) please comment to that effect?

The team would be especially grateful if such a comment included details such as:

  • Is this still relevant?
  • If so, what is blocking it?
  • Is it known what could be done to help move this forward?

Thank you for contributing!

If you're reading this comment from the distant future, fear not if this was closed automatically. If you believe it's still an issue please leave a comment and a team member can reopen this issue. Opening a new issue is also acceptable!

@stale stale bot added stale and removed stale labels Sep 16, 2018
@ehuss
Copy link
Contributor

ehuss commented Sep 20, 2019

@matthiaskrgr Does the new -Ztimings=info option sufficiently address this issue? It now prints the total time per unit:

   Completed flate2 v1.0.11 in 2.0s
   Completed synstructure v0.10.2 in 4.1s
   Completed syn v0.15.44 in 13.3s
   Completed ignore v0.4.10 in 5.4s
   Completed clap v2.33.0 in 14.8s
   Completed backtrace-sys v0.1.31 custom-build (run) in 7.8s
   Completed backtrace-sys v0.1.31 in 0.1s

@matthiaskrgr
Copy link
Member Author

Yup, closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants