RFR: JDK-8260571: Add PrintMetaspaceStatistics to print metaspace statistics upon VM exit

Ioi Lam iklam at openjdk.java.net
Fri Jan 29 23:22:39 UTC 2021


On Thu, 28 Jan 2021 10:20:42 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:

> This patch adds a new diagnostic boolean switch `PrintMetaspaceStatistics`. When set, it will cause the VM to print a brief report about metaspace occupancy when exiting. It follows the same logic as `PrintNMTStatistics` and similar switches.

I am wondering if we should use UL to avoid adding new command-line options.  How about this in `print_statistics()` in java.c? This way you can also distinguish the output with other "legacy" logs such as `PrintSystemDictionaryAtExit` (because `MetaspaceUtils::print_basic_report` doesn't indicate where its output starts and ends).

LogStreamHandle(Info, metaspace) metaspace_log;
if (metaspace_log.is_enabled()) {
  MetaspaceUtils::print_basic_report(&metaspace_log, 0);
}

Eventually we should move `PrintSystemDictionaryAtExit`, etc, to UL as well. We may need to add a new `atexit` tag for flexibility, so you can say

java -Xlog:systemdictionary+atexit -Xlog:metaspace+atexit:file=metsapce.log

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

PR: https://git.openjdk.java.net/jdk/pull/2283


More information about the hotspot-runtime-dev mailing list