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 a "Merge unaccounted native frames" transform #5141

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mstange
Copy link
Contributor

@mstange mstange commented Sep 26, 2024

Production | Deploy preview

This makes it easier to analyze profiles with JIT frames.

This transform gets rid of 0x12345 frames in the call tree - but only those that haven't been accounted to a shared library, i.e. only frames which we consider to be "probably JIT" frames. This transform does not merge unsymbolicated frames for which we know what library they belong to.

Ideally, we wouldn't have those stray hex addresses in the profiles; either Firefox would filter them out during stack merging, or it should give us the correct memory ranges for JIT functions so that we can account these addresses to the right JS function / JIT trampoline etc. But it's not doing that correctly today.

https://bugzilla.mozilla.org/show_bug.cgi?id=1463559 is one of the bugs about this.

For now it seems easier to just offer a transform which gets rid of these stray JIT address frames. This new transform doesn't really clutter anything up; users will only know about it if they right-click such a frame / call node.

Even if Firefox starts giving us better information for JIT frames, this transform can still be useful. For example, you could see this type of stack frame in profiles that are gathered with samply, on applications that use other JITs or applications which don't have Jitdump instrumentation enabled.
Another use case would be if Firefox uses a system library that makes use of jitting, for example a software OpenGL implementation. Those libraries can't be expected to expose their JIT details to our profiler.

@mstange mstange requested a review from canova September 26, 2024 18:35
@mstange mstange self-assigned this Sep 26, 2024
@mstange mstange requested a review from a team as a code owner September 26, 2024 18:35
Copy link
Contributor

@julienw julienw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me, thanks!

1 thing need to be fixed before landing: implement the shortcut key
Then there's some nitpicking over which shortcut key to use or how to serialize to the URL.
And here and there some comments changes, and some minor refactoring.

locales/en-US/app.ftl Show resolved Hide resolved
src/components/shared/CallNodeContextMenu.js Outdated Show resolved Hide resolved
src/profile-logic/transforms.js Outdated Show resolved Hide resolved
src/profile-logic/transforms.js Outdated Show resolved Hide resolved
src/profile-logic/transforms.js Outdated Show resolved Hide resolved
src/profile-logic/transforms.js Outdated Show resolved Hide resolved
@canova canova removed their request for review November 19, 2024 14:57
@flodolo
Copy link
Contributor

flodolo commented Nov 20, 2024

What's the status of this PR?

@mstange
Copy link
Contributor Author

mstange commented Nov 20, 2024

Sorry, the status is that I need to address the review comments. One of julien's review comments is about adding another comment inside the app.ftl file. Actually, let me do that now and then it's unblocked for your review.

@mstange mstange force-pushed the merge-unaccounted-native-functions-transform branch from e928146 to fe3ba38 Compare November 20, 2024 18:07
This makes it easier to analyze profiles with JIT frames.

This transform gets rid of 0x12345 frames in the call tree - but only
those that haven't been accounted to a shared library, i.e. only frames
which we consider to be "probably JIT" frames. This transform does not
merge unsymbolicated frames for which we know what library they belong to.

Ideally, we wouldn't have those stray hex addresses in the profiles;
either Firefox would filter them out during stack merging, or it should
give us the correct memory ranges for JIT functions so that we can account
these addresses to the right JS function / JIT trampoline etc.
But it's not doing that correctly today.

https://bugzilla.mozilla.org/show_bug.cgi?id=1463559 is one of the bugs
about this.

For now it seems easier to just offer a transform which gets rid of these
stray JIT address frames. This new transform doesn't really clutter
anything up; users will only know about it if they right-click such a
frame / call node.

Even if Firefox starts giving us better information for JIT frames, this
transform can still be useful. For example, you could see this type of
stack frame in profiles that are gathered with samply, on applications
that use other JITs or applications which don't have Jitdump
instrumentation enabled.
Another use case would be if Firefox uses a system library that makes
use of jitting, for example a software OpenGL implementation. Those
libraries can't be expected to expose their JIT details to our profiler.
@mstange mstange force-pushed the merge-unaccounted-native-functions-transform branch from fe3ba38 to 0b75184 Compare November 20, 2024 18:08
@mstange
Copy link
Contributor Author

mstange commented Nov 20, 2024

@flodolo This PR is now ready for your review.

Copy link

codecov bot commented Nov 20, 2024

Codecov Report

Attention: Patch coverage is 85.71429% with 10 lines in your changes missing coverage. Please review.

Project coverage is 88.61%. Comparing base (c69082b) to head (0b75184).

Files with missing lines Patch % Lines
src/components/shared/CallNodeContextMenu.js 33.33% 4 Missing ⚠️
src/actions/profile-view.js 0.00% 3 Missing ⚠️
src/profile-logic/transforms.js 95.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5141      +/-   ##
==========================================
- Coverage   88.62%   88.61%   -0.01%     
==========================================
  Files         308      308              
  Lines       28060    28129      +69     
  Branches     7599     7619      +20     
==========================================
+ Hits        24868    24927      +59     
- Misses       2978     2988      +10     
  Partials      214      214              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

.title =
Removes stack frames such as unsymbolicated JIT frames from the call tree,
and make their callers absorb their cost.
Specifically, this transform merges any native stack frames which were
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit lost on the second part (mind you, not a developer here).

Is this transform merging unaccounted for frames to a shared library (the action is "merge to a shared library"), or is this merging frames not belonging to a shared library ("merge specific frames, i.e. those that don't belong to a library")? Also, what does unaccounted for mean here: not examined, not included, something else?

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.

4 participants