@@ -17,28 +17,33 @@ object Bench {
17
17
val iterations = if (intArgs.length > 1 ) intArgs(1 ).toInt else 20
18
18
val forks = if (intArgs.length > 2 ) intArgs(2 ).toInt else 1
19
19
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
+ }
22
24
23
25
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 ) != " --" ) {
38
39
for ((param, values) <- paramsFromFile(args1(1 )))
39
40
builder = builder.param(param, values : _* )
40
41
}
41
42
43
+ if (args1.length > 2 ) {
44
+ builder = builder.result(args1(2 ))
45
+ }
46
+
42
47
val runner = new Runner (builder.build) // full access to all JMH features, you can also provide a custom output Format here
43
48
runner.run // actually run the benchmarks
44
49
}
0 commit comments