changeset 356:a98b9913eca2

Profilers: make sure profiler IDs are always consistent.
author shade
date Mon, 20 Jan 2014 23:01:16 +0400
parents 8d1e26a55e09
children 27c48ead21f8
files jmh-core/src/main/java/org/openjdk/jmh/profile/ProfilerType.java jmh-core/src/main/java/org/openjdk/jmh/runner/options/CommandLineOptions.java
diffstat 2 files changed, 8 insertions(+), 49 deletions(-) [+]
line wrap: on
line diff
--- a/jmh-core/src/main/java/org/openjdk/jmh/profile/ProfilerType.java	Mon Jan 20 20:49:30 2014 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/profile/ProfilerType.java	Mon Jan 20 23:01:16 2014 +0400
@@ -40,11 +40,6 @@
         }
 
         @Override
-        public String id() {
-            return "gc";
-        }
-
-        @Override
         public String label() {
             return "GC";
         }
@@ -66,11 +61,6 @@
         }
 
         @Override
-        public String id() {
-            return "comp";
-        }
-
-        @Override
         public String label() {
             return "JIT";
         }
@@ -92,11 +82,6 @@
         }
 
         @Override
-        public String id() {
-            return "cl";
-        }
-
-        @Override
         public String label() {
             return "Class";
         }
@@ -106,11 +91,7 @@
             return "Classloader profiling via standard MBeans";
         }
     },
-    HS_RUNTIME {
-        @Override
-        public String id() {
-            return "hs_rt";
-        }
+    HS_RT {
 
         @Override
         public String label() {
@@ -144,11 +125,6 @@
         }
 
         @Override
-        public String id() {
-            return "hs_cl";
-        }
-
-        @Override
         public String label() {
             return "HS(Class)";
         }
@@ -160,11 +136,6 @@
     },
     HS_COMP {
         @Override
-        public String id() {
-            return "hs_comp";
-        }
-
-        @Override
         public String label() {
             return "HS(JIT)";
         }
@@ -186,11 +157,6 @@
     },
     HS_GC {
         @Override
-        public String id() {
-            return "hs_gc";
-        }
-
-        @Override
         public String label() {
             return "HS(GC)";
         }
@@ -210,11 +176,7 @@
             return "HotSpot (tm) memory manager (GC) profiling via implementation-specific MBeans";
         }
     },
-    HS_THREAD {
-        @Override
-        public String id() {
-            return "hs_thr";
-        }
+    HS_THR {
 
         @Override
         public String label() {
@@ -236,12 +198,7 @@
             return "HotSpot (tm) threading subsystem via implementation-specific MBeans";
         }
     },
-    STACK_PROFILER {
-        @Override
-        public String id() {
-            return "stack";
-        }
-
+    STACK {
         @Override
         public String label() {
             return "Stack";
@@ -270,7 +227,9 @@
     /**
      * @return id to reference the profiler
      */
-    public abstract String id();
+    public final String id() {
+        return this.toString().toLowerCase();
+    }
 
     /**
      * @return label to pretty-print profiler name
--- a/jmh-core/src/main/java/org/openjdk/jmh/runner/options/CommandLineOptions.java	Mon Jan 20 20:49:30 2014 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/runner/options/CommandLineOptions.java	Mon Jan 20 23:01:16 2014 +0400
@@ -384,7 +384,7 @@
         StringBuilder sb = new StringBuilder();
         for (String s : ProfilerFactory.getAvailableProfilers()) {
             if (ProfilerFactory.isSupported(s)) {
-                sb.append(String.format("%10s: %s\n", s, ProfilerFactory.getDescription(s)));
+                sb.append(String.format("%20s: %s\n", s, ProfilerFactory.getDescription(s)));
             }
         }
         if (!sb.toString().isEmpty()) {
@@ -394,7 +394,7 @@
         sb = new StringBuilder();
         for (String s : ProfilerFactory.getAvailableProfilers()) {
             if (!ProfilerFactory.isSupported(s)) {
-                sb.append(String.format("%10s: %s\n", s, ProfilerFactory.getDescription(s)));
+                sb.append(String.format("%20s: %s\n", s, ProfilerFactory.getDescription(s)));
             }
         }