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(
Metric(
"", metricValue = calcMean.mean.toLong(),
"_value", metricValue = calcMean.mean.toLong(),
hasError = hasError,
metricError = calcMean.stdDev.toLong(),
rawMetrics = rawMetricChildren
@@ -318,7 +318,7 @@ class Stats(
phaseName: String,
profilerConfig: ProfilerConfig
): PhaseProfiler {
profilerConfig.name = "$testName${if (phaseName.isEmpty()) "" else "-"+phaseName}"
profilerConfig.name = "$testName${if (phaseName.isEmpty()) "" else "-$phaseName"}"
profilerConfig.path = pathToResource("profile/${plainname(name)}")
val profilerHandler = if (profilerConfig.enabled && !profilerConfig.warmup)
ProfilerHandler.getInstance(profilerConfig)
@@ -387,8 +387,6 @@ class Stats(
)
benchmark.writeJson()
//rebuildGeomMean(agentName, buildBranch, buildId, simpleDateFormat, benchmark)
}
} finally {
metric = null
@@ -396,31 +394,6 @@ class Stats(
//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 {
const val TEST_KEY = "test"
const val ERROR_KEY = "error"
@@ -428,7 +401,7 @@ class Stats(
const val WARM_UP = "warm-up"
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) {
val openProjectMillis = measureTimeMillis {
@@ -13,7 +13,7 @@ import java.util.ArrayList
@JsonInclude(JsonInclude.Include.NON_NULL)
data class Benchmark(
val version: Int = 3,
val version: Int = 4,
@set:JsonProperty("agentName")
var agentName: String?,
@set:JsonProperty("benchmark")
@@ -46,14 +46,6 @@ data class Benchmark(
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_]"), "_")
fun id(): String =
@@ -12,15 +12,14 @@ fun main(args: Array<String>) {
val argFile = File(args[0])
val groupBy = argFile.listFiles()
.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) ->
if (v.isEmpty()) return@forEach
val benchmarks = v.map { it.loadBenchmark() }
groupBy.forEach { (k, benchmarks) ->
if (benchmarks.isEmpty()) return@forEach
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 {
val warmUpBenchmark = Benchmark(
agentName = benchmark.agentName,
@@ -40,16 +39,15 @@ fun main(args: Array<String>) {
}
// build geom mean benchmark
val first = v.first()
val loadBenchmark = first.loadBenchmark()
val first = benchmarks.first()
val geomMeanBenchmark = Benchmark(
agentName = loadBenchmark.agentName,
buildBranch = loadBenchmark.buildBranch,
buildId = loadBenchmark.buildId,
benchmark = loadBenchmark.benchmark,
agentName = first.agentName,
buildBranch = first.buildBranch,
buildId = first.buildId,
benchmark = first.benchmark,
synthetic = true,
name = "geomMean",
buildTimestamp = loadBenchmark.buildTimestamp
buildTimestamp = first.buildTimestamp
)
benchmarks