summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain d'Alverny <rda@mageia.org>2011-04-18 18:59:16 +0000
committerRomain d'Alverny <rda@mageia.org>2011-04-18 18:59:16 +0000
commitef4eb4de8b819d274d805b6309f38c868fb2b8f0 (patch)
tree4786cd745fb3fa56660f8976520ba8a389493952
parenta6ac200ab07c3a45593fdc14554283bdfc586aa0 (diff)
downloadpkgsubmit-ef4eb4de8b819d274d805b6309f38c868fb2b8f0.tar
pkgsubmit-ef4eb4de8b819d274d805b6309f38c868fb2b8f0.tar.gz
pkgsubmit-ef4eb4de8b819d274d805b6309f38c868fb2b8f0.tar.bz2
pkgsubmit-ef4eb4de8b819d274d805b6309f38c868fb2b8f0.tar.xz
pkgsubmit-ef4eb4de8b819d274d805b6309f38c868fb2b8f0.zip
rough stats on average build time
-rw-r--r--index.php21
1 files changed, 18 insertions, 3 deletions
diff --git a/index.php b/index.php
index a9d1a4c..1c4eae9 100644
--- a/index.php
+++ b/index.php
@@ -87,7 +87,7 @@ function timediff($start, $end) {
* @return string
*/
if (is_null($end)) {
- $end = time();
+ $end = time();
}
$diff = $end - $start;
if ($diff<60)
@@ -282,6 +282,8 @@ echo sprintf(
#########################################
+$buildtime_stats = array();
+
$s = '';
$tmpl = <<<T
<tr class="%s">
@@ -318,8 +320,11 @@ if ($total > 0) {
$p['type'];
$s .= '</td><td>';
- if ($p['type'] == 'uploaded')
- $s .= timediff($p['buildtime']['start'], $p['buildtime']['end']);
+ if ($p['type'] == 'uploaded') {
+ $tdiff = timediff($p['buildtime']['start'], $p['buildtime']['end']);
+ $s .= $tdiff;
+ @$buildtime_stats[$tdiff] += 1;
+ }
$s .= '</td>';
//$s .= '<td>' . sprintf($badges[$p['type']], $p['user']) . '</td>';
$s .= '</tr>';
@@ -353,7 +358,17 @@ if ($total > 0) {
$s .= sprintf('<tr><td><a href="/?user=%s">%s</a></td><td>%d</td></tr>',
$k, $k, $v);
+ $s .= '</table><br /><br />';
+
+ $s .= '<table><caption>Build time</caption></tr><th></th><th></th></tr>';
+ ksort($buildtime_stats);
+ foreach ($buildtime_stats as $time => $count) {
+ $s .= sprintf('<tr><td><td>%s</td><td>%d</td></tr>',
+ $time, $count);
+ }
+ // TODO (rda) compute/show average for all builds
$s .= '</table>';
+
$s .= '</div>';
echo $s;