sbt / sbt-jmh

"Trust no one, bench everything." - sbt plugin for JMH (Java Microbenchmark Harness)
Apache License 2.0
787 stars 91 forks source link

How to use async-profiler with multiple options #227

Open lenguyenthanh opened 1 year ago

lenguyenthanh commented 1 year ago

I'm trying to run jmh with async-profiler, but It seems async-profiler cannot recognize the seconds options, for example:

This doesn't recognize libPath option: bench / Jmh / run -rf json .*PerftBench* -prof async:output=flamegraph;libPath=path/async-profiler/build/libasyncProfiler.so

but this works for libPath but not output:

bench / Jmh / run -rf json .*PerftBench* -prof async:libPath=path/async-profiler/build/libasyncProfiler.so;output=flamegraph

guizmaii commented 1 year ago

Can you try with a , instead of a ; as a separator maybe?

I don't remember how but, IIRC, I used to use multiple options and it was working

lenguyenthanh commented 1 year ago

thanks! I tried, but changing from ; to , doesn't help. async:help states that I should use ;:

sbt:scalachess> bench / Jmh / run -rf json .PerftBench -prof async:help [info] running (fork) org.openjdk.jmh.Main -rf json .PerftBench -prof async:help [error] Profilers failed to initialize, exiting. [error] Usage: -prof :opt1=value1,value2;opt2=value3

guizmaii commented 1 year ago

I wonder if the issue is not with the libPath option. AFAIR, It never worked for me. I don't remember the installation process but I can see that I installed the .so and .dylib in (I'm on Mac):

/System/Volumes/Data/Users/jules/Library/Java/Extensions/libasyncProfiler.so
/System/Volumes/Data/Users/jules/Library/Java/Extensions/libasyncProfiler.dylib
lenguyenthanh commented 1 year ago

thank @guizmaii, your solution works like a charm.

pdziedzic-sumo commented 1 year ago

Hi, I just wanted upvote this problem - libPath needs to be the first option or it is ignored and the profiler doesn't load. Options following the libPath option (after a ';') are ignored.

aherlihy commented 8 months ago

If you put the -prof options between double quotes it works: bench/Jmh/run <other options> -prof "async:libPath=<path>;output=flamegraph"