report correct compiler init timings
This commit is contained in:
@@ -60,6 +60,7 @@ public abstract class CLICompiler<A extends CommonCompilerArguments> {
|
|||||||
@SuppressWarnings("UnusedDeclaration") // Used via reflection in CompilerRunnerUtil#invokeExecMethod
|
@SuppressWarnings("UnusedDeclaration") // Used via reflection in CompilerRunnerUtil#invokeExecMethod
|
||||||
@NotNull
|
@NotNull
|
||||||
public ExitCode execAndOutputXml(@NotNull PrintStream errStream, @NotNull Services services, @NotNull String... args) {
|
public ExitCode execAndOutputXml(@NotNull PrintStream errStream, @NotNull Services services, @NotNull String... args) {
|
||||||
|
K2JVMCompiler.Companion.resetInitStartTime();
|
||||||
return exec(errStream, services, MessageRenderer.XML, args);
|
return exec(errStream, services, MessageRenderer.XML, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -207,8 +207,11 @@ public open class K2JVMCompiler : CLICompiler<K2JVMCompilerArguments>() {
|
|||||||
private fun createCoreEnvironment(rootDisposable: Disposable, configuration: CompilerConfiguration): KotlinCoreEnvironment {
|
private fun createCoreEnvironment(rootDisposable: Disposable, configuration: CompilerConfiguration): KotlinCoreEnvironment {
|
||||||
val result = KotlinCoreEnvironment.createForProduction(rootDisposable, configuration, EnvironmentConfigFiles.JVM_CONFIG_FILES)
|
val result = KotlinCoreEnvironment.createForProduction(rootDisposable, configuration, EnvironmentConfigFiles.JVM_CONFIG_FILES)
|
||||||
|
|
||||||
val initNanos = System.nanoTime() - initStartNanos
|
if (initStartNanos != 0L) {
|
||||||
reportPerf(configuration, "INIT: Compiler initialized in " + TimeUnit.NANOSECONDS.toMillis(initNanos) + " ms")
|
val initNanos = System.nanoTime() - initStartNanos
|
||||||
|
reportPerf(configuration, "INIT: Compiler initialized in " + TimeUnit.NANOSECONDS.toMillis(initNanos) + " ms")
|
||||||
|
initStartNanos = 0L
|
||||||
|
}
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -230,7 +233,9 @@ public open class K2JVMCompiler : CLICompiler<K2JVMCompilerArguments>() {
|
|||||||
private var elapsedJITTime = 0L
|
private var elapsedJITTime = 0L
|
||||||
|
|
||||||
public fun resetInitStartTime() {
|
public fun resetInitStartTime() {
|
||||||
initStartNanos = System.nanoTime()
|
if (initStartNanos == 0L) {
|
||||||
|
initStartNanos = System.nanoTime()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
platformStatic public fun main(args: Array<String>) {
|
platformStatic public fun main(args: Array<String>) {
|
||||||
|
|||||||
Reference in New Issue
Block a user