File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed
compiler/src/dotty/tools/dotc Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -96,6 +96,7 @@ trait TraceSyntax:
9696 (op : => T )(using Context ): T =
9797 if ctx.mode.is(Mode .Printing ) || ! isForced && (printer eq Printers .noPrinter) then op
9898 else
99+ val start = System .nanoTime
99100 // Avoid evaluating question multiple time, since each evaluation
100101 // may cause some extra logging output.
101102 val q = question
@@ -109,7 +110,13 @@ trait TraceSyntax:
109110 def finalize (msg : String ) =
110111 if ! finalized then
111112 ctx.base.indent -= 1
112- doLog(s " $margin$msg" )
113+ val stop = System .nanoTime
114+ val diffNs = stop - start
115+ val diffS = (diffNs / 1000 / 1000 ).toInt / 1000.0
116+ if diffS > 0.1 then
117+ doLog(s " $margin$msg ( ${" %.2f" .format(diffS)} s) " )
118+ else
119+ doLog(s " $margin$msg" )
113120 finalized = true
114121 try
115122 doLog(s " $margin$leading" )
Original file line number Diff line number Diff line change @@ -264,7 +264,7 @@ trait ImportSuggestions:
264264 end importSuggestions
265265
266266 /** Reduce next timeout for import suggestions by the amount of time it took
267- * for current search, but but never less than to half of the previous budget.
267+ * for current search, but never less than to half of the previous budget.
268268 */
269269 private def reduceTimeBudget (used : Int )(using Context ) =
270270 val run = ctx.run.nn
You can’t perform that action at this time.
0 commit comments