< prev index next >

src/jdk.jcmd/share/classes/sun/tools/jstack/JStack.java

Print this page
rev 50464 : Thread Dump Extension (memory allocation)

*** 46,55 **** --- 46,56 ---- } checkForUnsupportedOptions(args); boolean locks = false; + boolean extended = false; // Parse the options (arguments starting with "-" ) int optionCount = 0; while (optionCount < args.length) { String arg = args[optionCount];
*** 65,77 **** --- 66,82 ---- } else { if (arg.equals("-l")) { locks = true; } else { + if (arg.equals("-e")) { + extended = true; + } else { usage(1); } } + } optionCount++; } // Next we check the parameter count. int paramCount = args.length - optionCount;
*** 79,94 **** usage(1); } // pass -l to thread dump operation to get extra lock info String pidArg = args[optionCount]; ! String params[]; if (locks) { ! params = new String[] { "-l" }; ! } else { ! params = new String[0]; } ProcessArgumentMatcher ap = new ProcessArgumentMatcher(pidArg); Collection<String> pids = ap.getVirtualMachinePids(JStack.class); if (pids.isEmpty()) { System.err.println("Could not find any processes matching : '" + pidArg + "'"); --- 84,101 ---- usage(1); } // pass -l to thread dump operation to get extra lock info String pidArg = args[optionCount]; ! String params[]= new String[] { "" }; ! if (extended) { ! params[0] += "-e "; ! } if (locks) { ! params[0] += "-l"; } + ProcessArgumentMatcher ap = new ProcessArgumentMatcher(pidArg); Collection<String> pids = ap.getVirtualMachinePids(JStack.class); if (pids.isEmpty()) { System.err.println("Could not find any processes matching : '" + pidArg + "'");
*** 168,181 **** } // print usage message private static void usage(int exit) { System.err.println("Usage:"); ! System.err.println(" jstack [-l] <pid>"); System.err.println(" (to connect to running process)"); System.err.println(""); System.err.println("Options:"); System.err.println(" -l long listing. Prints additional information about locks"); System.err.println(" -? -h --help -help to print this help message"); System.exit(exit); } } --- 175,189 ---- } // print usage message private static void usage(int exit) { System.err.println("Usage:"); ! System.err.println(" jstack [-l][-e] <pid>"); System.err.println(" (to connect to running process)"); System.err.println(""); System.err.println("Options:"); System.err.println(" -l long listing. Prints additional information about locks"); + System.err.println(" -e extended listing. Prints additional information about threads"); System.err.println(" -? -h --help -help to print this help message"); System.exit(exit); } }
< prev index next >