--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/Pure/ML/ml_statistics.scala Wed Jan 02 16:48:22 2013 +0100
@@ -0,0 +1,41 @@
+/* Title: Pure/ML/ml_statistics.ML
+ Author: Makarius
+
+ML runtime statistics.
+*/
+
+package isabelle
+
+
+object ML_Statistics
+{
+ /* read properties from build log */
+
+ private val line_prefix = "\fML_statistics = "
+
+ private val syntax = Outer_Syntax.empty + "," + "(" + ")" + "[" + "]"
+
+ private object Parser extends Parse.Parser
+ {
+ private def stat: Parser[(String, String)] =
+ keyword("(") ~ string ~ keyword(",") ~ string ~ keyword(")") ^^
+ { case _ ~ x ~ _ ~ y ~ _ => (x, y) }
+ private def stats: Parser[Properties.T] =
+ keyword("[") ~> repsep(stat, keyword(",")) <~ keyword("]")
+
+ def parse_stats(s: String): Properties.T =
+ {
+ parse_all(stats, Token.reader(syntax.scan(s))) match {
+ case Success(result, _) => result
+ case bad => error(bad.toString)
+ }
+ }
+ }
+
+ def read_log(log: Path): List[Properties.T] =
+ for {
+ line <- split_lines(File.read_gzip(log))
+ if line.startsWith(line_prefix)
+ stats = line.substring(line_prefix.length)
+ } yield Parser.parse_stats(stats)
+}
--- a/src/Pure/build-jars Wed Jan 02 15:08:38 2013 +0100
+++ b/src/Pure/build-jars Wed Jan 02 16:48:22 2013 +0100
@@ -30,6 +30,7 @@
Isar/outer_syntax.scala
Isar/parse.scala
Isar/token.scala
+ ML/ml_statistics.scala
PIDE/command.scala
PIDE/document.scala
PIDE/markup.scala