tools/page-loader/report.pl

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/tools/page-loader/report.pl	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,78 @@
     1.4 +#!/usr/bin/perl
     1.5 +# 
     1.6 +# This Source Code Form is subject to the terms of the Mozilla Public
     1.7 +# License, v. 2.0. If a copy of the MPL was not distributed with this
     1.8 +# file, You can obtain one at http://mozilla.org/MPL/2.0/.
     1.9 +use CGI::Carp qw(fatalsToBrowser);
    1.10 +use CGI::Request;
    1.11 +use URLTimingDataSet;
    1.12 +use strict;
    1.13 +
    1.14 +my $request = new CGI::Request;
    1.15 +my $id = $request->param('id'); #XXX need to check for valid parameter id
    1.16 +
    1.17 +print "Content-type: text/html\n\n";
    1.18 +
    1.19 +print "<p>See Notes at the bottom of this page for some details.</p>\n";
    1.20 +print "<pre>\n";
    1.21 +my $rs = URLTimingDataSet->new($id);
    1.22 +
    1.23 +print  "Test id: $id<br>Avg. Median : <b>", $rs->{avgmedian},
    1.24 +       "</b> msec\t\tMinimum     : ", $rs->{minimum}, " msec\n";
    1.25 +print  "Average     : ", $rs->{average},
    1.26 +       " msec\t\tMaximum     : ", $rs->{maximum}, " msec</pre>\n\n\n";
    1.27 +
    1.28 +#XXX print more info (test id, ua, start time, user, IP, etc.)
    1.29 +
    1.30 +# draw the chart sorted
    1.31 +# XXX enable this line to draw a chart, sorted by time. However, in order
    1.32 +# to draw the chart, you will need to have installed the 'gd' drawing library,
    1.33 +# and the GD and GD::Graph Perl modules.
    1.34 +###print "\n<p><img src='graph.pl?id=", $id, "' height='720' width='800'></p><br>\n";
    1.35 +
    1.36 +
    1.37 +print "<hr><pre>\nIDX PATH                           AVG    MED    MAX    MIN  TIMES ...\n";
    1.38 +
    1.39 +if ($request->param('sort')) {
    1.40 +    print $rs->as_string_sorted();
    1.41 +} else {
    1.42 +    print $rs->as_string();
    1.43 +}
    1.44 +print "</pre>\n";
    1.45 +printEndNotes();
    1.46 +
    1.47 +exit;
    1.48 +
    1.49 +
    1.50 +sub printEndNotes {
    1.51 +    print <<"EndOfNotes";
    1.52 +
    1.53 +<hr>
    1.54 +<p>
    1.55 +<ol>
    1.56 +<li>Times are in milliseconds.
    1.57 +
    1.58 +<li>AVG, MED, MIN and MAX are the average, median, maximum and
    1.59 +minimum of the (non-NaN) test results for a given page.
    1.60 +
    1.61 +<li>If a page fails to fire the onload event within 30 seconds,
    1.62 +the test for that page is "aborted": a different JS function kicks in,
    1.63 +cleans up, and reports the time as "NaN". (The rest of the pages in
    1.64 +the series should still be loaded normally after this).
    1.65 +
    1.66 +<li>The value for AVG reported for 'All Pages' is the average of
    1.67 +the averages for all the pages loaded.
    1.68 +
    1.69 +<li>The value for MAX and MIN reported for 'All Pages' are the
    1.70 +overall maximum and minimum for all pages loaded (keeping in mind that
    1.71 +a load that never finishes is recorded as "NaN".)
    1.72 +
    1.73 +<li>The value for MED reported for 'All Pages' is the _average_ of
    1.74 +the medians for all the pages loaded (i.e., it is not the median of
    1.75 +the medians).
    1.76 +
    1.77 +</ol>
    1.78 +
    1.79 +</p>
    1.80 +EndOfNotes
    1.81 +}

mercurial