comparison agent/src/share/classes/sun/jvm/hotspot/tools/JInfo.java @ 13387:b03f33670080

6606002: jinfo doesn't detect dynamic vm flags changing Reviewed-by: coleenp, jbachorik, sspitsyn
author sla
date Thu, 14 Nov 2013 19:30:07 +0100
parents 7fe6ef09d242
children de6a9e811145
comparison
equal deleted inserted replaced
13386:3edddbff4865 13387:b03f33670080
22 * 22 *
23 */ 23 */
24 24
25 package sun.jvm.hotspot.tools; 25 package sun.jvm.hotspot.tools;
26 26
27 import sun.jvm.hotspot.runtime.*;
28 import sun.jvm.hotspot.debugger.JVMDebugger; 27 import sun.jvm.hotspot.debugger.JVMDebugger;
28 import sun.jvm.hotspot.runtime.Arguments;
29 import sun.jvm.hotspot.runtime.VM;
29 30
30 public class JInfo extends Tool { 31 public class JInfo extends Tool {
31 public JInfo() { 32 public JInfo() {
32 super(); 33 super();
33 } 34 }
136 JInfo jinfo = new JInfo(mode); 137 JInfo jinfo = new JInfo(mode);
137 jinfo.execute(args); 138 jinfo.execute(args);
138 } 139 }
139 140
140 private void printVMFlags() { 141 private void printVMFlags() {
142 VM.Flag[] flags = VM.getVM().getCommandLineFlags();
143 System.out.print("Non-default VM flags: ");
144 for (VM.Flag flag : flags) {
145 if (flag.getOrigin() == 0) {
146 // only print flags which aren't their defaults
147 continue;
148 }
149 if (flag.isBool()) {
150 String onoff = flag.getBool() ? "+" : "-";
151 System.out.print("-XX:" + onoff + flag.getName() + " ");
152 } else {
153 System.out.print("-XX:" + flag.getName() + "="
154 + flag.getValue() + " ");
155 }
156 }
157 System.out.println();
158
159 System.out.print("Command line: ");
141 String str = Arguments.getJVMFlags(); 160 String str = Arguments.getJVMFlags();
142 if (str != null) { 161 if (str != null) {
143 System.out.println(str); 162 System.out.print(str + " ");
144 } 163 }
145 str = Arguments.getJVMArgs(); 164 str = Arguments.getJVMArgs();
146 if (str != null) { 165 if (str != null) {
147 System.out.println(str); 166 System.out.print(str);
148 } 167 }
168 System.out.println();
149 } 169 }
150 170
151 private int mode; 171 private int mode;
152 } 172 }