summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain d'Alverny <rda@mageia.org>2011-04-19 13:13:33 +0000
committerRomain d'Alverny <rda@mageia.org>2011-04-19 13:13:33 +0000
commitf252b619fc883f6a647b0ef25ea0e983d4b90968 (patch)
treead2de2917a90116cb33efb0da15198384365d153
parent23055ad4e1fa2aa5106dad518a41388cff03c1b9 (diff)
downloadpkgsubmit-f252b619fc883f6a647b0ef25ea0e983d4b90968.tar
pkgsubmit-f252b619fc883f6a647b0ef25ea0e983d4b90968.tar.gz
pkgsubmit-f252b619fc883f6a647b0ef25ea0e983d4b90968.tar.bz2
pkgsubmit-f252b619fc883f6a647b0ef25ea0e983d4b90968.tar.xz
pkgsubmit-f252b619fc883f6a647b0ef25ea0e983d4b90968.zip
show usage time diagram (sort of)
-rw-r--r--index.php13
1 files changed, 13 insertions, 0 deletions
diff --git a/index.php b/index.php
index 2d88a3f..846bbd7 100644
--- a/index.php
+++ b/index.php
@@ -133,6 +133,7 @@ $r = preg_match_all($re,
$pkgs = array();
$buildtime_total = array();
+$buid_dates = array();
foreach ($matches as $val) {
@@ -171,10 +172,14 @@ foreach ($matches as $val) {
// parse build bot from $data
$pkgs[$key]['status']['build'] = 1;
} else if ($ext == '.done') {
+ // beware! this block is called twice for a given $key
+
$pkgs[$key]['buildtime']['start'] = key2timestamp($val[6]);
$pkgs[$key]['buildtime']['end'] = round($val[12]);
$pkgs[$key]['buildtime']['diff'] = $pkgs[$key]['buildtime']['end'] - $pkgs[$key]['buildtime']['start'];
+ @$build_dates[date('H', $pkgs[$key]['buildtime']['start'])] += 1;
+
// keep obviously dubious values out of there
// 12 hours is be an acceptable threshold given current BS global perfs
// as of April 2011
@@ -185,6 +190,7 @@ foreach ($matches as $val) {
}
// sort by key in reverse order to have more recent pkgs first
krsort($pkgs);
+ksort($build_dates);
$build_count = count($buildtime_total);
$buildtime_total = array_sum($buildtime_total);
@@ -412,6 +418,13 @@ if ($total > 0) {
$s .= $bts;
$s .= '</table><span style="font-size: 85%;">Does not take<br />build failures<br />into account.</span>';
+ $s .= '<table style="width:100%;"><caption>Build times</caption>';
+ $max = max($build_dates2);
+ foreach ($build_dates2 as $time => $count)
+ $s .= sprintf('<tr><td>%d</td><td><span style="width: %dpx; height: 10px; background: #aaa;" title="%d"></span></td></tr>',
+ $time, round($count / $max * 100), $count);
+ $s .= '</table>';
+
$s .= '</div>';
echo $s;