summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib.php9
-rw-r--r--test_index.php6
2 files changed, 8 insertions, 7 deletions
diff --git a/lib.php b/lib.php
index 94186a7..daf8b9a 100644
--- a/lib.php
+++ b/lib.php
@@ -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
);