equal
deleted
inserted
replaced
|
1 /* Title: Pure/Tools/build_process.scala |
|
2 Author: Makarius |
|
3 |
|
4 Build process for sessions, with build database, optional heap, and |
|
5 optional presentation. |
|
6 */ |
|
7 |
|
8 package isabelle |
|
9 |
|
10 |
|
11 object Build_Process { |
|
12 /* timings from session database */ |
|
13 |
|
14 type Session_Timing = (List[Properties.T], Double) |
|
15 |
|
16 object Session_Timing { |
|
17 val empty: Session_Timing = (Nil, 0.0) |
|
18 |
|
19 def load(progress: Progress, store: Sessions.Store, session_name: String): Session_Timing = { |
|
20 store.try_open_database(session_name) match { |
|
21 case None => empty |
|
22 case Some(db) => |
|
23 def ignore_error(msg: String) = { |
|
24 progress.echo_warning("Ignoring bad database " + db + |
|
25 " for session " + quote(session_name) + (if (msg == "") "" else ":\n" + msg)) |
|
26 empty |
|
27 } |
|
28 try { |
|
29 val command_timings = store.read_command_timings(db, session_name) |
|
30 val session_timing = |
|
31 store.read_session_timing(db, session_name) match { |
|
32 case Markup.Elapsed(t) => t |
|
33 case _ => 0.0 |
|
34 } |
|
35 (command_timings, session_timing) |
|
36 } |
|
37 catch { |
|
38 case ERROR(msg) => ignore_error(msg) |
|
39 case exn: java.lang.Error => ignore_error(Exn.message(exn)) |
|
40 case _: XML.Error => ignore_error("XML.Error") |
|
41 } |
|
42 finally { db.close() } |
|
43 } |
|
44 } |
|
45 } |
|
46 } |