tools/page-loader/report.pl

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rwxr-xr-x

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 #!/usr/bin/perl
     2 # 
     3 # This Source Code Form is subject to the terms of the Mozilla Public
     4 # License, v. 2.0. If a copy of the MPL was not distributed with this
     5 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
     6 use CGI::Carp qw(fatalsToBrowser);
     7 use CGI::Request;
     8 use URLTimingDataSet;
     9 use strict;
    11 my $request = new CGI::Request;
    12 my $id = $request->param('id'); #XXX need to check for valid parameter id
    14 print "Content-type: text/html\n\n";
    16 print "<p>See Notes at the bottom of this page for some details.</p>\n";
    17 print "<pre>\n";
    18 my $rs = URLTimingDataSet->new($id);
    20 print  "Test id: $id<br>Avg. Median : <b>", $rs->{avgmedian},
    21        "</b> msec\t\tMinimum     : ", $rs->{minimum}, " msec\n";
    22 print  "Average     : ", $rs->{average},
    23        " msec\t\tMaximum     : ", $rs->{maximum}, " msec</pre>\n\n\n";
    25 #XXX print more info (test id, ua, start time, user, IP, etc.)
    27 # draw the chart sorted
    28 # XXX enable this line to draw a chart, sorted by time. However, in order
    29 # to draw the chart, you will need to have installed the 'gd' drawing library,
    30 # and the GD and GD::Graph Perl modules.
    31 ###print "\n<p><img src='graph.pl?id=", $id, "' height='720' width='800'></p><br>\n";
    34 print "<hr><pre>\nIDX PATH                           AVG    MED    MAX    MIN  TIMES ...\n";
    36 if ($request->param('sort')) {
    37     print $rs->as_string_sorted();
    38 } else {
    39     print $rs->as_string();
    40 }
    41 print "</pre>\n";
    42 printEndNotes();
    44 exit;
    47 sub printEndNotes {
    48     print <<"EndOfNotes";
    50 <hr>
    51 <p>
    52 <ol>
    53 <li>Times are in milliseconds.
    55 <li>AVG, MED, MIN and MAX are the average, median, maximum and
    56 minimum of the (non-NaN) test results for a given page.
    58 <li>If a page fails to fire the onload event within 30 seconds,
    59 the test for that page is "aborted": a different JS function kicks in,
    60 cleans up, and reports the time as "NaN". (The rest of the pages in
    61 the series should still be loaded normally after this).
    63 <li>The value for AVG reported for 'All Pages' is the average of
    64 the averages for all the pages loaded.
    66 <li>The value for MAX and MIN reported for 'All Pages' are the
    67 overall maximum and minimum for all pages loaded (keeping in mind that
    68 a load that never finishes is recorded as "NaN".)
    70 <li>The value for MED reported for 'All Pages' is the _average_ of
    71 the medians for all the pages loaded (i.e., it is not the median of
    72 the medians).
    74 </ol>
    76 </p>
    77 EndOfNotes
    78 }

mercurial