问题
I have a several heavy benchmark classes annotated with @Benchmark. After bulding jar with benchmarks I can run all of them with following command
java -Xmx4G -jar benchmarks.jar -f 1 -wi 3 -i 10
How to specify benchmarks to run, if I don't want to run all of them?
回答1:
When in doubt, ask for command line help. In fact, running the JAR with -h
yields:
Usage: java -jar ... [regexp*] [options]
[opt] means optional argument.
<opt> means required argument.
"+" means comma-separated list of values.
"time" arguments accept time suffixes, like "100ms".
[arguments] Benchmarks to run (regexp+).
So, supplying a regular expression as the filter helps.
回答2:
This is the exact command:
java -Xmx4G -jar benchmarks.jar YourClass -f 1 -wi 3 -i 10
来源:https://stackoverflow.com/questions/34660599/run-specific-jmh-benchmarks-from-jar