@@ -62,15 +62,16 @@ object Main extends Logging {
62
62
val runs = Opts .options[String ](" run" , short = " r" , help = " IDs of the test runs to include (or 'last')." ).map(_.toList).orElse(Opts (Nil ))
63
63
val benchs = Opts .options[String ](" benchmark" , short = " b" , help = " Glob patterns of benchmark names to include." ).map(_.toList).orElse(Opts (Nil ))
64
64
val extract = Opts .options[String ](" extract" , help = " Extractor pattern to generate parameters from names." ).map(_.toList).orElse(Opts (Nil ))
65
+ val regex = Opts .flag(" regex" , short = " re" , help = " Interpret extract pattern as a Java regular expression." ).orFalse
65
66
val scorePrecision = Opts .option[Int ](" score-precision" , help = " Precision of score and error in tables (default: 3)" ).withDefault(3 )
66
67
val queryResultsCommand = Command [GlobalOptions => Unit ](name = " results" , header =
67
68
" Query the database for test results and print them." ) {
68
69
val pivot = Opts .options[String ](" pivot" , help = " Parameter names to pivot in table output." ).map(_.toList).orElse(Opts (Nil ))
69
70
val raw = Opts .flag(" raw" , " Print raw JSON data instead of a table." ).orFalse
70
- (runs, benchs, extract, scorePrecision, pivot, raw).mapN { case (runs, benchs, extract, sp, pivot, raw) =>
71
+ (runs, benchs, extract, regex, scorePrecision, pivot, raw).mapN { case (runs, benchs, extract, regex , sp, pivot, raw) =>
71
72
{ go =>
72
73
if (raw && pivot.nonEmpty) logger.error(" Cannot pivot in raw output mode." )
73
- else queryResults(go, runs, benchs, extract, sp, pivot, raw)
74
+ else queryResults(go, runs, benchs, extract, regex, sp, pivot, raw)
74
75
}
75
76
}
76
77
}
@@ -79,8 +80,8 @@ object Main extends Logging {
79
80
val template = Opts .option[Path ](" template" , " HTML template containing file." ).orNone
80
81
val out = Opts .option[Path ](" out" , short = " o" , help = " Output file to generate, or '-' for stdout." ).orNone
81
82
val pivot = Opts .options[String ](" pivot" , help = " Parameter names to combine in a chart." ).map(_.toList).orElse(Opts (Nil ))
82
- (runs, benchs, extract, scorePrecision, pivot, template, out).mapN { case (runs, benchs, extract, sp, pivot, template, out) =>
83
- createChart(_, runs, benchs, extract, sp, pivot, template, out, args)
83
+ (runs, benchs, extract, regex, scorePrecision, pivot, template, out).mapN { case (runs, benchs, extract, regex , sp, pivot, template, out) =>
84
+ createChart(_, runs, benchs, extract, regex, sp, pivot, template, out, args)
84
85
}
85
86
}
86
87
@@ -168,12 +169,12 @@ object Main extends Logging {
168
169
}
169
170
}
170
171
171
- def queryResults (go : GlobalOptions , runs : Seq [String ], benchs : Seq [String ], extract : Seq [String ], scorePrecision : Int , pivot : Seq [String ], raw : Boolean ): Unit = try {
172
+ def queryResults (go : GlobalOptions , runs : Seq [String ], benchs : Seq [String ], extract : Seq [String ], regex : Boolean , scorePrecision : Int , pivot : Seq [String ], raw : Boolean ): Unit = try {
172
173
new Global (go).use { g =>
173
174
val multi = runs.size > 1
174
175
val allRs = g.dao.run(g.dao.checkVersion andThen g.dao.queryResults(runs))
175
176
.map { case (rr, runId) => RunResult .fromDb(rr, runId, multi) }
176
- val rs = RunResult .extract(extract, RunResult .filterByName(benchs, allRs)).toSeq
177
+ val rs = RunResult .extract(extract, regex, RunResult .filterByName(benchs, allRs)).toSeq
177
178
if (raw) {
178
179
print(" [" )
179
180
rs.zipWithIndex.foreach { case (r, idx) =>
@@ -258,12 +259,12 @@ object Main extends Logging {
258
259
case ex : PatternSyntaxException => logger.error(ex.toString)
259
260
}
260
261
261
- def createChart (go : GlobalOptions , runs : Seq [String ], benchs : Seq [String ], extract : Seq [String ], scorePrecision : Int , pivot : Seq [String ], template : Option [Path ], out : Option [Path ], cmdLine : Array [String ]): Unit = {
262
+ def createChart (go : GlobalOptions , runs : Seq [String ], benchs : Seq [String ], extract : Seq [String ], regex : Boolean , scorePrecision : Int , pivot : Seq [String ], template : Option [Path ], out : Option [Path ], cmdLine : Array [String ]): Unit = {
262
263
new Global (go).use { g =>
263
264
val multi = runs.size > 1
264
265
val allRs = g.dao.run(g.dao.checkVersion andThen g.dao.queryResults(runs))
265
266
.map { case (rr, runId) => RunResult .fromDb(rr, runId, multi) }
266
- val rs = RunResult .extract(extract, RunResult .filterByName(benchs, allRs)).toSeq
267
+ val rs = RunResult .extract(extract, regex, RunResult .filterByName(benchs, allRs)).toSeq
267
268
val allParamNames = rs.flatMap(_.params.keys).distinct.toVector
268
269
val pivotSet = pivot.toSet
269
270
val paramNames = allParamNames.filterNot(pivotSet.contains)
0 commit comments