[K/N] Test runtime logging performance overhead
This commit is contained in:
committed by
Space Team
parent
325b152efa
commit
beeb016a9f
@@ -0,0 +1,21 @@
|
||||
import org.jetbrains.kotlin.gradle.plugin.mpp.NativeBuildType
|
||||
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
|
||||
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||
* that can be found in the LICENSE file.
|
||||
*/
|
||||
|
||||
plugins {
|
||||
id("benchmarking")
|
||||
}
|
||||
|
||||
benchmark {
|
||||
applicationName = "Logging"
|
||||
commonSrcDirs = listOf("../../tools/benchmarks/shared/src/main/kotlin/report", "src/main/kotlin", "../shared/src/main/kotlin")
|
||||
jvmSrcDirs = listOf("../shared/src/main/kotlin-jvm")
|
||||
nativeSrcDirs = listOf("../shared/src/main/kotlin-native/common")
|
||||
mingwSrcDirs = listOf("../shared/src/main/kotlin-native/mingw")
|
||||
posixSrcDirs = listOf("../shared/src/main/kotlin-native/posix")
|
||||
compilerOpts = listOf("-Xruntime-logs=logging=debug")
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright 2010-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import org.jetbrains.benchmarksLauncher.*
|
||||
|
||||
fun loop() {
|
||||
for (i in 0..10000) {
|
||||
Blackhole.consume(i)
|
||||
}
|
||||
}
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
val launcher = object : Launcher() {
|
||||
override val baseBenchmarksSet: MutableMap<String, AbstractBenchmarkEntry> = mutableMapOf("Loop" to BenchmarkEntry(::loop))
|
||||
}
|
||||
|
||||
BenchmarksRunner.runBenchmarks(args, { arguments: BenchmarkArguments ->
|
||||
if (arguments is BaseBenchmarkArguments) {
|
||||
launcher.launch(arguments.warmup, arguments.repeat, arguments.prefix,
|
||||
arguments.filter, arguments.filterRegex, arguments.verbose)
|
||||
} else emptyList()
|
||||
}, benchmarksListAction = launcher::benchmarksListAction)
|
||||
}
|
||||
@@ -22,6 +22,7 @@ include ':numerical'
|
||||
include ':videoplayer'
|
||||
include ':framework'
|
||||
include ':startup'
|
||||
include ':logging'
|
||||
if (System.getProperty("os.name") == "Mac OS X") {
|
||||
include ':objcinterop'
|
||||
include ':swiftinterop'
|
||||
|
||||
Reference in New Issue
Block a user