diff options
author | Martin Odersky <odersky@gmail.com> | 2013-05-13 18:52:19 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2013-05-13 18:52:19 +0200 |
commit | 9ba33cb09d684eb5b5ea10379e801ebc7de135ba (patch) | |
tree | 037e62b498dfa49f3fe8244c4c45d4860849c835 | |
parent | 19cce9dca34bf951787805069dc57bf177942758 (diff) | |
download | dotty-9ba33cb09d684eb5b5ea10379e801ebc7de135ba.tar.gz dotty-9ba33cb09d684eb5b5ea10379e801ebc7de135ba.tar.bz2 dotty-9ba33cb09d684eb5b5ea10379e801ebc7de135ba.zip |
First tiny bit of statistics.
-rw-r--r-- | src/dotty/tools/dotc/core/Trees.scala | 6 | ||||
-rw-r--r-- | src/dotty/tools/dotc/util/Stats.scala | 7 |
2 files changed, 13 insertions, 0 deletions
diff --git a/src/dotty/tools/dotc/core/Trees.scala b/src/dotty/tools/dotc/core/Trees.scala index 3e09eafb7..054b17fa9 100644 --- a/src/dotty/tools/dotc/core/Trees.scala +++ b/src/dotty/tools/dotc/core/Trees.scala @@ -8,6 +8,7 @@ import language.higherKinds import collection.mutable import collection.mutable.ArrayBuffer import parsing.Tokens.Token +import util.Stats object Trees { @@ -21,6 +22,9 @@ object Trees { type TypedTree = Tree[Type] type UntypedTree = Tree[Untyped] + /** The total number of created tree nodes, maintained if Stats.enabled */ + var ntrees = 0 + /** A base class for things that have positions (currently: modifiers and trees) */ abstract class Positioned extends DotClass with Product { @@ -133,6 +137,8 @@ object Trees { */ abstract class Tree[T >: Untyped] extends Positioned with Product with Showable with Cloneable { + if (Stats.enabled) ntrees += 1 + /** The type constructor at the root of the tree */ type ThisTree[T >: Untyped] <: Tree[T] diff --git a/src/dotty/tools/dotc/util/Stats.scala b/src/dotty/tools/dotc/util/Stats.scala new file mode 100644 index 000000000..68884fdbc --- /dev/null +++ b/src/dotty/tools/dotc/util/Stats.scala @@ -0,0 +1,7 @@ +package dotty.tools.dotc.util + +object Stats { + + final val enabled = true + +}
\ No newline at end of file |