2001-12-07 10:02:32 +00:00
#!/usr/bin/perl
2001-12-15 10:33:05 +00:00
# -*- Mode: perl; indent-tabs-mode: nil -*-
2004-10-26 21:41:41 +00:00
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is the Mozilla graph tool.
#
# The Initial Developer of the Original Code is AOL Time Warner, Inc.
#
# Portions created by AOL Time Warner, Inc. are Copyright (C) 2001
# AOL Time Warner, Inc. All Rights Reserved.
#
# Contributor(s):
# Chris McAfee <mcafee@mocha.com>
# John Morrison <jrgm@liveops.com>
#
2001-12-07 10:02:32 +00:00
use CGI::Carp qw(fatalsToBrowser);
use CGI::Request;
use Date::Calc qw(Add_Delta_Days); # http://www.engelschall.com/u/sb/download/Date-Calc/
my $req = new CGI::Request;
my $TESTNAME = lc($req->param('testname'));
my $UNITS = lc($req->param('units'));
my $TBOX = lc($req->param('tbox'));
my $AUTOSCALE = lc($req->param('autoscale'));
2001-12-16 00:06:51 +00:00
my $SIZE = lc($req->param('size'));
2001-12-07 10:02:32 +00:00
my $DAYS = lc($req->param('days'));
2001-12-13 07:17:48 +00:00
my $LTYPE = lc($req->param('ltype'));
2001-12-13 07:42:53 +00:00
my $POINTS = lc($req->param('points'));
2002-05-05 08:14:00 +00:00
my $SHOWPOINT = lc($req->param('showpoint'));
2001-12-31 05:03:23 +00:00
my $AVG = lc($req->param('avg'));
2001-12-13 04:53:03 +00:00
# Testing only:
#
#$TESTNAME = "testname";
#$UNITS = "units";
#$TBOX = "tbox";
#$AUTOSCALE = 1;
#$DAYS = 1;
2001-12-07 10:02:32 +00:00
sub make_filenames_list {
my ($dir) = @_;
my @result;
if (-d "$dir") {
chdir "$dir";
while(<*>) {
if( $_ ne 'config.txt' ) {
push @result, $_;
}
}
chdir "../..";
}
return @result;
}
# Print out a list of testnames in db directory
sub print_testnames {
2001-12-31 05:03:23 +00:00
my ($tbox, $autoscale, $days, $units, $ltype, $points, $avg) = @_;
2001-12-07 10:02:32 +00:00
# HTTP header
print "Content-type: text/html\n\n<HTML>\n";
2001-12-31 05:03:23 +00:00
2001-12-07 10:02:32 +00:00
print "<title>testnames</title>";
print "<center><h2><b>testnames</b></h2></center>";
2001-12-31 05:03:23 +00:00
2001-12-07 10:02:32 +00:00
print "<p><table width=\"100%\">";
print "<tr><td align=center>Select one of the following tests:</td></tr>";
print "<tr><td align=center>\n";
print " <table><tr><td><ul>\n";
2004-10-19 23:06:27 +00:00
my @tests = make_filenames_list("db");
my $tests_string = join(" ", @tests);
2001-12-07 10:02:32 +00:00
2004-10-19 23:06:27 +00:00
foreach (@tests) {
# 10/13/04 cmc: set defaults to showing points and showing averages
print "<li><a href=query.cgi?&testname=$_$testname&tbox=$tbox&autoscale=$autoscale&size=$SIZE&days=$days&units=$units<ype=$ltype&points=$points&showpoint=&avg=$avg>$_</a>\n";
2001-12-07 10:02:32 +00:00
}
print "</ul></td></tr></table></td></tr></table>";
}
# Print out a list of machines in db/<testname> directory, with links.
sub print_machines {
2001-12-31 05:03:23 +00:00
my ($testname, $autoscale, $days, $units, $ltype, $points, $avg) = @_;
2001-12-07 10:02:32 +00:00
# HTTP header
print "Content-type: text/html\n\n<HTML>\n";
print "<title>$TESTNAME machines</title>";
print "<center><h2><b>$TESTNAME machines:</b></h2></center>";
print "<p><table width=\"100%\">";
print "<tr><td align=center>Select one of the following machines:</td></tr>";
print "<tr><td align=center>\n";
print " <table><tr><td><ul>\n";
my @machines = make_filenames_list("db/$testname");
my $machines_string = join(" ", @machines);
foreach (@machines) {
2004-10-19 23:06:27 +00:00
print "<li><a href=query.cgi?tbox=$_&testname=$testname&autoscale=$autoscale&size=$SIZE&days=$days&units=$units<ype=$ltype&points=$points&avg=$avg&showpoint=>$_</a>\n";
2001-12-07 10:02:32 +00:00
}
print "</ul></td></tr></table></td></tr></table>";
}
sub show_graph {
# HTTP header
print "Content-type: text/html\n\n<HTML>\n";
2004-10-19 23:06:27 +00:00
print "<title>$TESTNAME $TBOX</title><br>\n";
2001-12-07 10:02:32 +00:00
2001-12-13 04:53:03 +00:00
print "<body>\n";
2001-12-31 05:03:23 +00:00
# JS refresh every 30min
print "<script>setTimeout('location.reload()',1800000);</script>\n";
2004-10-19 23:06:27 +00:00
print "<center>\n";
2004-10-26 23:04:41 +00:00
print "<table cellspacing=8 border=0>\n";
2004-10-19 23:06:27 +00:00
print "<tr>\n";
print "<b>$TESTNAME</b><br>($TBOX)\n";
print "</tr>\n";
2001-12-13 04:53:03 +00:00
print "<tr>\n";
# Scale Y-axis
2001-12-16 00:06:51 +00:00
print "<td valign=bottom>\n";
print "<font size=\"-1\">\n";
2001-12-13 02:10:16 +00:00
if($AUTOSCALE) {
print "Y-axis: (<b>zoom</b>|";
2002-05-05 08:14:00 +00:00
print "<a href=\"query.cgi?tbox=$TBOX&testname=$TESTNAME&autoscale=0&size=$SIZE&days=$DAYS&units=$UNITS<ype=$LTYPE&points=$POINTS&showpoint=$SHOWPOINT&avg=$AVG\">100%</a>";
2001-12-13 04:53:03 +00:00
print ") \n";
2001-12-13 02:10:16 +00:00
} else {
print "Y-axis: (";
2002-05-05 08:14:00 +00:00
print "<a href=\"query.cgi?tbox=$TBOX&testname=$TESTNAME&autoscale=1&size=$SIZE&days=$DAYS&units=$UNITS<ype=$LTYPE&points=$POINTS&showpoint=$SHOWPOINT&avg=$AVG\">zoom</a>";
2001-12-13 04:53:03 +00:00
print "|<b>100%</b>) \n";
2001-12-13 02:10:16 +00:00
}
2001-12-16 00:06:51 +00:00
print "</font>\n";
2001-12-13 04:53:03 +00:00
print "</td>\n";
# Days, Time-axis
2001-12-31 05:03:23 +00:00
print "<form method=\"get\" action=\"query.cgi?tbox=$TBOX&testname=$TESTNAME&autoscale=$AUTOSCALE&size=$SIZE&units=$UNITS<ype=$LTYPE&points=$POINTS&avg=$AVG\">\n";
2001-12-13 04:53:03 +00:00
print "<input type=hidden name=\"tbox\" value=\"$TBOX\">";
print "<input type=hidden name=\"testname\" value=\"$TESTNAME\">";
print "<input type=hidden name=\"autoscale\" value=\"$AUTOSCALE\">";
2001-12-16 00:06:51 +00:00
print "<input type=hidden name=\"size\" value=\"$SIZE\">";
2001-12-13 07:48:34 +00:00
print "<input type=hidden name=\"units\" value=\"$UNITS\">";
print "<input type=hidden name=\"ltype\" value=\"$LTYPE\">";
print "<input type=hidden name=\"points\" value=\"$POINTS\">";
2002-05-05 08:14:00 +00:00
print "<input type=hidden name=\"showpoint\" value=\"$SHOWPOINT\">";
2001-12-31 05:03:23 +00:00
print "<input type=hidden name=\"avg\" value=\"$AVG\">";
2001-12-13 04:53:03 +00:00
2004-10-26 23:04:41 +00:00
print "<td>\n";
print "<table valign=bottom cellspacing=0 border=0 cellpadding=0>\n";
print "<tr valign=\"bottom\">\n";
print "<td valign=bottom>\n";
print "<font size=\"-1\">\n";
2001-12-13 04:53:03 +00:00
print "Days:";
if($DAYS) {
2004-10-26 23:04:41 +00:00
print "(<a href=\"query.cgi?tbox=$TBOX&testname=$TESTNAME&autoscale=$AUTOSCALE&size=$SIZE&days=0&units=$UNITS<ype=$LTYPE&points=$POINTS&showpoint=$SHOWPOINT&avg=$AVG\">all data</a>|";
print "</td>\n";
print "<td valign=bottom>\n";
print "<font size=\"-1\">\n";
print "<input type=text value=$DAYS name=\"days\" size=3 maxlength=10>\n";
print "</td>\n";
print "<td valign=bottom>\n";
print "<font size=\"-1\">\n";
print ")\n";
print "</td>\n";
2001-12-13 04:53:03 +00:00
} else {
2004-10-26 23:04:41 +00:00
print "(<b>all data</b>|";
print "</td>\n";
print "<td valign=bottom>\n";
print "<font size=\"-1\">\n";
print "<input type=text value=\"\" name=\"days\" size=3 maxlength=10>\n";
print "</td>\n";
print "<td valign=bottom>\n";
print "<font size=\"-1\">\n";
print ")\n";
print "</td>\n";
2001-12-13 04:53:03 +00:00
}
2004-10-26 23:04:41 +00:00
print "</tr>\n";
print "</table>\n";
2001-12-16 00:06:51 +00:00
print "</font>\n";
2001-12-13 04:53:03 +00:00
print "</form>\n";
print "</td>\n";
2001-12-13 07:42:53 +00:00
# Line style (lines|steps)
2001-12-16 00:06:51 +00:00
print "<td valign=bottom>\n";
print "<font size=\"-1\">\n";
2001-12-13 07:17:48 +00:00
print "Style:";
if($LTYPE eq "steps") {
print "(";
2002-05-05 08:14:00 +00:00
print "<a href=\"query.cgi?tbox=$TBOX&testname=$TESTNAME&autoscale=$AUTOSCALE&size=$SIZE&days=$DAYS&units=$UNITS<ype=lines&points=$POINTS&showpoint=$SHOWPOINT&avg=$AVG\">lines</a>";
2001-12-13 07:42:53 +00:00
print "|<b>steps</b>";
2001-12-13 07:17:48 +00:00
print ")";
} else {
print "(<b>lines</b>|";
2002-05-05 08:14:00 +00:00
print "<a href=\"query.cgi?tbox=$TBOX&testname=$TESTNAME&autoscale=$AUTOSCALE&size=$SIZE&days=$DAYS&units=$UNITS<ype=steps&points=$POINTS&showpoint=$SHOWPOINT&avg=$AVG\">steps</a>";
2001-12-13 07:17:48 +00:00
print ")";
}
2001-12-16 00:06:51 +00:00
print "</font>\n";
2001-12-13 07:17:48 +00:00
print "</td>\n";
2001-12-13 07:42:53 +00:00
# Points (on|off)
2001-12-16 00:06:51 +00:00
print "<td valign=bottom>\n";
print "<font size=\"-1\">\n";
2001-12-13 07:42:53 +00:00
print "Points:";
if($POINTS) {
print "(<b>on</b>|";
2002-05-05 08:14:00 +00:00
print "<a href=\"query.cgi?tbox=$TBOX&testname=$TESTNAME&autoscale=$AUTOSCALE&size=$SIZE&days=$DAYS&units=$UNITS<ype=$LTYPE&points=0&showpoint=$SHOWPOINT&avg=$AVG\">off</a>";
2001-12-13 07:42:53 +00:00
print ")\n";
} else {
print "(";
2002-05-05 08:14:00 +00:00
print "<a href=\"query.cgi?tbox=$TBOX&testname=$TESTNAME&autoscale=$AUTOSCALE&size=$SIZE&days=$DAYS&units=$UNITS<ype=$LTYPE&points=1&showpoint=$SHOWPOINT&avg=$AVG\">on</a>";
2001-12-13 07:42:53 +00:00
print "|<b>off</b>)\n";
}
2001-12-16 00:06:51 +00:00
print "</font>\n";
2001-12-13 07:42:53 +00:00
print "</td>\n";
2001-12-13 07:17:48 +00:00
2001-12-31 05:03:23 +00:00
# Average (on|off)
print "<td valign=bottom>\n";
print "<font size=\"-1\">\n";
print "<A title=\"Moving average of last 10 points\">Average:</a>";
if($AVG) {
print "(<b>on</b>|";
2002-05-05 08:14:00 +00:00
print "<a href=\"query.cgi?tbox=$TBOX&testname=$TESTNAME&autoscale=$AUTOSCALE&size=$SIZE&days=$DAYS&units=$UNITS<ype=$LTYPE&points=$POINTS&showpoint=$SHOWPOINT&avg=0\">off</a>";
2001-12-31 05:03:23 +00:00
print ")\n";
} else {
print "(";
2002-05-05 08:14:00 +00:00
print "<a href=\"query.cgi?tbox=$TBOX&testname=$TESTNAME&autoscale=$AUTOSCALE&size=$SIZE&days=$DAYS&units=$UNITS<ype=$LTYPE&points=$POINTS&showpoint=$SHOWPOINT&avg=1\">on</a>";
2001-12-31 05:03:23 +00:00
print "|<b>off</b>)\n";
}
print "</font>\n";
print "</td>\n";
2001-12-13 04:53:03 +00:00
print "</tr>\n";
2001-12-31 05:03:23 +00:00
2001-12-13 04:53:03 +00:00
print "</table>\n";
2001-12-13 02:10:16 +00:00
print "<br>\n";
2001-12-13 05:35:12 +00:00
2001-12-31 05:03:23 +00:00
2001-12-07 10:02:32 +00:00
# graph
2002-05-05 08:14:00 +00:00
print "<img src=\"graph.cgi?tbox=$TBOX&testname=$TESTNAME&autoscale=$AUTOSCALE&size=$SIZE&days=$DAYS&units=$UNITS<ype=$LTYPE&points=$POINTS&showpoint=$SHOWPOINT&avg=$AVG\" alt=\"$TBOX $TESTNAME graph\">";
2001-12-13 04:53:03 +00:00
2001-12-13 05:35:12 +00:00
print "<br>\n";
print "<br>\n";
2001-12-16 00:06:51 +00:00
2004-10-26 23:04:41 +00:00
print "<table cellspacing=8 border=0>\n";
2001-12-16 00:06:51 +00:00
print "<tr>\n";
print "<td>\n";
2002-01-07 07:35:19 +00:00
#
# Links at the bottom
#
2001-12-13 05:35:12 +00:00
# Other machines
2001-12-13 05:37:23 +00:00
print "<font size=\"-1\">";
2001-12-13 05:35:12 +00:00
print "<li>\n";
2001-12-31 05:03:23 +00:00
print "<a href=\"query.cgi?tbox=&testname=$TESTNAME&autoscale=$AUTOSCALE&size=$SIZE&days=$DAYS&units=$UNITS<ype=$LTYPE&points=$POINTS&avg=$AVG\">Other machines running the $TESTNAME test</a>";
2001-12-13 05:35:12 +00:00
print "</li>\n";
2002-01-07 07:35:19 +00:00
# Other tests
2001-12-13 05:35:12 +00:00
print "<li>\n";
2002-01-06 20:13:05 +00:00
print "Other $TBOX tests: (<a href=\"query.cgi?tbox=$TBOX&testname=startup&autoscale=$AUTOSCALE&size=$SIZE&days=$DAYS&units=$UNITS<ype=$LTYPE&points=$POINTS&avg=$AVG\">startup</a>, <a href=\"query.cgi?tbox=$TBOX&testname=xulwinopen&autoscale=$AUTOSCALE&size=$SIZE&days=$DAYS&units=$UNITS<ype=$LTYPE&points=$POINTS&avg=$AVG\">xulwinopen</a>, <a href=\"query.cgi?tbox=$TBOX&testname=pageload&autoscale=$AUTOSCALE&size=$SIZE&days=$DAYS&units=$UNITS<ype=$LTYPE&points=$POINTS&avg=$AVG\">pageload</a>,
<a href=\"query.cgi?tbox=$TBOX&testname=&autoscale=$AUTOSCALE&size=$SIZE&days=$DAYS&units=$UNITS<ype=$LTYPE&points=$POINTS&avg=$AVG\">show all tests</a>)";
2001-12-13 05:35:12 +00:00
print "</li>\n";
2001-12-15 10:54:56 +00:00
2002-01-07 07:35:19 +00:00
# Multiplots, hard-coded for now.
2002-03-21 23:10:33 +00:00
# luna,sleestack,mecca,mocha
2002-01-07 07:35:19 +00:00
print "<li>\n";
2002-04-11 05:15:44 +00:00
print "Multiqueries: (<a href=\"multiquery.cgi?&testname=startup&tboxes=comet,luna,sleestack,mecca,facedown,openwound,rheeeet&days=$DAYS&autoscale=$AUTOSCALE&units=$UNITS<ype=$LTYPE&points=$POINTS&avg=$AVG\">startup</a>, <a href=\multiquery.cgi?&testname=xulwinopen&tboxes=comet,luna,sleestack,mecca,facedown,openwound,rheeeet&days=$DAYS&autoscale=$AUTOSCALE&units=$UNITS<ype=$LTYPE&points=$POINTS&avg=$AVG\">xulwinopen</a>, <a href=\"multiquery.cgi?&testname=pageload&tboxes=btek,luna,sleestack,mecca,mocha&days=$DAYS&autoscale=$AUTOSCALE&units=$UNITS<ype=$LTYPE&points=$POINTS&avg=$AVG\">pageload</a>, <a href=\"multiquery.cgi\">build your own multiquery</a>)";
2002-01-07 07:35:19 +00:00
print "</li>\n";
# Raw data.
2001-12-15 10:54:56 +00:00
print "<li>\n";
2001-12-18 07:52:18 +00:00
print "<a href=\"rawdata.cgi?tbox=$TBOX&testname=$TESTNAME&days=$DAYS\">Show the raw data for this plot</a>";
print "</li>\n";
2002-01-07 07:35:19 +00:00
# Mailto
2001-12-18 07:52:18 +00:00
print "<li>\n";
print "<a href=\"mailto:mozilla-performance\@mozilla.org?subject=Perf: $TBOX/$TESTNAME test regression\">Mail m.performance about regressions for this test</a>";
print "</li>\n";
2002-01-07 07:35:19 +00:00
# Newsgroup
2001-12-18 07:52:18 +00:00
print "<li>\n";
print "<a href=\"news://news.mozilla.org/netscape.public.mozilla.performance\">performance newsgroup</a>";
2001-12-15 10:54:56 +00:00
print "</li>\n";
2001-12-13 05:37:23 +00:00
print "</font>";
2001-12-13 05:35:12 +00:00
2001-12-16 00:06:51 +00:00
print "</td>\n";
print "<td>\n";
# Graph size
print "<td valign=\"top\">\n";
2001-12-31 05:03:23 +00:00
print "<form method=\"get\" action=\"query.cgi?tbox=$TBOX&testname=$TESTNAME&autoscale=$AUTOSCALE&days=$DAYS&units=$UNITS<ype=$LTYPE&points=$POINTS&avg=$AVG\">\n";
2001-12-16 00:06:51 +00:00
print "<font size=\"-1\">\n";
print "<input type=hidden name=\"tbox\" value=\"$TBOX\">";
print "<input type=hidden name=\"testname\" value=\"$TESTNAME\">";
print "<input type=hidden name=\"autoscale\" value=\"$AUTOSCALE\">";
print "<input type=hidden name=\"days\" value=\"$DAYS\">";
print "<input type=hidden name=\"units\" value=\"$UNITS\">";
print "<input type=hidden name=\"ltype\" value=\"$LTYPE\">";
print "<input type=hidden name=\"points\" value=\"$POINTS\">";
2002-05-05 08:14:00 +00:00
print "<input type=hidden name=\"showpoint\" value=\"$SHOWPOINT\">";
2002-01-28 06:51:22 +00:00
print "<input type=hidden name=\"avg\" value=\"$AVG\">";
2001-12-16 00:06:51 +00:00
print "Graph size:";
if($SIZE) {
print "<input type=text value=$SIZE name=\"size\" size=3 maxlength=10>\n";
} else {
print "<input type=text value=1.0 name=\"size\" size=3 maxlength=10>\n";
}
print "</font>\n";
print "</form>\n";
print "</td>\n";
print "</td>\n";
print "</tr>\n";
print "</table>\n";
2004-10-19 23:06:27 +00:00
print "</center>\n";
2001-12-13 05:35:12 +00:00
2001-12-13 04:53:03 +00:00
print "</body>\n";
2001-12-07 10:02:32 +00:00
}
2001-12-16 00:23:09 +00:00
# main
{
if(!$TESTNAME) {
2001-12-31 05:03:23 +00:00
print_testnames($TBOX, $AUTOSCALE, $DAYS, $UNITS, $LTYPE, $POINTS, $AVG);
2001-12-16 00:23:09 +00:00
} elsif(!$TBOX) {
2001-12-31 05:03:23 +00:00
print_machines($TESTNAME, $AUTOSCALE, $DAYS, $UNITS, $LTYPE, $POINTS, $AVG);
2001-12-16 00:23:09 +00:00
} else {
show_graph();
}
2001-12-07 10:02:32 +00:00
}
exit 0;