@@ -668,35 +668,35 @@ Learn how to write benchmarks in [JMH samples](https://hg.openjdk.java.net/code-
668
668
669
669
List of available options can be printed by:
670
670
``` sh
671
- sbt jsoniter-scala-benchmarkJVM/clean ' jsoniter-scala-benchmarkJVM/jmh: run -h'
671
+ sbt jsoniter-scala-benchmarkJVM/clean ' jsoniter-scala-benchmarkJVM/Jmh/ run -h'
672
672
```
673
673
674
674
Results of benchmark can be stored in different formats: * .csv, * .json, etc. All supported formats can be listed by:
675
675
``` sh
676
- sbt jsoniter-scala-benchmarkJVM/clean ' jsoniter-scala-benchmarkJVM/jmh: run -lrf'
676
+ sbt jsoniter-scala-benchmarkJVM/clean ' jsoniter-scala-benchmarkJVM/Jmh/ run -lrf'
677
677
```
678
678
679
679
JMH allows running benchmarks with different profilers, to get a list of supported use (can require entering of user
680
680
password):
681
681
``` sh
682
- sbt jsoniter-scala-benchmarkJVM/clean ' jsoniter-scala-benchmarkJVM/jmh: run -lprof'
682
+ sbt jsoniter-scala-benchmarkJVM/clean ' jsoniter-scala-benchmarkJVM/Jmh/ run -lprof'
683
683
```
684
684
685
685
Help for profiler options can be printed by following command (` <profiler_name> ` should be replaced by the name of the
686
686
supported profiler from the command above):
687
687
``` sh
688
- sbt jsoniter-scala-benchmarkJVM/clean ' jsoniter-scala-benchmarkJVM/jmh: run -prof <profiler_name>:help'
688
+ sbt jsoniter-scala-benchmarkJVM/clean ' jsoniter-scala-benchmarkJVM/Jmh/ run -prof <profiler_name>:help'
689
689
```
690
690
691
691
For parametrized benchmarks the constant value(s) for parameter(s) can be set by ` -p ` option:
692
692
``` sh
693
- sbt jsoniter-scala-benchmarkJVM/clean ' jsoniter-scala-benchmarkJVM/jmh: run -p size=1,10,100,1000 ArrayOf.*'
693
+ sbt jsoniter-scala-benchmarkJVM/clean ' jsoniter-scala-benchmarkJVM/Jmh/ run -p size=1,10,100,1000 ArrayOf.*'
694
694
```
695
695
696
696
To see throughput with the allocation rate of generated codecs run benchmarks with GC profiler using the following
697
697
command:
698
698
``` sh
699
- sbt jsoniter-scala-benchmarkJVM/clean ' jsoniter-scala-benchmarkJVM/jmh: run -prof gc .*Reading.*'
699
+ sbt jsoniter-scala-benchmarkJVM/clean ' jsoniter-scala-benchmarkJVM/Jmh/ run -prof gc .*Reading.*'
700
700
```
701
701
702
702
Results that are stored in JSON can be easy plotted in [ JMH Visualizer] ( https://jmh.morethan.io/ ) by drugging & dropping
@@ -705,13 +705,13 @@ of your file to the drop zone or using the `source` parameter with an HTTP link
705
705
706
706
On Linux the perf profiler can be used to see CPU event statistics normalized per ops:
707
707
``` sh
708
- sbt jsoniter-scala-benchmarkJVM/clean ' jsoniter-scala-benchmarkJVM/jmh: run -prof perfnorm TwitterAPIReading.jsoniterScala'
708
+ sbt jsoniter-scala-benchmarkJVM/clean ' jsoniter-scala-benchmarkJVM/Jmh/ run -prof perfnorm TwitterAPIReading.jsoniterScala'
709
709
```
710
710
711
711
Also, it can be run with a specified list of events. Here is an example of benchmarking using 16 threads to check of CPU
712
712
stalls:
713
713
``` sh
714
- sbt jsoniter-scala-benchmarkJVM/clean ' jsoniter-scala-benchmarkJVM/jmh: run -t 16 -prof "perfnorm:event=cycles,instructions,uops_executed.core,uops_executed.stall_cycles,cache-references,cache-misses,cycle_activity.stalls_total,cycle_activity.stalls_mem_any,cycle_activity.stalls_l3_miss,cycle_activity.stalls_l2_miss,cycle_activity.stalls_l1d_miss" .*'
714
+ sbt jsoniter-scala-benchmarkJVM/clean ' jsoniter-scala-benchmarkJVM/Jmh/ run -t 16 -prof "perfnorm:event=cycles,instructions,uops_executed.core,uops_executed.stall_cycles,cache-references,cache-misses,cycle_activity.stalls_total,cycle_activity.stalls_mem_any,cycle_activity.stalls_l3_miss,cycle_activity.stalls_l2_miss,cycle_activity.stalls_l1d_miss" .*'
715
715
```
716
716
717
717
List of available events for the perf profiler can be retrieved by the following command:
@@ -721,7 +721,7 @@ perf list
721
721
722
722
To get a result for some benchmarks with an in-flight recording file from JFR profiler use command like this:
723
723
``` sh
724
- sbt jsoniter-scala-benchmarkJVM/clean ' jsoniter-scala-benchmarkJVM/jmh: run -prof "jfr:dir=target/jfr-reports" -wi 10 -i 60 TwitterAPIReading.jsoniterScala'
724
+ sbt jsoniter-scala-benchmarkJVM/clean ' jsoniter-scala-benchmarkJVM/Jmh/ run -prof "jfr:dir=target/jfr-reports" -wi 10 -i 60 TwitterAPIReading.jsoniterScala'
725
725
```
726
726
You will get the profile in the ` jsoniter-scala-benchmark/jvm/target/jfr-reports ` directory.
727
727
@@ -734,7 +734,7 @@ sudo sysctl kernel.kptr_restrict=0
734
734
735
735
Then use command like this:
736
736
``` sh
737
- sbt -java-home /usr/lib/jvm/jdk-21 jsoniter-scala-benchmarkJVM/clean ' jsoniter-scala-benchmarkJVM/jmh: run -prof "async:dir=target/async-reports;interval=1000000;output=flamegraph;libPath=/opt/async-profiler/lib/libasyncProfiler.so" -jvmArgsAppend "-XX:+UnlockDiagnosticVMOptions -XX:+DebugNonSafepoints" --p size=128 -wi 5 -i 10 jsoniterScala'
737
+ sbt -java-home /usr/lib/jvm/jdk-21 jsoniter-scala-benchmarkJVM/clean ' jsoniter-scala-benchmarkJVM/Jmh/ run -prof "async:dir=target/async-reports;interval=1000000;output=flamegraph;libPath=/opt/async-profiler/lib/libasyncProfiler.so" -jvmArgsAppend "-XX:+UnlockDiagnosticVMOptions -XX:+DebugNonSafepoints" --p size=128 -wi 5 -i 10 jsoniterScala'
738
738
```
739
739
Now you can open direct and reverse flame graphs in the ` jsoniter-scala-benchmark/jvmtarget/async-reports ` directory.
740
740
@@ -771,7 +771,7 @@ Perf events:
771
771
Following command can be used to profile and print assembly code of the hottest methods, but it requires [ a setup of
772
772
` hsdis ` library to make PrintAssembly feature enabled] ( https://builds.shipilev.net/hsdis/ ) :
773
773
``` sh
774
- sbt jsoniter-scala-benchmarkJVM/clean ' jsoniter-scala-benchmarkJVM/jmh: run -prof perfasm -wi 10 -i 10 -p size=128 BigIntReading.jsoniterScala'
774
+ sbt jsoniter-scala-benchmarkJVM/clean ' jsoniter-scala-benchmarkJVM/Jmh/ run -prof perfasm -wi 10 -i 10 -p size=128 BigIntReading.jsoniterScala'
775
775
```
776
776
777
777
More info about extras, options, and ability to generate flame graphs see in [ Sbt-JMH docs] ( https://github.com/ktoso/sbt-jmh )
0 commit comments