RFR: 8157023: Integrate NMT with JFR [v2]
Thomas Stuefe
stuefe at openjdk.org
Mon Dec 5 10:52:38 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
How about we give you an NMT API which returns the relevant data in one structure and allows to selectively disable some portions of it? That would have some advantages:
- we could "fake" a consistent view by fixing small discrepancies ad-hoc
- you choose how expensive you want to get
- we could hide the nitty gritty of result retrieving (e.g. mtNone, mtChunk handling etc) at least in part from using code like JFR.
- would be reusable.
something like
struct nmt_data_t {
malloc_data_t md; // collection of n malloc counters
virtmem_data_t vd; // collection of n (reserved/committed) pairs
threadstack_data_t tsd; // reserved + committed thread stack size
int num_threads;
bool has_md;
bool has_vd;
bool has_tsd;
};
void get_nmt_statistics(nmt_data_t* out, options);
You can then leave out more expensive options like thread stacks at will.
-------------
PR: https://git.openjdk.org/jdk/pull/11449
More information about the hotspot-dev
mailing list