< prev index next >
src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/JMap.java
Print this page
*** 69,78 ****
--- 69,80 ----
public static final int MODE_PMAP = 3;
public static final int MODE_HEAP_GRAPH_HPROF_BIN = 4;
public static final int MODE_HEAP_GRAPH_GXL = 5;
public static final int MODE_FINALIZERINFO = 6;
+ private static String dumpfile = "heap.bin";
+
public void run() {
Tool tool = null;
switch (mode) {
case MODE_HEAP_SUMMARY:
*** 90,104 ****
case MODE_PMAP:
tool = new PMap();
break;
case MODE_HEAP_GRAPH_HPROF_BIN:
! writeHeapHprofBin();
return;
case MODE_HEAP_GRAPH_GXL:
! writeHeapGXL();
return;
case MODE_FINALIZERINFO:
tool = new FinalizerInfo();
break;
--- 92,106 ----
case MODE_PMAP:
tool = new PMap();
break;
case MODE_HEAP_GRAPH_HPROF_BIN:
! writeHeapHprofBin(dumpfile);
return;
case MODE_HEAP_GRAPH_GXL:
! writeHeapGXL(dumpfile);
return;
case MODE_FINALIZERINFO:
tool = new FinalizerInfo();
break;
*** 125,147 ****
} else if (modeFlag.equals("-clstats")) {
mode = MODE_CLSTATS;
} else if (modeFlag.equals("-finalizerinfo")) {
mode = MODE_FINALIZERINFO;
} else {
! int index = modeFlag.indexOf("-heap:format=");
if (index != -1) {
! String format = modeFlag.substring(1 + modeFlag.indexOf('='));
! if (format.equals("b")) {
mode = MODE_HEAP_GRAPH_HPROF_BIN;
! } else if (format.equals("x")) {
mode = MODE_HEAP_GRAPH_GXL;
} else {
! System.err.println("unknown heap format:" + format);
// Exit with error status
System.exit(1);
}
} else {
copyArgs = false;
}
}
--- 127,165 ----
} else if (modeFlag.equals("-clstats")) {
mode = MODE_CLSTATS;
} else if (modeFlag.equals("-finalizerinfo")) {
mode = MODE_FINALIZERINFO;
} else {
! int index = modeFlag.indexOf("-heap:");
if (index != -1) {
! String[] options = modeFlag.substring(6).split(",");
! for (String option : options) {
! String[] keyValue = option.split("=");
! if (keyValue[0].equals("format")) {
! if (keyValue[1].equals("b")) {
mode = MODE_HEAP_GRAPH_HPROF_BIN;
! } else if (keyValue[1].equals("x")) {
mode = MODE_HEAP_GRAPH_GXL;
} else {
! System.err.println("unknown heap format:" + keyValue[0]);
// Exit with error status
System.exit(1);
}
+ } else if (keyValue[0].equals("file")) {
+ if ((keyValue[1] == null) || keyValue[1].equals("")) {
+ System.err.println("File name must be set.");
+ System.exit(1);
+ }
+ dumpfile = keyValue[1];
+ } else {
+ System.err.println("unknown option:" + keyValue[0]);
+
+ // Exit with error status
+ System.exit(1);
+ }
+ }
} else {
copyArgs = false;
}
}
< prev index next >