Run specific JMH benchmarks from jar

强颜欢笑 提交于 2020-01-03 13:30:31

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!