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

Marcus Hirt hirt at openjdk.java.net
Thu Jun 25 11:01:33 UTC 2020


On Wed, 24 Jun 2020 19:35:56 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:
> 
>   make spotless happy

application/org.openjdk.jmc.joverflow.ui/src/main/java/org/openjdk/jmc/joverflow/ui/swt/BreadcrumbItem.java line 134:

> 133:
> 134: 	/* package-private */ Point getDimension(GC gc) {
> 135: 		Font font = gc.getFont();

Nit: We usually don't call out things as being package private in comments. The Java language (and the IDE) does that
for you. If you want to call out a design decision, explaining the decision in the comment may be more helpful. This is
not a blocker - I'm okay with it, if you find it helpful.

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

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


More information about the jmc-dev mailing list