52 def read_data(options: Options, |
52 def read_data(options: Options, |
53 profiles: List[Profile] = standard_profiles, |
53 profiles: List[Profile] = standard_profiles, |
54 progress: Progress = No_Progress, |
54 progress: Progress = No_Progress, |
55 history_length: Int = default_history_length, |
55 history_length: Int = default_history_length, |
56 only_sessions: Set[String] = Set.empty, |
56 only_sessions: Set[String] = Set.empty, |
57 elapsed_threshold: Time = Time.zero): Data = |
57 elapsed_threshold: Time = Time.zero, |
|
58 verbose: Boolean = false): Data = |
58 { |
59 { |
59 var data: Data = Map.empty |
60 var data: Data = Map.empty |
60 |
61 |
61 val store = Build_Log.store(options) |
62 val store = Build_Log.store(options) |
62 using(store.open_database())(db => |
63 using(store.open_database())(db => |
74 Build_Log.Data.timing_gc, |
75 Build_Log.Data.timing_gc, |
75 Build_Log.Data.ml_timing_elapsed, |
76 Build_Log.Data.ml_timing_elapsed, |
76 Build_Log.Data.ml_timing_cpu, |
77 Build_Log.Data.ml_timing_cpu, |
77 Build_Log.Data.ml_timing_gc) |
78 Build_Log.Data.ml_timing_gc) |
78 |
79 |
79 db.using_statement(profile.select(columns, history_length, only_sessions))(stmt => |
80 val sql = profile.select(columns, history_length, only_sessions) |
|
81 if (verbose) progress.echo(sql) |
|
82 |
|
83 db.using_statement(sql)(stmt => |
80 { |
84 { |
81 val res = stmt.execute_query() |
85 val res = stmt.execute_query() |
82 while (res.next()) { |
86 while (res.next()) { |
83 val ml_platform = res.string(Build_Log.Settings.ML_PLATFORM) |
87 val ml_platform = res.string(Build_Log.Settings.ML_PLATFORM) |
84 val threads = res.get_int(Build_Log.Data.threads) |
88 val threads = res.get_int(Build_Log.Data.threads) |
228 var only_sessions = Set.empty[String] |
232 var only_sessions = Set.empty[String] |
229 var elapsed_threshold = Time.zero |
233 var elapsed_threshold = Time.zero |
230 var history_length = default_history_length |
234 var history_length = default_history_length |
231 var options = Options.init() |
235 var options = Options.init() |
232 var image_size = default_image_size |
236 var image_size = default_image_size |
|
237 var verbose = false |
233 |
238 |
234 val getopts = Getopts(""" |
239 val getopts = Getopts(""" |
235 Usage: isabelle build_status [OPTIONS] |
240 Usage: isabelle build_status [OPTIONS] |
236 |
241 |
237 Options are: |
242 Options are: |
241 -T THRESHOLD only sessions with elapsed time >= THRESHOLD (minutes) |
246 -T THRESHOLD only sessions with elapsed time >= THRESHOLD (minutes) |
242 -l LENGTH length of history (default """ + default_history_length + """) |
247 -l LENGTH length of history (default """ + default_history_length + """) |
243 -m include ML timing |
248 -m include ML timing |
244 -o OPTION override Isabelle system OPTION (via NAME=VAL or NAME) |
249 -o OPTION override Isabelle system OPTION (via NAME=VAL or NAME) |
245 -s WxH size of PNG image (default """ + image_size._1 + "x" + image_size._2 + """) |
250 -s WxH size of PNG image (default """ + image_size._1 + "x" + image_size._2 + """) |
|
251 -v verbose |
246 |
252 |
247 Present performance statistics from build log database, which is specified |
253 Present performance statistics from build log database, which is specified |
248 via system options build_log_database_host, build_log_database_user etc. |
254 via system options build_log_database_host, build_log_database_user etc. |
249 """, |
255 """, |
250 "D:" -> (arg => target_dir = Path.explode(arg)), |
256 "D:" -> (arg => target_dir = Path.explode(arg)), |
256 "o:" -> (arg => options = options + arg), |
262 "o:" -> (arg => options = options + arg), |
257 "s:" -> (arg => |
263 "s:" -> (arg => |
258 space_explode('x', arg).map(Value.Int.parse(_)) match { |
264 space_explode('x', arg).map(Value.Int.parse(_)) match { |
259 case List(w, h) if w > 0 && h > 0 => image_size = (w, h) |
265 case List(w, h) if w > 0 && h > 0 => image_size = (w, h) |
260 case _ => error("Error bad PNG image size: " + quote(arg)) |
266 case _ => error("Error bad PNG image size: " + quote(arg)) |
261 })) |
267 }), |
|
268 "v" -> (_ => verbose = true)) |
262 |
269 |
263 val more_args = getopts(args) |
270 val more_args = getopts(args) |
264 if (more_args.nonEmpty) getopts.usage() |
271 if (more_args.nonEmpty) getopts.usage() |
265 |
272 |
266 val progress = new Console_Progress |
273 val progress = new Console_Progress |
267 |
274 |
268 val data = |
275 val data = |
269 read_data(options, progress = progress, history_length = history_length, |
276 read_data(options, progress = progress, history_length = history_length, |
270 only_sessions = only_sessions, elapsed_threshold = elapsed_threshold) |
277 only_sessions = only_sessions, elapsed_threshold = elapsed_threshold, verbose = verbose) |
271 |
278 |
272 present_data(data, progress = progress, target_dir = target_dir, |
279 present_data(data, progress = progress, target_dir = target_dir, |
273 image_size = image_size, ml_timing = ml_timing) |
280 image_size = image_size, ml_timing = ml_timing) |
274 |
281 |
275 }, admin = true) |
282 }, admin = true) |