From 1d67fe63b8c1e5537cccc60734cfbf3bc64d10ab Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Mon, 25 Jun 2012 22:46:49 +0200 Subject: Statistics improvements and bug fixes. Added compile-time option hotEnabled to Statistics that can be used to count very high frequency methods with 0 overhead for the disabled case. Fixed problem with weak maps that caused some timers to be discarded prematurely before they could be printed. Fixed problem with accouning for stacked timers. --- .../scala/tools/nsc/typechecker/Implicits.scala | 2 +- src/compiler/scala/tools/nsc/typechecker/Typers.scala | 19 ++++++++++--------- 2 files changed, 11 insertions(+), 10 deletions(-) (limited to 'src/compiler') diff --git a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala index f7e00109ae..68782379a6 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala @@ -1125,7 +1125,7 @@ trait Implicits { * such that some part of `tp` has C as one of its superclasses. */ private def implicitsOfExpectedType: Infoss = { - Statistics.incCounter(implicitCacheHits) + Statistics.incCounter(implicitCacheAccs) implicitsCache get pt match { case Some(implicitInfoss) => Statistics.incCounter(implicitCacheHits) diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index 69d3fd7f47..a92a9aa82e 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -4025,7 +4025,7 @@ trait Typers extends Modes with Adaptations with Tags { } else { context.enclMethod.returnsSeen = true val expr1: Tree = typed(expr, EXPRmode | BYVALmode | RETmode, restpt.tpe) - + // Warn about returning a value if no value can be returned. if (restpt.tpe.typeSymbol == UnitClass) { // The typing in expr1 says expr is Unit (it has already been coerced if @@ -5131,7 +5131,7 @@ trait Typers extends Modes with Adaptations with Tags { indentTyping() var alreadyTyped = false - val startByType = Statistics.pushTimerClass(byTypeNanos, tree.getClass) + val startByType = Statistics.pushTimer(byTypeStack, byTypeNanos(tree.getClass)) Statistics.incCounter(visitsByType, tree.getClass) try { if (context.retyping && @@ -5187,7 +5187,7 @@ trait Typers extends Modes with Adaptations with Tags { } finally { deindentTyping() - Statistics.popTimerClass(byTypeNanos, startByType) + Statistics.popTimer(byTypeStack, startByType) } } @@ -5375,10 +5375,11 @@ object TypersStats { val compoundBaseTypeSeqCount = Statistics.newSubCounter(" of which for compound types", baseTypeSeqCount) val typerefBaseTypeSeqCount = Statistics.newSubCounter(" of which for typerefs", baseTypeSeqCount) val singletonBaseTypeSeqCount = Statistics.newSubCounter(" of which for singletons", baseTypeSeqCount) - val failedSilentNanos = Statistics.newSubTimer ("time spent in failed", typerNanos) - val failedApplyNanos = Statistics.newSubTimer (" failed apply", typerNanos) - val failedOpEqNanos = Statistics.newSubTimer (" failed op=", typerNanos) - val isReferencedNanos = Statistics.newSubTimer ("time spent ref scanning", typerNanos) - val visitsByType = Statistics.newByClass ("#visits by tree node", "typer")(Statistics.newCounter("")) - val byTypeNanos = Statistics.newByClassTimerStack("time spent by tree node", typerNanos) + val failedSilentNanos = Statistics.newSubTimer("time spent in failed", typerNanos) + val failedApplyNanos = Statistics.newSubTimer(" failed apply", typerNanos) + val failedOpEqNanos = Statistics.newSubTimer(" failed op=", typerNanos) + val isReferencedNanos = Statistics.newSubTimer("time spent ref scanning", typerNanos) + val visitsByType = Statistics.newByClass("#visits by tree node", "typer")(Statistics.newCounter("")) + val byTypeNanos = Statistics.newByClass("time spent by tree node", "typer")(Statistics.newStackableTimer("", typerNanos)) + val byTypeStack = Statistics.newTimerStack() } -- cgit v1.2.3