michael@0: #!/usr/bin/perl michael@0: # michael@0: # This Source Code Form is subject to the terms of the Mozilla Public michael@0: # License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: # file, You can obtain one at http://mozilla.org/MPL/2.0/. michael@0: use CGI::Carp qw(fatalsToBrowser); michael@0: use CGI::Request; michael@0: use URLTimingDataSet; michael@0: use strict; michael@0: michael@0: my $request = new CGI::Request; michael@0: my $id = $request->param('id'); #XXX need to check for valid parameter id michael@0: michael@0: print "Content-type: text/html\n\n"; michael@0: michael@0: print "

See Notes at the bottom of this page for some details.

\n"; michael@0: print "
\n";
michael@0: my $rs = URLTimingDataSet->new($id);
michael@0: 
michael@0: print  "Test id: $id
Avg. Median : ", $rs->{avgmedian}, michael@0: " msec\t\tMinimum : ", $rs->{minimum}, " msec\n"; michael@0: print "Average : ", $rs->{average}, michael@0: " msec\t\tMaximum : ", $rs->{maximum}, " msec
\n\n\n"; michael@0: michael@0: #XXX print more info (test id, ua, start time, user, IP, etc.) michael@0: michael@0: # draw the chart sorted michael@0: # XXX enable this line to draw a chart, sorted by time. However, in order michael@0: # to draw the chart, you will need to have installed the 'gd' drawing library, michael@0: # and the GD and GD::Graph Perl modules. michael@0: ###print "\n


\n"; michael@0: michael@0: michael@0: print "
\nIDX PATH                           AVG    MED    MAX    MIN  TIMES ...\n";
michael@0: 
michael@0: if ($request->param('sort')) {
michael@0:     print $rs->as_string_sorted();
michael@0: } else {
michael@0:     print $rs->as_string();
michael@0: }
michael@0: print "
\n"; michael@0: printEndNotes(); michael@0: michael@0: exit; michael@0: michael@0: michael@0: sub printEndNotes { michael@0: print <<"EndOfNotes"; michael@0: michael@0:
michael@0:

michael@0:

    michael@0:
  1. Times are in milliseconds. michael@0: michael@0:
  2. AVG, MED, MIN and MAX are the average, median, maximum and michael@0: minimum of the (non-NaN) test results for a given page. michael@0: michael@0:
  3. If a page fails to fire the onload event within 30 seconds, michael@0: the test for that page is "aborted": a different JS function kicks in, michael@0: cleans up, and reports the time as "NaN". (The rest of the pages in michael@0: the series should still be loaded normally after this). michael@0: michael@0:
  4. The value for AVG reported for 'All Pages' is the average of michael@0: the averages for all the pages loaded. michael@0: michael@0:
  5. The value for MAX and MIN reported for 'All Pages' are the michael@0: overall maximum and minimum for all pages loaded (keeping in mind that michael@0: a load that never finishes is recorded as "NaN".) michael@0: michael@0:
  6. The value for MED reported for 'All Pages' is the _average_ of michael@0: the medians for all the pages loaded (i.e., it is not the median of michael@0: the medians). michael@0: michael@0:
michael@0: michael@0:

michael@0: EndOfNotes michael@0: }