< prev index next >

src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/SALauncher.java

Print this page

        

*** 28,46 **** --- 28,48 ---- import java.util.Arrays; import sun.jvm.hotspot.tools.JStack; import sun.jvm.hotspot.tools.JMap; import sun.jvm.hotspot.tools.JInfo; + import sun.jvm.hotspot.tools.JSnap; public class SALauncher { private static boolean launcherHelp() { System.out.println(" clhsdb \tcommand line debugger"); System.out.println(" hsdb \tui debugger"); System.out.println(" jstack --help\tto get more information"); System.out.println(" jmap --help\tto get more information"); System.out.println(" jinfo --help\tto get more information"); + System.out.println(" jsnap --help\tto get more information"); return false; } private static boolean commonHelp() { // --pid <pid>
*** 83,102 **** --- 85,112 ---- System.out.println(" --locks\tto print java.util.concurrent locks"); System.out.println(" --mixed\tto print both java and native frames (mixed mode)"); return commonHelp(); } + private static boolean jsnapHelp() { + System.out.println(" <no option>\tdump perfromance counters"); + return commonHelp(); + } + private static boolean toolHelp(String toolName) { if (toolName.equals("jstack")) { return jstackHelp(); } if (toolName.equals("jinfo")) { return jinfoHelp(); } if (toolName.equals("jmap")) { return jmapHelp(); } + if (toolName.equals("jsnap")) { + return jsnapHelp(); + } if (toolName.equals("hsdb") || toolName.equals("clhsdb")) { return commonHelp(); } return launcherHelp(); }
*** 306,315 **** --- 316,359 ---- } JInfo.main(newArgs.toArray(new String[newArgs.size()])); } + private static void runJSNAP(String[] oldArgs) { + SAGetopt sg = new SAGetopt(oldArgs); + String[] longOpts = {"exe=", "core=", "pid="}; + + ArrayList<String> newArgs = new ArrayList(); + String exeORpid = null; + String core = null; + String s = null; + + while((s = sg.next(null, longOpts)) != null) { + if (s.equals("exe")) { + exeORpid = sg.getOptarg(); + continue; + } + if (s.equals("core")) { + core = sg.getOptarg(); + continue; + } + if (s.equals("pid")) { + exeORpid = sg.getOptarg(); + continue; + } + } + + if (exeORpid != null) { + newArgs.add(exeORpid); + if (core != null) { + newArgs.add(core); + } + } + + JSnap.main(newArgs.toArray(new String[newArgs.size()])); + } + public static void main(String[] args) { // Provide a help if (args.length == 0) { launcherHelp(); return;
*** 353,359 **** --- 397,408 ---- if (args[0].equals("jinfo")) { runJINFO(oldArgs); return; } + + if (args[0].equals("jsnap")) { + runJSNAP(oldArgs); + return; + } } }
< prev index next >