agent/src/share/classes/sun/jvm/hotspot/tools/JInfo.java
Print this page
rev 5644 : 6606002: jinfo doesn't detect dynamic vm flags changing
*** 22,33 ****
*
*/
package sun.jvm.hotspot.tools;
- import sun.jvm.hotspot.runtime.*;
import sun.jvm.hotspot.debugger.JVMDebugger;
public class JInfo extends Tool {
public JInfo() {
super();
}
--- 22,34 ----
*
*/
package sun.jvm.hotspot.tools;
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() {
super();
}
*** 136,152 ****
JInfo jinfo = new JInfo(mode);
jinfo.execute(args);
}
private void printVMFlags() {
String str = Arguments.getJVMFlags();
if (str != null) {
! System.out.println(str);
}
str = Arguments.getJVMArgs();
if (str != null) {
! System.out.println(str);
}
}
private int mode;
}
--- 137,173 ----
JInfo jinfo = new JInfo(mode);
jinfo.execute(args);
}
private void printVMFlags() {
+ VM.Flag[] flags = VM.getVM().getCommandLineFlags();
+ System.out.print("Non-default VM flags: ");
+ for (int f = 0; f < flags.length; f++) {
+ VM.Flag flag = flags[f];
+ 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.print(str + " ");
}
str = Arguments.getJVMArgs();
if (str != null) {
! System.out.print(str);
}
+ System.out.println();
}
private int mode;
}