From f252b619fc883f6a647b0ef25ea0e983d4b90968 Mon Sep 17 00:00:00 2001 From: Romain d'Alverny Date: Tue, 19 Apr 2011 13:13:33 +0000 Subject: show usage time diagram (sort of) --- index.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'index.php') diff --git a/index.php b/index.php index 2d88a3f..846bbd7 100644 --- a/index.php +++ b/index.php @@ -133,6 +133,7 @@ $r = preg_match_all($re, $pkgs = array(); $buildtime_total = array(); +$buid_dates = array(); foreach ($matches as $val) { @@ -171,10 +172,14 @@ foreach ($matches as $val) { // parse build bot from $data $pkgs[$key]['status']['build'] = 1; } else if ($ext == '.done') { + // beware! this block is called twice for a given $key + $pkgs[$key]['buildtime']['start'] = key2timestamp($val[6]); $pkgs[$key]['buildtime']['end'] = round($val[12]); $pkgs[$key]['buildtime']['diff'] = $pkgs[$key]['buildtime']['end'] - $pkgs[$key]['buildtime']['start']; + @$build_dates[date('H', $pkgs[$key]['buildtime']['start'])] += 1; + // keep obviously dubious values out of there // 12 hours is be an acceptable threshold given current BS global perfs // as of April 2011 @@ -185,6 +190,7 @@ foreach ($matches as $val) { } // sort by key in reverse order to have more recent pkgs first krsort($pkgs); +ksort($build_dates); $build_count = count($buildtime_total); $buildtime_total = array_sum($buildtime_total); @@ -412,6 +418,13 @@ if ($total > 0) { $s .= $bts; $s .= 'Does not take
build failures
into account.
'; + $s .= ''; + $max = max($build_dates2); + foreach ($build_dates2 as $time => $count) + $s .= sprintf('', + $time, round($count / $max * 100), $count); + $s .= '
Build times
%d
'; + $s .= ''; echo $s; -- cgit v1.2.1