src/Pure/Tools/build_log.scala
changeset 64120 6c5039016321
parent 64119 8094eaa38d4b
child 64150 b10f2ddd7679
     1.1 --- a/src/Pure/Tools/build_log.scala	Sun Oct 09 15:28:18 2016 +0200
     1.2 +++ b/src/Pure/Tools/build_log.scala	Sun Oct 09 16:24:54 2016 +0200
     1.3 @@ -357,6 +357,7 @@
     1.4      timing: Timing,
     1.5      ml_timing: Timing,
     1.6      ml_statistics: List[Properties.T],
     1.7 +    heap_size: Option[Long],
     1.8      status: Session_Status.Value)
     1.9    {
    1.10      def finished: Boolean = status == Session_Status.FINISHED
    1.11 @@ -401,6 +402,7 @@
    1.12      val Session_Started = new Regex("""^(?:Running|Building) (\S+) \.\.\.$""")
    1.13      val Session_Failed = new Regex("""^(\S+) FAILED""")
    1.14      val Session_Cancelled = new Regex("""^(\S+) CANCELLED""")
    1.15 +    val Heap = new Regex("""^Heap (\S+) \((\d+) bytes\)$""")
    1.16  
    1.17      var chapter = Map.empty[String, String]
    1.18      var groups = Map.empty[String, List[String]]
    1.19 @@ -411,10 +413,11 @@
    1.20      var failed = Set.empty[String]
    1.21      var cancelled = Set.empty[String]
    1.22      var ml_statistics = Map.empty[String, List[Properties.T]]
    1.23 +    var heap_sizes = Map.empty[String, Long]
    1.24  
    1.25      def all_sessions: Set[String] =
    1.26 -      chapter.keySet ++ groups.keySet ++ threads.keySet ++ timing.keySet ++
    1.27 -      ml_timing.keySet ++ failed ++ cancelled ++ started ++ ml_statistics.keySet
    1.28 +      chapter.keySet ++ groups.keySet ++ threads.keySet ++ timing.keySet ++ ml_timing.keySet ++
    1.29 +      failed ++ cancelled ++ started ++ ml_statistics.keySet ++ heap_sizes.keySet
    1.30  
    1.31  
    1.32      for (line <- log_file.lines) {
    1.33 @@ -450,13 +453,16 @@
    1.34            ml_timing += (name -> Timing(elapsed, cpu, gc))
    1.35            threads += (name -> t)
    1.36  
    1.37 +        case Heap(name, Value.Long(size)) =>
    1.38 +          heap_sizes += (name -> size)
    1.39 +
    1.40          case _ if line.startsWith(ML_STATISTICS_MARKER) =>
    1.41            val (name, props) =
    1.42              Library.try_unprefix(ML_STATISTICS_MARKER, line).map(log_file.parse_props(_)) match {
    1.43                case Some((SESSION_NAME, session_name) :: props) => (session_name, props)
    1.44                case _ => log_file.err("malformed ML_statistics " + quote(line))
    1.45              }
    1.46 -          ml_statistics = ml_statistics + (name -> (props :: ml_statistics.getOrElse(name, Nil)))
    1.47 +          ml_statistics += (name -> (props :: ml_statistics.getOrElse(name, Nil)))
    1.48  
    1.49          case _ =>
    1.50        }
    1.51 @@ -480,6 +486,7 @@
    1.52                timing.getOrElse(name, Timing.zero),
    1.53                ml_timing.getOrElse(name, Timing.zero),
    1.54                ml_statistics.getOrElse(name, Nil).reverse,
    1.55 +              heap_sizes.get(name),
    1.56                status)
    1.57            (name -> entry)
    1.58          }):_*)