Don't use aggregated GC metric for build reports
This commit is contained in:
committed by
Space Team
parent
a34657195b
commit
79fff92dc1
@@ -12,7 +12,10 @@ class GcMetrics : Serializable {
|
||||
|
||||
private val myGcMetrics = HashMap<String, GcMetric>()
|
||||
fun addAll(gcMetrics: GcMetrics) {
|
||||
myGcMetrics.putAll(gcMetrics.myGcMetrics)
|
||||
gcMetrics.myGcMetrics.forEach { (key, value) ->
|
||||
val gcMetric = myGcMetrics[key]
|
||||
myGcMetrics[key] = gcMetric?.let { gcMetric + value } ?: value
|
||||
}
|
||||
}
|
||||
|
||||
fun add(metric: String, value: GcMetric) {
|
||||
@@ -22,6 +25,8 @@ class GcMetrics : Serializable {
|
||||
fun asGcCountMap(): Map<String, Long> = myGcMetrics.mapValues { it.value.count }
|
||||
fun asGcTimeMap(): Map<String, Long> = myGcMetrics.mapValues { it.value.time }
|
||||
fun asMap(): Map<String, GcMetric> = myGcMetrics
|
||||
|
||||
fun isEmpty() = myGcMetrics.isEmpty()
|
||||
}
|
||||
data class GcMetric(
|
||||
val time: Long,
|
||||
@@ -30,4 +35,8 @@ data class GcMetric(
|
||||
operator fun minus(increment: GcMetric): GcMetric {
|
||||
return GcMetric(time - increment.time, count - increment.count)
|
||||
}
|
||||
|
||||
operator fun plus(increment: GcMetric?): GcMetric {
|
||||
return GcMetric(time + (increment?.time ?: 0), count + (increment?.count ?: 0))
|
||||
}
|
||||
}
|
||||
|
||||
+8
-6
@@ -52,7 +52,7 @@ internal class PlainTextBuildReportWriter(
|
||||
// TODO: If it is confusing, consider renaming "tasks" to "build operations" in this class.
|
||||
printBuildInfo(build)
|
||||
if (printMetrics) {
|
||||
printMetrics(build.aggregatedMetrics, newLineBetweenSections = true)
|
||||
printMetrics(build.aggregatedMetrics, aggregatedMetric = true)
|
||||
p.println()
|
||||
}
|
||||
printTaskOverview(build)
|
||||
@@ -77,18 +77,20 @@ internal class PlainTextBuildReportWriter(
|
||||
}
|
||||
}
|
||||
|
||||
private fun printMetrics(buildMetrics: BuildMetrics, newLineBetweenSections: Boolean = false) {
|
||||
private fun printMetrics(buildMetrics: BuildMetrics, aggregatedMetric: Boolean = false) {
|
||||
printBuildTimes(buildMetrics.buildTimes)
|
||||
if (newLineBetweenSections) p.println()
|
||||
if (aggregatedMetric) p.println()
|
||||
|
||||
printBuildPerformanceMetrics(buildMetrics.buildPerformanceMetrics)
|
||||
if (newLineBetweenSections) p.println()
|
||||
if (aggregatedMetric) p.println()
|
||||
|
||||
printBuildAttributes(buildMetrics.buildAttributes)
|
||||
if (newLineBetweenSections) p.println()
|
||||
|
||||
//TODO: KT-57310 Implement build GC metric in
|
||||
if (!aggregatedMetric) {
|
||||
printGcMetrics(buildMetrics.gcMetrics)
|
||||
}
|
||||
}
|
||||
|
||||
private fun printBuildTimes(buildTimes: BuildTimes) {
|
||||
val buildTimesMs = buildTimes.asMapMs()
|
||||
@@ -173,7 +175,7 @@ internal class PlainTextBuildReportWriter(
|
||||
p.println("${gcMetric.key}:")
|
||||
p.withIndent {
|
||||
p.println("GC count: ${gcMetric.value.count}")
|
||||
p.println("GC time: ${gcMetric.value.time}")
|
||||
p.println("GC time: ${formatTime(gcMetric.value.time)}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user