Add GC metric to build statistic
This commit is contained in:
committed by
Space Team
parent
c16dabba1f
commit
a34657195b
+3
@@ -73,6 +73,9 @@ class BuildReportsIT : KGPBaseTest() {
|
||||
//for non-incremental builds
|
||||
assertTrue { report.contains("Build attributes:") }
|
||||
assertTrue { report.contains("REBUILD_REASON:") }
|
||||
//gc metrics
|
||||
assertTrue {report.contains("GC count:")}
|
||||
assertTrue {report.contains("GC time:")}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
@@ -32,6 +32,8 @@ data class CompileStatisticsData(
|
||||
//TODO think about it,time in milliseconds
|
||||
val buildTimesMetrics: Map<BuildTime, Long>,
|
||||
val performanceMetrics: Map<BuildPerformanceMetric, Long>,
|
||||
val gcTimeMetrics: Map<String, Long>?,
|
||||
val gcCountMetrics: Map<String, Long>?,
|
||||
val type: String = BuildDataType.TASK_DATA.name
|
||||
)
|
||||
|
||||
|
||||
+1
-1
@@ -171,7 +171,7 @@ internal class TaskRecord(
|
||||
override val buildMetrics: BuildMetrics,
|
||||
override val didWork: Boolean,
|
||||
override val skipMessage: String?,
|
||||
override val icLogLines: List<String>
|
||||
override val icLogLines: List<String>,
|
||||
) : BuildOperationRecord {
|
||||
override val isFromKotlinPlugin: Boolean = classFqName.startsWith("org.jetbrains.kotlin")
|
||||
}
|
||||
|
||||
+17
@@ -85,6 +85,9 @@ internal class PlainTextBuildReportWriter(
|
||||
if (newLineBetweenSections) p.println()
|
||||
|
||||
printBuildAttributes(buildMetrics.buildAttributes)
|
||||
if (newLineBetweenSections) p.println()
|
||||
|
||||
printGcMetrics(buildMetrics.gcMetrics)
|
||||
}
|
||||
|
||||
private fun printBuildTimes(buildTimes: BuildTimes) {
|
||||
@@ -162,6 +165,20 @@ internal class PlainTextBuildReportWriter(
|
||||
}
|
||||
}
|
||||
|
||||
private fun printGcMetrics(gcMetrics: GcMetrics) {
|
||||
val allGcMetrics = gcMetrics.asMap()
|
||||
if (allGcMetrics.isEmpty()) return
|
||||
p.withIndent("GC metrics:") {
|
||||
for (gcMetric in allGcMetrics) {
|
||||
p.println("${gcMetric.key}:")
|
||||
p.withIndent {
|
||||
p.println("GC count: ${gcMetric.value.count}")
|
||||
p.println("GC time: ${gcMetric.value.time}")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun printTaskOverview(build: BuildExecutionData) {
|
||||
var allTasksTimeMs = 0L
|
||||
var kotlinTotalTimeMs = 0L
|
||||
|
||||
+3
-1
@@ -81,7 +81,9 @@ internal fun prepareData(
|
||||
kotlinVersion = kotlinVersion,
|
||||
buildUuid = uuid,
|
||||
finishTime = System.currentTimeMillis(),
|
||||
compilerArguments = taskExecutionResult?.taskInfo?.compilerArguments?.asList() ?: emptyList()
|
||||
compilerArguments = taskExecutionResult?.taskInfo?.compilerArguments?.asList() ?: emptyList(),
|
||||
gcCountMetrics = buildMetrics?.gcMetrics?.asGcCountMap(),
|
||||
gcTimeMetrics = buildMetrics?.gcMetrics?.asGcTimeMap()
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user