Commit cd0d11f7 authored by Noric Couderc's avatar Noric Couderc

Added options for running a short benchmarks

For testing.
parent 5740c193
......@@ -2,11 +2,13 @@ package se.lth.cs.jmh.commandline
import com.github.ajalt.clikt.core.CliktCommand
import com.github.ajalt.clikt.parameters.options.default
import com.github.ajalt.clikt.parameters.options.flag
import com.github.ajalt.clikt.parameters.options.option
import com.github.ajalt.clikt.parameters.types.int
import com.github.ajalt.clikt.parameters.types.long
import org.openjdk.jmh.results.format.ResultFormatType
import org.openjdk.jmh.runner.Runner
import org.openjdk.jmh.runner.options.CommandLineOptions
import org.openjdk.jmh.runner.options.OptionsBuilder
import org.openjdk.jmh.runner.options.TimeValue
import se.lth.cs.jmh.JMHTimedRunner
......@@ -48,6 +50,12 @@ class JMHCommandLine : CliktCommand() {
val infoFileName : String? by option("--info-file", "-p",
help="File name to write data about JMH run")
/**
* A field to activate a smaller run to test things.
*/
val quickBenchmark : Boolean by option("--quick-bench", "-q",
help="Run a smaller benchmark").flag()
override fun run() {
val seedsText = IntRange(0, numberSeeds - 1)
.map { it.toString() }
......@@ -61,12 +69,19 @@ class JMHCommandLine : CliktCommand() {
.measurementIterations(measurementIterations)
.resultFormat(ResultFormatType.CSV)
.result(String.format("jmh-results-%s.csv", getCommit()))
.param("seed", *seedsText)
if (quickBenchmark) {
opts.param("seed", "0", "1", "2")
.include("List")
.param("baseStructureSize", "100000")
.param("applicationSize", "10", "100", "1000")
} else {
opts.param("seed", *seedsText)
.param("baseStructureSize", "0", "1000", "10000")
.param("applicationSize", "10", "100", "1000")
.build()
}
val r = JMHTimedRunner(opts)
val r = JMHTimedRunner(opts.build())
val results = r.runWithTime()
if (!infoFileName.isNullOrBlank()) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment