< prev index next >
src/jdk.jcmd/share/classes/sun/tools/jmap/JMap.java
Print this page
*** 167,176 ****
--- 167,177 ----
private static void histo(String pid, String options)
throws AttachNotSupportedException, IOException,
UnsupportedEncodingException {
String liveopt = "-all";
String filename = null;
+ String parallel = null;
String subopts[] = options.split(",");
for (int i = 0; i < subopts.length; i++) {
String subopt = subopts[i];
if (subopt.equals("") || subopt.equals("all")) {
*** 178,198 ****
} else if (subopt.equals("live")) {
liveopt = "-live";
} else if (subopt.startsWith("file=")) {
filename = parseFileName(subopt);
if (filename == null) {
! usage(1); // invalid options or no filename
}
} else {
! usage(1);
}
}
-
System.out.flush();
// inspectHeap is not the same as jcmd GC.class_histogram
! executeCommandForPid(pid, "inspectheap", liveopt, filename);
}
private static void dump(String pid, String options)
throws AttachNotSupportedException, IOException,
UnsupportedEncodingException {
--- 179,206 ----
} else if (subopt.equals("live")) {
liveopt = "-live";
} else if (subopt.startsWith("file=")) {
filename = parseFileName(subopt);
if (filename == null) {
! System.err.println("Fail: invalid option or no file name '" + subopt +"'");
! System.exit(1);
! }
! } else if (subopt.startsWith("parallel=")) {
! parallel = subopt.substring("parallel=".length());
! if (parallel == null) {
! System.err.println("Fail: no number provided in option: '" + subopt + "'");
! System.exit(1);
}
} else {
! System.err.println("Fail: invalid option: '" + subopt + "'");
! System.exit(1);
}
}
System.out.flush();
// inspectHeap is not the same as jcmd GC.class_histogram
! executeCommandForPid(pid, "inspectheap", liveopt, filename, parallel);
}
private static void dump(String pid, String options)
throws AttachNotSupportedException, IOException,
UnsupportedEncodingException {
*** 209,219 ****
filename = parseFileName(subopt);
}
}
if (filename == null) {
! usage(1); // invalid options or no filename
}
// dumpHeap is not the same as jcmd GC.heap_dump
executeCommandForPid(pid, "dumpheap", filename, liveopt);
}
--- 217,228 ----
filename = parseFileName(subopt);
}
}
if (filename == null) {
! System.err.println("Fail: invalid option or no file name");
! System.exit(1);
}
// dumpHeap is not the same as jcmd GC.heap_dump
executeCommandForPid(pid, "dumpheap", filename, liveopt);
}
*** 285,294 ****
--- 294,307 ----
System.err.println("");
System.err.println(" histo-options:");
System.err.println(" live count only live objects");
System.err.println(" all count all objects in the heap (default if one of \"live\" or \"all\" is not specified)");
System.err.println(" file=<file> dump data to <file>");
+ System.err.println(" parallel=<number> parallel threads number for heap iteration:");
+ System.err.println(" parallel=0 default behavior, use predefined number of threads");
+ System.err.println(" parallel=1 disable parallel heap iteration");
+ System.err.println(" parallel=<N> use N threads for parallel heap iteration");
System.err.println("");
System.err.println(" Example: jmap -histo:live,file=/tmp/histo.data <pid>");
System.exit(exit);
}
}
< prev index next >