From 05573f2c384688ae86ca9bffcc797b09c0e37505 Mon Sep 17 00:00:00 2001 From: Romain d'Alverny Date: Mon, 18 Apr 2011 21:05:56 +0000 Subject: buildtime avg --- index.php | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'index.php') diff --git a/index.php b/index.php index 82e4609..a91d445 100644 --- a/index.php +++ b/index.php @@ -360,8 +360,6 @@ if ($total > 0) { $s .= '

'; - $s .= ''; - /** */ function timesort($a, $b) @@ -384,11 +382,23 @@ if ($total > 0) { } uksort($buildtime_stats, "timesort"); + $bts = ''; + $buildtime_avg = 0; + $buildtime_cnt = 0; foreach ($buildtime_stats as $time => $count) { - $s .= sprintf('', + $bts .= sprintf('', $time, $count); + + $tmp = explode(' ', $time); + $buildtime_avg += $tmp[0] * $count; + $buildtime_cnt += $count; } - // TODO (rda) compute/show average for all builds + $buildtime_avg = round($buildtime_avg / $buildtime_cnt, 1); + + $s .= sprintf('
Build time
DurationCount
%s%d
%s%d
+ ', + $buildtime_avg); + $s .= $bts; $s .= '
Build time (average: %s)
DurationPack. nb.
'; $s .= ''; -- cgit v1.2.1