[Commonizer] Print true time for resolving of libraries to be commonized

This commit is contained in:
Dmitriy Dolovov
2021-02-18 15:36:45 +03:00
parent 0b26a281de
commit 05447ce0c8
3 changed files with 12 additions and 5 deletions
@@ -62,7 +62,7 @@ internal class NativeKlibCommonize(options: Collection<Option<*>>) : Task(option
val konanTargets = outputCommonizerTarget.konanTargets
val commonizerTargets = konanTargets.map(::CommonizerTarget)
val progressLogger = ProgressLogger(CliLoggerAdapter(2))
val progressLogger = ProgressLogger(CliLoggerAdapter(2), startImmediately = true)
val libraryLoader = DefaultNativeLibraryLoader(progressLogger)
val statsCollector = StatsCollector(statsType, commonizerTargets)
val repository = FilesRepository(targetLibraries.toSet(), libraryLoader)
@@ -104,7 +104,7 @@ internal class NativeDistributionCommonize(options: Collection<Option<*>>) : Tas
val copyEndorsedLibs = getOptional<Boolean, BooleanOptionType> { it == "copy-endorsed-libs" } ?: false
val statsType = getOptional<StatsType, StatsTypeOptionType> { it == "log-stats" } ?: StatsType.NONE
val progressLogger = ProgressLogger(CliLoggerAdapter(2))
val progressLogger = ProgressLogger(CliLoggerAdapter(2), startImmediately = true)
val libraryLoader = DefaultNativeLibraryLoader(progressLogger)
val repository = KonanDistributionRepository(distribution, commonizerTargets.toSet(), libraryLoader)
val existingTargets = commonizerTargets.filter { repository.getLibraries(it).isNotEmpty() }.toSet()
@@ -27,7 +27,6 @@ internal class LibraryCommonizer internal constructor(
fun run() {
checkPreconditions()
progressLogger.reset()
val allLibraries = loadLibraries()
commonizeAndSaveResults(allLibraries)
progressLogger.logTotal()
@@ -45,7 +44,7 @@ internal class LibraryCommonizer internal constructor(
progressLogger.warning("No platform libraries found for target ${target.prettyName}. This target will be excluded from commonization.")
}
}
progressLogger.log("Read lazy (uninitialized) libraries")
progressLogger.log("Resolved libraries to be commonized")
return AllNativeLibraries(stdlib, librariesByTargets)
}
@@ -7,10 +7,18 @@ package org.jetbrains.kotlin.descriptors.commonizer.utils
import org.jetbrains.kotlin.util.Logger
class ProgressLogger(private val wrapped: Logger) : Logger by wrapped {
class ProgressLogger(
private val wrapped: Logger,
startImmediately: Boolean = false
) : Logger by wrapped {
private val clockMark = ResettableClockMark()
private var finished = true
init {
if (startImmediately)
reset()
}
fun reset() {
clockMark.reset()
finished = false