Save use_ni key state to log

This commit is contained in:
Simon Ogorodnik
2019-10-21 19:39:07 +03:00
parent 57a674e9e6
commit 1bd861c5eb
@@ -24,6 +24,7 @@ import java.io.FileOutputStream
import java.io.PrintStream import java.io.PrintStream
import kotlin.system.measureNanoTime import kotlin.system.measureNanoTime
private val USE_NI = System.getProperty("fir.bench.oldfe.ni", "true") == "true"
class NonFirResolveModularizedTotalKotlinTest : AbstractModularizedTest() { class NonFirResolveModularizedTotalKotlinTest : AbstractModularizedTest() {
private var totalTime = 0L private var totalTime = 0L
@@ -43,12 +44,16 @@ class NonFirResolveModularizedTotalKotlinTest : AbstractModularizedTest() {
println("Time is ${time * 1e-6} ms") println("Time is ${time * 1e-6} ms")
} }
private fun dumpTime(message: String, time: Long) { private fun writeMessageToLog(message: String) {
PrintStream(FileOutputStream(reportDir().resolve("report-$reportDateStr.log"), true)).use { stream -> PrintStream(FileOutputStream(reportDir().resolve("report-$reportDateStr.log"), true)).use { stream ->
stream.println("$message: ${time * 1e-6} ms") stream.println(message)
} }
} }
private fun dumpTime(message: String, time: Long) {
writeMessageToLog("$message: ${time * 1e-6} ms")
}
override fun processModule(moduleData: ModuleData): ProcessorAction { override fun processModule(moduleData: ModuleData): ProcessorAction {
val configurationKind = ConfigurationKind.ALL val configurationKind = ConfigurationKind.ALL
val testJdkKind = TestJdkKind.FULL_JDK val testJdkKind = TestJdkKind.FULL_JDK
@@ -63,7 +68,7 @@ class NonFirResolveModularizedTotalKotlinTest : AbstractModularizedTest() {
CONTENT_ROOTS, CONTENT_ROOTS,
moduleData.sources.filter { it.extension == "kt" }.map { KotlinSourceRoot(it.absolutePath, false) }) moduleData.sources.filter { it.extension == "kt" }.map { KotlinSourceRoot(it.absolutePath, false) })
if (System.getProperty("fir.bench.oldfe.ni", "true") == "true") { if (USE_NI) {
configuration.languageVersionSettings = configuration.languageVersionSettings =
LanguageVersionSettingsImpl( LanguageVersionSettingsImpl(
LanguageVersion.KOTLIN_1_4, ApiVersion.KOTLIN_1_3, specificFeatures = mapOf( LanguageVersion.KOTLIN_1_4, ApiVersion.KOTLIN_1_3, specificFeatures = mapOf(
@@ -107,10 +112,12 @@ class NonFirResolveModularizedTotalKotlinTest : AbstractModularizedTest() {
override fun beforePass() {} override fun beforePass() {}
fun testTotalKotlin() { fun testTotalKotlin() {
writeMessageToLog("use_ni: $USE_NI")
for (i in 0 until PASSES) { for (i in 0 until PASSES) {
runTestOnce(i) runTestOnce(i)
times += totalTime times += totalTime
dumpTime("Pass $i:", totalTime) dumpTime("Pass $i", totalTime)
totalTime = 0L totalTime = 0L
} }