Perfasm fails on Fedora/OpenJDK

Clément MATHIEU clement at unportant.info
Mon Aug 11 21:36:35 UTC 2014


Hi JMHers,

I played a bit with perfasm today and found an integration issue making
perfasm unusable on Fedora 20. I believe that my setup is not specific
and any Fedora user using the OpenJDK package will face the same issue.

Basically running perfasm always leads to this error message:

---
        WARNING: The perf event count is suspiciously low (1). The performance data might be
        inaccurate or misleading. Try to do the profiling again, or tune up the sampling frequency.
---

I did play a little bit with a debugger to troubleshoot the issue. The
outcome is that the name of the process returned by perf on Fedora is
java-abrt and not java. LinuxPerfAsmProfiler makes the assumption that
the name of the process is "java" and discard all the events. 

The following ugly patch against the main branch does solve the issue.
However I am not sure it will not cause harm on other platforms. 

diff -r 9b2561a5e071 jmh-core/src/main/java/org/openjdk/jmh/profile/LinuxPerfAsmProfiler.java
--- a/jmh-core/src/main/java/org/openjdk/jmh/profile/LinuxPerfAsmProfiler.java	Thu Aug 07 00:00:14 2014 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/profile/LinuxPerfAsmProfiler.java	Mon Aug 11 23:19:45 2014 +0200
@@ -724,7 +724,7 @@
                 String lib = elems[elems.length - 1];
                 lib = lib.substring(lib.lastIndexOf("/") + 1, lib.length()).replace("(", "").replace(")", "");
 
-                if (process.equalsIgnoreCase("java")) {
+                if (process.toLowerCase().startsWith("java")) {
                     try {
                         Double time = Double.valueOf(strTime);
                         if (startTime == null) {


Is this issue already known ? What would be the best way to solve it ?
Not sure if it should handled on the JMH side or if we should ask Fedora
to not change the name of the process. I can provide more information
about this java-abrt weirdness if needed.


Regards,

Clément MATHIEU



More information about the jmh-dev mailing list