From bbc8bac499302538e7851dd22c5da7f1038b3b1a Mon Sep 17 00:00:00 2001 From: sla Date: Thu, 14 Nov 2013 19:30:07 +0100 Subject: [PATCH] 6606002: jinfo doesn't detect dynamic vm flags changing Reviewed-by: coleenp, jbachorik, sspitsyn --- .../classes/sun/jvm/hotspot/tools/JInfo.java | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/agent/src/share/classes/sun/jvm/hotspot/tools/JInfo.java b/agent/src/share/classes/sun/jvm/hotspot/tools/JInfo.java index 6f9cd0f41..bec93e65d 100644 --- a/agent/src/share/classes/sun/jvm/hotspot/tools/JInfo.java +++ b/agent/src/share/classes/sun/jvm/hotspot/tools/JInfo.java @@ -24,8 +24,9 @@ package sun.jvm.hotspot.tools; -import sun.jvm.hotspot.runtime.*; import sun.jvm.hotspot.debugger.JVMDebugger; +import sun.jvm.hotspot.runtime.Arguments; +import sun.jvm.hotspot.runtime.VM; public class JInfo extends Tool { public JInfo() { @@ -138,14 +139,33 @@ public class JInfo extends Tool { } private void printVMFlags() { + VM.Flag[] flags = VM.getVM().getCommandLineFlags(); + System.out.print("Non-default VM flags: "); + for (VM.Flag flag : flags) { + if (flag.getOrigin() == 0) { + // only print flags which aren't their defaults + continue; + } + if (flag.isBool()) { + String onoff = flag.getBool() ? "+" : "-"; + System.out.print("-XX:" + onoff + flag.getName() + " "); + } else { + System.out.print("-XX:" + flag.getName() + "=" + + flag.getValue() + " "); + } + } + System.out.println(); + + System.out.print("Command line: "); String str = Arguments.getJVMFlags(); if (str != null) { - System.out.println(str); + System.out.print(str + " "); } str = Arguments.getJVMArgs(); if (str != null) { - System.out.println(str); + System.out.print(str); } + System.out.println(); } private int mode; -- GitLab