# HG changeset patch # User sla # Date 1384453807 -3600 # Node ID b03f33670080198d5559e00be37e862d689be374 # Parent 3edddbff48658c3e49a2ce5256773b3202400c69 6606002: jinfo doesn't detect dynamic vm flags changing Reviewed-by: coleenp, jbachorik, sspitsyn diff -r 3edddbff4865 -r b03f33670080 agent/src/share/classes/sun/jvm/hotspot/tools/JInfo.java --- a/agent/src/share/classes/sun/jvm/hotspot/tools/JInfo.java Wed Nov 13 16:35:55 2013 -0800 +++ b/agent/src/share/classes/sun/jvm/hotspot/tools/JInfo.java Thu Nov 14 19:30:07 2013 +0100 @@ -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 @@ } 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;