Skip to content

Commit 0e21000

Browse files
committed
Print phases with time they need
Print a phase after it has run, together with the time it needs. Useful to locate performance problems in transforms.
1 parent ba67e55 commit 0e21000

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/dotty/tools/dotc/Run.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,13 @@ class Run(comp: Compiler)(implicit ctx: Context) {
5656
ctx.usePhases(phases)
5757
for (phase <- ctx.allPhases)
5858
if (!ctx.reporter.hasErrors) {
59-
if (ctx.settings.verbose.value) ctx.println(s"[$phase]")
59+
val start = System.currentTimeMillis
6060
units = phase.runOn(units)
6161
def foreachUnit(op: Context => Unit)(implicit ctx: Context): Unit =
6262
for (unit <- units) op(ctx.fresh.setPhase(phase.next).setCompilationUnit(unit))
6363
if (ctx.settings.Xprint.value.containsPhase(phase))
6464
foreachUnit(printTree)
65+
ctx.informTime(s"$phase ", start)
6566
}
6667
}
6768

0 commit comments

Comments
 (0)