Added short summary report for all targets. (#2622)
This commit is contained in:
@@ -83,7 +83,7 @@ fun main(args: Array<String>) {
|
||||
OptionDescriptor(ArgType.String(), "output", "o", "Output file"),
|
||||
OptionDescriptor(ArgType.Double(), "eps", "e", "Meaningful performance changes", "0.5"),
|
||||
OptionDescriptor(ArgType.Boolean(), "short", "s", "Show short version of report", "false"),
|
||||
OptionDescriptor(ArgType.Choice(listOf("text", "html", "teamcity")),
|
||||
OptionDescriptor(ArgType.Choice(listOf("text", "html", "teamcity", "statistics")),
|
||||
"renders", "r", "Renders for showing information", "text", isMultiple = true),
|
||||
OptionDescriptor(ArgType.String(), "user", "u", "User access information for authorization")
|
||||
)
|
||||
|
||||
@@ -468,6 +468,26 @@ class HTMLRender: Render() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!report.addedBenchmarks.isEmpty()) {
|
||||
renderCollapsedData("Added", true) {
|
||||
table {
|
||||
attributes["class"] = "table table-sm table-striped table-hover"
|
||||
attributes["style"] = "width:initial; font-size: 11pt;"
|
||||
renderTableFromList(report.addedBenchmarks, "Added benchmarks")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!report.removedBenchmarks.isEmpty()) {
|
||||
renderCollapsedData("Removed", true) {
|
||||
table {
|
||||
attributes["class"] = "table table-sm table-striped table-hover"
|
||||
attributes["style"] = "width:initial; font-size: 11pt;"
|
||||
renderTableFromList(report.removedBenchmarks, "Removed benchmarks")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun BodyTag.renderPerformanceSummary(report: SummaryBenchmarksReport) {
|
||||
|
||||
@@ -31,6 +31,7 @@ abstract class Render {
|
||||
"text" -> TextRender()
|
||||
"html" -> HTMLRender()
|
||||
"teamcity" -> TeamCityStatisticsRender()
|
||||
"statistics" -> StatisticsRender()
|
||||
else -> error("Unknown render $name")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
package org.jetbrains.renders
|
||||
|
||||
import org.jetbrains.analyzer.*
|
||||
import org.jetbrains.report.BenchmarkResult
|
||||
|
||||
enum class Status {
|
||||
FAILED, FIXED, IMPROVED, REGRESSED, STABLE, UNSTABLE
|
||||
}
|
||||
|
||||
// Report render to short summary statistics.
|
||||
class StatisticsRender: Render() {
|
||||
override val name: String
|
||||
get() = "statistics"
|
||||
|
||||
private var content = StringBuilder()
|
||||
|
||||
override fun render(report: SummaryBenchmarksReport, onlyChanges: Boolean): String {
|
||||
val benchmarksWithChangedStatus = report.getBenchmarksWithChangedStatus()
|
||||
val newPasses = benchmarksWithChangedStatus
|
||||
.filter { it.current == BenchmarkResult.Status.PASSED }
|
||||
val newFailures = benchmarksWithChangedStatus
|
||||
.filter { it.current == BenchmarkResult.Status.FAILED }
|
||||
if (report.failedBenchmarks.isNotEmpty()) {
|
||||
content.append("failed: ${report.failedBenchmarks.size}\n")
|
||||
}
|
||||
val status = when {
|
||||
newFailures.isNotEmpty() -> {
|
||||
content.append("new failures: ${newFailures.size}\n")
|
||||
Status.FAILED
|
||||
}
|
||||
newPasses.isNotEmpty() -> {
|
||||
content.append("new passes: ${newPasses.size}\n")
|
||||
Status.FIXED
|
||||
}
|
||||
report.improvements.isNotEmpty() && report.regressions.isNotEmpty() -> {
|
||||
content.append("regressions: ${report.regressions.size}\nimprovements: ${report.improvements.size}")
|
||||
Status.UNSTABLE
|
||||
}
|
||||
report.improvements.isNotEmpty() && report.regressions.isEmpty() -> {
|
||||
content.append("improvements: ${report.improvements.size}")
|
||||
Status.IMPROVED
|
||||
}
|
||||
report.improvements.isEmpty() && report.regressions.isNotEmpty() -> {
|
||||
content.append("regressions: ${report.regressions.size}")
|
||||
Status.REGRESSED
|
||||
}
|
||||
else -> Status.STABLE
|
||||
}
|
||||
return """
|
||||
status: $status
|
||||
total: ${report.benchmarksNumber}
|
||||
""".trimIndent() + "\n$content"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user