kotlinx-benchmark icon indicating copy to clipboard operation
kotlinx-benchmark copied to clipboard

Setup JHM profiler

Open mcpiroman opened this issue 3 years ago • 8 comments

For Jvm-only setup, can I use profiler as described in https://github.com/openjdk/jmh/blob/master/jmh-samples/src/main/java/org/openjdk/jmh/samples/JMHSample_35_Profilers.java?

mcpiroman avatar Sep 09 '21 16:09 mcpiroman

Any news on this?

elect86 avatar Dec 14 '21 05:12 elect86

@mcpiroman @elect86 Could you clarify your questions? There is simple example with JMH https://github.com/Kotlin/kotlinx-benchmark/blob/master/examples/java/, maybe it could answer your question?

max-kammerer avatar Dec 15 '21 09:12 max-kammerer

Nope, this is what we'd like

elect86 avatar Dec 15 '21 10:12 elect86

@elect86 Sorry, but pointing to line doesn't explain your problem and difficulties. Could you explain them?

max-kammerer avatar Dec 16 '21 09:12 max-kammerer

Ok, I'll try to explain better.

From the main docs in the sample

JMH has a few very handy profilers that help to understand your benchmarks. While these profilers are not the substitute for full-fledged external profilers, in many cases, these are handy to quickly dig into the benchmark behavior. When you are doing many cycles of tuning up the benchmark code itself, it is important to have a quick turnaround for the results.

Among these, there is for example one regarding the GC. You can use it by passing -prof gc on the cli. It'll print something like here:

Benchmark Mode Cnt Score Error Units

ScalarReplacement.single avgt 15 1.919 ± 0.002 ns/op ScalarReplacement.single:·gc.alloc.rate avgt 15 ≈ 10⁻⁴ MB/sec ScalarReplacement.single:·gc.alloc.rate.norm avgt 15 ≈ 10⁻⁶ B/op ScalarReplacement.single:·gc.count avgt 15 ≈ 0 counts

It's useful to check, for example, if the EA kicks in and helps avoiding allocations

I'd like to have the possibility to set it in kotlinx-benchmark as well. I tried param and advanced, but it didn't work

elect86 avatar Dec 16 '21 09:12 elect86

@elect86 Thank you for clarification! I hope @qurbonzoda could answer your question after coming back from vacation

max-kammerer avatar Jan 04 '22 08:01 max-kammerer

Profiler is a very important feature for JMH users, hope to support soon :)

guohao avatar Jan 04 '22 09:01 guohao

Hi everyone, You can still run a specific profiler (-prof <profiler>) by running the jar file that the <target>BenchmarkJar task generates. The generated jar file is located under the build/benchmarks/<target>/jars directory.

Currently, there is no way to define a profiler in the configuration script. Would a configuration option be helpful for you?

qurbonzoda avatar Jan 12 '22 09:01 qurbonzoda