@@ -99,18 +99,26 @@ class PipelineMainClass {
9999 toProcess = blocked
100100 for (p <- nextRound) {
101101 println(s " Round # $round: ${p.argsFile}" )
102- if (! compile(p.command )) return false
102+ if (! compile(p)) return false
103103 done += p
104+ println(f " Done: outline typing ${p.outlineDurationMs}%.2f ms, full compilation ${p.regularDurationMs}%.2f ms " )
104105 }
105106 }
106107 true
107108 }
108109
109110 private case class Task (argsFile : String , command : CompilerCommand ) {
110111 override def toString : String = argsFile
112+ var start : Long = 0
113+ var outlineEnd : Long = 0
114+ var regularStart : Long = 0
115+ var regularEnd : Long = 0
116+ def outlineDurationMs : Double = (outlineEnd - start).toDouble / 1000 / 1000
117+ def regularDurationMs : Double = (regularEnd - regularStart).toDouble / 1000 / 1000
111118 }
112119
113- def compile (command : CompilerCommand ): Boolean = {
120+ def compile (task : Task ): Boolean = {
121+ import task .command
114122 val compiler = newCompiler(command.settings)
115123 reporter = compiler.reporter
116124 try {
@@ -119,7 +127,7 @@ class PipelineMainClass {
119127 else if (command.shouldStopWithInfo)
120128 reporter.echo(command.getInfoMessage(compiler))
121129 else
122- doCompile(command , compiler)
130+ doCompile(task , compiler)
123131 } catch {
124132 case ex : Throwable =>
125133 compiler.reportThrowable(ex)
@@ -168,38 +176,50 @@ class PipelineMainClass {
168176 g
169177 }
170178
171- protected def doCompile (command : CompilerCommand , compiler : Global ): Unit = {
179+ protected def doCompile (task : Task , compiler : Global ): Unit = {
180+ import task .command
172181 if (command.files.isEmpty) {
173182 reporter.echo(command.usageMsg)
174183 reporter.echo(compiler.pluginOptionsHelp)
175184 } else {
176- println(" outline typing" )
177- command.settings.Youtline .value = true
178- command.settings.stopAfter.value = List (" pickler" )
179- val run1 = new compiler.Run ()
180- run1 compile command.files
181- reporter.finish()
182- if (! reporter.hasErrors) {
183- println(" regular compilation" )
185+ def outlineCompile (): Unit = {
186+ command.settings.Youtline .value = true
187+ command.settings.stopAfter.value = List (" pickler" )
188+ val run1 = new compiler.Run ()
189+ run1 compile command.files
190+ allPickleData.put(command.settings.outputDirs.getSingleOutput.get.file.toPath.toRealPath().normalize(), new PickleClassPath (run1.symData))
191+ reporter.finish()
192+ }
193+ def fullCompile (): Unit = {
184194 command.settings.Youtline .value = false
185195 command.settings.stopAfter.value = Nil
186196 val compiler2 = newCompiler(command.settings)
187- allPickleData.put(command.settings.outputDirs.getSingleOutput.get.file.toPath.toRealPath().normalize(), new PickleClassPath (run1.symData))
188197 val run2 = new compiler2.Run ()
189198 run2 compile command.files
190199 compiler2.reporter.finish()
191200 }
201+
202+ task.start = System .nanoTime()
203+ outlineCompile()
204+ task.outlineEnd = System .nanoTime()
205+ if (! reporter.hasErrors) {
206+
207+ task.regularStart = System .nanoTime()
208+ fullCompile()
209+ task.regularEnd = System .nanoTime()
210+ }
192211 }
193212 }
213+ }
194214
215+ object PipelineMain {
195216 def main (args : Array [String ]): Unit = {
196217 for (i <- 1 to 10 ) {
197- val result = process(args)
218+ val result = new PipelineMainClass (). process(args)
198219 if (! result)
199220 System .exit(1 )
200221 }
201222 System .exit(0 )
202223 }
203224}
204225
205- object PipelineMain extends PipelineMainClass {}
0 commit comments