RFR: 6810: Create treemap viewer for JOverflow
Kangcheng Xu
kxu at openjdk.java.net
Wed May 27 19:32:29 UTC 2020
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.

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:

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

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

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. :)
**Note**: at the time of submission the GitHub action CI will probably fail because
[repository.ops4j.org](http://repository.ops4j.org/) is currently down, but I've built and tested with local cache and
everything seems to be in order.
-------------
Commit messages:
- Merge branch 'master' into joverflow-treemap
- Set zoom-in disabled when leaf node selected
- Updated documentation
- WIP: fixed format and externalized message strings
- WIP: added/updated license headers
- WIP: added tool bar buttons
- WIP: linked Breadcrumb with Treemap
- WIP: fixed Breadcrumb layout sizes
- WIP: TODO: fix Breadcrumb layout sizes
- WIP: add messages when no instances selected
- ... and 9 more: https://git.openjdk.java.net/jmc/compare/bb6765d7...e4bae1c9
Changes: https://git.openjdk.java.net/jmc/pull/77/files
Webrev: https://webrevs.openjdk.java.net/jmc/77/webrev.00
Issue: https://bugs.openjdk.java.net/browse/JMC-6810
Stats: 3860 lines in 31 files changed: 3850 ins; 0 del; 10 mod
Patch: https://git.openjdk.java.net/jmc/pull/77.diff
Fetch: git fetch https://git.openjdk.java.net/jmc pull/77/head:pull/77
PR: https://git.openjdk.java.net/jmc/pull/77
More information about the jmc-dev
mailing list