author | wenzelm |
Wed, 26 Apr 2017 16:30:11 +0200 | |
changeset 65590 | 3e7bf5e34e0b |
parent 65588 | b0d8d97198b3 |
child 65591 | 5953c7fbc2b8 |
permissions | -rw-r--r-- |
64160 | 1 |
/* Title: Pure/Admin/build_log.scala |
64045 | 2 |
Author: Makarius |
3 |
||
64110 | 4 |
Build log parsing for current and historic formats. |
64045 | 5 |
*/ |
6 |
||
7 |
package isabelle |
|
8 |
||
9 |
||
64100 | 10 |
import java.io.{File => JFile} |
11 |
import java.time.ZoneId |
|
64110 | 12 |
import java.time.format.{DateTimeFormatter, DateTimeParseException} |
64096 | 13 |
import java.util.Locale |
64061
1bbea2b55d22
some support for header and data fields, notably from afp-test;
wenzelm
parents:
64054
diff
changeset
|
14 |
|
64054 | 15 |
import scala.collection.mutable |
16 |
import scala.util.matching.Regex |
|
17 |
||
18 |
||
64045 | 19 |
object Build_Log |
20 |
{ |
|
64298 | 21 |
/** content **/ |
64101 | 22 |
|
64298 | 23 |
/* properties */ |
64150 | 24 |
|
64298 | 25 |
object Prop |
26 |
{ |
|
64303
605351c7ef97
another attempt to squeeze a list into a property list entry;
wenzelm
parents:
64300
diff
changeset
|
27 |
val separator = '\u000b' |
605351c7ef97
another attempt to squeeze a list into a property list entry;
wenzelm
parents:
64300
diff
changeset
|
28 |
|
64300
3073688abbe9
clarified multiple props: result needs to fit on a single line within the log file;
wenzelm
parents:
64299
diff
changeset
|
29 |
def multiple(name: String, args: List[String]): Properties.T = |
3073688abbe9
clarified multiple props: result needs to fit on a single line within the log file;
wenzelm
parents:
64299
diff
changeset
|
30 |
if (args.isEmpty) Nil |
64303
605351c7ef97
another attempt to squeeze a list into a property list entry;
wenzelm
parents:
64300
diff
changeset
|
31 |
else List(name -> args.mkString(separator.toString)) |
64299 | 32 |
|
64300
3073688abbe9
clarified multiple props: result needs to fit on a single line within the log file;
wenzelm
parents:
64299
diff
changeset
|
33 |
val build_tags = "build_tags" // multiple |
3073688abbe9
clarified multiple props: result needs to fit on a single line within the log file;
wenzelm
parents:
64299
diff
changeset
|
34 |
val build_args = "build_args" // multiple |
64298 | 35 |
val build_group_id = "build_group_id" |
36 |
val build_id = "build_id" |
|
37 |
val build_engine = "build_engine" |
|
38 |
val build_host = "build_host" |
|
39 |
val build_start = "build_start" |
|
40 |
val build_end = "build_end" |
|
41 |
val isabelle_version = "isabelle_version" |
|
42 |
val afp_version = "afp_version" |
|
43 |
} |
|
64150 | 44 |
|
45 |
||
64298 | 46 |
/* settings */ |
64080 | 47 |
|
64081 | 48 |
object Settings |
49 |
{ |
|
50 |
val build_settings = List("ISABELLE_BUILD_OPTIONS") |
|
51 |
val ml_settings = List("ML_PLATFORM", "ML_HOME", "ML_SYSTEM", "ML_OPTIONS") |
|
52 |
val all_settings = build_settings ::: ml_settings |
|
53 |
||
54 |
type Entry = (String, String) |
|
55 |
type T = List[Entry] |
|
64080 | 56 |
|
64081 | 57 |
object Entry |
58 |
{ |
|
59 |
def unapply(s: String): Option[Entry] = |
|
60 |
s.indexOf('=') match { |
|
61 |
case -1 => None |
|
62 |
case i => |
|
63 |
val a = s.substring(0, i) |
|
64 |
val b = Library.perhaps_unquote(s.substring(i + 1)) |
|
65 |
Some((a, b)) |
|
66 |
} |
|
67 |
def apply(a: String, b: String): String = a + "=" + quote(b) |
|
68 |
def getenv(a: String): String = apply(a, Isabelle_System.getenv(a)) |
|
69 |
} |
|
64080 | 70 |
|
64081 | 71 |
def show(): String = |
72 |
cat_lines( |
|
73 |
build_settings.map(Entry.getenv(_)) ::: List("") ::: ml_settings.map(Entry.getenv(_))) |
|
64080 | 74 |
} |
75 |
||
76 |
||
64298 | 77 |
/* file names */ |
78 |
||
79 |
def log_date(date: Date): String = |
|
80 |
String.format(Locale.ROOT, "%s.%05d", |
|
81 |
DateTimeFormatter.ofPattern("yyyy-MM-dd").format(date.rep), |
|
82 |
new java.lang.Long((date.time - date.midnight.time).ms / 1000)) |
|
83 |
||
84 |
def log_subdir(date: Date): Path = |
|
85 |
Path.explode("log") + Path.explode(date.rep.getYear.toString) |
|
86 |
||
87 |
def log_filename(engine: String, date: Date, more: List[String] = Nil): Path = |
|
88 |
Path.explode((engine :: log_date(date) :: more).mkString("", "_", ".log")) |
|
89 |
||
90 |
||
91 |
/* log file collections */ |
|
92 |
||
65588 | 93 |
def is_log(file: JFile, |
94 |
prefixes: Iterable[String] = |
|
95 |
List(Build_History.log_prefix, Isatest.log_prefix, AFP_Test.log_prefix), |
|
96 |
suffixes: Iterable[String] = |
|
97 |
List(".log", ".log.gz", ".log.xz")): Boolean = |
|
98 |
{ |
|
99 |
val name = file.getName |
|
100 |
prefixes.iterator.exists(name.startsWith(_)) && |
|
101 |
suffixes.iterator.exists(name.endsWith(_)) |
|
102 |
} |
|
64298 | 103 |
|
65588 | 104 |
def log_files(dirs: Iterable[Path]): List[JFile] = |
105 |
dirs.iterator.flatMap(dir => File.find_files(dir.file, is_log(_))).toList |
|
64298 | 106 |
|
107 |
||
64100 | 108 |
|
64062 | 109 |
/** log file **/ |
64045 | 110 |
|
64155 | 111 |
def print_date(date: Date): String = Log_File.Date_Format(date) |
112 |
||
64062 | 113 |
object Log_File |
114 |
{ |
|
115 |
def apply(name: String, lines: List[String]): Log_File = |
|
116 |
new Log_File(name, lines) |
|
117 |
||
118 |
def apply(name: String, text: String): Log_File = |
|
64063 | 119 |
Log_File(name, Library.trim_split_lines(text)) |
64090 | 120 |
|
121 |
def apply(file: JFile): Log_File = |
|
122 |
{ |
|
123 |
val name = file.getName |
|
124 |
val (base_name, text) = |
|
125 |
Library.try_unsuffix(".gz", name) match { |
|
126 |
case Some(base_name) => (base_name, File.read_gzip(file)) |
|
127 |
case None => |
|
128 |
Library.try_unsuffix(".xz", name) match { |
|
129 |
case Some(base_name) => (base_name, File.read_xz(file)) |
|
130 |
case None => (name, File.read(file)) |
|
131 |
} |
|
132 |
} |
|
133 |
apply(base_name, text) |
|
134 |
} |
|
135 |
||
136 |
def apply(path: Path): Log_File = apply(path.file) |
|
64101 | 137 |
|
64110 | 138 |
|
139 |
/* date format */ |
|
140 |
||
64101 | 141 |
val Date_Format = |
142 |
{ |
|
143 |
val fmts = |
|
144 |
Date.Formatter.variants( |
|
64116 | 145 |
List("EEE MMM d HH:mm:ss O yyyy", "EEE MMM d HH:mm:ss VV yyyy"), |
64104
b70fa05d6746
more permissive: accept all historic isatest and afp-test logs;
wenzelm
parents:
64103
diff
changeset
|
146 |
List(Locale.ENGLISH, Locale.GERMAN)) ::: |
64110 | 147 |
List( |
148 |
DateTimeFormatter.RFC_1123_DATE_TIME, |
|
149 |
Date.Formatter.pattern("EEE MMM d HH:mm:ss yyyy").withZone(ZoneId.of("Europe/Berlin"))) |
|
64101 | 150 |
|
64104
b70fa05d6746
more permissive: accept all historic isatest and afp-test logs;
wenzelm
parents:
64103
diff
changeset
|
151 |
def tune_timezone(s: String): String = |
b70fa05d6746
more permissive: accept all historic isatest and afp-test logs;
wenzelm
parents:
64103
diff
changeset
|
152 |
s match { |
64101 | 153 |
case "CET" | "MET" => "GMT+1" |
154 |
case "CEST" | "MEST" => "GMT+2" |
|
64104
b70fa05d6746
more permissive: accept all historic isatest and afp-test logs;
wenzelm
parents:
64103
diff
changeset
|
155 |
case "EST" => "Europe/Berlin" |
b70fa05d6746
more permissive: accept all historic isatest and afp-test logs;
wenzelm
parents:
64103
diff
changeset
|
156 |
case _ => s |
b70fa05d6746
more permissive: accept all historic isatest and afp-test logs;
wenzelm
parents:
64103
diff
changeset
|
157 |
} |
b70fa05d6746
more permissive: accept all historic isatest and afp-test logs;
wenzelm
parents:
64103
diff
changeset
|
158 |
def tune_weekday(s: String): String = |
b70fa05d6746
more permissive: accept all historic isatest and afp-test logs;
wenzelm
parents:
64103
diff
changeset
|
159 |
s match { |
b70fa05d6746
more permissive: accept all historic isatest and afp-test logs;
wenzelm
parents:
64103
diff
changeset
|
160 |
case "Die" => "Di" |
b70fa05d6746
more permissive: accept all historic isatest and afp-test logs;
wenzelm
parents:
64103
diff
changeset
|
161 |
case "Mit" => "Mi" |
b70fa05d6746
more permissive: accept all historic isatest and afp-test logs;
wenzelm
parents:
64103
diff
changeset
|
162 |
case "Don" => "Do" |
b70fa05d6746
more permissive: accept all historic isatest and afp-test logs;
wenzelm
parents:
64103
diff
changeset
|
163 |
case "Fre" => "Fr" |
b70fa05d6746
more permissive: accept all historic isatest and afp-test logs;
wenzelm
parents:
64103
diff
changeset
|
164 |
case "Sam" => "Sa" |
b70fa05d6746
more permissive: accept all historic isatest and afp-test logs;
wenzelm
parents:
64103
diff
changeset
|
165 |
case "Son" => "So" |
b70fa05d6746
more permissive: accept all historic isatest and afp-test logs;
wenzelm
parents:
64103
diff
changeset
|
166 |
case _ => s |
b70fa05d6746
more permissive: accept all historic isatest and afp-test logs;
wenzelm
parents:
64103
diff
changeset
|
167 |
} |
b70fa05d6746
more permissive: accept all historic isatest and afp-test logs;
wenzelm
parents:
64103
diff
changeset
|
168 |
|
b70fa05d6746
more permissive: accept all historic isatest and afp-test logs;
wenzelm
parents:
64103
diff
changeset
|
169 |
def tune(s: String): String = |
b70fa05d6746
more permissive: accept all historic isatest and afp-test logs;
wenzelm
parents:
64103
diff
changeset
|
170 |
Word.implode( |
b70fa05d6746
more permissive: accept all historic isatest and afp-test logs;
wenzelm
parents:
64103
diff
changeset
|
171 |
Word.explode(s) match { |
b70fa05d6746
more permissive: accept all historic isatest and afp-test logs;
wenzelm
parents:
64103
diff
changeset
|
172 |
case a :: "M\uFFFDr" :: bs => tune_weekday(a) :: "Mär" :: bs.map(tune_timezone(_)) |
b70fa05d6746
more permissive: accept all historic isatest and afp-test logs;
wenzelm
parents:
64103
diff
changeset
|
173 |
case a :: bs => tune_weekday(a) :: bs.map(tune_timezone(_)) |
b70fa05d6746
more permissive: accept all historic isatest and afp-test logs;
wenzelm
parents:
64103
diff
changeset
|
174 |
case Nil => Nil |
b70fa05d6746
more permissive: accept all historic isatest and afp-test logs;
wenzelm
parents:
64103
diff
changeset
|
175 |
} |
b70fa05d6746
more permissive: accept all historic isatest and afp-test logs;
wenzelm
parents:
64103
diff
changeset
|
176 |
) |
64101 | 177 |
|
178 |
Date.Format.make(fmts, tune) |
|
179 |
} |
|
64117 | 180 |
|
181 |
||
182 |
/* inlined content */ |
|
183 |
||
64119
8094eaa38d4b
inline session ML statistics into main build log;
wenzelm
parents:
64117
diff
changeset
|
184 |
def print_props(marker: String, props: Properties.T): String = |
8094eaa38d4b
inline session ML statistics into main build log;
wenzelm
parents:
64117
diff
changeset
|
185 |
marker + YXML.string_of_body(XML.Encode.properties(props)) |
64102 | 186 |
} |
187 |
||
188 |
class Log_File private(val name: String, val lines: List[String]) |
|
189 |
{ |
|
190 |
log_file => |
|
191 |
||
192 |
override def toString: String = name |
|
193 |
||
194 |
def text: String = cat_lines(lines) |
|
195 |
||
196 |
def err(msg: String): Nothing = |
|
197 |
error("Error in log file " + quote(name) + ": " + msg) |
|
198 |
||
199 |
||
200 |
/* date format */ |
|
64101 | 201 |
|
202 |
object Strict_Date |
|
203 |
{ |
|
204 |
def unapply(s: String): Some[Date] = |
|
64102 | 205 |
try { Some(Log_File.Date_Format.parse(s)) } |
64101 | 206 |
catch { case exn: DateTimeParseException => log_file.err(exn.getMessage) } |
207 |
} |
|
208 |
||
209 |
||
64062 | 210 |
/* inlined content */ |
211 |
||
212 |
def find[A](f: String => Option[A]): Option[A] = |
|
213 |
lines.iterator.map(f).find(_.isDefined).map(_.get) |
|
214 |
||
64196
6688b9cd443b
more robust wrt. old versions that use clear-text properties (e.g. Timing in build_history_base);
wenzelm
parents:
64193
diff
changeset
|
215 |
def find_line(marker: String): Option[String] = |
6688b9cd443b
more robust wrt. old versions that use clear-text properties (e.g. Timing in build_history_base);
wenzelm
parents:
64193
diff
changeset
|
216 |
find(Library.try_unprefix(marker, _)) |
6688b9cd443b
more robust wrt. old versions that use clear-text properties (e.g. Timing in build_history_base);
wenzelm
parents:
64193
diff
changeset
|
217 |
|
64062 | 218 |
def find_match(regex: Regex): Option[String] = |
219 |
lines.iterator.map(regex.unapplySeq(_)).find(res => res.isDefined && res.get.length == 1). |
|
220 |
map(res => res.get.head) |
|
221 |
||
222 |
||
223 |
/* settings */ |
|
224 |
||
64091 | 225 |
def get_setting(a: String): Option[Settings.Entry] = |
226 |
lines.find(_.startsWith(a + "=")) match { |
|
227 |
case Some(line) => Settings.Entry.unapply(line) |
|
228 |
case None => None |
|
229 |
} |
|
64045 | 230 |
|
64091 | 231 |
def get_settings(as: List[String]): Settings.T = |
232 |
for { a <- as; entry <- get_setting(a) } yield entry |
|
64062 | 233 |
|
234 |
||
235 |
/* properties (YXML) */ |
|
236 |
||
237 |
val xml_cache = new XML.Cache() |
|
238 |
||
239 |
def parse_props(text: String): Properties.T = |
|
240 |
xml_cache.props(XML.Decode.properties(YXML.parse_body(text))) |
|
241 |
||
64119
8094eaa38d4b
inline session ML statistics into main build log;
wenzelm
parents:
64117
diff
changeset
|
242 |
def filter_props(marker: String): List[Properties.T] = |
64196
6688b9cd443b
more robust wrt. old versions that use clear-text properties (e.g. Timing in build_history_base);
wenzelm
parents:
64193
diff
changeset
|
243 |
for { |
6688b9cd443b
more robust wrt. old versions that use clear-text properties (e.g. Timing in build_history_base);
wenzelm
parents:
64193
diff
changeset
|
244 |
line <- lines |
6688b9cd443b
more robust wrt. old versions that use clear-text properties (e.g. Timing in build_history_base);
wenzelm
parents:
64193
diff
changeset
|
245 |
s <- Library.try_unprefix(marker, line) |
6688b9cd443b
more robust wrt. old versions that use clear-text properties (e.g. Timing in build_history_base);
wenzelm
parents:
64193
diff
changeset
|
246 |
if YXML.detect(s) |
6688b9cd443b
more robust wrt. old versions that use clear-text properties (e.g. Timing in build_history_base);
wenzelm
parents:
64193
diff
changeset
|
247 |
} yield parse_props(s) |
64062 | 248 |
|
64119
8094eaa38d4b
inline session ML statistics into main build log;
wenzelm
parents:
64117
diff
changeset
|
249 |
def find_props(marker: String): Option[Properties.T] = |
64196
6688b9cd443b
more robust wrt. old versions that use clear-text properties (e.g. Timing in build_history_base);
wenzelm
parents:
64193
diff
changeset
|
250 |
find_line(marker) match { |
6688b9cd443b
more robust wrt. old versions that use clear-text properties (e.g. Timing in build_history_base);
wenzelm
parents:
64193
diff
changeset
|
251 |
case Some(text) if YXML.detect(text) => Some(parse_props(text)) |
6688b9cd443b
more robust wrt. old versions that use clear-text properties (e.g. Timing in build_history_base);
wenzelm
parents:
64193
diff
changeset
|
252 |
case _ => None |
6688b9cd443b
more robust wrt. old versions that use clear-text properties (e.g. Timing in build_history_base);
wenzelm
parents:
64193
diff
changeset
|
253 |
} |
64062 | 254 |
|
255 |
||
256 |
/* parse various formats */ |
|
257 |
||
64105 | 258 |
def parse_meta_info(): Meta_Info = Build_Log.parse_meta_info(log_file) |
259 |
||
260 |
def parse_build_info(): Build_Info = Build_Log.parse_build_info(log_file) |
|
261 |
||
64082 | 262 |
def parse_session_info( |
263 |
command_timings: Boolean = false, |
|
264 |
ml_statistics: Boolean = false, |
|
265 |
task_statistics: Boolean = false): Session_Info = |
|
65318
342efc382558
eliminated somewhat redundant inlined name (despite a7aa17a1f721);
wenzelm
parents:
65290
diff
changeset
|
266 |
Build_Log.parse_session_info(log_file, command_timings, ml_statistics, task_statistics) |
64045 | 267 |
} |
268 |
||
269 |
||
64098 | 270 |
|
65276 | 271 |
/** digested meta info: produced by Admin/build_history in log.xz file **/ |
64045 | 272 |
|
64108 | 273 |
object Meta_Info |
64099 | 274 |
{ |
64108 | 275 |
val empty: Meta_Info = Meta_Info(Nil, Nil) |
64099 | 276 |
} |
64098 | 277 |
|
64108 | 278 |
sealed case class Meta_Info(props: Properties.T, settings: List[(String, String)]) |
64103 | 279 |
{ |
280 |
def is_empty: Boolean = props.isEmpty && settings.isEmpty |
|
281 |
} |
|
64061
1bbea2b55d22
some support for header and data fields, notably from afp-test;
wenzelm
parents:
64054
diff
changeset
|
282 |
|
64095 | 283 |
object Isatest |
284 |
{ |
|
65588 | 285 |
val log_prefix = "isatest-makeall-" |
64108 | 286 |
val engine = "isatest" |
64109 | 287 |
val Start = new Regex("""^------------------- starting test --- (.+) --- (.+)$""") |
288 |
val End = new Regex("""^------------------- test (?:successful|FAILED) --- (.+) --- .*$""") |
|
64095 | 289 |
val Isabelle_Version = new Regex("""^Isabelle version: (\S+)$""") |
290 |
val No_AFP_Version = new Regex("""$.""") |
|
291 |
} |
|
292 |
||
64109 | 293 |
object AFP_Test |
64061
1bbea2b55d22
some support for header and data fields, notably from afp-test;
wenzelm
parents:
64054
diff
changeset
|
294 |
{ |
65588 | 295 |
val log_prefix = "afp-test-devel-" |
64108 | 296 |
val engine = "afp-test" |
64109 | 297 |
val Start = new Regex("""^Start test(?: for .+)? at ([^,]+), (.*)$""") |
298 |
val Start_Old = new Regex("""^Start test(?: for .+)? at ([^,]+)$""") |
|
299 |
val End = new Regex("""^End test on (.+), .+, elapsed time:.*$""") |
|
64087 | 300 |
val Isabelle_Version = new Regex("""^Isabelle version: .* -- hg id (\S+)$""") |
301 |
val AFP_Version = new Regex("""^AFP version: .* -- hg id (\S+)$""") |
|
64104
b70fa05d6746
more permissive: accept all historic isatest and afp-test logs;
wenzelm
parents:
64103
diff
changeset
|
302 |
val Bad_Init = new Regex("""^cp:.*: Disc quota exceeded$""") |
64061
1bbea2b55d22
some support for header and data fields, notably from afp-test;
wenzelm
parents:
64054
diff
changeset
|
303 |
} |
1bbea2b55d22
some support for header and data fields, notably from afp-test;
wenzelm
parents:
64054
diff
changeset
|
304 |
|
64110 | 305 |
object Jenkins |
306 |
{ |
|
307 |
val engine = "jenkins" |
|
308 |
val Start = new Regex("""^Started .*$""") |
|
309 |
val Start_Date = new Regex("""^Build started at (.+)$""") |
|
310 |
val No_End = new Regex("""$.""") |
|
311 |
val Isabelle_Version = new Regex("""^Isabelle id (\S+)$""") |
|
312 |
val AFP_Version = new Regex("""^AFP id (\S+)$""") |
|
313 |
val CONFIGURATION = "=== CONFIGURATION ===" |
|
314 |
val BUILD = "=== BUILD ===" |
|
315 |
val FINISHED = "Finished: " |
|
316 |
} |
|
317 |
||
64105 | 318 |
private def parse_meta_info(log_file: Log_File): Meta_Info = |
64061
1bbea2b55d22
some support for header and data fields, notably from afp-test;
wenzelm
parents:
64054
diff
changeset
|
319 |
{ |
64108 | 320 |
def parse(engine: String, host: String, start: Date, |
64109 | 321 |
End: Regex, Isabelle_Version: Regex, AFP_Version: Regex): Meta_Info = |
64091 | 322 |
{ |
64296
544481988e65
explicit identification of builds and correlated build groups;
wenzelm
parents:
64196
diff
changeset
|
323 |
val build_id = |
544481988e65
explicit identification of builds and correlated build groups;
wenzelm
parents:
64196
diff
changeset
|
324 |
{ |
544481988e65
explicit identification of builds and correlated build groups;
wenzelm
parents:
64196
diff
changeset
|
325 |
val prefix = if (host != "") host else if (engine != "") engine else "" |
544481988e65
explicit identification of builds and correlated build groups;
wenzelm
parents:
64196
diff
changeset
|
326 |
(if (prefix == "") "build" else prefix) + ":" + start.time.ms |
544481988e65
explicit identification of builds and correlated build groups;
wenzelm
parents:
64196
diff
changeset
|
327 |
} |
64298 | 328 |
val build_engine = if (engine == "") Nil else List(Prop.build_engine -> engine) |
329 |
val build_host = if (host == "") Nil else List(Prop.build_host -> host) |
|
64108 | 330 |
|
64298 | 331 |
val start_date = List(Prop.build_start -> start.toString) |
64091 | 332 |
val end_date = |
333 |
log_file.lines.last match { |
|
64109 | 334 |
case End(log_file.Strict_Date(end_date)) => |
64298 | 335 |
List(Prop.build_end -> end_date.toString) |
64091 | 336 |
case _ => Nil |
337 |
} |
|
338 |
||
339 |
val isabelle_version = |
|
64298 | 340 |
log_file.find_match(Isabelle_Version).map(Prop.isabelle_version -> _) |
64091 | 341 |
val afp_version = |
64298 | 342 |
log_file.find_match(AFP_Version).map(Prop.afp_version -> _) |
64062 | 343 |
|
64298 | 344 |
Meta_Info((Prop.build_id -> build_id) :: build_engine ::: build_host ::: |
64108 | 345 |
start_date ::: end_date ::: isabelle_version.toList ::: afp_version.toList, |
64091 | 346 |
log_file.get_settings(Settings.all_settings)) |
347 |
} |
|
348 |
||
349 |
log_file.lines match { |
|
64119
8094eaa38d4b
inline session ML statistics into main build log;
wenzelm
parents:
64117
diff
changeset
|
350 |
case line :: _ if line.startsWith(Build_History.META_INFO_MARKER) => |
8094eaa38d4b
inline session ML statistics into main build log;
wenzelm
parents:
64117
diff
changeset
|
351 |
Meta_Info(log_file.find_props(Build_History.META_INFO_MARKER).get, |
64117 | 352 |
log_file.get_settings(Settings.all_settings)) |
353 |
||
64109 | 354 |
case Isatest.Start(log_file.Strict_Date(start), host) :: _ => |
355 |
parse(Isatest.engine, host, start, Isatest.End, |
|
64108 | 356 |
Isatest.Isabelle_Version, Isatest.No_AFP_Version) |
64099 | 357 |
|
64109 | 358 |
case AFP_Test.Start(log_file.Strict_Date(start), host) :: _ => |
359 |
parse(AFP_Test.engine, host, start, AFP_Test.End, |
|
360 |
AFP_Test.Isabelle_Version, AFP_Test.AFP_Version) |
|
64099 | 361 |
|
64109 | 362 |
case AFP_Test.Start_Old(log_file.Strict_Date(start)) :: _ => |
363 |
parse(AFP_Test.engine, "", start, AFP_Test.End, |
|
364 |
AFP_Test.Isabelle_Version, AFP_Test.AFP_Version) |
|
64099 | 365 |
|
64110 | 366 |
case Jenkins.Start() :: _ |
367 |
if log_file.lines.contains(Jenkins.CONFIGURATION) || |
|
368 |
log_file.lines.last.startsWith(Jenkins.FINISHED) => |
|
369 |
log_file.lines.dropWhile(_ != Jenkins.BUILD) match { |
|
370 |
case Jenkins.BUILD :: _ :: Jenkins.Start_Date(log_file.Strict_Date(start)) :: _ => |
|
64111 | 371 |
parse(Jenkins.engine, "", start.to(ZoneId.of("Europe/Berlin")), Jenkins.No_End, |
64110 | 372 |
Jenkins.Isabelle_Version, Jenkins.AFP_Version) |
373 |
case _ => Meta_Info.empty |
|
374 |
} |
|
375 |
||
64341 | 376 |
case line :: _ if line.startsWith("\u0000") => Meta_Info.empty |
64109 | 377 |
case List(Isatest.End(_)) => Meta_Info.empty |
378 |
case _ :: AFP_Test.Bad_Init() :: _ => Meta_Info.empty |
|
64105 | 379 |
case Nil => Meta_Info.empty |
64104
b70fa05d6746
more permissive: accept all historic isatest and afp-test logs;
wenzelm
parents:
64103
diff
changeset
|
380 |
|
64110 | 381 |
case _ => log_file.err("cannot detect log file format") |
64061
1bbea2b55d22
some support for header and data fields, notably from afp-test;
wenzelm
parents:
64054
diff
changeset
|
382 |
} |
1bbea2b55d22
some support for header and data fields, notably from afp-test;
wenzelm
parents:
64054
diff
changeset
|
383 |
} |
1bbea2b55d22
some support for header and data fields, notably from afp-test;
wenzelm
parents:
64054
diff
changeset
|
384 |
|
64085
1c451e5c145f
clarified parse_build_info: isabelle build output;
wenzelm
parents:
64083
diff
changeset
|
385 |
|
64098 | 386 |
|
65276 | 387 |
/** build info: toplevel output of isabelle build or Admin/build_history **/ |
64119
8094eaa38d4b
inline session ML statistics into main build log;
wenzelm
parents:
64117
diff
changeset
|
388 |
|
8094eaa38d4b
inline session ML statistics into main build log;
wenzelm
parents:
64117
diff
changeset
|
389 |
val ML_STATISTICS_MARKER = "\fML_statistics = " |
8094eaa38d4b
inline session ML statistics into main build log;
wenzelm
parents:
64117
diff
changeset
|
390 |
val SESSION_NAME = "session_name" |
64085
1c451e5c145f
clarified parse_build_info: isabelle build output;
wenzelm
parents:
64083
diff
changeset
|
391 |
|
64061
1bbea2b55d22
some support for header and data fields, notably from afp-test;
wenzelm
parents:
64054
diff
changeset
|
392 |
object Session_Status extends Enumeration |
1bbea2b55d22
some support for header and data fields, notably from afp-test;
wenzelm
parents:
64054
diff
changeset
|
393 |
{ |
64085
1c451e5c145f
clarified parse_build_info: isabelle build output;
wenzelm
parents:
64083
diff
changeset
|
394 |
val EXISTING = Value("existing") |
64061
1bbea2b55d22
some support for header and data fields, notably from afp-test;
wenzelm
parents:
64054
diff
changeset
|
395 |
val FINISHED = Value("finished") |
1bbea2b55d22
some support for header and data fields, notably from afp-test;
wenzelm
parents:
64054
diff
changeset
|
396 |
val FAILED = Value("failed") |
1bbea2b55d22
some support for header and data fields, notably from afp-test;
wenzelm
parents:
64054
diff
changeset
|
397 |
val CANCELLED = Value("cancelled") |
1bbea2b55d22
some support for header and data fields, notably from afp-test;
wenzelm
parents:
64054
diff
changeset
|
398 |
} |
1bbea2b55d22
some support for header and data fields, notably from afp-test;
wenzelm
parents:
64054
diff
changeset
|
399 |
|
64085
1c451e5c145f
clarified parse_build_info: isabelle build output;
wenzelm
parents:
64083
diff
changeset
|
400 |
sealed case class Session_Entry( |
1c451e5c145f
clarified parse_build_info: isabelle build output;
wenzelm
parents:
64083
diff
changeset
|
401 |
chapter: String, |
1c451e5c145f
clarified parse_build_info: isabelle build output;
wenzelm
parents:
64083
diff
changeset
|
402 |
groups: List[String], |
1c451e5c145f
clarified parse_build_info: isabelle build output;
wenzelm
parents:
64083
diff
changeset
|
403 |
threads: Option[Int], |
64089 | 404 |
timing: Timing, |
405 |
ml_timing: Timing, |
|
64119
8094eaa38d4b
inline session ML statistics into main build log;
wenzelm
parents:
64117
diff
changeset
|
406 |
ml_statistics: List[Properties.T], |
64120 | 407 |
heap_size: Option[Long], |
64085
1c451e5c145f
clarified parse_build_info: isabelle build output;
wenzelm
parents:
64083
diff
changeset
|
408 |
status: Session_Status.Value) |
1c451e5c145f
clarified parse_build_info: isabelle build output;
wenzelm
parents:
64083
diff
changeset
|
409 |
{ |
1c451e5c145f
clarified parse_build_info: isabelle build output;
wenzelm
parents:
64083
diff
changeset
|
410 |
def finished: Boolean = status == Session_Status.FINISHED |
1c451e5c145f
clarified parse_build_info: isabelle build output;
wenzelm
parents:
64083
diff
changeset
|
411 |
} |
64054 | 412 |
|
64085
1c451e5c145f
clarified parse_build_info: isabelle build output;
wenzelm
parents:
64083
diff
changeset
|
413 |
sealed case class Build_Info(sessions: Map[String, Session_Entry]) |
64054 | 414 |
{ |
64085
1c451e5c145f
clarified parse_build_info: isabelle build output;
wenzelm
parents:
64083
diff
changeset
|
415 |
def session(name: String): Session_Entry = sessions(name) |
1c451e5c145f
clarified parse_build_info: isabelle build output;
wenzelm
parents:
64083
diff
changeset
|
416 |
def get_session(name: String): Option[Session_Entry] = sessions.get(name) |
64054 | 417 |
|
64089 | 418 |
def get_default[A](name: String, f: Session_Entry => A, x: A): A = |
64085
1c451e5c145f
clarified parse_build_info: isabelle build output;
wenzelm
parents:
64083
diff
changeset
|
419 |
get_session(name) match { |
64089 | 420 |
case Some(entry) => f(entry) |
421 |
case None => x |
|
64085
1c451e5c145f
clarified parse_build_info: isabelle build output;
wenzelm
parents:
64083
diff
changeset
|
422 |
} |
1c451e5c145f
clarified parse_build_info: isabelle build output;
wenzelm
parents:
64083
diff
changeset
|
423 |
|
64119
8094eaa38d4b
inline session ML statistics into main build log;
wenzelm
parents:
64117
diff
changeset
|
424 |
def finished_sessions: List[String] = sessions.keySet.iterator.filter(finished(_)).toList |
64089 | 425 |
def finished(name: String): Boolean = get_default(name, _.finished, false) |
426 |
def timing(name: String): Timing = get_default(name, _.timing, Timing.zero) |
|
427 |
def ml_timing(name: String): Timing = get_default(name, _.ml_timing, Timing.zero) |
|
65052 | 428 |
def ml_statistics(name: String): ML_Statistics = |
429 |
get_default(name, entry => ML_Statistics(name, entry.ml_statistics), ML_Statistics.empty) |
|
64054 | 430 |
} |
431 |
||
64085
1c451e5c145f
clarified parse_build_info: isabelle build output;
wenzelm
parents:
64083
diff
changeset
|
432 |
private def parse_build_info(log_file: Log_File): Build_Info = |
1c451e5c145f
clarified parse_build_info: isabelle build output;
wenzelm
parents:
64083
diff
changeset
|
433 |
{ |
1c451e5c145f
clarified parse_build_info: isabelle build output;
wenzelm
parents:
64083
diff
changeset
|
434 |
object Chapter_Name |
1c451e5c145f
clarified parse_build_info: isabelle build output;
wenzelm
parents:
64083
diff
changeset
|
435 |
{ |
1c451e5c145f
clarified parse_build_info: isabelle build output;
wenzelm
parents:
64083
diff
changeset
|
436 |
def unapply(s: String): Some[(String, String)] = |
1c451e5c145f
clarified parse_build_info: isabelle build output;
wenzelm
parents:
64083
diff
changeset
|
437 |
space_explode('/', s) match { |
1c451e5c145f
clarified parse_build_info: isabelle build output;
wenzelm
parents:
64083
diff
changeset
|
438 |
case List(chapter, name) => Some((chapter, name)) |
1c451e5c145f
clarified parse_build_info: isabelle build output;
wenzelm
parents:
64083
diff
changeset
|
439 |
case _ => Some(("", s)) |
1c451e5c145f
clarified parse_build_info: isabelle build output;
wenzelm
parents:
64083
diff
changeset
|
440 |
} |
1c451e5c145f
clarified parse_build_info: isabelle build output;
wenzelm
parents:
64083
diff
changeset
|
441 |
} |
64054 | 442 |
|
64085
1c451e5c145f
clarified parse_build_info: isabelle build output;
wenzelm
parents:
64083
diff
changeset
|
443 |
val Session_No_Groups = new Regex("""^Session (\S+)$""") |
1c451e5c145f
clarified parse_build_info: isabelle build output;
wenzelm
parents:
64083
diff
changeset
|
444 |
val Session_Groups = new Regex("""^Session (\S+) \((.*)\)$""") |
1c451e5c145f
clarified parse_build_info: isabelle build output;
wenzelm
parents:
64083
diff
changeset
|
445 |
val Session_Finished1 = |
1c451e5c145f
clarified parse_build_info: isabelle build output;
wenzelm
parents:
64083
diff
changeset
|
446 |
new Regex("""^Finished (\S+) \((\d+):(\d+):(\d+) elapsed time, (\d+):(\d+):(\d+) cpu time.*$""") |
1c451e5c145f
clarified parse_build_info: isabelle build output;
wenzelm
parents:
64083
diff
changeset
|
447 |
val Session_Finished2 = |
1c451e5c145f
clarified parse_build_info: isabelle build output;
wenzelm
parents:
64083
diff
changeset
|
448 |
new Regex("""^Finished (\S+) \((\d+):(\d+):(\d+) elapsed time.*$""") |
1c451e5c145f
clarified parse_build_info: isabelle build output;
wenzelm
parents:
64083
diff
changeset
|
449 |
val Session_Timing = |
1c451e5c145f
clarified parse_build_info: isabelle build output;
wenzelm
parents:
64083
diff
changeset
|
450 |
new Regex("""^Timing (\S+) \((\d) threads, (\d+\.\d+)s elapsed time, (\d+\.\d+)s cpu time, (\d+\.\d+)s GC time.*$""") |
64086
ac7ae5067783
clarified status: started sessions may bomb without explicit FAILED or CANCELLED (cf. in afp-test-devel-2016-01-03.log);
wenzelm
parents:
64085
diff
changeset
|
451 |
val Session_Started = new Regex("""^(?:Running|Building) (\S+) \.\.\.$""") |
64085
1c451e5c145f
clarified parse_build_info: isabelle build output;
wenzelm
parents:
64083
diff
changeset
|
452 |
val Session_Failed = new Regex("""^(\S+) FAILED""") |
1c451e5c145f
clarified parse_build_info: isabelle build output;
wenzelm
parents:
64083
diff
changeset
|
453 |
val Session_Cancelled = new Regex("""^(\S+) CANCELLED""") |
64120 | 454 |
val Heap = new Regex("""^Heap (\S+) \((\d+) bytes\)$""") |
64085
1c451e5c145f
clarified parse_build_info: isabelle build output;
wenzelm
parents:
64083
diff
changeset
|
455 |
|
1c451e5c145f
clarified parse_build_info: isabelle build output;
wenzelm
parents:
64083
diff
changeset
|
456 |
var chapter = Map.empty[String, String] |
1c451e5c145f
clarified parse_build_info: isabelle build output;
wenzelm
parents:
64083
diff
changeset
|
457 |
var groups = Map.empty[String, List[String]] |
1c451e5c145f
clarified parse_build_info: isabelle build output;
wenzelm
parents:
64083
diff
changeset
|
458 |
var threads = Map.empty[String, Int] |
64054 | 459 |
var timing = Map.empty[String, Timing] |
64085
1c451e5c145f
clarified parse_build_info: isabelle build output;
wenzelm
parents:
64083
diff
changeset
|
460 |
var ml_timing = Map.empty[String, Timing] |
64086
ac7ae5067783
clarified status: started sessions may bomb without explicit FAILED or CANCELLED (cf. in afp-test-devel-2016-01-03.log);
wenzelm
parents:
64085
diff
changeset
|
461 |
var started = Set.empty[String] |
64085
1c451e5c145f
clarified parse_build_info: isabelle build output;
wenzelm
parents:
64083
diff
changeset
|
462 |
var failed = Set.empty[String] |
1c451e5c145f
clarified parse_build_info: isabelle build output;
wenzelm
parents:
64083
diff
changeset
|
463 |
var cancelled = Set.empty[String] |
64119
8094eaa38d4b
inline session ML statistics into main build log;
wenzelm
parents:
64117
diff
changeset
|
464 |
var ml_statistics = Map.empty[String, List[Properties.T]] |
64120 | 465 |
var heap_sizes = Map.empty[String, Long] |
64119
8094eaa38d4b
inline session ML statistics into main build log;
wenzelm
parents:
64117
diff
changeset
|
466 |
|
64085
1c451e5c145f
clarified parse_build_info: isabelle build output;
wenzelm
parents:
64083
diff
changeset
|
467 |
def all_sessions: Set[String] = |
64120 | 468 |
chapter.keySet ++ groups.keySet ++ threads.keySet ++ timing.keySet ++ ml_timing.keySet ++ |
469 |
failed ++ cancelled ++ started ++ ml_statistics.keySet ++ heap_sizes.keySet |
|
64085
1c451e5c145f
clarified parse_build_info: isabelle build output;
wenzelm
parents:
64083
diff
changeset
|
470 |
|
64054 | 471 |
|
64062 | 472 |
for (line <- log_file.lines) { |
64054 | 473 |
line match { |
64085
1c451e5c145f
clarified parse_build_info: isabelle build output;
wenzelm
parents:
64083
diff
changeset
|
474 |
case Session_No_Groups(Chapter_Name(chapt, name)) => |
1c451e5c145f
clarified parse_build_info: isabelle build output;
wenzelm
parents:
64083
diff
changeset
|
475 |
chapter += (name -> chapt) |
1c451e5c145f
clarified parse_build_info: isabelle build output;
wenzelm
parents:
64083
diff
changeset
|
476 |
groups += (name -> Nil) |
64119
8094eaa38d4b
inline session ML statistics into main build log;
wenzelm
parents:
64117
diff
changeset
|
477 |
|
64085
1c451e5c145f
clarified parse_build_info: isabelle build output;
wenzelm
parents:
64083
diff
changeset
|
478 |
case Session_Groups(Chapter_Name(chapt, name), grps) => |
1c451e5c145f
clarified parse_build_info: isabelle build output;
wenzelm
parents:
64083
diff
changeset
|
479 |
chapter += (name -> chapt) |
1c451e5c145f
clarified parse_build_info: isabelle build output;
wenzelm
parents:
64083
diff
changeset
|
480 |
groups += (name -> Word.explode(grps)) |
64119
8094eaa38d4b
inline session ML statistics into main build log;
wenzelm
parents:
64117
diff
changeset
|
481 |
|
64086
ac7ae5067783
clarified status: started sessions may bomb without explicit FAILED or CANCELLED (cf. in afp-test-devel-2016-01-03.log);
wenzelm
parents:
64085
diff
changeset
|
482 |
case Session_Started(name) => |
ac7ae5067783
clarified status: started sessions may bomb without explicit FAILED or CANCELLED (cf. in afp-test-devel-2016-01-03.log);
wenzelm
parents:
64085
diff
changeset
|
483 |
started += name |
64119
8094eaa38d4b
inline session ML statistics into main build log;
wenzelm
parents:
64117
diff
changeset
|
484 |
|
64054 | 485 |
case Session_Finished1(name, |
486 |
Value.Int(e1), Value.Int(e2), Value.Int(e3), |
|
487 |
Value.Int(c1), Value.Int(c2), Value.Int(c3)) => |
|
488 |
val elapsed = Time.hms(e1, e2, e3) |
|
489 |
val cpu = Time.hms(c1, c2, c3) |
|
64085
1c451e5c145f
clarified parse_build_info: isabelle build output;
wenzelm
parents:
64083
diff
changeset
|
490 |
timing += (name -> Timing(elapsed, cpu, Time.zero)) |
64119
8094eaa38d4b
inline session ML statistics into main build log;
wenzelm
parents:
64117
diff
changeset
|
491 |
|
64054 | 492 |
case Session_Finished2(name, |
493 |
Value.Int(e1), Value.Int(e2), Value.Int(e3)) => |
|
494 |
val elapsed = Time.hms(e1, e2, e3) |
|
64085
1c451e5c145f
clarified parse_build_info: isabelle build output;
wenzelm
parents:
64083
diff
changeset
|
495 |
timing += (name -> Timing(elapsed, Time.zero, Time.zero)) |
64119
8094eaa38d4b
inline session ML statistics into main build log;
wenzelm
parents:
64117
diff
changeset
|
496 |
|
64054 | 497 |
case Session_Timing(name, |
498 |
Value.Int(t), Value.Double(e), Value.Double(c), Value.Double(g)) => |
|
499 |
val elapsed = Time.seconds(e) |
|
500 |
val cpu = Time.seconds(c) |
|
501 |
val gc = Time.seconds(g) |
|
64085
1c451e5c145f
clarified parse_build_info: isabelle build output;
wenzelm
parents:
64083
diff
changeset
|
502 |
ml_timing += (name -> Timing(elapsed, cpu, gc)) |
64054 | 503 |
threads += (name -> t) |
64119
8094eaa38d4b
inline session ML statistics into main build log;
wenzelm
parents:
64117
diff
changeset
|
504 |
|
64120 | 505 |
case Heap(name, Value.Long(size)) => |
506 |
heap_sizes += (name -> size) |
|
507 |
||
65590 | 508 |
case _ if line.startsWith(ML_STATISTICS_MARKER) && YXML.detect(line) => |
64119
8094eaa38d4b
inline session ML statistics into main build log;
wenzelm
parents:
64117
diff
changeset
|
509 |
val (name, props) = |
8094eaa38d4b
inline session ML statistics into main build log;
wenzelm
parents:
64117
diff
changeset
|
510 |
Library.try_unprefix(ML_STATISTICS_MARKER, line).map(log_file.parse_props(_)) match { |
8094eaa38d4b
inline session ML statistics into main build log;
wenzelm
parents:
64117
diff
changeset
|
511 |
case Some((SESSION_NAME, session_name) :: props) => (session_name, props) |
8094eaa38d4b
inline session ML statistics into main build log;
wenzelm
parents:
64117
diff
changeset
|
512 |
case _ => log_file.err("malformed ML_statistics " + quote(line)) |
8094eaa38d4b
inline session ML statistics into main build log;
wenzelm
parents:
64117
diff
changeset
|
513 |
} |
64120 | 514 |
ml_statistics += (name -> (props :: ml_statistics.getOrElse(name, Nil))) |
64119
8094eaa38d4b
inline session ML statistics into main build log;
wenzelm
parents:
64117
diff
changeset
|
515 |
|
64054 | 516 |
case _ => |
517 |
} |
|
518 |
} |
|
519 |
||
64085
1c451e5c145f
clarified parse_build_info: isabelle build output;
wenzelm
parents:
64083
diff
changeset
|
520 |
val sessions = |
1c451e5c145f
clarified parse_build_info: isabelle build output;
wenzelm
parents:
64083
diff
changeset
|
521 |
Map( |
1c451e5c145f
clarified parse_build_info: isabelle build output;
wenzelm
parents:
64083
diff
changeset
|
522 |
(for (name <- all_sessions.toList) yield { |
1c451e5c145f
clarified parse_build_info: isabelle build output;
wenzelm
parents:
64083
diff
changeset
|
523 |
val status = |
1c451e5c145f
clarified parse_build_info: isabelle build output;
wenzelm
parents:
64083
diff
changeset
|
524 |
if (failed(name)) Session_Status.FAILED |
1c451e5c145f
clarified parse_build_info: isabelle build output;
wenzelm
parents:
64083
diff
changeset
|
525 |
else if (cancelled(name)) Session_Status.CANCELLED |
64086
ac7ae5067783
clarified status: started sessions may bomb without explicit FAILED or CANCELLED (cf. in afp-test-devel-2016-01-03.log);
wenzelm
parents:
64085
diff
changeset
|
526 |
else if (timing.isDefinedAt(name) || ml_timing.isDefinedAt(name)) |
ac7ae5067783
clarified status: started sessions may bomb without explicit FAILED or CANCELLED (cf. in afp-test-devel-2016-01-03.log);
wenzelm
parents:
64085
diff
changeset
|
527 |
Session_Status.FINISHED |
ac7ae5067783
clarified status: started sessions may bomb without explicit FAILED or CANCELLED (cf. in afp-test-devel-2016-01-03.log);
wenzelm
parents:
64085
diff
changeset
|
528 |
else if (started(name)) Session_Status.FAILED |
64085
1c451e5c145f
clarified parse_build_info: isabelle build output;
wenzelm
parents:
64083
diff
changeset
|
529 |
else Session_Status.EXISTING |
1c451e5c145f
clarified parse_build_info: isabelle build output;
wenzelm
parents:
64083
diff
changeset
|
530 |
val entry = |
1c451e5c145f
clarified parse_build_info: isabelle build output;
wenzelm
parents:
64083
diff
changeset
|
531 |
Session_Entry( |
1c451e5c145f
clarified parse_build_info: isabelle build output;
wenzelm
parents:
64083
diff
changeset
|
532 |
chapter.getOrElse(name, ""), |
1c451e5c145f
clarified parse_build_info: isabelle build output;
wenzelm
parents:
64083
diff
changeset
|
533 |
groups.getOrElse(name, Nil), |
1c451e5c145f
clarified parse_build_info: isabelle build output;
wenzelm
parents:
64083
diff
changeset
|
534 |
threads.get(name), |
64089 | 535 |
timing.getOrElse(name, Timing.zero), |
536 |
ml_timing.getOrElse(name, Timing.zero), |
|
64119
8094eaa38d4b
inline session ML statistics into main build log;
wenzelm
parents:
64117
diff
changeset
|
537 |
ml_statistics.getOrElse(name, Nil).reverse, |
64120 | 538 |
heap_sizes.get(name), |
64085
1c451e5c145f
clarified parse_build_info: isabelle build output;
wenzelm
parents:
64083
diff
changeset
|
539 |
status) |
1c451e5c145f
clarified parse_build_info: isabelle build output;
wenzelm
parents:
64083
diff
changeset
|
540 |
(name -> entry) |
1c451e5c145f
clarified parse_build_info: isabelle build output;
wenzelm
parents:
64083
diff
changeset
|
541 |
}):_*) |
1c451e5c145f
clarified parse_build_info: isabelle build output;
wenzelm
parents:
64083
diff
changeset
|
542 |
Build_Info(sessions) |
64054 | 543 |
} |
64099 | 544 |
|
545 |
||
546 |
||
65276 | 547 |
/** session info: produced by isabelle build as session log.gz file **/ |
64099 | 548 |
|
549 |
sealed case class Session_Info( |
|
550 |
session_timing: Properties.T, |
|
551 |
command_timings: List[Properties.T], |
|
552 |
ml_statistics: List[Properties.T], |
|
553 |
task_statistics: List[Properties.T]) |
|
554 |
||
555 |
private def parse_session_info( |
|
556 |
log_file: Log_File, |
|
557 |
command_timings: Boolean, |
|
558 |
ml_statistics: Boolean, |
|
559 |
task_statistics: Boolean): Session_Info = |
|
560 |
{ |
|
65290 | 561 |
Session_Info( |
562 |
session_timing = log_file.find_props("\fTiming = ") getOrElse Nil, |
|
563 |
command_timings = if (command_timings) log_file.filter_props("\fcommand_timing = ") else Nil, |
|
564 |
ml_statistics = if (ml_statistics) log_file.filter_props(ML_STATISTICS_MARKER) else Nil, |
|
565 |
task_statistics = if (task_statistics) log_file.filter_props("\ftask_statistics = ") else Nil) |
|
64099 | 566 |
} |
64045 | 567 |
} |