Benchmarks: Add task descriptions
This commit is contained in:
committed by
Ilya Matveev
parent
bd6f2ae01c
commit
864d456ee0
+21
-2
@@ -51,6 +51,9 @@ internal val Project.konanVersion: String
|
|||||||
internal val Project.nativeJson: String
|
internal val Project.nativeJson: String
|
||||||
get() = project.property("nativeJson") as String
|
get() = project.property("nativeJson") as String
|
||||||
|
|
||||||
|
internal val Project.jvmJson: String
|
||||||
|
get() = project.property("jvmJson") as String
|
||||||
|
|
||||||
internal val Project.commonBenchmarkProperties: Map<String, Any>
|
internal val Project.commonBenchmarkProperties: Map<String, Any>
|
||||||
get() = mapOf(
|
get() = mapOf(
|
||||||
"cpu" to System.getProperty("os.arch"),
|
"cpu" to System.getProperty("os.arch"),
|
||||||
@@ -148,7 +151,10 @@ open class BenchmarkingPlugin: Plugin<Project> {
|
|||||||
// Native run task.
|
// Native run task.
|
||||||
val nativeTarget = kotlin.targets.getByName(NATIVE_TARGET_NAME) as KotlinNativeTarget
|
val nativeTarget = kotlin.targets.getByName(NATIVE_TARGET_NAME) as KotlinNativeTarget
|
||||||
val nativeExecutable = nativeTarget.binaries.getExecutable(NATIVE_EXECUTABLE_NAME, NativeBuildType.RELEASE)
|
val nativeExecutable = nativeTarget.binaries.getExecutable(NATIVE_EXECUTABLE_NAME, NativeBuildType.RELEASE)
|
||||||
val konanRun = createRunTask(this, "konanRun", nativeExecutable.runTask!!)
|
val konanRun = createRunTask(this, "konanRun", nativeExecutable.runTask!!).apply {
|
||||||
|
group = BENCHMARKING_GROUP
|
||||||
|
description = "Runs the benchmark for Kotlin/Native."
|
||||||
|
}
|
||||||
|
|
||||||
// JVM run task.
|
// JVM run task.
|
||||||
val jvmRun = tasks.create("jvmRun", RunJvmTask::class.java) { task ->
|
val jvmRun = tasks.create("jvmRun", RunJvmTask::class.java) { task ->
|
||||||
@@ -158,6 +164,9 @@ open class BenchmarkingPlugin: Plugin<Project> {
|
|||||||
task.classpath(files(mainCompilation.output.allOutputs, runtimeDependencies))
|
task.classpath(files(mainCompilation.output.allOutputs, runtimeDependencies))
|
||||||
task.main = "MainKt"
|
task.main = "MainKt"
|
||||||
|
|
||||||
|
task.group = BENCHMARKING_GROUP
|
||||||
|
task.description = "Runs the benchmark for Kotlin/JVM."
|
||||||
|
|
||||||
// Specify settings configured by a user in the benchmark extension.
|
// Specify settings configured by a user in the benchmark extension.
|
||||||
afterEvaluate {
|
afterEvaluate {
|
||||||
task.args(
|
task.args(
|
||||||
@@ -171,6 +180,10 @@ open class BenchmarkingPlugin: Plugin<Project> {
|
|||||||
|
|
||||||
// Native report task.
|
// Native report task.
|
||||||
val konanJsonReport = tasks.create("konanJsonReport") {
|
val konanJsonReport = tasks.create("konanJsonReport") {
|
||||||
|
|
||||||
|
it.group = BENCHMARKING_GROUP
|
||||||
|
it.description = "Builds the benchmarking report for Kotlin/Native."
|
||||||
|
|
||||||
it.doLast {
|
it.doLast {
|
||||||
val applicationName = benchmark.applicationName
|
val applicationName = benchmark.applicationName
|
||||||
val nativeCompileTime = getNativeCompileTime(applicationName)
|
val nativeCompileTime = getNativeCompileTime(applicationName)
|
||||||
@@ -192,6 +205,10 @@ open class BenchmarkingPlugin: Plugin<Project> {
|
|||||||
|
|
||||||
// JVM report task.
|
// JVM report task.
|
||||||
val jvmJsonReport = tasks.create("jvmJsonReport") {
|
val jvmJsonReport = tasks.create("jvmJsonReport") {
|
||||||
|
|
||||||
|
it.group = BENCHMARKING_GROUP
|
||||||
|
it.description = "Builds the benchmarking report for Kotlin/JVM."
|
||||||
|
|
||||||
it.doLast {
|
it.doLast {
|
||||||
val applicationName = benchmark.applicationName
|
val applicationName = benchmark.applicationName
|
||||||
val jarPath = (tasks.getByName("jvmJar") as Jar).archiveFile.get().asFile
|
val jarPath = (tasks.getByName("jvmJar") as Jar).archiveFile.get().asFile
|
||||||
@@ -207,7 +224,7 @@ open class BenchmarkingPlugin: Plugin<Project> {
|
|||||||
)
|
)
|
||||||
|
|
||||||
val output = createJsonReport(properties)
|
val output = createJsonReport(properties)
|
||||||
buildDir.resolve(project.property("jvmJson") as String).writeText(output)
|
buildDir.resolve(jvmJson).writeText(output)
|
||||||
}
|
}
|
||||||
|
|
||||||
jvmRun.finalizedBy(it)
|
jvmRun.finalizedBy(it)
|
||||||
@@ -230,5 +247,7 @@ open class BenchmarkingPlugin: Plugin<Project> {
|
|||||||
const val NATIVE_TARGET_NAME = "native"
|
const val NATIVE_TARGET_NAME = "native"
|
||||||
const val NATIVE_EXECUTABLE_NAME = "benchmark"
|
const val NATIVE_EXECUTABLE_NAME = "benchmark"
|
||||||
const val BENCHMARK_EXTENSION_NAME = "benchmark"
|
const val BENCHMARK_EXTENSION_NAME = "benchmark"
|
||||||
|
|
||||||
|
const val BENCHMARKING_GROUP = "benchmarking"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+11
@@ -35,6 +35,9 @@ open class CompileBenchmarkingPlugin : Plugin<Project> {
|
|||||||
// Aggregate task.
|
// Aggregate task.
|
||||||
val konanRun = tasks.create("konanRun") { task ->
|
val konanRun = tasks.create("konanRun") { task ->
|
||||||
task.dependsOn("configureBuild")
|
task.dependsOn("configureBuild")
|
||||||
|
|
||||||
|
task.group = BenchmarkingPlugin.BENCHMARKING_GROUP
|
||||||
|
task.description = "Runs the compile only benchmark for Kotlin/Native."
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compile tasks.
|
// Compile tasks.
|
||||||
@@ -55,6 +58,10 @@ open class CompileBenchmarkingPlugin : Plugin<Project> {
|
|||||||
|
|
||||||
// Report task.
|
// Report task.
|
||||||
tasks.create("konanJsonReport").apply {
|
tasks.create("konanJsonReport").apply {
|
||||||
|
|
||||||
|
group = BenchmarkingPlugin.BENCHMARKING_GROUP
|
||||||
|
description = "Builds the benchmarking report for Kotlin/Native."
|
||||||
|
|
||||||
doLast {
|
doLast {
|
||||||
val nativeCompileTime = getCompileBenchmarkTime(
|
val nativeCompileTime = getCompileBenchmarkTime(
|
||||||
applicationName,
|
applicationName,
|
||||||
@@ -81,10 +88,14 @@ open class CompileBenchmarkingPlugin : Plugin<Project> {
|
|||||||
benchmarkExtension: CompileBenchmarkExtension
|
benchmarkExtension: CompileBenchmarkExtension
|
||||||
) {
|
) {
|
||||||
val jvmRun = tasks.create("jvmRun") {
|
val jvmRun = tasks.create("jvmRun") {
|
||||||
|
it.group = BenchmarkingPlugin.BENCHMARKING_GROUP
|
||||||
|
it.description = "Runs the compile only benchmark for Kotlin/JVM."
|
||||||
it.doLast { println("JVM run isn't supported") }
|
it.doLast { println("JVM run isn't supported") }
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.create("jvmJsonReport") {
|
tasks.create("jvmJsonReport") {
|
||||||
|
it.group = BenchmarkingPlugin.BENCHMARKING_GROUP
|
||||||
|
it.description = "Builds the benchmarking report for Kotlin/Native."
|
||||||
it.doLast { println("JVM run isn't supported") }
|
it.doLast { println("JVM run isn't supported") }
|
||||||
jvmRun.finalizedBy(it)
|
jvmRun.finalizedBy(it)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user