Clean ups in IDE performance tests output

This commit is contained in:
Vladimir Dolzhenko
2020-10-31 23:33:46 +01:00
parent 5fae769a90
commit d36511c094
3 changed files with 15 additions and 52 deletions
@@ -49,7 +49,7 @@ class Stats(
metricChildren.add( metricChildren.add(
Metric( Metric(
"", metricValue = calcMean.mean.toLong(), "_value", metricValue = calcMean.mean.toLong(),
hasError = hasError, hasError = hasError,
metricError = calcMean.stdDev.toLong(), metricError = calcMean.stdDev.toLong(),
rawMetrics = rawMetricChildren rawMetrics = rawMetricChildren
@@ -318,7 +318,7 @@ class Stats(
phaseName: String, phaseName: String,
profilerConfig: ProfilerConfig profilerConfig: ProfilerConfig
): PhaseProfiler { ): PhaseProfiler {
profilerConfig.name = "$testName${if (phaseName.isEmpty()) "" else "-"+phaseName}" profilerConfig.name = "$testName${if (phaseName.isEmpty()) "" else "-$phaseName"}"
profilerConfig.path = pathToResource("profile/${plainname(name)}") profilerConfig.path = pathToResource("profile/${plainname(name)}")
val profilerHandler = if (profilerConfig.enabled && !profilerConfig.warmup) val profilerHandler = if (profilerConfig.enabled && !profilerConfig.warmup)
ProfilerHandler.getInstance(profilerConfig) ProfilerHandler.getInstance(profilerConfig)
@@ -387,8 +387,6 @@ class Stats(
) )
benchmark.writeJson() benchmark.writeJson()
//rebuildGeomMean(agentName, buildBranch, buildId, simpleDateFormat, benchmark)
} }
} finally { } finally {
metric = null metric = null
@@ -396,31 +394,6 @@ class Stats(
//metrics.writeCSV(name, header) //metrics.writeCSV(name, header)
} }
private fun rebuildGeomMean(
agentName: String?,
buildBranch: String?,
buildId: Int?,
simpleDateFormat: SimpleDateFormat,
benchmark: Benchmark
) {
with(
Benchmark(
agentName = agentName,
buildBranch = buildBranch,
buildId = buildId,
benchmark = name,
synthetic = true,
name = "geomMean",
buildTimestamp = simpleDateFormat.format(Date())
)
) {
loadJson()
merge(benchmark)
writeJson()
}
}
companion object { companion object {
const val TEST_KEY = "test" const val TEST_KEY = "test"
const val ERROR_KEY = "error" const val ERROR_KEY = "error"
@@ -428,7 +401,7 @@ class Stats(
const val WARM_UP = "warm-up" const val WARM_UP = "warm-up"
const val GEOM_MEAN = "geomMean" const val GEOM_MEAN = "geomMean"
internal val extraMetricNames = setOf("", GEOM_MEAN, "mean", "stdDev") internal val extraMetricNames = setOf("", "_value", GEOM_MEAN, "mean", "stdDev")
inline fun runAndMeasure(note: String, block: () -> Unit) { inline fun runAndMeasure(note: String, block: () -> Unit) {
val openProjectMillis = measureTimeMillis { val openProjectMillis = measureTimeMillis {
@@ -13,7 +13,7 @@ import java.util.ArrayList
@JsonInclude(JsonInclude.Include.NON_NULL) @JsonInclude(JsonInclude.Include.NON_NULL)
data class Benchmark( data class Benchmark(
val version: Int = 3, val version: Int = 4,
@set:JsonProperty("agentName") @set:JsonProperty("agentName")
var agentName: String?, var agentName: String?,
@set:JsonProperty("benchmark") @set:JsonProperty("benchmark")
@@ -46,14 +46,6 @@ data class Benchmark(
hasError = if (metrics.any { it.ifHasError() == true }) true else null hasError = if (metrics.any { it.ifHasError() == true }) true else null
} }
fun resetValue() {
buildId = null
metricValue = null
metricError = null
buildBranch = null
metrics.forEach { it.resetValue() }
}
private fun String?.escapeName() = this?.replace(Regex("[^A-Za-z0-9_]"), "_") private fun String?.escapeName() = this?.replace(Regex("[^A-Za-z0-9_]"), "_")
fun id(): String = fun id(): String =
@@ -12,15 +12,14 @@ fun main(args: Array<String>) {
val argFile = File(args[0]) val argFile = File(args[0])
val groupBy = argFile.listFiles() val groupBy = argFile.listFiles()
.filter { it.length() > 0 && it.name.startsWith("stats-") && it.extension == "json" } .filter { it.length() > 0 && it.name.startsWith("stats-") && it.extension == "json" }
.groupBy { it.name.replace("stats-", "").split("_")[0] } .map { it.loadBenchmark() }
.groupBy { it.benchmark }
groupBy.forEach { (k, v) -> groupBy.forEach { (k, benchmarks) ->
if (v.isEmpty()) return@forEach if (benchmarks.isEmpty()) return@forEach
val benchmarks = v.map { it.loadBenchmark() }
benchmarks.forEach { benchmark -> benchmarks.forEach { benchmark ->
benchmark.metrics.firstOrNull { it.metricName == "" }?.let { metric -> benchmark.metrics.firstOrNull { it.metricName == "_value" }?.let { metric ->
metric.rawMetrics?.firstOrNull { it.warmUp == true && it.index == 0 }?.let { metric.rawMetrics?.firstOrNull { it.warmUp == true && it.index == 0 }?.let {
val warmUpBenchmark = Benchmark( val warmUpBenchmark = Benchmark(
agentName = benchmark.agentName, agentName = benchmark.agentName,
@@ -40,16 +39,15 @@ fun main(args: Array<String>) {
} }
// build geom mean benchmark // build geom mean benchmark
val first = v.first() val first = benchmarks.first()
val loadBenchmark = first.loadBenchmark()
val geomMeanBenchmark = Benchmark( val geomMeanBenchmark = Benchmark(
agentName = loadBenchmark.agentName, agentName = first.agentName,
buildBranch = loadBenchmark.buildBranch, buildBranch = first.buildBranch,
buildId = loadBenchmark.buildId, buildId = first.buildId,
benchmark = loadBenchmark.benchmark, benchmark = first.benchmark,
synthetic = true, synthetic = true,
name = "geomMean", name = "geomMean",
buildTimestamp = loadBenchmark.buildTimestamp buildTimestamp = first.buildTimestamp
) )
benchmarks benchmarks