Author: jfthomps
Date: Mon Apr 12 16:38:42 2010
New Revision: 933314

URL: http://svn.apache.org/viewvc?rev=933314&view=rev
Log:
VCL-244

modified viewStatistics - added $imagefails that tracks how many times each 
image failed; it gets printed for people with viewmode of ADMIN_FULL or higher

Modified:
    incubator/vcl/trunk/web/.ht-inc/statistics.php

Modified: incubator/vcl/trunk/web/.ht-inc/statistics.php
URL: 
http://svn.apache.org/viewvc/incubator/vcl/trunk/web/.ht-inc/statistics.php?rev=933314&r1=933313&r2=933314&view=diff
==============================================================================
--- incubator/vcl/trunk/web/.ht-inc/statistics.php (original)
+++ incubator/vcl/trunk/web/.ht-inc/statistics.php Mon Apr 12 16:38:42 2010
@@ -227,6 +227,7 @@ function viewStatistics() {
        $imagehours = array();
        $imageload2less = array();
        $imageload2more = array();
+       $imagefails = array();
        $lengths = array("30min" => 0,
                         "1hour" => 0,
                         "2hours" => 0,
@@ -300,6 +301,12 @@ function viewStatistics() {
                        $imagehours[$row["prettyname"]] = 0;
                $imagehours[$row["prettyname"]] += ($length / 3600);
 
+               # imagefails
+               if(! array_key_exists($row["prettyname"], $imagefails))
+                       $imagefails[$row["prettyname"]] = 0;
+               if($row['ending'] == 'failed')
+                       $imagefails[$row["prettyname"]] += 1;
+
                # total hours
                $totalhours += ($length / 3600);
 
@@ -361,6 +368,7 @@ function viewStatistics() {
        if($viewmode >= ADMIN_FULL) {
                print "    <TH>&lt; 2 min load time</TH>\n";
                print "    <TH>&gt;= 2 min load time</TH>\n";
+               print "    <TH>Failures</TH>\n";
        }
        print "  </TR>\n";
        foreach($imagecount as $key => $value) {
@@ -375,6 +383,17 @@ function viewStatistics() {
                if($viewmode >= ADMIN_FULL) {
                        print "    <TD 
align=center>{$imageload2less[$key]}</TD>\n";
                        print "    <TD 
align=center>{$imageload2more[$key]}</TD>\n";
+                       if($imagefails[$key]) {
+                               $percent = $imagefails[$key] * 100 / $value;
+                               if($percent < 1)
+                                       $percent = sprintf('%.1f%%', $percent);
+                               else
+                                       $percent = sprintf('%d%%', $percent);
+                               print "    <TD align=center><font 
color=red>{$imagefails[$key]} ";
+                               print "($percent)</font></TD>\n";
+                       }
+                       else
+                               print "    <TD 
align=center>{$imagefails[$key]}</TD>\n";
                }
                print "  </TR>\n";
        }


Reply via email to