< prev index next >

src/jdk.jcmd/share/classes/sun/tools/jmap/JMap.java

Print this page

        

*** 162,222 **** } // no filename return null; } - private static String add_option(String cmd, String opt) { - if (cmd.isEmpty()) { - return opt; - } - return cmd + "," + opt; - } - 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(","); boolean set_all = false; boolean set_live = false; - String cmdline = ""; for (int i = 0; i < subopts.length; i++) { String subopt = subopts[i]; if (subopt.equals("") || subopt.equals("all")) { - cmdline = add_option(cmdline, "-all"); set_all = true; } else if (subopt.equals("live")) { // Add '-' for compatibility. - cmdline = add_option(cmdline, "-live"); set_live = true; } else if (subopt.startsWith("file=")) { filename = parseFileName(subopt); if (filename == null) { usage(1); // invalid options or no filename } - cmdline = add_option(cmdline, filename); } else if (subopt.startsWith("parallel=")) { parallel = subopt.substring("parallel=".length()); if (parallel == null) { usage(1); } - // Add "parallelThreadsNum=<>" for later check - cmdline = add_option(cmdline, subopt); } else { usage(1); } } if (set_live && set_all) { usage(1); } System.out.flush(); // inspectHeap is not the same as jcmd GC.class_histogram ! executeCommandForPid(pid, "inspectheap", cmdline); } private static void dump(String pid, String options) throws AttachNotSupportedException, IOException, UnsupportedEncodingException { --- 162,211 ---- } // no filename return null; } 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(","); boolean set_all = false; boolean set_live = false; for (int i = 0; i < subopts.length; i++) { String subopt = subopts[i]; if (subopt.equals("") || subopt.equals("all")) { set_all = true; + liveopt = "-all"; } else if (subopt.equals("live")) { // Add '-' for compatibility. set_live = true; + liveopt = "-live"; } else if (subopt.startsWith("file=")) { filename = parseFileName(subopt); if (filename == null) { usage(1); // invalid options or no filename } } else if (subopt.startsWith("parallel=")) { parallel = subopt.substring("parallel=".length()); if (parallel == null) { usage(1); } } else { usage(1); } } if (set_live && set_all) { usage(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 {
< prev index next >