[Native][tests] Don't log memory usage in Gradle build
Memory logging has been moved to the Native test infrastructure. It is performed during Gradle test runner execution.
This commit is contained in:
@@ -1,4 +1,3 @@
|
|||||||
import org.gradle.internal.util.NumberUtil.formatBytes
|
|
||||||
import org.jetbrains.kotlin.ideaExt.idea
|
import org.jetbrains.kotlin.ideaExt.idea
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
@@ -139,31 +138,16 @@ fun nativeTest(taskName: String, vararg tags: String) = projectTest(
|
|||||||
includeTags(*tags)
|
includeTags(*tags)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun formatExecutionParameters() = buildString {
|
|
||||||
appendLine("$path parallel test execution parameters:")
|
|
||||||
append(" Available CPU cores = $availableCpuCores")
|
|
||||||
systemProperties.filterKeys { it.startsWith("junit.jupiter") }.toSortedMap().forEach { (key, value) ->
|
|
||||||
append("\n $key = $value")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun formatMemoryUsage(before: Boolean) = buildString {
|
|
||||||
with(Runtime.getRuntime()) {
|
|
||||||
appendLine("$path (${if (before) "before" else "after"}) memory info:")
|
|
||||||
appendLine(" Max memory (-Xmx) = ${formatBytes(maxMemory())}")
|
|
||||||
appendLine(" Allocated memory = ${formatBytes(totalMemory())}")
|
|
||||||
appendLine(" Used memory = ${formatBytes(totalMemory() - freeMemory())}")
|
|
||||||
append(" Free memory = ${formatBytes(freeMemory())}")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
doFirst {
|
doFirst {
|
||||||
logger.info(formatExecutionParameters())
|
logger.info(
|
||||||
logger.info(formatMemoryUsage(before = true))
|
buildString {
|
||||||
}
|
appendLine("$path parallel test execution parameters:")
|
||||||
|
append(" Available CPU cores = $availableCpuCores")
|
||||||
doLast {
|
systemProperties.filterKeys { it.startsWith("junit.jupiter") }.toSortedMap().forEach { (key, value) ->
|
||||||
logger.info(formatMemoryUsage(before = false))
|
append("\n $key = $value")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
doFirst {
|
doFirst {
|
||||||
|
|||||||
Reference in New Issue
Block a user