sbt-jmh icon indicating copy to clipboard operation
sbt-jmh copied to clipboard

How to use async-profiler with multiple options

Open lenguyenthanh opened this issue 11 months ago • 6 comments

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

lenguyenthanh avatar Jul 08 '23 14:07 lenguyenthanh

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

guizmaii avatar Jul 08 '23 14:07 guizmaii

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

lenguyenthanh avatar Jul 08 '23 15:07 lenguyenthanh

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

guizmaii avatar Jul 08 '23 15:07 guizmaii

thank @guizmaii, your solution works like a charm.

lenguyenthanh avatar Jul 08 '23 15:07 lenguyenthanh

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.

pdziedzic-sumo avatar Nov 04 '23 13:11 pdziedzic-sumo

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

aherlihy avatar Feb 18 '24 17:02 aherlihy