Unable to find the resource: /META-INF/BenchmarkList
gradle
Exception in thread "main" java.lang.RuntimeException: ERROR: Unable to find the resource: /META-INF/BenchmarkList
Solution
dependencies {
implementation group: 'org.openjdk.jmh', name: 'jmh-core', version: '1.29'
//implementation group: 'org.openjdk.jmh', name: 'jmh-generator-annprocess', version: '1.29'
annotationProcessor group: 'org.openjdk.jmh', name: 'jmh-generator-annprocess', version: '1.29'
}
得用annotationProcessor
引用依赖,在build->classes会生成MATE-INF目录
OptionsBuilder 方法说明
- shouldFailOnError(false) 碰到错时是否停止,停止将不会出报告,只是抛出异常,默认是false。
查看benchmarks.jar参数
java -jar benchmarks.jar -h
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".
Command line options usually take precedence over annotations.
[arguments] Benchmarks to run (regexp+). (default: .*)
-bm <mode> Benchmark mode. Available modes are: [Throughput/thrpt,
AverageTime/avgt, SampleTime/sample, SingleShotTime/ss,
All/all]. (default: Throughput)
-bs <int> Batch size: number of benchmark method calls per
operation. Some benchmark modes may ignore this
setting, please check this separately. (default:
1)
要查找命令可以这么写:java -jar benchmarks.jar -h 2>&1 | grep wi