changeset 10692:3b3bd6c38547

Merge
author dsamersoff
date Wed, 23 Mar 2016 17:36:18 +0000
parents 155f22b63931 a074585a9f08
children 906fa01e86a0
files
diffstat 2 files changed, 27 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/SALauncher.java	Wed Mar 23 10:52:35 2016 +0100
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/SALauncher.java	Wed Mar 23 17:36:18 2016 +0000
@@ -88,7 +88,7 @@
     }
 
     private static boolean jsnapHelp() {
-        System.out.println(" <no option>\tdump performance counters");
+        System.out.println("    --all\tto print all performance counters");
         return commonHelp();
     }
 
@@ -331,7 +331,7 @@
 
     private static void runJSNAP(String[] oldArgs) {
         SAGetopt sg = new SAGetopt(oldArgs);
-        String[] longOpts = {"exe=", "core=", "pid="};
+        String[] longOpts = {"exe=", "core=", "pid=", "all"};
 
         ArrayList<String> newArgs = new ArrayList();
         String exe = null;
@@ -352,6 +352,10 @@
                 pid = sg.getOptarg();
                 continue;
             }
+            if (s.equals("all")) {
+                newArgs.add("-a");
+                continue;
+            }
         }
 
         buildAttachArgs(newArgs, pid, exe, core);
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/JSnap.java	Wed Mar 23 10:52:35 2016 +0100
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/JSnap.java	Wed Mar 23 17:36:18 2016 +0000
@@ -25,11 +25,15 @@
 package sun.jvm.hotspot.tools;
 
 import java.io.*;
+import java.util.*;
+import java.util.stream.*;
 import sun.jvm.hotspot.debugger.JVMDebugger;
 import sun.jvm.hotspot.runtime.*;
 
 public class JSnap extends Tool {
 
+    private boolean all;
+
     public JSnap() {
         super();
     }
@@ -45,7 +49,7 @@
             if (prologue.accessible()) {
                 PerfMemory.iterate(new PerfMemory.PerfDataEntryVisitor() {
                         public boolean visit(PerfDataEntry pde) {
-                            if (pde.supported()) {
+                            if (all || pde.supported()) {
                                 out.print(pde.name());
                                 out.print('=');
                                 out.println(pde.valueAsString());
@@ -62,8 +66,24 @@
         }
     }
 
+    @Override
+    protected void printFlagsUsage() {
+        System.out.println("    -a\tto print all performance counters");
+        super.printFlagsUsage();
+    }
+
     public static void main(String[] args) {
         JSnap js = new JSnap();
+        js.all = Arrays.stream(args)
+                       .anyMatch(s -> s.equals("-a"));
+
+        if (js.all) {
+            args = Arrays.stream(args)
+                         .filter(s -> !s.equals("-a"))
+                         .collect(Collectors.toList())
+                         .toArray(new String[0]);
+        }
+
         js.execute(args);
     }
 }