Perfasm fails on Fedora/OpenJDK
Aleksey Shipilev
aleksey.shipilev at oracle.com
Mon Aug 11 23:04:41 UTC 2014
Hi Clement,
On 08/12/2014 01:36 AM, Clément MATHIEU wrote:
> 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.
Awwww.
> 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) {
This feels like an ugly fix, and it can capture more processes than
required...
But, the funny thing is, we don't need this check at all, since perf is
instrumenting the java process only. This check was used before to
separate the "data" lines from the other garbage, but now there is a
formatting check above. Therefore, we might as well remove it:
http://hg.openjdk.java.net/code-tools/jmh/rev/e739c4bf5798
Please check it works on your Fedora installation.
Thanks,
-Aleksey.
More information about the jmh-dev
mailing list