perfasm "perf script" invocation

Tavian Barnes tavianator at tavianator.com
Tue Jul 7 15:45:49 UTC 2015


I suspect this might have changed in newer perf versions (otherwise it
never would have worked), but according on my computer (perf version
4.1),

$ perf script -h
...
    -F, --fields <str>    comma separated output fields prepend with
'type:'. Valid types: hw,sw,trace,raw. Fields:
comm,tid,pid,time,cpu,event,trace,ip,sym,dso,addr,symoff,period
...
    -f, --force           don't complain, do it

Therefore, I propose this patch, which fixes perfasm for me:

diff -r 29564342b418
jmh-core/src/main/java/org/openjdk/jmh/profile/LinuxPerfAsmProfiler.java
--- 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 11:38:05 2015 -0400
@@ -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",
"-F", "time,event,ip,sym,dso", "-i", perfBinData);
             Process p = pb.start();

             // drain streams, else we might lock up

Without it, I get:

Perf output processed (skipped 5.052 seconds):
 Column 1: cycles (0 events)
 Column 2: instructions (0 events)
...
WARNING: The perf event count is suspiciously low (0). The performance
data might be
inaccurate or misleading. Try to do the profiling again, or tune up
the sampling frequency.


More information about the jmh-dev mailing list