author | wenzelm |
Thu, 18 May 2017 14:38:09 +0200 | |
changeset 65866 | 00e8b836d4db |
parent 65865 | 177b90f33f40 |
child 65867 | 53613acb76e7 |
permissions | -rw-r--r-- |
65743 | 1 |
/* Title: Pure/Admin/build_status.scala |
63686 | 2 |
Author: Makarius |
3 |
||
65743 | 4 |
Present recent build status information from database. |
63686 | 5 |
*/ |
6 |
||
7 |
package isabelle |
|
8 |
||
9 |
||
65743 | 10 |
object Build_Status |
63686 | 11 |
{ |
65799 | 12 |
/* defaults */ |
13 |
||
14 |
val default_target_dir = Path.explode("build_status") |
|
15 |
val default_image_size = (800, 600) |
|
16 |
val default_history = 30 |
|
17 |
||
18 |
def default_profiles: List[Profile] = |
|
19 |
Jenkins.build_status_profiles ::: Isabelle_Cronjob.build_status_profiles |
|
20 |
||
21 |
||
65791 | 22 |
/* data profiles */ |
23 |
||
65798 | 24 |
sealed case class Profile(description: String, history: Int, sql: String) |
65791 | 25 |
{ |
65799 | 26 |
def days(options: Options): Int = options.int("build_log_history") max history |
27 |
||
28 |
def stretch(options: Options): Double = |
|
29 |
(days(options) max default_history min (default_history * 5)).toDouble / default_history |
|
30 |
||
31 |
def select(options: Options, columns: List[SQL.Column], only_sessions: Set[String]): SQL.Source = |
|
65791 | 32 |
{ |
33 |
Build_Log.Data.universal_table.select(columns, distinct = true, |
|
34 |
sql = "WHERE " + |
|
65799 | 35 |
Build_Log.Data.pull_date + " > " + Build_Log.Data.recent_time(days(options)) + " AND " + |
65791 | 36 |
Build_Log.Data.status + " = " + SQL.string(Build_Log.Session_Status.finished.toString) + |
65804 | 37 |
(if (only_sessions.isEmpty) "" |
38 |
else " AND " + SQL.member(Build_Log.Data.session_name.ident, only_sessions)) + |
|
39 |
" AND " + SQL.enclose(sql) + |
|
65849 | 40 |
" ORDER BY " + Build_Log.Data.pull_date) |
65791 | 41 |
} |
42 |
} |
|
43 |
||
44 |
||
65785 | 45 |
/* build status */ |
46 |
||
47 |
def build_status(options: Options, |
|
48 |
progress: Progress = No_Progress, |
|
49 |
profiles: List[Profile] = default_profiles, |
|
50 |
only_sessions: Set[String] = Set.empty, |
|
51 |
verbose: Boolean = false, |
|
52 |
target_dir: Path = default_target_dir, |
|
65854 | 53 |
ml_statistics: Boolean = false, |
65785 | 54 |
image_size: (Int, Int) = default_image_size) |
55 |
{ |
|
56 |
val data = |
|
57 |
read_data(options, progress = progress, profiles = profiles, |
|
65854 | 58 |
only_sessions = only_sessions, ml_statistics = ml_statistics, verbose = verbose) |
65785 | 59 |
|
60 |
present_data(data, progress = progress, target_dir = target_dir, image_size = image_size) |
|
61 |
} |
|
65736 | 62 |
|
63 |
||
65791 | 64 |
/* read data */ |
65736 | 65 |
|
65792 | 66 |
sealed case class Data(date: Date, entries: List[Data_Entry]) |
65799 | 67 |
sealed case class Data_Entry( |
68 |
name: String, hosts: List[String], stretch: Double, sessions: List[Session]) |
|
65865 | 69 |
sealed case class Session( |
70 |
name: String, threads: Int, entries: List[Entry], ml_statistics: ML_Statistics) |
|
65754 | 71 |
{ |
65795 | 72 |
require(entries.nonEmpty) |
73 |
||
65863 | 74 |
def head: Entry = entries.head |
75 |
def order: Long = - head.timing.elapsed.ms |
|
65860 | 76 |
|
65769 | 77 |
def check_timing: Boolean = entries.length >= 3 |
65854 | 78 |
def check_heap: Boolean = |
79 |
entries.length >= 3 && |
|
65859 | 80 |
entries.forall(entry => |
81 |
entry.maximum_heap > 0 || |
|
82 |
entry.average_heap > 0 || |
|
65866 | 83 |
entry.stored_heap > 0) |
65754 | 84 |
} |
65854 | 85 |
sealed case class Entry( |
86 |
pull_date: Date, |
|
87 |
isabelle_version: String, |
|
88 |
afp_version: String, |
|
89 |
timing: Timing, |
|
90 |
ml_timing: Timing, |
|
65859 | 91 |
maximum_heap: Long, |
92 |
average_heap: Long, |
|
65866 | 93 |
stored_heap: Long) |
65736 | 94 |
|
65865 | 95 |
sealed case class Image(name: String, width: Int, height: Int) |
96 |
{ |
|
97 |
def path: Path = Path.basic(name) |
|
98 |
} |
|
99 |
||
65736 | 100 |
def read_data(options: Options, |
101 |
progress: Progress = No_Progress, |
|
65785 | 102 |
profiles: List[Profile] = default_profiles, |
65736 | 103 |
only_sessions: Set[String] = Set.empty, |
65854 | 104 |
ml_statistics: Boolean = false, |
65750 | 105 |
verbose: Boolean = false): Data = |
65736 | 106 |
{ |
65754 | 107 |
val date = Date.now() |
65792 | 108 |
var data_hosts = Map.empty[String, Set[String]] |
65799 | 109 |
var data_stretch = Map.empty[String, Double] |
65762 | 110 |
var data_entries = Map.empty[String, Map[String, Session]] |
63688
cc57255bf6ae
gnuplot presentation similar to former isatest-statistics;
wenzelm
parents:
63686
diff
changeset
|
111 |
|
65792 | 112 |
def get_hosts(data_name: String): Set[String] = |
113 |
data_hosts.getOrElse(data_name, Set.empty) |
|
114 |
||
65736 | 115 |
val store = Build_Log.store(options) |
116 |
using(store.open_database())(db => |
|
64089 | 117 |
{ |
65764 | 118 |
for (profile <- profiles.sortBy(_.description)) { |
119 |
progress.echo("input " + quote(profile.description)) |
|
65854 | 120 |
|
65736 | 121 |
val columns = |
122 |
List( |
|
123 |
Build_Log.Data.pull_date, |
|
65792 | 124 |
Build_Log.Prop.build_host, |
65796 | 125 |
Build_Log.Prop.isabelle_version, |
126 |
Build_Log.Prop.afp_version, |
|
65752
ed7b5cd3a7f2
more uniform threads value, notably for Pure session;
wenzelm
parents:
65751
diff
changeset
|
127 |
Build_Log.Settings.ISABELLE_BUILD_OPTIONS, |
65736 | 128 |
Build_Log.Settings.ML_PLATFORM, |
129 |
Build_Log.Data.session_name, |
|
130 |
Build_Log.Data.threads, |
|
131 |
Build_Log.Data.timing_elapsed, |
|
132 |
Build_Log.Data.timing_cpu, |
|
133 |
Build_Log.Data.timing_gc, |
|
134 |
Build_Log.Data.ml_timing_elapsed, |
|
135 |
Build_Log.Data.ml_timing_cpu, |
|
65769 | 136 |
Build_Log.Data.ml_timing_gc, |
65854 | 137 |
Build_Log.Data.heap_size) ::: |
138 |
(if (ml_statistics) List(Build_Log.Data.ml_statistics) else Nil) |
|
63700 | 139 |
|
65752
ed7b5cd3a7f2
more uniform threads value, notably for Pure session;
wenzelm
parents:
65751
diff
changeset
|
140 |
val Threads_Option = """threads\s*=\s*(\d+)""".r |
ed7b5cd3a7f2
more uniform threads value, notably for Pure session;
wenzelm
parents:
65751
diff
changeset
|
141 |
|
65799 | 142 |
val sql = profile.select(options, columns, only_sessions) |
65750 | 143 |
if (verbose) progress.echo(sql) |
144 |
||
145 |
db.using_statement(sql)(stmt => |
|
65736 | 146 |
{ |
65740 | 147 |
val res = stmt.execute_query() |
148 |
while (res.next()) { |
|
65766
2edb89630a80
more specific workaround (see also ed7b5cd3a7f2);
wenzelm
parents:
65765
diff
changeset
|
149 |
val session_name = res.string(Build_Log.Data.session_name) |
65764 | 150 |
val threads = |
151 |
{ |
|
152 |
val threads1 = |
|
153 |
res.string(Build_Log.Settings.ISABELLE_BUILD_OPTIONS) match { |
|
65766
2edb89630a80
more specific workaround (see also ed7b5cd3a7f2);
wenzelm
parents:
65765
diff
changeset
|
154 |
case Threads_Option(Value.Int(i)) if session_name == "Pure" => i |
65764 | 155 |
case _ => 1 |
156 |
} |
|
157 |
val threads2 = res.get_int(Build_Log.Data.threads).getOrElse(1) |
|
158 |
threads1 max threads2 |
|
159 |
} |
|
65766
2edb89630a80
more specific workaround (see also ed7b5cd3a7f2);
wenzelm
parents:
65765
diff
changeset
|
160 |
val ml_platform = res.string(Build_Log.Settings.ML_PLATFORM) |
65762 | 161 |
val data_name = |
65764 | 162 |
profile.description + |
163 |
(if (ml_platform.startsWith("x86_64")) ", 64bit" else "") + |
|
164 |
(if (threads == 1) "" else ", " + threads + " threads") |
|
63703 | 165 |
|
65799 | 166 |
res.get_string(Build_Log.Prop.build_host).foreach(host => |
167 |
data_hosts += (data_name -> (get_hosts(data_name) + host))) |
|
168 |
||
169 |
data_stretch += (data_name -> profile.stretch(options)) |
|
170 |
||
65854 | 171 |
val isabelle_version = res.string(Build_Log.Prop.isabelle_version) |
172 |
||
173 |
val ml_stats = |
|
174 |
ML_Statistics( |
|
175 |
if (ml_statistics) |
|
65857 | 176 |
Properties.uncompress(res.bytes(Build_Log.Data.ml_statistics)) |
65866 | 177 |
else Nil, heading = session_name + " (Isabelle/" + isabelle_version + ")") |
65854 | 178 |
|
65736 | 179 |
val entry = |
65796 | 180 |
Entry( |
181 |
pull_date = res.date(Build_Log.Data.pull_date), |
|
65854 | 182 |
isabelle_version = isabelle_version, |
65796 | 183 |
afp_version = res.string(Build_Log.Prop.afp_version), |
184 |
timing = |
|
185 |
res.timing( |
|
186 |
Build_Log.Data.timing_elapsed, |
|
187 |
Build_Log.Data.timing_cpu, |
|
188 |
Build_Log.Data.timing_gc), |
|
189 |
ml_timing = |
|
190 |
res.timing( |
|
191 |
Build_Log.Data.ml_timing_elapsed, |
|
192 |
Build_Log.Data.ml_timing_cpu, |
|
193 |
Build_Log.Data.ml_timing_gc), |
|
65859 | 194 |
maximum_heap = ml_stats.maximum_heap_size, |
195 |
average_heap = ml_stats.average_heap_size, |
|
65866 | 196 |
stored_heap = ML_Statistics.heap_scale(res.long(Build_Log.Data.heap_size))) |
65736 | 197 |
|
65762 | 198 |
val sessions = data_entries.getOrElse(data_name, Map.empty) |
65766
2edb89630a80
more specific workaround (see also ed7b5cd3a7f2);
wenzelm
parents:
65765
diff
changeset
|
199 |
val entries = sessions.get(session_name).map(_.entries) getOrElse Nil |
65865 | 200 |
val session = Session(session_name, threads, entry :: entries, ml_stats) |
65766
2edb89630a80
more specific workaround (see also ed7b5cd3a7f2);
wenzelm
parents:
65765
diff
changeset
|
201 |
data_entries += (data_name -> (sessions + (session_name -> session))) |
65736 | 202 |
} |
203 |
}) |
|
204 |
} |
|
205 |
}) |
|
206 |
||
65792 | 207 |
val sorted_entries = |
65762 | 208 |
(for { |
65792 | 209 |
(name, sessions) <- data_entries.toList |
65847
ad35427dbe88
less restrictive filter: omit empty charts, but show latest timing;
wenzelm
parents:
65838
diff
changeset
|
210 |
sorted_sessions <- proper_list(sessions.toList.map(_._2).sortBy(_.order)) |
65799 | 211 |
} |
212 |
yield { |
|
213 |
val hosts = get_hosts(name).toList.sorted |
|
214 |
val stretch = data_stretch(name) |
|
215 |
Data_Entry(name, hosts, stretch, sorted_sessions) |
|
216 |
}).sortBy(_.name) |
|
65792 | 217 |
|
218 |
Data(date, sorted_entries) |
|
65736 | 219 |
} |
220 |
||
221 |
||
222 |
/* present data */ |
|
223 |
||
224 |
def present_data(data: Data, |
|
225 |
progress: Progress = No_Progress, |
|
226 |
target_dir: Path = default_target_dir, |
|
65759 | 227 |
image_size: (Int, Int) = default_image_size) |
65736 | 228 |
{ |
65791 | 229 |
def clean_name(name: String): String = |
230 |
name.flatMap(c => if (c == ' ' || c == '/') "_" else if (c == ',') "" else c.toString) |
|
231 |
||
65860 | 232 |
def print_heap(x: Long): Option[String] = |
65866 | 233 |
if (x == 0L) None else Some(x.toString + " M") |
65854 | 234 |
|
65838 | 235 |
HTML.write_document(target_dir, "index.html", |
236 |
List(HTML.title("Isabelle build status")), |
|
237 |
List(HTML.chapter("Isabelle build status"), |
|
238 |
HTML.par( |
|
239 |
List(HTML.description( |
|
240 |
List(HTML.text("status date:") -> HTML.text(data.date.toString))))), |
|
241 |
HTML.par( |
|
242 |
List(HTML.itemize(data.entries.map({ case data_entry => |
|
243 |
List(HTML.link(clean_name(data_entry.name) + "/index.html", |
|
244 |
HTML.text(data_entry.name))) })))))) |
|
65786 | 245 |
|
65792 | 246 |
for (data_entry <- data.entries) { |
247 |
val data_name = data_entry.name |
|
248 |
||
65865 | 249 |
val (image_width, image_height) = image_size |
250 |
val image_width_stretch = (image_width * data_entry.stretch).toInt |
|
65799 | 251 |
|
65786 | 252 |
progress.echo("output " + quote(data_name)) |
253 |
||
65764 | 254 |
val dir = target_dir + Path.basic(clean_name(data_name)) |
65736 | 255 |
Isabelle_System.mkdirs(dir) |
256 |
||
65764 | 257 |
val session_plots = |
258 |
Par_List.map((session: Session) => |
|
259 |
Isabelle_System.with_tmp_file(session.name, "data") { data_file => |
|
260 |
Isabelle_System.with_tmp_file(session.name, "gnuplot") { gnuplot_file => |
|
63706 | 261 |
|
65865 | 262 |
def plot_name(kind: String): String = session.name + "_" + kind + ".png" |
263 |
||
65764 | 264 |
File.write(data_file, |
265 |
cat_lines( |
|
266 |
session.entries.map(entry => |
|
65854 | 267 |
List(entry.pull_date.unix_epoch, |
65764 | 268 |
entry.timing.elapsed.minutes, |
269 |
entry.timing.resources.minutes, |
|
270 |
entry.ml_timing.elapsed.minutes, |
|
65769 | 271 |
entry.ml_timing.resources.minutes, |
65866 | 272 |
entry.maximum_heap, |
273 |
entry.average_heap, |
|
274 |
entry.stored_heap).mkString(" ")))) |
|
65736 | 275 |
|
65764 | 276 |
val max_time = |
277 |
((0.0 /: session.entries){ case (m, entry) => |
|
278 |
m.max(entry.timing.elapsed.minutes). |
|
279 |
max(entry.timing.resources.minutes). |
|
280 |
max(entry.ml_timing.elapsed.minutes). |
|
281 |
max(entry.ml_timing.resources.minutes) } max 0.1) * 1.1 |
|
65769 | 282 |
val timing_range = "[0:" + max_time + "]" |
65763 | 283 |
|
65865 | 284 |
def gnuplot(plot_name: String, plots: List[String], range: String): Image = |
65764 | 285 |
{ |
65865 | 286 |
val image = Image(plot_name, image_width_stretch, image_height) |
65764 | 287 |
|
288 |
File.write(gnuplot_file, """ |
|
65865 | 289 |
set terminal png size """ + image.width + "," + image.height + """ |
290 |
set output """ + quote(File.standard_path(dir + image.path)) + """ |
|
65759 | 291 |
set xdata time |
292 |
set timefmt "%s" |
|
293 |
set format x "%d-%b" |
|
65762 | 294 |
set xlabel """ + quote(session.name) + """ noenhanced |
65763 | 295 |
set key left bottom |
65769 | 296 |
plot [] """ + range + " " + |
297 |
plots.map(s => quote(data_file.implode) + " " + s).mkString(", ") + "\n") |
|
65759 | 298 |
|
65764 | 299 |
val result = |
300 |
Isabelle_System.bash("\"$ISABELLE_GNUPLOT\" " + File.bash_path(gnuplot_file)) |
|
301 |
if (!result.ok) |
|
302 |
result.error("Gnuplot failed for " + data_name + "/" + plot_name).check |
|
303 |
||
65865 | 304 |
image |
65764 | 305 |
} |
65759 | 306 |
|
65765 | 307 |
val timing_plots = |
65769 | 308 |
{ |
309 |
val plots1 = |
|
310 |
List( |
|
311 |
""" using 1:2 smooth sbezier title "elapsed time (smooth)" """, |
|
312 |
""" using 1:2 smooth csplines title "elapsed time" """) |
|
313 |
val plots2 = |
|
314 |
List( |
|
315 |
""" using 1:3 smooth sbezier title "cpu time (smooth)" """, |
|
316 |
""" using 1:3 smooth csplines title "cpu time" """) |
|
317 |
if (session.threads == 1) plots1 else plots1 ::: plots2 |
|
318 |
} |
|
65765 | 319 |
|
65764 | 320 |
val ml_timing_plots = |
321 |
List( |
|
65765 | 322 |
""" using 1:4 smooth sbezier title "ML elapsed time (smooth)" """, |
323 |
""" using 1:4 smooth csplines title "ML elapsed time" """, |
|
65764 | 324 |
""" using 1:5 smooth sbezier title "ML cpu time (smooth)" """, |
65765 | 325 |
""" using 1:5 smooth csplines title "ML cpu time" """) |
65736 | 326 |
|
65769 | 327 |
val heap_plots = |
328 |
List( |
|
65859 | 329 |
""" using 1:6 smooth sbezier title "maximum heap (smooth)" """, |
330 |
""" using 1:6 smooth csplines title "maximum heap" """, |
|
331 |
""" using 1:7 smooth sbezier title "average heap (smooth)" """, |
|
332 |
""" using 1:7 smooth csplines title "average heap" """, |
|
333 |
""" using 1:8 smooth sbezier title "final heap (smooth)" """, |
|
334 |
""" using 1:8 smooth csplines title "final heap" """) |
|
65769 | 335 |
|
65865 | 336 |
def jfreechart(plot_name: String, fields: ML_Statistics.Fields): Image = |
337 |
{ |
|
338 |
val image = Image(plot_name, image_width, image_height) |
|
339 |
val chart = |
|
340 |
session.ml_statistics.chart( |
|
341 |
fields._1 + ": " + session.ml_statistics.heading, fields._2) |
|
342 |
Graphics_File.write_chart_png( |
|
343 |
(dir + image.path).file, chart, image.width, image.height) |
|
344 |
image |
|
345 |
} |
|
346 |
||
347 |
val images = |
|
65847
ad35427dbe88
less restrictive filter: omit empty charts, but show latest timing;
wenzelm
parents:
65838
diff
changeset
|
348 |
(if (session.check_timing) |
ad35427dbe88
less restrictive filter: omit empty charts, but show latest timing;
wenzelm
parents:
65838
diff
changeset
|
349 |
List( |
65865 | 350 |
gnuplot(plot_name("timing"), timing_plots, timing_range), |
351 |
gnuplot(plot_name("ml_timing"), ml_timing_plots, timing_range)) |
|
352 |
else Nil) ::: |
|
353 |
(if (session.check_heap) |
|
354 |
List(gnuplot(plot_name("heap"), heap_plots, "[0:]")) |
|
65847
ad35427dbe88
less restrictive filter: omit empty charts, but show latest timing;
wenzelm
parents:
65838
diff
changeset
|
355 |
else Nil) ::: |
65865 | 356 |
(if (session.ml_statistics.content.nonEmpty) |
357 |
List(jfreechart(plot_name("heap_chart"), ML_Statistics.heap_fields)) ::: |
|
358 |
(if (session.threads > 1) |
|
359 |
List(jfreechart(plot_name("tasks_chart"), ML_Statistics.tasks_fields)) |
|
360 |
else Nil) |
|
361 |
else Nil) |
|
65769 | 362 |
|
65865 | 363 |
session.name -> images |
65764 | 364 |
} |
65792 | 365 |
}, data_entry.sessions).toMap |
65754 | 366 |
|
65838 | 367 |
HTML.write_document(dir, "index.html", |
368 |
List(HTML.title("Isabelle build status for " + data_name)), |
|
369 |
HTML.chapter("Isabelle build status for " + data_name) :: |
|
370 |
HTML.par( |
|
371 |
List(HTML.description( |
|
65754 | 372 |
List( |
65838 | 373 |
HTML.text("status date:") -> HTML.text(data.date.toString), |
374 |
HTML.text("build host:") -> HTML.text(commas(data_entry.hosts)))))) :: |
|
375 |
HTML.par( |
|
376 |
List(HTML.itemize( |
|
377 |
data_entry.sessions.map(session => |
|
378 |
HTML.link("#session_" + session.name, HTML.text(session.name)) :: |
|
65863 | 379 |
HTML.text(" (" + session.head.timing.message_resources + ")"))))) :: |
65838 | 380 |
data_entry.sessions.flatMap(session => |
381 |
List( |
|
382 |
HTML.section(session.name) + HTML.id("session_" + session.name), |
|
383 |
HTML.par( |
|
384 |
HTML.description( |
|
385 |
List( |
|
65863 | 386 |
HTML.text("timing:") -> HTML.text(session.head.timing.message_resources), |
387 |
HTML.text("ML timing:") -> HTML.text(session.head.ml_timing.message_resources)) ::: |
|
388 |
print_heap(session.head.maximum_heap).map(s => |
|
65860 | 389 |
HTML.text("maximum heap:") -> HTML.text(s)).toList ::: |
65863 | 390 |
print_heap(session.head.average_heap).map(s => |
65860 | 391 |
HTML.text("average heap:") -> HTML.text(s)).toList ::: |
65866 | 392 |
print_heap(session.head.stored_heap).map(s => |
393 |
HTML.text("stored heap:") -> HTML.text(s)).toList ::: |
|
65863 | 394 |
proper_string(session.head.isabelle_version).map(s => |
65838 | 395 |
HTML.text("Isabelle version:") -> HTML.text(s)).toList ::: |
65863 | 396 |
proper_string(session.head.afp_version).map(s => |
65838 | 397 |
HTML.text("AFP version:") -> HTML.text(s)).toList) :: |
65865 | 398 |
session_plots.getOrElse(session.name, Nil).map(image => |
399 |
HTML.image(image.name) + |
|
400 |
HTML.width(image.width / 2) + |
|
401 |
HTML.height(image.height / 2)))))) |
|
63688
cc57255bf6ae
gnuplot presentation similar to former isatest-statistics;
wenzelm
parents:
63686
diff
changeset
|
402 |
} |
cc57255bf6ae
gnuplot presentation similar to former isatest-statistics;
wenzelm
parents:
63686
diff
changeset
|
403 |
} |
cc57255bf6ae
gnuplot presentation similar to former isatest-statistics;
wenzelm
parents:
63686
diff
changeset
|
404 |
|
cc57255bf6ae
gnuplot presentation similar to former isatest-statistics;
wenzelm
parents:
63686
diff
changeset
|
405 |
|
cc57255bf6ae
gnuplot presentation similar to former isatest-statistics;
wenzelm
parents:
63686
diff
changeset
|
406 |
/* Isabelle tool wrapper */ |
cc57255bf6ae
gnuplot presentation similar to former isatest-statistics;
wenzelm
parents:
63686
diff
changeset
|
407 |
|
cc57255bf6ae
gnuplot presentation similar to former isatest-statistics;
wenzelm
parents:
63686
diff
changeset
|
408 |
val isabelle_tool = |
65743 | 409 |
Isabelle_Tool("build_status", "present recent build status information from database", args => |
63688
cc57255bf6ae
gnuplot presentation similar to former isatest-statistics;
wenzelm
parents:
63686
diff
changeset
|
410 |
{ |
65736 | 411 |
var target_dir = default_target_dir |
65854 | 412 |
var ml_statistics = false |
65736 | 413 |
var only_sessions = Set.empty[String] |
414 |
var options = Options.init() |
|
415 |
var image_size = default_image_size |
|
65750 | 416 |
var verbose = false |
63688
cc57255bf6ae
gnuplot presentation similar to former isatest-statistics;
wenzelm
parents:
63686
diff
changeset
|
417 |
|
cc57255bf6ae
gnuplot presentation similar to former isatest-statistics;
wenzelm
parents:
63686
diff
changeset
|
418 |
val getopts = Getopts(""" |
65743 | 419 |
Usage: isabelle build_status [OPTIONS] |
63688
cc57255bf6ae
gnuplot presentation similar to former isatest-statistics;
wenzelm
parents:
63686
diff
changeset
|
420 |
|
cc57255bf6ae
gnuplot presentation similar to former isatest-statistics;
wenzelm
parents:
63686
diff
changeset
|
421 |
Options are: |
65737 | 422 |
-D DIR target directory (default """ + default_target_dir + """) |
65854 | 423 |
-M include full ML statistics |
63700 | 424 |
-S SESSIONS only given SESSIONS (comma separated) |
65736 | 425 |
-o OPTION override Isabelle system OPTION (via NAME=VAL or NAME) |
65737 | 426 |
-s WxH size of PNG image (default """ + image_size._1 + "x" + image_size._2 + """) |
65750 | 427 |
-v verbose |
63688
cc57255bf6ae
gnuplot presentation similar to former isatest-statistics;
wenzelm
parents:
63686
diff
changeset
|
428 |
|
65736 | 429 |
Present performance statistics from build log database, which is specified |
65782 | 430 |
via system options build_log_database_host, build_log_database_user, |
431 |
build_log_history etc. |
|
63688
cc57255bf6ae
gnuplot presentation similar to former isatest-statistics;
wenzelm
parents:
63686
diff
changeset
|
432 |
""", |
cc57255bf6ae
gnuplot presentation similar to former isatest-statistics;
wenzelm
parents:
63686
diff
changeset
|
433 |
"D:" -> (arg => target_dir = Path.explode(arg)), |
65854 | 434 |
"M" -> (_ => ml_statistics = true), |
63700 | 435 |
"S:" -> (arg => only_sessions = space_explode(',', arg).toSet), |
65736 | 436 |
"o:" -> (arg => options = options + arg), |
63700 | 437 |
"s:" -> (arg => |
63805 | 438 |
space_explode('x', arg).map(Value.Int.parse(_)) match { |
65736 | 439 |
case List(w, h) if w > 0 && h > 0 => image_size = (w, h) |
63700 | 440 |
case _ => error("Error bad PNG image size: " + quote(arg)) |
65750 | 441 |
}), |
442 |
"v" -> (_ => verbose = true)) |
|
63688
cc57255bf6ae
gnuplot presentation similar to former isatest-statistics;
wenzelm
parents:
63686
diff
changeset
|
443 |
|
65736 | 444 |
val more_args = getopts(args) |
445 |
if (more_args.nonEmpty) getopts.usage() |
|
63700 | 446 |
|
65736 | 447 |
val progress = new Console_Progress |
63688
cc57255bf6ae
gnuplot presentation similar to former isatest-statistics;
wenzelm
parents:
63686
diff
changeset
|
448 |
|
65785 | 449 |
build_status(options, progress = progress, only_sessions = only_sessions, verbose = verbose, |
65854 | 450 |
target_dir = target_dir, ml_statistics = ml_statistics, image_size = image_size) |
65736 | 451 |
|
64161 | 452 |
}, admin = true) |
63686 | 453 |
} |