Fix in analyzer + debug mode for compile only benchmarks (#3210)

This commit is contained in:
LepilkinaElena
2019-07-25 14:28:18 +03:00
committed by GitHub
parent c1a84aa8a6
commit e363746717
5 changed files with 28 additions and 16 deletions
+3 -3
View File
@@ -52,7 +52,7 @@ kotlin {
}
macosX64("macos").binaries {
framework(frameworkName, [RELEASE])
framework(frameworkName, [DEBUG])
}
}
@@ -75,10 +75,10 @@ task konanJsonReport {
if (PlatformInfo.isMac()) {
def applicationName = "FrameworkBenchmarksAnalyzer"
def frameworkPath = kotlin.macosX64("macos").binaries.
getFramework(frameworkName, kotlin.macosX64("macos").binaries.RELEASE).outputFile.absolutePath
getFramework(frameworkName, kotlin.macosX64("macos").binaries.DEBUG).outputFile.absolutePath
def nativeExecutable = new File("$frameworkPath/$frameworkName").canonicalPath
def nativeCompileTime = MPPTools.getNativeCompileTime(applicationName, ['compileKotlinMacos',
'linkBenchmarksAnalyzerReleaseFrameworkMacos',
'linkBenchmarksAnalyzerDebugFrameworkMacos',
'cinteropLibcurlMacos'])
def properties = getCommonProperties() + ['type' : 'native',
'compilerVersion': "${konanVersion}".toString(),
+1 -1
View File
@@ -18,7 +18,7 @@ compileBenchmark {
repeatNumber = 10
buildSteps {
step("runKonanc") {
command("$dist/bin/konanc$toolSuffix", "$projectDir/src/main/kotlin/main.kt", "-o", "$buildDir/program$binarySuffix")
command("$dist/bin/konanc$toolSuffix", "$projectDir/src/main/kotlin/main.kt", "-g", "-o", "$buildDir/program$binarySuffix")
}
}
}
+1 -1
View File
@@ -68,7 +68,7 @@ compileBenchmark {
step("runKonanProgram") {
command = listOf(
"$dist/bin/konanc$toolSuffix",
"-ea", "-p", "program",
"-ea", "-p", "program", "-g",
"-o", "${buildDir.absolutePath}/program$binarySuffix",
"-l", "$dist/../samples/videoplayer/build/classes/kotlin/videoPlayer/main/videoplayer-cinterop-ffmpeg.klib",
"-l", "$dist/../samples/videoplayer/build/classes/kotlin/videoPlayer/main/videoplayer-cinterop-sdl.klib",
@@ -141,20 +141,26 @@ fun main(args: Array<String>) {
val codesizeNormalize = codesizeNormalize?.let {
parseNormalizeResults(getFileContent(it))
}
results.apply {
add(benchsReport.failedBenchmarks.size.toString())
if (!execSamples.isEmpty()) {
val filterExec = if (execSamples.first() == "all") null else execSamples
add(benchsReport.getResultsByMetric(BenchmarkResult.Metric.EXECUTION_TIME,
exec == "geomean", filterExec, executionNormalize).joinToString(";"))
}
val filterExec = if (execSamples.first() == "all") null else execSamples
add(benchsReport.getResultsByMetric(BenchmarkResult.Metric.EXECUTION_TIME,
exec == "geomean", filterExec, executionNormalize).joinToString(";"))
if (!compileSamples.isEmpty()) {
val filterCompile = if (compileSamples.first() == "all") null else compileSamples
add(benchsReport.getResultsByMetric(BenchmarkResult.Metric.COMPILE_TIME,
compile == "geomean", filterCompile, compileNormalize).joinToString(";"))
}
val filterCompile = if (compileSamples.first() == "all") null else compileSamples
add(benchsReport.getResultsByMetric(BenchmarkResult.Metric.COMPILE_TIME,
compile == "geomean", filterCompile, compileNormalize).joinToString(";"))
val filterCodesize = if (codesizeSamples.first() == "all") null else codesizeSamples
add(benchsReport.getResultsByMetric(BenchmarkResult.Metric.CODE_SIZE,
codesize == "geomean", filterCodesize, codesizeNormalize).joinToString(";"))
if (!codesizeSamples.isEmpty()) {
val filterCodesize = if (codesizeSamples.first() == "all") null else codesizeSamples
add(benchsReport.getResultsByMetric(BenchmarkResult.Metric.CODE_SIZE,
codesize == "geomean", filterCodesize, codesizeNormalize).joinToString(";"))
}
}
println(results.joinToString())
@@ -83,7 +83,13 @@ data class MeanVarianceBenchmark(val meanBenchmark: BenchmarkResult, val varianc
}
fun geometricMean(values: Collection<Double>, totalNumber: Int = values.size) =
values.asSequence().filter{ it != 0.0 }.map { it.pow(1.0 / totalNumber) }.reduce { a, b -> a * b }
with(values.asSequence().filter { it != 0.0 }) {
if (count() == 0) {
0.0
} else {
map { it.pow(1.0 / totalNumber) }.reduce { a, b -> a * b }
}
}
fun computeMeanVariance(samples: List<Double>): MeanVariance {
val zStar = 1.67 // Critical point for 90% confidence of normal distribution.