JMH and ocperf

Nitsan Wakart nitsanw at
Fri Nov 18 06:49:00 UTC 2016

+1, sounds like a good idea. Note however that ocperf uses the PERF environment variable already:

So maybe use JMH_PERF instead. 

    On Thursday, November 17, 2016 10:57 PM, Sergey Melnikov <melnikov.sergey.v at> wrote:

 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