@@ -17,28 +17,33 @@ object Bench {
1717 val iterations = if (intArgs.length > 1 ) intArgs(1 ).toInt else 20
1818 val forks = if (intArgs.length > 2 ) intArgs(2 ).toInt else 1
1919
20- val benchmarks = if (args1.length > 0 ) args1(0 ) else " .*"
21- val outputFile = if (args1.length > 2 ) args1(2 ) else " output.csv"
20+ if (args1.isEmpty) {
21+ println(" You should specify which benchmarks to run." )
22+ return
23+ }
2224
2325 var builder = new OptionsBuilder ()
24- .shouldFailOnError(true )
25- .jvmArgs(" -Xms2G" , " -Xmx2G" )
26- .mode(Mode .AverageTime )
27- .timeUnit(TimeUnit .NANOSECONDS )
28- .warmupIterations(warmup)
29- .warmupTime(TimeValue .milliseconds(750 ))
30- .measurementIterations(iterations)
31- .measurementTime(TimeValue .milliseconds(500 ))
32- .forks(forks)
33- .include(benchmarks)
34- .resultFormat(ResultFormatType .CSV )
35- .result(outputFile)
36-
37- if (args1.length > 1 ) {
26+ .shouldFailOnError(true )
27+ .jvmArgs(" -Xms2G" , " -Xmx2G" )
28+ .mode(Mode .AverageTime )
29+ .timeUnit(TimeUnit .NANOSECONDS )
30+ .warmupIterations(warmup)
31+ .warmupTime(TimeValue .milliseconds(750 ))
32+ .measurementIterations(iterations)
33+ .measurementTime(TimeValue .milliseconds(500 ))
34+ .forks(forks)
35+ .include(args1(0 ))
36+ .resultFormat(ResultFormatType .CSV )
37+
38+ if (args1.length > 1 && args1(1 ) != " --" ) {
3839 for ((param, values) <- paramsFromFile(args1(1 )))
3940 builder = builder.param(param, values : _* )
4041 }
4142
43+ if (args1.length > 2 ) {
44+ builder = builder.result(args1(2 ))
45+ }
46+
4247 val runner = new Runner (builder.build) // full access to all JMH features, you can also provide a custom output Format here
4348 runner.run // actually run the benchmarks
4449 }
0 commit comments