From ef4eb4de8b819d274d805b6309f38c868fb2b8f0 Mon Sep 17 00:00:00 2001 From: Romain d'Alverny Date: Mon, 18 Apr 2011 18:59:16 +0000 Subject: rough stats on average build time --- index.php | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'index.php') 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 = << @@ -318,8 +320,11 @@ if ($total > 0) { $p['type']; $s .= ''; - 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 .= ''; //$s .= '' . sprintf($badges[$p['type']], $p['user']) . ''; $s .= ''; @@ -353,7 +358,17 @@ if ($total > 0) { $s .= sprintf('%s%d', $k, $k, $v); + $s .= '

'; + + $s .= ''; + ksort($buildtime_stats); + foreach ($buildtime_stats as $time => $count) { + $s .= sprintf('', + $time, $count); + } + // TODO (rda) compute/show average for all builds $s .= '
Build time
%s%d
'; + $s .= ''; echo $s; -- cgit v1.2.1