-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Add TRACING_ENABLED to Machine and add enter_trace_span!() #140972
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
Conversation
af8f491
to
7261a79
Compare
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.
I don't think we need a new module for that -- please just put this into the existing util
module.
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.
Done and force-pushed
@rustbot author Given how simple this PR is, feel free to just amend and force-push, so that we avoid another round-trip for a final squash. |
Reminder, once the PR becomes ready for a review, use |
7261a79
to
28db348
Compare
Please remember to |
LGTM, thanks! |
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#140972 (Add TRACING_ENABLED to Machine and add enter_trace_span!()) - rust-lang#141282 (`core_float_math`: Move functions to `math` module) - rust-lang#141288 (Get rid of unnecessary `BufDisplay` abstraction) - rust-lang#141289 (use `Self` alias in self types rather than manually substituting it) - rust-lang#141291 (link tracking issue in explicit-extern-abis.md) - rust-lang#141294 (triagebot: ping me if rustdoc js is modified) - rust-lang#141303 (Fix pagetoc inactive color in rustc book) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#140972 - Stypox:machine-tracing-flag, r=RalfJung Add TRACING_ENABLED to Machine and add enter_trace_span!() This PR adds the necessary infrastructure to make it possible to do tracing calls from within `rustc_const_eval` when running Miri, while making sure they don't impact the performance of normal compiler execution. This is done by adding a `const` boolean to `Machine`, false by default, but that will be set to true in Miri only. The tracing macro `enter_trace_span!()` checks if it is true before doing anything, and since the value of a `const` is known at compile time, if it it false it the whole tracing call should be optimized out. I will soon open further PRs to add tracing macro calls similar to this one, so that afterwards it will be possible to learn more about Miri's time spent in the various interpretation steps: ```rs let _guard = enter_trace_span!(M, "eval_statement", "{:?}", stmt); ``` r? `@RalfJung`
This PR adds the necessary infrastructure to make it possible to do tracing calls from within
rustc_const_eval
when running Miri, while making sure they don't impact the performance of normal compiler execution. This is done by adding aconst
boolean toMachine
, false by default, but that will be set to true in Miri only. The tracing macroenter_trace_span!()
checks if it is true before doing anything, and since the value of aconst
is known at compile time, if it it false it the whole tracing call should be optimized out.I will soon open further PRs to add tracing macro calls similar to this one, so that afterwards it will be possible to learn more about Miri's time spent in the various interpretation steps:
r? @RalfJung