Separate performance project (#4473)

This commit is contained in:
LepilkinaElena
2020-10-29 17:05:06 +03:00
committed by Stanislav Erokhin
parent 590aa42f3d
commit e57839ece6
17 changed files with 79 additions and 85 deletions
@@ -7,7 +7,7 @@ import org.jetbrains.kotlin.benchmark.BenchmarkingPlugin
import org.jetbrains.kotlin.ExecClang
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
import org.jetbrains.kotlin.gradle.plugin.mpp.NativeBuildType
import org.jetbrains.kotlin.konan.target.HostManager
import org.jetbrains.kotlin.konan.target.*
plugins {
id("benchmarking")
@@ -22,24 +22,7 @@ benchmark {
nativeSrcDirs = listOf("src/main/kotlin-native", "../shared/src/main/kotlin-native/common")
mingwSrcDirs = listOf("../shared/src/main/kotlin-native/mingw")
posixSrcDirs = listOf("../shared/src/main/kotlin-native/posix")
linkerOpts = listOf("$buildDir/pi.o")
buildType = (findProperty("nativeBuildType") as String?)?.let { NativeBuildType.valueOf(it) } ?: defaultBuildType
dependencies.common(project(":endorsedLibraries:kotlinx.cli"))
}
val compileLibary by tasks.creating {
doFirst {
mkdir(buildDir)
project.withConvention(ExecClang::class) {
execKonanClang(HostManager.host) {
args("-O3")
args("-c", "$projectDir/src/nativeInterop/cinterop/pi.c")
args("-o", "$buildDir/pi.o")
}
}
}
}
val native = kotlin.targets.getByName("native") as KotlinNativeTarget
@@ -47,7 +30,8 @@ native.apply {
compilations["main"].cinterops {
create("cinterop") {
headers("$projectDir/src/nativeInterop/cinterop/pi.h")
extraOpts("-Xcompile-source", "$projectDir/src/nativeInterop/cinterop/pi.c")
extraOpts("-Xsource-compiler-option", "-O3")
}
}
binaries.getExecutable(BenchmarkingPlugin.NATIVE_EXECUTABLE_NAME, "RELEASE").linkTask.dependsOn(compileLibary)
}
@@ -15,6 +15,7 @@
*/
#include <math.h>
#include "pi.h"
/* uncomment the following line to use 'long long' integers */
#define HAS_LONG_LONG
@@ -11,6 +11,12 @@
#ifndef _BELLARD_PI_H
#define _BELLARD_PI_H
#ifdef __cplusplus
extern "C" {
#endif
int pi_nth_digit(int n);
#ifdef __cplusplus
}
#endif
#endif /*_BELLARD_PI_H*/