File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -173,3 +173,4 @@ subprojects {
173
173
174
174
apply from : rootProject. file(' gradle/compiler-version.gradle' )
175
175
apply from : rootProject. file(" gradle/dokka.gradle" )
176
+ apply from : rootProject. file(" gradle/benchmark-parsing.gradle" )
Original file line number Diff line number Diff line change
1
+ import groovy.json.JsonSlurper
2
+ import org.gradle.api.*
3
+
4
+ /**
5
+ * Utility for printing benchmark results.
6
+ * Results can be obtained with JMH flags
7
+ * -rf json -rff serialization-benchmark-results.json
8
+ */
9
+ class PrintBenchmarksTask extends DefaultTask {
10
+ private String fileName = " serialization-benchmark-results.json"
11
+
12
+ @TaskAction
13
+ def printBenchmarkJsonAsTeamcityStats () {
14
+ File jsonFile = project. file(fileName)
15
+ if (! jsonFile. exists()) throw new TaskExecutionException (this , new FileNotFoundException (" File $fileName not found" ))
16
+ def parsedJson = new JsonSlurper (). parseText(jsonFile. text)
17
+
18
+ parsedJson. each { v ->
19
+ def name = (v. benchmark - " kotlinx.benchmarks." )
20
+ def score = v. primaryMetric. score
21
+ println (" ##teamcity[buildStatisticValue key='" + name + " ' value='" + score + " ']" )
22
+ }
23
+ }
24
+ }
25
+
26
+ rootProject. tasks. register(" printBenchmarksJsonAsTeamcityStats" , PrintBenchmarksTask )
You can’t perform that action at this time.
0 commit comments