diff options
author | Romain d'Alverny <rda@mageia.org> | 2012-09-05 15:07:32 +0000 |
---|---|---|
committer | Romain d'Alverny <rda@mageia.org> | 2012-09-05 15:07:32 +0000 |
commit | ce2b60721754a1b1f2c3a08cdf08c20312ba6253 (patch) | |
tree | a4e523c19289da80a6a2f74a7c67a7e3da14e2b7 | |
parent | 4f4061ca4e3cb4eed76b6ecfcb6d3a0a2d609bb7 (diff) | |
download | pkgsubmit-ce2b60721754a1b1f2c3a08cdf08c20312ba6253.tar pkgsubmit-ce2b60721754a1b1f2c3a08cdf08c20312ba6253.tar.gz pkgsubmit-ce2b60721754a1b1f2c3a08cdf08c20312ba6253.tar.bz2 pkgsubmit-ce2b60721754a1b1f2c3a08cdf08c20312ba6253.tar.xz pkgsubmit-ce2b60721754a1b1f2c3a08cdf08c20312ba6253.zip |
move buildtime_* computations outside of publish_stats_headers()
-rw-r--r-- | lib.php | 9 | ||||
-rw-r--r-- | test_index.php | 6 |
2 files changed, 8 insertions, 7 deletions
@@ -281,7 +281,7 @@ function timesort($a, $b) * * @return void */ -function publish_stats_headers($stats, $buildtime_total, $build_count, $last_package = null) +function publish_stats_headers($stats, $buildtime_total, $buildtime_avg, $build_count, $last_package = null) { foreach ($stats as $k => $v) { header("X-BS-Queue-$k: $v"); @@ -298,13 +298,8 @@ function publish_stats_headers($stats, $buildtime_total, $build_count, $last_pac header("X-BS-Package-Status: ".$last_package['type']); } - $buildtime_total = $buildtime_total / 60; - header(sprintf('X-BS-Buildtime: %d', round($buildtime_total))); - - $buildtime_avg = ($build_count == 0) ? - 0 : - round($buildtime_total / $build_count, 2); + header(sprintf('X-BS-Buildtime: %d', round($buildtime_total))); header(sprintf('X-BS-Buildtime-Average: %5.2f', $buildtime_avg)); } diff --git a/test_index.php b/test_index.php index bf07e25..2024548 100644 --- a/test_index.php +++ b/test_index.php @@ -55,9 +55,15 @@ list($pkgs, $hosts, $build_count, $build_dates, $buildtime_total) = get_refined_ list($stats, $users, $total, $pkgs) = build_stats($pkgs); +$buildtime_total = $buildtime_total / 60; +$buildtime_avg = ($build_count == 0) ? + 0 : + round($buildtime_total / $build_count, 2); + publish_stats_headers( $stats, $buildtime_total, + $buildtime_avg, $build_count, (isset($_GET['last']) && $total > 0) ? reset($pkgs) : null ); |