RFR: 7894: Provide an alternative Java based flamegraph visualization [v18]

Alex Macdonald aptmac at openjdk.org
Fri Jun 9 15:27:53 UTC 2023


On Fri, 9 Jun 2023 14:06:05 GMT, Brice Dutheil <bdutheil at openjdk.org> wrote:

>> This change introduces a possible replacement for the current flamegraph view.
>> 
>> **Motivation**
>> The current is based on a web view. In the current state, 
>> - the web view can be slow to render especially when the tree is large.
>> - the web view don't feel well integrated, in particular when popups are shown.
>> - web view are difficult to work with from a JMC developer perspective.
>> 
>> ![image](https://user-images.githubusercontent.com/803621/177537938-423a4d53-c2ac-4c56-8583-abe4cc910e37.png)
>> 
>> **Description**
>> Concretely this PR relies on the swing component to render flamegraphs : https://github.com/bric3/fireplace. And plays with the bridge between SWT and AWT via the `SWT_AWT` class.
>> 
>> As the intent of this view is to eventually replace the current one, the icons are the same.
>> 
>> Since fireplace has no actual release, only snapshots, in order to try this PR, it is necessary to install the snapshot manually before starting the p2 server.
>> 
>> 
>> cd releng/third-party
>> 
>> mvn dependency:get -DrepoUrl=https://s01.oss.sonatype.org/content/repositories/snapshots -Dartifact=io.github.bric3.fireplace:fireplace-swing:0.0.1-SNAPSHOT:jar
>> 
>> # if sources are wanted
>> mvn dependency:get -DrepoUrl=https://s01.oss.sonatype.org/content/repositories/snapshots -Dartifact=io.github.bric3.fireplace:fireplace-swing:0.0.1-SNAPSHOT:jar:sources
>> 
>> # make the p2 site, don't forget the -U
>> mvn p2:site -U; mvn jetty:run
>> 
>> 
>> **Outstanding issues / limitation**
>> - [x] Fireplace has not yet a stable release as some part of its API are a bit rough.
>> - [x] Currently the view does not initializes correctly:
>>    the swing `JScrollPane` don't show scroll bars, until the view is resized by the user. I lack the SWT / Swing expertise to understand why at this time.
>>    https://github.com/bric3/fireplace/issues/79
>> - [x] Fireplace only supports _icicle_ view at this time.
>>    https://github.com/bric3/fireplace/issues/22
>> - [x] Icons for minimap toggle and zoom reset
>>    <img width="237" alt="image" src="https://user-images.githubusercontent.com/803621/183126781-07af0e94-a5d5-458c-97e3-a5e012177248.png">
>> - [x] Export to image
>>    https://github.com/bric3/fireplace/issues/99
>> - [x] Export to print ?
>>    Can be done at a later time
>> - [x] release of fireplace
>
> Brice Dutheil has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 39 commits:
> 
>  - chore: Adds search text field
>  - Merge remote-tracking branch 'upstream/master' into flamegraph-swing
>  - fix: Make spotless happy
>  - feature: Replace existing flameview by the swing flamegraph
>  - chore: Port attribute selection
>    
>    Refs: #365, JMC-6757
>  - fix: copyright typo
>  - fix: Make spotless happy
>  - fix: Use tabs
>  - fix: Saving flamegraph to JPG
>  - Bump copright year to 2023
>  - ... and 29 more: https://git.openjdk.org/jmc/compare/1163ef89...1d4475b3

> > I'd have to take a bit more a look if it's just me, but I don't have any tooltips displayed when hovering the graph lanes.
>    
>    
>    Those are showing fine on macOs, regardless it's an eclipse plugin or a standalone app. I don't have a windows under the hod so I don't know.

I'm on Linux, the last time I tried to set-up an Eclipse development setup on Windows it was a nightmare, I won't be doing that again. I'll roughly speculate it's some gnome issue and might poke around in the future to see if there's something I can dig into.

> @aptmac JPG Image saving is fixed.

Excellent, thanks!

> > What is the future for this dependency? Could it be hosted on something like maven central? Just thinking about potential vendor builds & releases of JMC and the validity pulling rc tags from GitHub.
>    
>    
>    Currently the libraries are uploaded to [central](https://central.sonatype.com/artifact/io.github.bric3.fireplace/fireplace-swing/) (if they are at least _release candidates_).

Sounds good to me, thanks for the clarification.

I have two notes about the search functionality at the moment. The first being the NPE I'm seeing, I added a comment where it's happening. The second being the search itself, with the JTextField I need to explicitly hit enter in order for the search to execute, whereas before it automatically updated based on text being added to the text field.

application/org.openjdk.jmc.flightrecorder.flamegraph/src/main/java/org/openjdk/jmc/flightrecorder/flamegraph/views/FlamegraphSwingView.java line 539:

> 537: 										&& method.getType().getPackage().getName().contains(searched))
> 538: 								|| method.getType().getPackage().getModule() != null
> 539: 										&& method.getType().getPackage().getModule().getName().contains(searched)

`java.lang.NullPointerException: Cannot invoke "String.contains(java.lang.CharSequence)" because the return value of "org.openjdk.jmc.common.IMCModule.getName()" is null
	at org.openjdk.jmc.flightrecorder.flamegraph.views.FlamegraphSwingView.lambda$12(FlamegraphSwingView.java:543)`
	
![search](https://github.com/openjdk/jmc/assets/10425301/0ab33875-e191-453a-9a39-eb52eb3f72fb)

-------------

PR Review: https://git.openjdk.org/jmc/pull/408#pullrequestreview-1472333299
PR Review Comment: https://git.openjdk.org/jmc/pull/408#discussion_r1224415516


More information about the jmc-dev mailing list