RFR: 8157023: Integrate NMT with JFR [v2]

Stefan Johansson sjohanss at openjdk.org
Fri Dec 2 15:43:53 UTC 2022


On Fri, 2 Dec 2022 15:39:52 GMT, Stefan Johansson <sjohanss at openjdk.org> wrote:

>> Please review this enhancement to include NMT information in JFR recordings.
>> 
>> **Summary**
>> Native Memory Tracking summary information can be obtained from a running VM using `jcmd` if started with `-XX:NativeMemoryTracking=summary/detail`. Using `jcmd` requires you to run a separate process and to parse the output to get the needed information. This change adds JFR events for NMT information to enable additional ways to consume the NMT data.
>> 
>> There are two new events added:
>> * _NativeMemoryUsage_ - The total native memory usage.
>> * _NativeMemoryUsagePart_ - The native memory usage for each component.
>> 
>> These events are sent periodically and by default the interval is 1s. This can of course be discussed, but that is the staring point. When NMT is not enabled on events will be sent.
>> 
>> **Testing**
>> * Added a simple test to verify that the events are sent as expected depending on if NMT is enabled or not.
>> * Mach5 sanity testing
>
> Stefan Johansson has updated the pull request incrementally with two additional commits since the last revision:
> 
>  - Some refactoring after comments
>  - egahlin and carterkozak comments

Pushed some changes inspired by the discussion here. Not all things have been handled, but I think this is a step in the right direction. 
* The baseline is re-used if newer than 50ms, so if the two events are configured to occur with the same period they should be using the same baseline. I also save the  time of the baseline and use that in all events using that baseline.
* I swapped the event-names, or rather `NativeMemoryUsage` is not the event with a type, and we instead have `NativeMemoryUsageTotal` for the total event. This way we don't have to come up with something better for "part", and "total" is good.
* Also move the JFR-reporting to its own file to get better separation. 

Still some more open questions, like:
* Should we include reserved?
* Should we skip thread probing when doing the baseline?

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

PR: https://git.openjdk.org/jdk/pull/11449


More information about the hotspot-dev mailing list