FIR: report lowering time from JvmIrCodegenFactory

This commit is contained in:
Georgy Bronnikov
2021-01-20 23:18:36 +03:00
parent 75954dd1a4
commit 1664eec7e4
6 changed files with 31 additions and 7 deletions
@@ -22,6 +22,7 @@ abstract class CommonCompilerPerformanceManager(private val presentableName: Str
private var startGCData = mutableMapOf<String, GCData>()
private var irTranslationStart: Long = 0
private var irLoweringStart: Long = 0
private var irGenerationStart: Long = 0
private var targetDescription: String? = null
@@ -88,6 +89,19 @@ abstract class CommonCompilerPerformanceManager(private val presentableName: Str
)
}
open fun notifyIRLoweringStarted() {
irLoweringStart = PerformanceCounter.currentTime()
}
open fun notifyIRLoweringFinished() {
val time = deltaTime(irLoweringStart)
measurements += IRMeasurement(
lines,
TimeUnit.NANOSECONDS.toMillis(time),
IRMeasurement.Kind.LOWERING
)
}
open fun notifyIRGenerationStarted() {
irGenerationStart = PerformanceCounter.currentTime()
}
@@ -37,7 +37,7 @@ class IRMeasurement(val lines: Int?, val milliseconds: Long, val kind: Kind) : P
override fun render(): String = formatMeasurement("IR $kind", milliseconds, lines)
enum class Kind {
TRANSLATION, GENERATION
TRANSLATION, LOWERING, GENERATION
}
}
@@ -387,10 +387,14 @@ object KotlinToJVMBytecodeCompiler {
ProgressIndicatorAndCompilationCanceledStatus.checkCanceled()
performanceManager?.notifyIRGenerationStarted()
performanceManager?.notifyIRLoweringStarted()
generationState.beforeCompile()
codegenFactory.generateModuleInFrontendIRMode(
generationState, moduleFragment, symbolTable, sourceManager, extensions, FirJvmBackendExtension(session, components)
generationState, moduleFragment, symbolTable, sourceManager, extensions, FirJvmBackendExtension(session, components),
{
performanceManager?.notifyIRLoweringFinished()
performanceManager?.notifyIRGenerationStarted()
}
)
CodegenFactory.doCheckCancelled(generationState)
generationState.factory.done()