blob: a5d579dc37a5efd18dff3ce9d3910fab40b68f6d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
/* NSC -- new Scala compiler
* Copyright 2005-2013 LAMP/EPFL
* @author Martin Odersky
*/
package scala.tools.nsc
package util
import scala.reflect.internal.util.Statistics
abstract class StatisticsInfo {
val global: Global
import global._
import scala.reflect.internal.TreesStats.nodeByType
val retainedCount = Statistics.newCounter("#retained tree nodes")
val retainedByType = Statistics.newByClass("#retained tree nodes by type")(Statistics.newCounter(""))
def print(phase: Phase) = if (settings.YstatisticsPhases contains phase.name) {
inform("*** Cumulative statistics at phase " + phase)
retainedCount.value = 0
for (c <- retainedByType.keys)
retainedByType(c).value = 0
for (u <- currentRun.units; t <- u.body) {
retainedCount.value += 1
retainedByType(t.getClass).value += 1
}
val quants =
if (phase.name == "parser") Seq(treeNodeCount, nodeByType, retainedCount, retainedByType)
else Statistics.allQuantities
for (q <- quants if q.showAt(phase.name)) inform(q.line)
}
}
|