src/Pure/Tools/build_log.scala
author wenzelm
Sat Oct 08 11:04:47 2016 +0200 (2016-10-08)
changeset 64099 7a273824e206
parent 64098 099518e8af2c
child 64100 9b1573213ebe
permissions -rw-r--r--
tuned;
wenzelm@64045
     1
/*  Title:      Pure/Tools/build_log.scala
wenzelm@64045
     2
    Author:     Makarius
wenzelm@64045
     3
wenzelm@64098
     4
Build log parsing for historic versions.
wenzelm@64045
     5
*/
wenzelm@64045
     6
wenzelm@64045
     7
package isabelle
wenzelm@64045
     8
wenzelm@64045
     9
wenzelm@64096
    10
import java.util.Locale
wenzelm@64090
    11
import java.io.{File => JFile}
wenzelm@64061
    12
wenzelm@64054
    13
import scala.collection.mutable
wenzelm@64054
    14
import scala.util.matching.Regex
wenzelm@64054
    15
wenzelm@64054
    16
wenzelm@64045
    17
object Build_Log
wenzelm@64045
    18
{
wenzelm@64081
    19
  /** settings **/
wenzelm@64080
    20
wenzelm@64081
    21
  object Settings
wenzelm@64081
    22
  {
wenzelm@64081
    23
    val build_settings = List("ISABELLE_BUILD_OPTIONS")
wenzelm@64081
    24
    val ml_settings = List("ML_PLATFORM", "ML_HOME", "ML_SYSTEM", "ML_OPTIONS")
wenzelm@64081
    25
    val all_settings = build_settings ::: ml_settings
wenzelm@64081
    26
wenzelm@64081
    27
    type Entry = (String, String)
wenzelm@64081
    28
    type T = List[Entry]
wenzelm@64080
    29
wenzelm@64081
    30
    object Entry
wenzelm@64081
    31
    {
wenzelm@64081
    32
      def unapply(s: String): Option[Entry] =
wenzelm@64081
    33
        s.indexOf('=') match {
wenzelm@64081
    34
          case -1 => None
wenzelm@64081
    35
          case i =>
wenzelm@64081
    36
            val a = s.substring(0, i)
wenzelm@64081
    37
            val b = Library.perhaps_unquote(s.substring(i + 1))
wenzelm@64081
    38
            Some((a, b))
wenzelm@64081
    39
        }
wenzelm@64081
    40
      def apply(a: String, b: String): String = a + "=" + quote(b)
wenzelm@64081
    41
      def getenv(a: String): String = apply(a, Isabelle_System.getenv(a))
wenzelm@64081
    42
    }
wenzelm@64080
    43
wenzelm@64081
    44
    def show(): String =
wenzelm@64081
    45
      cat_lines(
wenzelm@64081
    46
        build_settings.map(Entry.getenv(_)) ::: List("") ::: ml_settings.map(Entry.getenv(_)))
wenzelm@64080
    47
  }
wenzelm@64080
    48
wenzelm@64080
    49
wenzelm@64062
    50
  /** log file **/
wenzelm@64045
    51
wenzelm@64062
    52
  object Log_File
wenzelm@64062
    53
  {
wenzelm@64062
    54
    def apply(name: String, lines: List[String]): Log_File =
wenzelm@64062
    55
      new Log_File(name, lines)
wenzelm@64062
    56
wenzelm@64062
    57
    def apply(name: String, text: String): Log_File =
wenzelm@64063
    58
      Log_File(name, Library.trim_split_lines(text))
wenzelm@64090
    59
wenzelm@64090
    60
    def apply(file: JFile): Log_File =
wenzelm@64090
    61
    {
wenzelm@64090
    62
      val name = file.getName
wenzelm@64090
    63
      val (base_name, text) =
wenzelm@64090
    64
        Library.try_unsuffix(".gz", name) match {
wenzelm@64090
    65
          case Some(base_name) => (base_name, File.read_gzip(file))
wenzelm@64090
    66
          case None =>
wenzelm@64090
    67
            Library.try_unsuffix(".xz", name) match {
wenzelm@64090
    68
              case Some(base_name) => (base_name, File.read_xz(file))
wenzelm@64090
    69
              case None => (name, File.read(file))
wenzelm@64090
    70
            }
wenzelm@64090
    71
          }
wenzelm@64090
    72
      apply(base_name, text)
wenzelm@64090
    73
    }
wenzelm@64090
    74
wenzelm@64090
    75
    def apply(path: Path): Log_File = apply(path.file)
wenzelm@64062
    76
  }
wenzelm@64062
    77
wenzelm@64062
    78
  class Log_File private(val name: String, val lines: List[String])
wenzelm@64045
    79
  {
wenzelm@64062
    80
    log_file =>
wenzelm@64062
    81
wenzelm@64062
    82
    override def toString: String = name
wenzelm@64062
    83
wenzelm@64062
    84
    def text: String = cat_lines(lines)
wenzelm@64062
    85
wenzelm@64062
    86
    def err(msg: String): Nothing =
wenzelm@64062
    87
      error("Error in log file " + quote(name) + ": " + msg)
wenzelm@64062
    88
wenzelm@64062
    89
wenzelm@64062
    90
    /* inlined content */
wenzelm@64062
    91
wenzelm@64062
    92
    def find[A](f: String => Option[A]): Option[A] =
wenzelm@64062
    93
      lines.iterator.map(f).find(_.isDefined).map(_.get)
wenzelm@64062
    94
wenzelm@64062
    95
    def find_match(regex: Regex): Option[String] =
wenzelm@64062
    96
      lines.iterator.map(regex.unapplySeq(_)).find(res => res.isDefined && res.get.length == 1).
wenzelm@64062
    97
        map(res => res.get.head)
wenzelm@64062
    98
wenzelm@64062
    99
wenzelm@64062
   100
    /* settings */
wenzelm@64062
   101
wenzelm@64091
   102
    def get_setting(a: String): Option[Settings.Entry] =
wenzelm@64091
   103
      lines.find(_.startsWith(a + "=")) match {
wenzelm@64091
   104
        case Some(line) => Settings.Entry.unapply(line)
wenzelm@64091
   105
        case None => None
wenzelm@64091
   106
      }
wenzelm@64045
   107
wenzelm@64091
   108
    def get_settings(as: List[String]): Settings.T =
wenzelm@64091
   109
      for { a <- as; entry <- get_setting(a) } yield entry
wenzelm@64062
   110
wenzelm@64062
   111
wenzelm@64062
   112
    /* properties (YXML) */
wenzelm@64062
   113
wenzelm@64062
   114
    val xml_cache = new XML.Cache()
wenzelm@64062
   115
wenzelm@64062
   116
    def parse_props(text: String): Properties.T =
wenzelm@64062
   117
      xml_cache.props(XML.Decode.properties(YXML.parse_body(text)))
wenzelm@64062
   118
wenzelm@64062
   119
    def filter_props(prefix: String): List[Properties.T] =
wenzelm@64062
   120
      for (line <- lines; s <- Library.try_unprefix(prefix, line)) yield parse_props(s)
wenzelm@64045
   121
wenzelm@64062
   122
    def find_line(prefix: String): Option[String] =
wenzelm@64062
   123
      find(Library.try_unprefix(prefix, _))
wenzelm@64062
   124
wenzelm@64062
   125
    def find_props(prefix: String): Option[Properties.T] =
wenzelm@64062
   126
      find_line(prefix).map(parse_props(_))
wenzelm@64062
   127
wenzelm@64062
   128
wenzelm@64062
   129
    /* parse various formats */
wenzelm@64062
   130
wenzelm@64082
   131
    def parse_session_info(
wenzelm@64085
   132
        default_name: String = "",
wenzelm@64082
   133
        command_timings: Boolean = false,
wenzelm@64082
   134
        ml_statistics: Boolean = false,
wenzelm@64082
   135
        task_statistics: Boolean = false): Session_Info =
wenzelm@64082
   136
      Build_Log.parse_session_info(
wenzelm@64085
   137
        log_file, default_name, command_timings, ml_statistics, task_statistics)
wenzelm@64062
   138
wenzelm@64085
   139
    def parse_header(): Header = Build_Log.parse_header(log_file)
wenzelm@64062
   140
wenzelm@64085
   141
    def parse_build_info(): Build_Info = Build_Log.parse_build_info(log_file)
wenzelm@64045
   142
  }
wenzelm@64045
   143
wenzelm@64045
   144
wenzelm@64098
   145
wenzelm@64099
   146
  /** meta data **/
wenzelm@64045
   147
wenzelm@64099
   148
  object Field
wenzelm@64045
   149
  {
wenzelm@64099
   150
    val build_host = "build_host"
wenzelm@64099
   151
    val build_start = "build_start"
wenzelm@64099
   152
    val build_end = "build_end"
wenzelm@64099
   153
    val isabelle_version = "isabelle_version"
wenzelm@64099
   154
    val afp_version = "afp_version"
wenzelm@64045
   155
  }
wenzelm@64054
   156
wenzelm@64099
   157
  object Kind extends Enumeration
wenzelm@64099
   158
  {
wenzelm@64099
   159
    val ISATEST = Value("isatest")
wenzelm@64099
   160
    val AFP_TEST = Value("afp-test")
wenzelm@64099
   161
    val JENKINS = Value("jenkins")
wenzelm@64099
   162
  }
wenzelm@64098
   163
wenzelm@64099
   164
  sealed case class Header(kind: Kind.Value, props: Properties.T, settings: List[(String, String)])
wenzelm@64061
   165
wenzelm@64095
   166
  val Date_Format =
wenzelm@64098
   167
  {
wenzelm@64098
   168
    val fmts =
wenzelm@64098
   169
      Date.Formatter.variants(
wenzelm@64098
   170
        List("EEE MMM d HH:mm:ss VV yyyy", "EEE MMM d HH:mm:ss O yyyy"),
wenzelm@64098
   171
        List(Locale.ENGLISH, Locale.GERMAN))
wenzelm@64098
   172
wenzelm@64099
   173
    // workaround undetected timezones
wenzelm@64098
   174
    def tune(s: String): String =
wenzelm@64098
   175
      Word.implode(Word.explode(s).map({
wenzelm@64095
   176
        case "CET" | "MET" => "GMT+1"
wenzelm@64095
   177
        case "CEST" | "MEST" => "GMT+2"
wenzelm@64095
   178
        case "EST" => "GMT+1"  // FIXME ??
wenzelm@64098
   179
        case a => a }))
wenzelm@64098
   180
wenzelm@64098
   181
    Date.Format.make(fmts, tune)
wenzelm@64098
   182
  }
wenzelm@64095
   183
wenzelm@64095
   184
  object Isatest
wenzelm@64095
   185
  {
wenzelm@64095
   186
    val Test_Start = new Regex("""^------------------- starting test --- (.+) --- (.+)$""")
wenzelm@64095
   187
    val Test_End = new Regex("""^------------------- test (?:successful|FAILED) --- (.+) --- .*$""")
wenzelm@64095
   188
    val Isabelle_Version = new Regex("""^Isabelle version: (\S+)$""")
wenzelm@64095
   189
    val No_AFP_Version = new Regex("""$.""")
wenzelm@64095
   190
  }
wenzelm@64095
   191
wenzelm@64061
   192
  object AFP
wenzelm@64061
   193
  {
wenzelm@64091
   194
    val Test_Start = new Regex("""^Start test(?: for .+)? at ([^,]+), (.*)$""")
wenzelm@64091
   195
    val Test_Start_Old = new Regex("""^Start test(?: for .+)? at ([^,]+)$""")
wenzelm@64091
   196
    val Test_End = new Regex("""^End test on (.+), .+, elapsed time:.*$""")
wenzelm@64087
   197
    val Isabelle_Version = new Regex("""^Isabelle version: .* -- hg id (\S+)$""")
wenzelm@64087
   198
    val AFP_Version = new Regex("""^AFP version: .* -- hg id (\S+)$""")
wenzelm@64061
   199
  }
wenzelm@64061
   200
wenzelm@64062
   201
  private def parse_header(log_file: Log_File): Header =
wenzelm@64061
   202
  {
wenzelm@64099
   203
    def parse(kind: Kind.Value, start: Date, hostname: String,
wenzelm@64095
   204
      Test_End: Regex, Isabelle_Version: Regex, AFP_Version: Regex): Header =
wenzelm@64091
   205
    {
wenzelm@64091
   206
      val start_date = Field.build_start -> start.toString
wenzelm@64091
   207
      val end_date =
wenzelm@64091
   208
        log_file.lines.last match {
wenzelm@64095
   209
          case Test_End(Date_Format.Strict(end_date)) =>
wenzelm@64091
   210
            List(Field.build_end -> end_date.toString)
wenzelm@64091
   211
          case _ => Nil
wenzelm@64091
   212
        }
wenzelm@64091
   213
wenzelm@64091
   214
      val build_host = if (hostname == "") Nil else List(Field.build_host -> hostname)
wenzelm@64061
   215
wenzelm@64091
   216
      val isabelle_version =
wenzelm@64095
   217
        log_file.find_match(Isabelle_Version).map(Field.isabelle_version -> _)
wenzelm@64091
   218
wenzelm@64091
   219
      val afp_version =
wenzelm@64095
   220
        log_file.find_match(AFP_Version).map(Field.afp_version -> _)
wenzelm@64062
   221
wenzelm@64095
   222
      Header(kind,
wenzelm@64095
   223
        start_date :: end_date ::: build_host :::
wenzelm@64095
   224
          isabelle_version.toList ::: afp_version.toList,
wenzelm@64091
   225
        log_file.get_settings(Settings.all_settings))
wenzelm@64091
   226
    }
wenzelm@64091
   227
wenzelm@64091
   228
    log_file.lines match {
wenzelm@64095
   229
      case Isatest.Test_Start(Date_Format.Strict(start), hostname) :: _ =>
wenzelm@64099
   230
        parse(Kind.ISATEST, start, hostname,
wenzelm@64095
   231
          Isatest.Test_End, Isatest.Isabelle_Version, Isatest.No_AFP_Version)
wenzelm@64099
   232
wenzelm@64095
   233
      case AFP.Test_Start(Date_Format.Strict(start), hostname) :: _ =>
wenzelm@64099
   234
        parse(Kind.AFP_TEST, start, hostname,
wenzelm@64095
   235
          AFP.Test_End, AFP.Isabelle_Version, AFP.AFP_Version)
wenzelm@64099
   236
wenzelm@64095
   237
      case AFP.Test_Start_Old(Date_Format.Strict(start)) :: _ =>
wenzelm@64099
   238
        parse(Kind.AFP_TEST, start, "",
wenzelm@64095
   239
          AFP.Test_End, AFP.Isabelle_Version, AFP.AFP_Version)
wenzelm@64099
   240
wenzelm@64062
   241
      case _ => log_file.err("cannot detect log header format")
wenzelm@64061
   242
    }
wenzelm@64061
   243
  }
wenzelm@64061
   244
wenzelm@64085
   245
wenzelm@64098
   246
wenzelm@64098
   247
  /** build info: produced by isabelle build **/
wenzelm@64085
   248
wenzelm@64061
   249
  object Session_Status extends Enumeration
wenzelm@64061
   250
  {
wenzelm@64085
   251
    val EXISTING = Value("existing")
wenzelm@64061
   252
    val FINISHED = Value("finished")
wenzelm@64061
   253
    val FAILED = Value("failed")
wenzelm@64061
   254
    val CANCELLED = Value("cancelled")
wenzelm@64061
   255
  }
wenzelm@64061
   256
wenzelm@64085
   257
  sealed case class Session_Entry(
wenzelm@64085
   258
    chapter: String,
wenzelm@64085
   259
    groups: List[String],
wenzelm@64085
   260
    threads: Option[Int],
wenzelm@64089
   261
    timing: Timing,
wenzelm@64089
   262
    ml_timing: Timing,
wenzelm@64085
   263
    status: Session_Status.Value)
wenzelm@64085
   264
  {
wenzelm@64085
   265
    def finished: Boolean = status == Session_Status.FINISHED
wenzelm@64085
   266
  }
wenzelm@64054
   267
wenzelm@64085
   268
  sealed case class Build_Info(sessions: Map[String, Session_Entry])
wenzelm@64054
   269
  {
wenzelm@64085
   270
    def session(name: String): Session_Entry = sessions(name)
wenzelm@64085
   271
    def get_session(name: String): Option[Session_Entry] = sessions.get(name)
wenzelm@64054
   272
wenzelm@64089
   273
    def get_default[A](name: String, f: Session_Entry => A, x: A): A =
wenzelm@64085
   274
      get_session(name) match {
wenzelm@64089
   275
        case Some(entry) => f(entry)
wenzelm@64089
   276
        case None => x
wenzelm@64085
   277
      }
wenzelm@64085
   278
wenzelm@64089
   279
    def finished(name: String): Boolean = get_default(name, _.finished, false)
wenzelm@64089
   280
    def timing(name: String): Timing = get_default(name, _.timing, Timing.zero)
wenzelm@64089
   281
    def ml_timing(name: String): Timing = get_default(name, _.ml_timing, Timing.zero)
wenzelm@64054
   282
  }
wenzelm@64054
   283
wenzelm@64085
   284
  private def parse_build_info(log_file: Log_File): Build_Info =
wenzelm@64085
   285
  {
wenzelm@64085
   286
    object Chapter_Name
wenzelm@64085
   287
    {
wenzelm@64085
   288
      def unapply(s: String): Some[(String, String)] =
wenzelm@64085
   289
        space_explode('/', s) match {
wenzelm@64085
   290
          case List(chapter, name) => Some((chapter, name))
wenzelm@64085
   291
          case _ => Some(("", s))
wenzelm@64085
   292
        }
wenzelm@64085
   293
    }
wenzelm@64054
   294
wenzelm@64085
   295
    val Session_No_Groups = new Regex("""^Session (\S+)$""")
wenzelm@64085
   296
    val Session_Groups = new Regex("""^Session (\S+) \((.*)\)$""")
wenzelm@64085
   297
    val Session_Finished1 =
wenzelm@64085
   298
      new Regex("""^Finished (\S+) \((\d+):(\d+):(\d+) elapsed time, (\d+):(\d+):(\d+) cpu time.*$""")
wenzelm@64085
   299
    val Session_Finished2 =
wenzelm@64085
   300
      new Regex("""^Finished (\S+) \((\d+):(\d+):(\d+) elapsed time.*$""")
wenzelm@64085
   301
    val Session_Timing =
wenzelm@64085
   302
      new Regex("""^Timing (\S+) \((\d) threads, (\d+\.\d+)s elapsed time, (\d+\.\d+)s cpu time, (\d+\.\d+)s GC time.*$""")
wenzelm@64086
   303
    val Session_Started = new Regex("""^(?:Running|Building) (\S+) \.\.\.$""")
wenzelm@64085
   304
    val Session_Failed = new Regex("""^(\S+) FAILED""")
wenzelm@64085
   305
    val Session_Cancelled = new Regex("""^(\S+) CANCELLED""")
wenzelm@64085
   306
wenzelm@64085
   307
    var chapter = Map.empty[String, String]
wenzelm@64085
   308
    var groups = Map.empty[String, List[String]]
wenzelm@64085
   309
    var threads = Map.empty[String, Int]
wenzelm@64054
   310
    var timing = Map.empty[String, Timing]
wenzelm@64085
   311
    var ml_timing = Map.empty[String, Timing]
wenzelm@64086
   312
    var started = Set.empty[String]
wenzelm@64085
   313
    var failed = Set.empty[String]
wenzelm@64085
   314
    var cancelled = Set.empty[String]
wenzelm@64085
   315
    def all_sessions: Set[String] =
wenzelm@64085
   316
      chapter.keySet ++ groups.keySet ++ threads.keySet ++
wenzelm@64086
   317
      timing.keySet ++ ml_timing.keySet ++ failed ++ cancelled ++ started
wenzelm@64085
   318
wenzelm@64054
   319
wenzelm@64062
   320
    for (line <- log_file.lines) {
wenzelm@64054
   321
      line match {
wenzelm@64085
   322
        case Session_No_Groups(Chapter_Name(chapt, name)) =>
wenzelm@64085
   323
          chapter += (name -> chapt)
wenzelm@64085
   324
          groups += (name -> Nil)
wenzelm@64085
   325
        case Session_Groups(Chapter_Name(chapt, name), grps) =>
wenzelm@64085
   326
          chapter += (name -> chapt)
wenzelm@64085
   327
          groups += (name -> Word.explode(grps))
wenzelm@64086
   328
        case Session_Started(name) =>
wenzelm@64086
   329
          started += name
wenzelm@64054
   330
        case Session_Finished1(name,
wenzelm@64054
   331
            Value.Int(e1), Value.Int(e2), Value.Int(e3),
wenzelm@64054
   332
            Value.Int(c1), Value.Int(c2), Value.Int(c3)) =>
wenzelm@64054
   333
          val elapsed = Time.hms(e1, e2, e3)
wenzelm@64054
   334
          val cpu = Time.hms(c1, c2, c3)
wenzelm@64085
   335
          timing += (name -> Timing(elapsed, cpu, Time.zero))
wenzelm@64054
   336
        case Session_Finished2(name,
wenzelm@64054
   337
            Value.Int(e1), Value.Int(e2), Value.Int(e3)) =>
wenzelm@64054
   338
          val elapsed = Time.hms(e1, e2, e3)
wenzelm@64085
   339
          timing += (name -> Timing(elapsed, Time.zero, Time.zero))
wenzelm@64054
   340
        case Session_Timing(name,
wenzelm@64054
   341
            Value.Int(t), Value.Double(e), Value.Double(c), Value.Double(g)) =>
wenzelm@64054
   342
          val elapsed = Time.seconds(e)
wenzelm@64054
   343
          val cpu = Time.seconds(c)
wenzelm@64054
   344
          val gc = Time.seconds(g)
wenzelm@64085
   345
          ml_timing += (name -> Timing(elapsed, cpu, gc))
wenzelm@64054
   346
          threads += (name -> t)
wenzelm@64054
   347
        case _ =>
wenzelm@64054
   348
      }
wenzelm@64054
   349
    }
wenzelm@64054
   350
wenzelm@64085
   351
    val sessions =
wenzelm@64085
   352
      Map(
wenzelm@64085
   353
        (for (name <- all_sessions.toList) yield {
wenzelm@64085
   354
          val status =
wenzelm@64085
   355
            if (failed(name)) Session_Status.FAILED
wenzelm@64085
   356
            else if (cancelled(name)) Session_Status.CANCELLED
wenzelm@64086
   357
            else if (timing.isDefinedAt(name) || ml_timing.isDefinedAt(name))
wenzelm@64086
   358
              Session_Status.FINISHED
wenzelm@64086
   359
            else if (started(name)) Session_Status.FAILED
wenzelm@64085
   360
            else Session_Status.EXISTING
wenzelm@64085
   361
          val entry =
wenzelm@64085
   362
            Session_Entry(
wenzelm@64085
   363
              chapter.getOrElse(name, ""),
wenzelm@64085
   364
              groups.getOrElse(name, Nil),
wenzelm@64085
   365
              threads.get(name),
wenzelm@64089
   366
              timing.getOrElse(name, Timing.zero),
wenzelm@64089
   367
              ml_timing.getOrElse(name, Timing.zero),
wenzelm@64085
   368
              status)
wenzelm@64085
   369
          (name -> entry)
wenzelm@64085
   370
        }):_*)
wenzelm@64085
   371
    Build_Info(sessions)
wenzelm@64054
   372
  }
wenzelm@64099
   373
wenzelm@64099
   374
wenzelm@64099
   375
wenzelm@64099
   376
  /** session info: produced by "isabelle build" **/
wenzelm@64099
   377
wenzelm@64099
   378
  sealed case class Session_Info(
wenzelm@64099
   379
    session_name: String,
wenzelm@64099
   380
    session_timing: Properties.T,
wenzelm@64099
   381
    command_timings: List[Properties.T],
wenzelm@64099
   382
    ml_statistics: List[Properties.T],
wenzelm@64099
   383
    task_statistics: List[Properties.T])
wenzelm@64099
   384
wenzelm@64099
   385
  private def parse_session_info(
wenzelm@64099
   386
    log_file: Log_File,
wenzelm@64099
   387
    default_name: String,
wenzelm@64099
   388
    command_timings: Boolean,
wenzelm@64099
   389
    ml_statistics: Boolean,
wenzelm@64099
   390
    task_statistics: Boolean): Session_Info =
wenzelm@64099
   391
  {
wenzelm@64099
   392
    val xml_cache = new XML.Cache()
wenzelm@64099
   393
wenzelm@64099
   394
    val session_name =
wenzelm@64099
   395
      log_file.find_line("\fSession.name = ") match {
wenzelm@64099
   396
        case None => default_name
wenzelm@64099
   397
        case Some(name) if default_name == "" || default_name == name => name
wenzelm@64099
   398
        case Some(name) => log_file.err("log from different session " + quote(name))
wenzelm@64099
   399
      }
wenzelm@64099
   400
    val session_timing = log_file.find_props("\fTiming = ") getOrElse Nil
wenzelm@64099
   401
    val command_timings_ =
wenzelm@64099
   402
      if (command_timings) log_file.filter_props("\fcommand_timing = ") else Nil
wenzelm@64099
   403
    val ml_statistics_ =
wenzelm@64099
   404
      if (ml_statistics) log_file.filter_props("\fML_statistics = ") else Nil
wenzelm@64099
   405
    val task_statistics_ =
wenzelm@64099
   406
      if (task_statistics) log_file.filter_props("\ftask_statistics = ") else Nil
wenzelm@64099
   407
wenzelm@64099
   408
    Session_Info(session_name, session_timing, command_timings_, ml_statistics_, task_statistics_)
wenzelm@64099
   409
  }
wenzelm@64045
   410
}