summaryrefslogtreecommitdiffstats
path: root/index.php
diff options
context:
space:
mode:
authorRomain d'Alverny <rda@mageia.org>2011-04-18 21:05:56 +0000
committerRomain d'Alverny <rda@mageia.org>2011-04-18 21:05:56 +0000
commit05573f2c384688ae86ca9bffcc797b09c0e37505 (patch)
tree2865042d70fc07cb7819c422dd5314fa29d202f8 /index.php
parent617d93b57aaf20135b4994ab47f8905fa92a3c82 (diff)
downloadpkgsubmit-05573f2c384688ae86ca9bffcc797b09c0e37505.tar
pkgsubmit-05573f2c384688ae86ca9bffcc797b09c0e37505.tar.gz
pkgsubmit-05573f2c384688ae86ca9bffcc797b09c0e37505.tar.bz2
pkgsubmit-05573f2c384688ae86ca9bffcc797b09c0e37505.tar.xz
pkgsubmit-05573f2c384688ae86ca9bffcc797b09c0e37505.zip
buildtime avg
Diffstat (limited to 'index.php')
-rw-r--r--index.php18
1 files changed, 14 insertions, 4 deletions
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 .= '</table><br /><br />';
- $s .= '<table style="width: 100%"><caption>Build time</caption></tr><th>Duration</th><th>Count</th></tr>';
-
/**
*/
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('<tr><td>%s</td><td>%d</td></tr>',
+ $bts .= sprintf('<tr><td>%s</td><td>%d</td></tr>',
$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('<table style="width: 100%"><caption>Build time (average: %s)</caption>
+ <tr><th title="Build time">Duration</th><th title="Packages number">Pack. nb.</th></tr>',
+ $buildtime_avg);
+ $s .= $bts;
$s .= '</table>';
$s .= '</div>';