| 1 | -- SQL invoked from regtest/aports-html.sh
|
| 2 |
|
| 3 | -- annoying: you have to cast(x as real) for pragma_info to have type info
|
| 4 | create table packages as
|
| 5 | select
|
| 6 | status,
|
| 7 | elapsed_secs,
|
| 8 | cast(user_secs / elapsed_secs as real) as user_elapsed_ratio,
|
| 9 | cast(user_secs / sys_secs as real) as user_sys_ratio,
|
| 10 | cast(max_rss_KiB * 1024 / 1e6 as real) as max_rss_MB,
|
| 11 | pkg,
|
| 12 | pkg_HREF
|
| 13 | from tasks;
|
| 14 |
|
| 15 | -- Compute stats
|
| 16 |
|
| 17 | create table metrics (
|
| 18 | id integer primary key check (id = 1), -- ensure only one row
|
| 19 | elapsed_minutes real not null,
|
| 20 | num_failures integer not null,
|
| 21 | num_timeouts integer not null,
|
| 22 | num_tasks integer not null,
|
| 23 | -- filled in later
|
| 24 | num_apk integer not null
|
| 25 | );
|
| 26 |
|
| 27 | -- dummy row
|
| 28 | insert into metrics values (1, -1.0, -1, -1, -1, -1);
|
| 29 |
|
| 30 | update metrics
|
| 31 | set elapsed_minutes = (select (max(end_time) - min(start_time)) / 60 from tasks)
|
| 32 | where id = 1;
|
| 33 |
|
| 34 | update metrics
|
| 35 | set num_failures = (select count(*) from tasks where status != 0)
|
| 36 | where id = 1;
|
| 37 |
|
| 38 | update metrics
|
| 39 | set num_timeouts = (select count(*) from tasks where status in (124, 143))
|
| 40 | where id = 1;
|
| 41 |
|
| 42 | update metrics
|
| 43 | set num_tasks = (select count(*) from tasks)
|
| 44 | where id = 1;
|