-
Notifications
You must be signed in to change notification settings - Fork 352
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 measureme
integration for profiling the interpreted program
#1791
Conversation
Sample output: fn main() {
for i in 0..1000 {
let a = i.to_string();
}
println!("Hello, world!");
} produces the following Chromium performance profile (generated using the |
how is this done in real executions with threads? Can we reuse the same infrastructure? |
You can pass a |
Miri has "thread IDs", why can't we pass those to measureme? |
That's amazing. :) |
☔ The latest upstream changes (presumably #1801) made this pull request unmergeable. Please resolve the merge conflicts. |
This PR uses the `measureme` crate to profile the call stack of the program being interpreted by Miri. This is accomplished by starting a measureme 'event' when we enter a function call, and ending the event when we exit the call. The `measureme` tooling can be used to produce a call stack from the generated profile data. Limitations: * We currently record every single entry/exit. This might generate very large profile outputs for programs with a large number of function calls. In follow-up work, we might want to explore sampling (e.g. only recording every N function calls). * This does not integrate very well with Miri's concurrency support. Each event we record starts when we push a frame, and ends when we pop a frame. As a result, switching between virtual threads will cause events from different threads to be interleaved. Additionally, the recorded for a particular frame will include all of the work Miri does before that frame completes, including executing another thread. The `measureme` integration is off by default, and must be enabled via `-Zmiri-measureme=<output_name>`
@RalfJung I've addressed your comments |
This is a great step forward for performance debugging in Miri, thanks a lot @Aaron1011. :) |
📌 Commit c89a5d6 has been approved by |
☀️ Test successful - checks-actions |
This PR uses the
measureme
crate to profile the call stack of theprogram being interpreted by Miri. This is accomplished by starting a
measureme 'event' when we enter a function call, and ending the event
when we exit the call. The
measureme
tooling can be used to produce acall stack from the generated profile data.
Limitations:
large profile outputs for programs with a large number of function
calls. In follow-up work, we might want to explore sampling (e.g. only
recording every N function calls).
Each event we record starts when we push a frame, and ends when we pop
a frame. As a result, the timing recorded for a particular frame will include all of the work Miri does before that frame completes, including executing another thread.
The
measureme
integration is off by default, and must be enabled via-Zmiri-measureme=<output_name>