summaryrefslogtreecommitdiff
path: root/src/reflect/scala/reflect/internal/Trees.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2012-06-18 17:20:14 +0200
committerAdriaan Moors <adriaan.moors@epfl.ch>2012-06-19 10:38:48 +0200
commit8284486a155f145bf61019fc0bd8b56b8d327ff2 (patch)
tree3babc67e2ca41656eac8827f3e83bff0c129f2e9 /src/reflect/scala/reflect/internal/Trees.scala
parent736f622f770700a9c18b84e6a76e31260990496c (diff)
downloadscala-8284486a155f145bf61019fc0bd8b56b8d327ff2.tar.gz
scala-8284486a155f145bf61019fc0bd8b56b8d327ff2.tar.bz2
scala-8284486a155f145bf61019fc0bd8b56b8d327ff2.zip
Statistics reorganization
Statistics were broken since the move to reflect.internal. They are now re-organized, made more robost and modular.
Diffstat (limited to 'src/reflect/scala/reflect/internal/Trees.scala')
-rw-r--r--src/reflect/scala/reflect/internal/Trees.scala10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/reflect/scala/reflect/internal/Trees.scala b/src/reflect/scala/reflect/internal/Trees.scala
index 75bb0e6d49..e100e0c1a3 100644
--- a/src/reflect/scala/reflect/internal/Trees.scala
+++ b/src/reflect/scala/reflect/internal/Trees.scala
@@ -9,6 +9,7 @@ package internal
import Flags._
import base.Attachments
import collection.mutable.{ListBuffer, LinkedHashSet}
+import util.Statistics
trait Trees extends api.Trees { self: SymbolTable =>
@@ -18,6 +19,8 @@ trait Trees extends api.Trees { self: SymbolTable =>
val id = nodeCount // TODO: add to attachment?
nodeCount += 1
+ Statistics.incCounter(TreesStats.nodeByType, getClass)
+
@inline final def pos: Position = rawatt.pos
def pos_=(pos: Position): Unit = rawatt = (rawatt withPos pos)
def setPos(newpos: Position): this.type = { pos = newpos; this }
@@ -1592,4 +1595,11 @@ trait Trees extends api.Trees { self: SymbolTable =>
implicit val TypeBoundsTreeTag = ClassTag[TypeBoundsTree](classOf[TypeBoundsTree])
implicit val ExistentialTypeTreeTag = ClassTag[ExistentialTypeTree](classOf[ExistentialTypeTree])
implicit val TypeTreeTag = ClassTag[TypeTree](classOf[TypeTree])
+
+ val treeNodeCount = Statistics.newView("#created tree nodes")(nodeCount)
+}
+
+object TreesStats {
+ // statistics
+ val nodeByType = Statistics.newByClass("#created tree nodes by type")(Statistics.newCounter(""))
}