Running JMH with dtraceasm profiler on macOS

Patrick Concannon patrick.concannon at oracle.com
Wed Apr 8 08:51:14 UTC 2020


Hi Vsevolod,


Thanks for your reply.

I've tried this against several benchmarks of my own and in the JDK, and 
the problem persists.


OSX version: macOS Mojavae version 10.14.6

JDK: 13.0.2


When running with csrutil enabled, and I run the command you suggested 
-- "sudo dtrace -n 'profile-1001 /arg1/ { printf("%d 0x%lx %d", pid, 
arg1, timestamp); ufunc(arg1)}" -- I get the snippet included below :

...

   3  31760                    :profile-1001 43 0x11b8b1801 
177820318982  0x11b8b1801
   0  31760                    :profile-1001 409 0x7fff6333b6b2 
177821293648  0x7fff6333b6b2
   1  31760                    :profile-1001 43 0x7fff64acf5bc 
177821293649  0x7fff64acf5bc
   0  31760                    :profile-1001 43 0x10f3dc370 
177822292254  0x10f3dc370
   1  31760                    :profile-1001 43 0x10f3da425 
177822292257  0x10f3da425
dtrace: error on enabled probe ID 1 (ID 31760: profile:::profile-1001): 
invalid user access in action #4
   1  31760                    :profile-1001 43 0x11b9cbeb7 
177823298370  0x11b9cbeb7
dtrace: error on enabled probe ID 1 (ID 31760: profile:::profile-1001): 
invalid user access in action #4
   2  31760                    :profile-1001 412 0x7fff64c4daa9 
177824314791  0x7fff64c4daa9
   0  31760                    :profile-1001 43 0x11b9cbfe9 
177825291165  0x11b9cbfe9

...

When I disable csrutil these errors disappear. However, neither option 
seems to effect the output when running JMH with the dtraceasm profiler, 
which again is similar to the error in my original post:

# Processing profiler results: DTraceAsmProfiler Exception in thread 
"main" java.lang.IllegalStateException: []
     at 
org.openjdk.jmh.profile.DTraceAsmProfiler.afterTrial(DTraceAsmProfiler.java:92)
     at org.openjdk.jmh.runner.Runner.runSeparate(Runner.java:685)
     at org.openjdk.jmh.runner.Runner.runBenchmarks(Runner.java:568)
     at org.openjdk.jmh.runner.Runner.internalRun(Runner.java:320)
     at org.openjdk.jmh.runner.Runner.run(Runner.java:209)
     at org.openjdk.jmh.Main.main(Main.java:71)


Kind regards,

Patrick


On 24/03/2020 16:30, Vsevolod Tolstopyatov wrote:
> Hi,
>
> Could you please specify your OS X version, JDK version (or, if it is 
> built from sources, revision number) and whether this problem 
> reproduces with any JMH benchmark or with a specific one?
>
> Also, could you please show the output of the "csrutil status" command 
> and check whether the following command "sudo dtrace -n 'profile-1001 
> /arg1/ { printf("%d 0x%lx %d", pid, arg1, timestamp); ufunc(arg1)}'" 
> prints any errors?
>
> --
> Best regards,
> Tolstopyatov Vsevolod
>
>
> On Thu, Feb 20, 2020 at 12:47 PM Patrick Concannon 
> <patrick.concannon at oracle.com <mailto:patrick.concannon at oracle.com>> 
> wrote:
>
>     Hi,
>
>     I am having trouble getting the dtraceasm profiler to work with
>     JMH on
>     macOS.
>
>
>     I was able to build the binutils-2.30 successfully, and I see the
>     expected output when I run:
>
>     java -XX:+UnlockDiagnosticVMOptions -XX:+PrintAssembly
>
>
>     However, when I go to run JMH with MICRO="OPTIONS=-prof dtraceasm;
>     ... I
>     get the error below:
>
>     # Processing profiler results: DTraceAsmProfiler Exception in thread
>     "main" java.lang.IllegalStateException: []
>          at
>     org.openjdk.jmh.profile.DTraceAsmProfiler.afterTrial(DTraceAsmProfiler.java:92)
>          at org.openjdk.jmh.runner.Runner.runSeparate(Runner.java:685)
>          at org.openjdk.jmh.runner.Runner.runBenchmarks(Runner.java:568)
>          at org.openjdk.jmh.runner.Runner.internalRun(Runner.java:320)
>          at org.openjdk.jmh.runner.Runner.run(Runner.java:209)
>          at org.openjdk.jmh.Main.main(Main.java:71)
>
>
>     I was wondering if anyone has experience setting up this profiler on
>     macOS, and has encountered this error before?
>
>
>     Kind regards,
>
>     Patrick
>


More information about the jmh-dev mailing list