-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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 profiling of bootstrap commands using Chrome events #136924
Conversation
The rustc-dev-guide subtree was changed. If this PR only touches the dev guide consider submitting a PR directly to rust-lang/rustc-dev-guide otherwise thank you for updating the dev guide with your changes. |
omg |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks very cool (and impl looks good in general), I'll play around with this tmrw
This comment has been minimized.
This comment has been minimized.
Clippy lint failures look likely genuine, maybe the span guards aren't actually being returned? |
Sigh, this is annoying. I need the let binding to have a guard if tracing is enabled, and nothing if not. But storing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Impl looks good, can you squash the bootstrap changes into one commit? r=me after
@rustbot author |
3589dea
to
521cbd3
Compare
I squashed the Clippy change, I assume that's what you meant (?). I think that keeping the command tracing commit separate makes sense, it could be useful even without the profiling. |
@rustbot ready |
Yeah that's fine, thanks |
Add profiling of bootstrap commands using Chrome events Since we now have support for tracing in bootstrap, and the execution of most commands is centralized within a few functions, it's quite trivial to also trace command execution, and visualize it using the Chrome profiler. This can be helpful both to profile what takes time in bootstrap and also to get a visual idea of what happens in a given bootstrap invocation (since the execution of external commands is usually the most interesting thing). This is how it looks:  I first tried to use [tracing-flame](https://github.com/tokio-rs/tracing/tree/master/tracing-flame), but the output wasn't very useful, because the event/stackframe names were bootstrap code locations, instead of the command contents. r? `@jieyouxu`
…kingjubilee Rollup of 13 pull requests Successful merges: - rust-lang#135439 (Make `-O` mean `OptLevel::Aggressive`) - rust-lang#136460 (Simplify `rustc_span` `analyze_source_file`) - rust-lang#136642 (Put the alloc unit tests in a separate alloctests package) - rust-lang#136904 (add `IntoBounds` trait) - rust-lang#136908 ([AIX] expect `EINVAL` for `pthread_mutex_destroy`) - rust-lang#136924 (Add profiling of bootstrap commands using Chrome events) - rust-lang#136951 (Use the right binder for rebinding `PolyTraitRef`) - rust-lang#136956 (add vendor directory to .gitignore) - rust-lang#136967 (Use `slice::fill` in `io::Repeat` implementation) - rust-lang#136976 (alloc boxed: docs: use MaybeUninit::write instead of as_mut_ptr) - rust-lang#136981 (ci: switch loongarch jobs to free runners) - rust-lang#136992 (Update backtrace) - rust-lang#136993 ([cg_llvm] Remove dead error message) r? `@ghost` `@rustbot` modify labels: rollup
…kingjubilee Rollup of 9 pull requests Successful merges: - rust-lang#135439 (Make `-O` mean `OptLevel::Aggressive`) - rust-lang#136460 (Simplify `rustc_span` `analyze_source_file`) - rust-lang#136904 (add `IntoBounds` trait) - rust-lang#136908 ([AIX] expect `EINVAL` for `pthread_mutex_destroy`) - rust-lang#136924 (Add profiling of bootstrap commands using Chrome events) - rust-lang#136951 (Use the right binder for rebinding `PolyTraitRef`) - rust-lang#136981 (ci: switch loongarch jobs to free runners) - rust-lang#136992 (Update backtrace) - rust-lang#136993 ([cg_llvm] Remove dead error message) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#136924 - Kobzol:bootstrap-tracing, r=jieyouxu Add profiling of bootstrap commands using Chrome events Since we now have support for tracing in bootstrap, and the execution of most commands is centralized within a few functions, it's quite trivial to also trace command execution, and visualize it using the Chrome profiler. This can be helpful both to profile what takes time in bootstrap and also to get a visual idea of what happens in a given bootstrap invocation (since the execution of external commands is usually the most interesting thing). This is how it looks:  I first tried to use [tracing-flame](https://github.com/tokio-rs/tracing/tree/master/tracing-flame), but the output wasn't very useful, because the event/stackframe names were bootstrap code locations, instead of the command contents. r? ``@jieyouxu``
Since we now have support for tracing in bootstrap, and the execution of most commands is centralized within a few functions, it's quite trivial to also trace command execution, and visualize it using the Chrome profiler. This can be helpful both to profile what takes time in bootstrap and also to get a visual idea of what happens in a given bootstrap invocation (since the execution of external commands is usually the most interesting thing).
This is how it looks:

I first tried to use tracing-flame, but the output wasn't very useful, because the event/stackframe names were bootstrap code locations, instead of the command contents.
r? @jieyouxu