kotlinx-benchmark
kotlinx-benchmark copied to clipboard
Setup JHM profiler
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?
Any news on this?
@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?
Nope, this is what we'd like
@elect86 Sorry, but pointing to line doesn't explain your problem and difficulties. Could you explain them?
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 Thank you for clarification! I hope @qurbonzoda could answer your question after coming back from vacation
Profiler is a very important feature for JMH users, hope to support soon :)
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?