changeset 1251:ef2249099e8b

7901459: perf* profilers fails with perf_events 4.1
author shade
date Tue, 07 Jul 2015 23:51:41 +0300
parents 29564342b418
children 8aaae8226846
files jmh-core/src/main/java/org/openjdk/jmh/profile/LinuxPerfAsmProfiler.java jmh-core/src/main/java/org/openjdk/jmh/profile/LinuxPerfNormProfiler.java jmh-core/src/main/java/org/openjdk/jmh/profile/LinuxPerfProfiler.java
diffstat 3 files changed, 11 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/jmh-core/src/main/java/org/openjdk/jmh/profile/LinuxPerfAsmProfiler.java	Thu Jun 25 22:31:55 2015 +0300
+++ b/jmh-core/src/main/java/org/openjdk/jmh/profile/LinuxPerfAsmProfiler.java	Tue Jul 07 23:51:41 2015 +0300
@@ -56,13 +56,13 @@
     @Override
     protected void addMyOptions(OptionParser parser) {
         optFrequency = parser.accepts("frequency",
-                "Sampling frequency. This is synonymous to perf -F #")
+                "Sampling frequency. This is synonymous to perf record --freq #")
                 .withRequiredArg().ofType(Long.class).describedAs("freq").defaultsTo(1000L);
     }
 
     @Override
     public Collection<String> addJVMInvokeOptions(BenchmarkParams params) {
-        return Arrays.asList("perf", "record", "-F" + sampleFrequency, "-e" + Utils.join(events, ","), "-o" + perfBinData);
+        return Arrays.asList("perf", "record", "--freq", String.valueOf(sampleFrequency), "--event", Utils.join(events, ","), "--output", perfBinData);
     }
 
     @Override
@@ -73,7 +73,7 @@
     @Override
     protected void parseEvents() {
         try {
-            ProcessBuilder pb = new ProcessBuilder("perf", "script", "-f", "time,event,ip,sym,dso", "-i", perfBinData);
+            ProcessBuilder pb = new ProcessBuilder("perf", "script", "--fields", "time,event,ip,sym,dso", "--input", perfBinData);
             Process p = pb.start();
 
             // drain streams, else we might lock up
--- a/jmh-core/src/main/java/org/openjdk/jmh/profile/LinuxPerfNormProfiler.java	Thu Jun 25 22:31:55 2015 +0300
+++ b/jmh-core/src/main/java/org/openjdk/jmh/profile/LinuxPerfNormProfiler.java	Tue Jul 07 23:51:41 2015 +0300
@@ -102,12 +102,12 @@
 
         Collection<String> userEvents = set.valuesOf(optEvents);
 
-        Collection<String> msgs = Utils.tryWith("perf", "stat", "--log-fd", "2", "-x,", "echo", "1");
+        Collection<String> msgs = Utils.tryWith("perf", "stat", "--log-fd", "2", "--field-separator", ",", "echo", "1");
         if (!msgs.isEmpty()) {
             throw new ProfilerException(msgs.toString());
         }
 
-        Collection<String> incremental = Utils.tryWith("perf", "stat", "--log-fd", "2", "-x,", "-I", String.valueOf(incrementInterval), "echo", "1");
+        Collection<String> incremental = Utils.tryWith("perf", "stat", "--log-fd", "2", "--field-separator", ",", "--interval-print", String.valueOf(incrementInterval), "echo", "1");
         isIncrementable = incremental.isEmpty();
 
         if (userEvents != null) {
@@ -119,7 +119,7 @@
 
         if (supportedEvents.isEmpty()) {
             for (String ev : interestingEvents) {
-                Collection<String> res = Utils.tryWith("perf", "stat", "--log-fd", "2", "-x,", "-e", "cycles,instructions," + ev, "echo", "1");
+                Collection<String> res = Utils.tryWith("perf", "stat", "--log-fd", "2", "--field-separator", ",", "--event", "cycles,instructions," + ev, "echo", "1");
                 if (res.isEmpty()) {
                     supportedEvents.add(ev);
                 }
@@ -131,9 +131,9 @@
     public Collection<String> addJVMInvokeOptions(BenchmarkParams params) {
         List<String> cmd = new ArrayList<String>();
         if (useDefaultStats) {
-            cmd.addAll(Arrays.asList("perf", "stat", "--log-fd", "2", "-x,", "-d", "-d", "-d"));
+            cmd.addAll(Arrays.asList("perf", "stat", "--log-fd", "2", "--field-separator", ",", "--detailed", "--detailed", "--detailed"));
         } else {
-            cmd.addAll(Arrays.asList("perf", "stat", "--log-fd", "2", "-x,", "-e", Utils.join(supportedEvents, ",")));
+            cmd.addAll(Arrays.asList("perf", "stat", "--log-fd", "2", "--field-separator", ",", "--event", Utils.join(supportedEvents, ",")));
         }
         if (isIncrementable) {
             cmd.addAll(Arrays.asList("-I", String.valueOf(incrementInterval)));
--- a/jmh-core/src/main/java/org/openjdk/jmh/profile/LinuxPerfProfiler.java	Thu Jun 25 22:31:55 2015 +0300
+++ b/jmh-core/src/main/java/org/openjdk/jmh/profile/LinuxPerfProfiler.java	Tue Jul 07 23:51:41 2015 +0300
@@ -65,7 +65,7 @@
             throw new ProfilerException(msgs.toString());
         }
 
-        Collection<String> delay = Utils.tryWith("perf", "stat", "--log-fd", "2", "-D", "1", "echo", "1");
+        Collection<String> delay = Utils.tryWith("perf", "stat", "--log-fd", "2", "--delay", "1", "echo", "1");
         isDelayed = delay.isEmpty();
     }
 
@@ -81,9 +81,9 @@
         }
 
         if (isDelayed) {
-            return Arrays.asList("perf", "stat", "--log-fd", "2", "-d", "-d", "-d", "-D", String.valueOf(delay));
+            return Arrays.asList("perf", "stat", "--log-fd", "2", "--detailed", "--detailed", "--detailed", "--delay", String.valueOf(delay));
         } else {
-            return Arrays.asList("perf", "stat", "--log-fd", "2", "-d", "-d", "-d");
+            return Arrays.asList("perf", "stat", "--log-fd", "2", "--detailed", "--detailed", "--detailed");
         }
     }