JMH and ocperf

Sergey Melnikov melnikov.sergey.v at
Thu Nov 17 20:57:08 UTC 2016

Hi All,

I'm using JMH and it covers my need except one small thing. I can't
measure sophisticated Intel's performance monitoring counters (PMU)
and analyze annotated assembler output from JMH.
For example, there are a lot of counters for brunches
(mispredicted|taken|...) on my Haswell workstation. But linux perf
doesn't support them directly (it requires to pass something terrible
like '-e 'cpu/event=0x3c,umask=0x0,any=1/').

The good tool for this situation is ocperf by Andi Kleen. ocperf is a
small python wrapper over perf. ocperf lets to use symbolical PMU
counter names instead of raw PMU event. Moreover, ocperf is able to
display errata for each available PMU for the particular hardware.

So, I'd like to propose to modify JMH a bit: to let user to overwrite
'perf' executable name via environment variable. It let to use ocperf
with JMH and to specify symbolic names via JMH parameters.

Therefore, JMH run will look like:

$ java -jar target/benchmarks.jar -prof

Alexey, what do you think, if I implement this functionality, will it
be possible to merge fix to trunk?


More information about the jmh-dev mailing list