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

Add raw line numbers for raw mode #213

Merged
merged 1 commit into from
Jul 9, 2023
Merged

Add raw line numbers for raw mode #213

merged 1 commit into from
Jul 9, 2023

Conversation

tenderlove
Copy link
Collaborator

This commit records line numbers in raw mode along with the frame information.

Before this commit, stackprof would lose information about callee frames at a particular line. For example, you could not answer "given a frame and line, what function do we call in to at that line?" This commit encodes the line information along with the raw frame information so that we can answer that question.

This is probably TMI, but when we ask the Ruby frame profiler, it returns a list of memory addresses (CMEs or possibly iseqs?). AArch64 systems guarantee the top 16 bits won't be used, x86 doesn't use them either (but possibly could in the future, but probably not). Armed with this information, we just put the line number in those top 16 bits and we don't need to allocate any extra memory when doing a profile.

For backwards compatibility, this patch splits apart the information in the .result method so existing tools should just work.

This commit records line numbers in raw mode along with the frame
information.

Before this commit, stackprof would lose information about callee frames
at a particular line.  For example, you could not answer "given a frame
and line, what function do we call in to at that line?"  This commit
encodes the line information along with the raw frame information so
that we can answer that question.

This is probably TMI, but when we ask the Ruby frame profiler, it
returns a list of memory addresses (CMEs or possibly iseqs?).  AArch64
systems guarantee the top 16 bits won't be used, x86 doesn't use them
either (but possibly could in the future, but probably not). Armed with
this information, we just put the line number in those top 16 bits and
we don't need to allocate any extra memory when doing a profile.

For backwards compatibility, this patch splits apart the information in
the `.result` method so existing tools should just work.
@tenderlove
Copy link
Collaborator Author

With this patch I was able to translate stackprof profiles in to FireFox profiler compatible profiles:

profile

Translation script is here, and I uploaded the sample profile here

@tenderlove tenderlove merged commit 51b71bf into master Jul 9, 2023
14 checks passed
@tenderlove tenderlove deleted the raw-line-numbers branch July 9, 2023 19:57
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

Successfully merging this pull request may close these issues.

None yet

1 participant