aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2016-03-03 10:36:53 +0100
committerMartin Odersky <odersky@gmail.com>2016-03-03 10:36:53 +0100
commit0e21000f5527461b68a382346712e5f52fb3beec (patch)
treeed47d716d400e0fc9aac0c117dd7c69b946ececd
parentba67e556271156c11f5f313f68891bf18f7a51d2 (diff)
downloaddotty-0e21000f5527461b68a382346712e5f52fb3beec.tar.gz
dotty-0e21000f5527461b68a382346712e5f52fb3beec.tar.bz2
dotty-0e21000f5527461b68a382346712e5f52fb3beec.zip
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.
-rw-r--r--src/dotty/tools/dotc/Run.scala3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/Run.scala b/src/dotty/tools/dotc/Run.scala
index 39fd42a64..9972e3e64 100644
--- a/src/dotty/tools/dotc/Run.scala
+++ b/src/dotty/tools/dotc/Run.scala
@@ -56,12 +56,13 @@ class Run(comp: Compiler)(implicit ctx: Context) {
ctx.usePhases(phases)
for (phase <- ctx.allPhases)
if (!ctx.reporter.hasErrors) {
- if (ctx.settings.verbose.value) ctx.println(s"[$phase]")
+ val start = System.currentTimeMillis
units = phase.runOn(units)
def foreachUnit(op: Context => Unit)(implicit ctx: Context): Unit =
for (unit <- units) op(ctx.fresh.setPhase(phase.next).setCompilationUnit(unit))
if (ctx.settings.Xprint.value.containsPhase(phase))
foreachUnit(printTree)
+ ctx.informTime(s"$phase ", start)
}
}