diff --git a/kotlin-native/tools/performance-server/shared/src/main/kotlin/org/jetbrains/buildInfo/BuildInfo.kt b/kotlin-native/tools/performance-server/shared/src/main/kotlin/org/jetbrains/buildInfo/BuildInfo.kt index 2ced13b02a9..1ffc6000f88 100644 --- a/kotlin-native/tools/performance-server/shared/src/main/kotlin/org/jetbrains/buildInfo/BuildInfo.kt +++ b/kotlin-native/tools/performance-server/shared/src/main/kotlin/org/jetbrains/buildInfo/BuildInfo.kt @@ -8,6 +8,7 @@ package org.jetbrains.buildInfo import org.jetbrains.report.* import org.jetbrains.report.json.* +@JsExport data class Build(val buildNumber: String, val startTime: String, val finishTime: String, val branch: String, val commits: String, val failuresNumber: Int) { diff --git a/kotlin-native/tools/performance-server/src/main/kotlin/database/BenchmarksIndexesDispatcher.kt b/kotlin-native/tools/performance-server/src/main/kotlin/database/BenchmarksIndexesDispatcher.kt index 70d3aadd72b..d600a7b7e8c 100644 --- a/kotlin-native/tools/performance-server/src/main/kotlin/database/BenchmarksIndexesDispatcher.kt +++ b/kotlin-native/tools/performance-server/src/main/kotlin/database/BenchmarksIndexesDispatcher.kt @@ -122,7 +122,7 @@ class BenchmarksIndexesDispatcher(connector: ElasticSearchConnector, val feature "bool": { "must": [ { "match": { "benchmarks.metric": "$metricName" } }, - { "terms": { "benchmarks.name": [${samples.map { "\"${it.lowercase()}\"" }.joinToString()}] }} + { "terms": { "benchmarks.name": [${samples.joinToString { "\"$it\"" }}] }} ] } }, "inner_hits": { diff --git a/kotlin-native/tools/performance-server/src/main/kotlin/routes/route.kt b/kotlin-native/tools/performance-server/src/main/kotlin/routes/route.kt index 0af658db76e..6987362f561 100644 --- a/kotlin-native/tools/performance-server/src/main/kotlin/routes/route.kt +++ b/kotlin-native/tools/performance-server/src/main/kotlin/routes/route.kt @@ -231,6 +231,10 @@ internal fun orderedValues(values: List, buildElement: (T) -> CompositeBu fun urlParameterToBaseFormat(value: dynamic) = value.toString().replace("_", " ") +@JsExport +class ExportedPair(val first: T, val second: U) + + // Routing of requests to current server. fun router(connector: ElasticSearchConnector) { val express = require("express") @@ -451,14 +455,14 @@ fun router(connector: ElasticSearchConnector) { buildSuffix = request.query.buildSuffix } } - + getBuildsNumbers(type, branch, target, buildsCountToShow, buildInfoIndex, beforeDate, afterDate).then { buildNumbers -> if (aggregation == "geomean") { // Get geometric mean for samples. benchmarksDispatcher.getGeometricMean(metric, target, buildNumbers, normalize, excludeNames, buildSuffix).then { geoMeansValues -> success(orderedValues(geoMeansValues, { it -> it.first }, branch == "master") - .map { it.first.second to it.second }) + .map { ExportedPair(it.first.second, it.second) }) }.catch { errorResponse -> println("Error during getting geometric mean") println(errorResponse) @@ -468,7 +472,7 @@ fun router(connector: ElasticSearchConnector) { benchmarksDispatcher.getSamples(metric, target, samples, buildsCountToShow, buildNumbers, normalize, buildSuffix) .then { geoMeansValues -> success(orderedValues(geoMeansValues, { it -> it.first }, branch == "master") - .map { it.first.second to it.second }) + .map { ExportedPair(it.first.second, it.second) }) }.catch { errorResponse -> println("Error during getting samples") println(errorResponse) @@ -688,7 +692,7 @@ fun BenchmarksReport.normalizeBenchmarksSet(dataForNormalization: Map it.score / golden } ?: 0.0) + dataForNormalization[benchmarksList.key]?.get(0)?.score?.let { golden -> it.score.toDouble() / golden } ?: 0.0) } }.flatten() return BenchmarksReport(env, resultBenchmarksList, compiler) diff --git a/kotlin-native/tools/performance-server/ui/src/main/kotlin/main.kt b/kotlin-native/tools/performance-server/ui/src/main/kotlin/main.kt index 02a4a97822d..fe5e9de4b2b 100644 --- a/kotlin-native/tools/performance-server/ui/src/main/kotlin/main.kt +++ b/kotlin-native/tools/performance-server/ui/src/main/kotlin/main.kt @@ -53,6 +53,7 @@ fun getChartData(labels: List, valuesList: Collection>, fun getChartOptions(samples: Array, yTitle: String, classNames: Array? = null): dynamic { val chartOptions: dynamic = object {} chartOptions["fullWidth"] = true + chartOptions["low"] = 0 val paddingObject: dynamic = object {} paddingObject["right"] = 40 chartOptions["chartPadding"] = paddingObject