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

YJIT: Fix raw sample stack lengths in exit traces #7728

Merged
merged 1 commit into from Apr 18, 2023

Conversation

jhawthorn
Copy link
Member

Sorry. Didn't spot this additional issue when doing #7702

yjit-trace-exits appends a synthetic sample for the instruction being exited, but we didn't increment the size of the stack. It wasn't clear where best to fix this, we did so here because it required the fewest changes.

I also replaced the line number for instructions with 0, as I don't think the previous value had meaning.


With this change we can successfully generate flamegraphs from exit locations.

With the stackprof default viewer

stackprof --flamegraph yjit_exit_locations.dump > yjit_exit_locations.flamegraph.js
stackprof --flamegraph-viewer yjit_exit_locations.flamegraph.js

in speedscope (there's a hack in here because speedscope makes some poor assumptions so we need to pretend to be an object flamegraph. I hope to send a patch upstream)

stackprof --json yjit_exit_locations.dump | sed 's/{/{"mode":"object",/' > yjit_exit_locations.stackprof.json
# Drag output file into https://www.speedscope.app/

yjit-trace-exits appends a synthetic sample for the instruction being
exited, but we didn't increment the size of the stack. Fixing this count
correctly lets us successfully generate a flamegraph from the exits.

I also replaced the line number for instructions with 0, as I don't
think the previous value had meaning.

Co-authored-by: Adam Hess <HParker@github.com>
@matzbot matzbot requested a review from a team April 17, 2023 22:26
@maximecb maximecb merged commit 2dff1d4 into ruby:master Apr 18, 2023
98 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants