Merge
authordsamersoff
Mon, 14 Mar 2016 11:53:13 +0000
changeset 37091 42ea16b55bf1
parent 37089 56dfac39fc71 (current diff)
parent 37090 50b71fddee3e (diff)
child 37093 20173dffae08
Merge
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/SALauncher.java	Mon Mar 14 11:55:51 2016 +0100
+++ b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/SALauncher.java	Mon Mar 14 11:53:13 2016 +0000
@@ -30,6 +30,7 @@
 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 {
 
@@ -39,6 +40,7 @@
         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;
     }
 
@@ -85,6 +87,11 @@
         return commonHelp();
     }
 
+    private static boolean jsnapHelp() {
+        System.out.println(" <no option>\tdump performance counters");
+        return commonHelp();
+    }
+
     private static boolean toolHelp(String toolName) {
         if (toolName.equals("jstack")) {
             return jstackHelp();
@@ -95,6 +102,9 @@
         if (toolName.equals("jmap")) {
             return jmapHelp();
         }
+        if (toolName.equals("jsnap")) {
+            return jsnapHelp();
+        }
         if (toolName.equals("hsdb") || toolName.equals("clhsdb")) {
             return commonHelp();
         }
@@ -308,6 +318,40 @@
         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) {
@@ -355,5 +399,10 @@
             runJINFO(oldArgs);
             return;
         }
+
+        if (args[0].equals("jsnap")) {
+            runJSNAP(oldArgs);
+            return;
+        }
     }
 }