profiler icon indicating copy to clipboard operation
profiler copied to clipboard

Add focus/merge category transforms

Open parttimenerd opened this issue 1 year ago • 3 comments

This PR implements (and tests) two new transformations that allow the user to either focus on a specific category or to merge the frames of all other categories (from the altered guide):

  • Focus on category: Focusing on the functions that belong to the same category as the selected function thereby removing all other functions.
  • Merge other category functions: Merge all functions belonging to other categories than the selected function that do not call such functions directly, into the nearest function directly called by function with the same category as the selected function.

Example: image It is transformed into the following by applying the "Focus on category" transform on the first frame, displaying only frames of the Category "Java (project)": image It is transformed into the following by applying the "Merge other category functions" transform on the first frame, displaying only frames of the Category "Java (project)" and directly calling/called frames, hiding the inner workings of the used libraries: image

Sample profile

Deployment preview

Motivation: This is really, really, really helpful for large Java applications where the two categories might be "Java (non-project)" and "Java (project)". The second transform helps especially with profiling Spring based applications where long stretches of Spring frames are interspersed with a few project frames in the call stacks. Removing the Spring methods fully renders the call stacks useless. An example call stack for Spring looks like the following Sample Spring stack trace by Lukasz Zmudzinski.

parttimenerd avatar Aug 31 '22 11:08 parttimenerd

Codecov Report

Base: 88.48% // Head: 88.49% // Increases project coverage by +0.01% :tada:

Coverage data is based on head (a81e228) compared to base (fa05f01). Patch coverage: 93.75% of modified lines in pull request are covered.

:exclamation: Current head a81e228 differs from pull request most recent head f0e2b1f. Consider uploading reports for the commit f0e2b1f to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4212      +/-   ##
==========================================
+ Coverage   88.48%   88.49%   +0.01%     
==========================================
  Files         282      282              
  Lines       25034    25107      +73     
  Branches     6736     6756      +20     
==========================================
+ Hits        22151    22219      +68     
- Misses       2678     2683       +5     
  Partials      205      205              
Impacted Files Coverage Δ
src/components/shared/CallNodeContextMenu.js 89.51% <84.61%> (-0.39%) :arrow_down:
src/profile-logic/transforms.js 94.61% <94.33%> (-0.02%) :arrow_down:
src/actions/profile-view.js 87.28% <100.00%> (+0.11%) :arrow_up:
src/app-logic/url-handling.js 86.53% <100.00%> (+0.02%) :arrow_up:
src/profile-logic/profile-data.js 90.41% <100.00%> (ø)
src/reducers/profile-view.js 96.23% <100.00%> (ø)
src/selectors/per-thread/thread.js 94.69% <100.00%> (+0.04%) :arrow_up:
src/utils/flow.js 84.28% <100.00%> (+0.22%) :arrow_up:

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

codecov[bot] avatar Aug 31 '22 11:08 codecov[bot]

We looked at this with Markus, and while we agree with the ideas here, we wondered if we should have a "Collapse everything from lib XXX" in addition to the one we already have with the resource.

julienw avatar Oct 11 '22 17:10 julienw

How is this related to my PR? Collapsing be library is certainly interesting, but categories are also used widely to distinguish e.g. between native and JS frames.

parttimenerd avatar Oct 11 '22 17:10 parttimenerd

I'm happy to add "Collapse lib" transformation if this helps bringing this PR forward.

parttimenerd avatar Oct 19 '22 09:10 parttimenerd

I'm keeping the comments open which reference the "with border" transform. This transform will be added in a later PR.

parttimenerd avatar Oct 28 '22 10:10 parttimenerd

I integrated all your suggestions.

parttimenerd avatar Oct 28 '22 13:10 parttimenerd

Good to know...

parttimenerd avatar Oct 28 '22 16:10 parttimenerd