RFR: 6810: Create treemap viewer for JOverflow [v6]

Alex Macdonald aptmac at openjdk.java.net
Wed Jun 17 20:35:10 UTC 2020


On Wed, 17 Jun 2020 19:43:03 GMT, Kangcheng Xu <kxu at openjdk.org> wrote:

>> This PR implements [JMC-6810: Create treemap viewer for JOverflow](https://bugs.openjdk.java.net/browse/JMC-6810). It
>> adds a treemap displaying memory usage by classes. It makes easier to spot what is consuming most of the memory. Like
>> JOverflow instance viewer, the treemap viewer utilizes the filtering feature provided by JOverflow.
>> ![screen-shot](https://i.imgur.com/hTeNLtw.png)
>> The treemap is not included in the building by default, therefore you'll need to manually enable the
>> `org.openjdk.jmc.feature.joverflow.ext.treemap` feature explicitly. Once enabled, the treemap view part can be opened
>> in *Window* -> *Show View* -> *Other* -> *JOverflow* -> *JOverflow Treemap*.
>> ---
>> 
>> The treemap view part consists of three components: the toolbar actions, the breadcrumb, and the treemap. All three
>> components are automatically updated when the JOverflow filter changes, or when a new JOverflow editor page becomes
>> active.
>>  
>> ### Toolbar actions:
>> 
>> ![toobar-actions-screen-shot](https://i.imgur.com/kxbed1a.png)
>> 
>> Buttons are enabled and disabled automatically according to the state of the treemap.
>> 
>> - Zoom-in button: zoom-in to the selected node of the treemap
>> - Zoom-out button: zoom-out to the parent node of the currently expanded node of the treemap
>> - Zoom-off button: display the root node (ie. "[ROOT]" node)
>> 
>> ### Breadcrumb
>> 
>> ![breadcrumb-screen-shot](https://i.imgur.com/kpvWOcp.png)
>> 
>> The breadcrumb indicates the location of the currently expanded treemap node relative to the root. Breadcrumb entries
>> are updated upon treemap expands/collapse. User interactions on the breadcrumb also updates the treemap.
>> - Left mouse click: navigate to desired zooming level.
>> 
>> ### Treemap
>> 
>> ![treemap-screen-shot](https://i.imgur.com/W1JOPDV.png)
>> 
>> The treemap implements the squarified treemap algorithm. Memory usage is aggregated by class and package names. The
>> larger the area, the more memory consumed by this class/package. Treemap nodes on different levels are labelled with
>> different background colours. User interactions on the treemap also updates the breadcrumb.
>> - Left mouse click: select and highlight the clicked node, allowing zooming-in with the toolbar button.
>> - Middle mouse click: display the root node (ie. "[ROOT]" node)
>> - Right mouse click: zoom-out to the parent node of the currently expanded node
>> - Left mouse double click: zoom-in to the clicked node (or to its parent node if the clicked node is a leaf)
>> - Mouse hover: displays the tooltip with the full qualified package/class name and the memory usage in a human-readable
>>   format.
>> 
>> ---
>> 
>> Let me know what you think about the design and functionality. :)
>
> Kangcheng Xu has updated the pull request incrementally with one additional commit since the last revision:
> 
>   made spotless happy

Looks good to me, thanks for making the changes.

I'll open a new bug for this (or take a look if one exists already ..) because it's outside of the scope of this patch,
but it would be nice if newly added views automatically updated in response what's currently being viewed on screen.
For example, if I had a JOverflow page open first and then I add the Treemap view, the treemap view has to wait for me
to make a selection. Whereas if I had the Treemap view already open and then I opened an hprof file then the treemap
view draws the default selection. This isn't a problem specific to the treemap view; it's easy to recreate with other
optional views like the flameview for example.

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

Marked as reviewed by aptmac (Committer).

PR: https://git.openjdk.java.net/jmc/pull/77


More information about the jmc-dev mailing list