2001-12-07 13:02:32 +03:00
|
|
|
#!/usr/bin/perl
|
|
|
|
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'));
|
|
|
|
my $DAYS = lc($req->param('days'));
|
|
|
|
|
2001-12-13 07:53:03 +03:00
|
|
|
#
|
|
|
|
# Testing only:
|
|
|
|
#
|
|
|
|
#$TESTNAME = "testname";
|
|
|
|
#$UNITS = "units";
|
|
|
|
#$TBOX = "tbox";
|
|
|
|
#$AUTOSCALE = 1;
|
|
|
|
#$DAYS = 1;
|
|
|
|
|
|
|
|
|
2001-12-07 13:02:32 +03: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 {
|
|
|
|
my ($testname) = @_;
|
|
|
|
|
|
|
|
# HTTP header
|
|
|
|
print "Content-type: text/html\n\n<HTML>\n";
|
|
|
|
print "<title>testnames</title>";
|
|
|
|
print "<center><h2><b>testnames</b></h2></center>";
|
|
|
|
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";
|
|
|
|
|
|
|
|
my @machines = make_filenames_list("db");
|
|
|
|
my $machines_string = join(" ", @machines);
|
|
|
|
|
|
|
|
foreach (@machines) {
|
2001-12-07 14:43:41 +03:00
|
|
|
print "<li><a href=query.cgi?&testname=$_$testname>$_</a>\n";
|
2001-12-07 13:02:32 +03:00
|
|
|
}
|
|
|
|
print "</ul></td></tr></table></td></tr></table>";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# Print out a list of machines in db/<testname> directory, with links.
|
|
|
|
sub print_machines {
|
|
|
|
my ($testname) = @_;
|
|
|
|
|
|
|
|
# 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) {
|
2001-12-07 14:43:41 +03:00
|
|
|
print "<li><a href=query.cgi?tbox=$_&testname=$testname&autoscale=0&days=0>$_</a>\n";
|
2001-12-07 13:02:32 +03:00
|
|
|
}
|
|
|
|
print "</ul></td></tr></table></td></tr></table>";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
sub show_graph {
|
|
|
|
# HTTP header
|
|
|
|
print "Content-type: text/html\n\n<HTML>\n";
|
|
|
|
|
2001-12-07 14:31:10 +03:00
|
|
|
print "<title>$TBOX $TESTNAME</title><br>\n";
|
2001-12-07 13:02:32 +03:00
|
|
|
|
2001-12-13 07:53:03 +03:00
|
|
|
print "<body>\n";
|
|
|
|
|
|
|
|
print "<table>\n";
|
|
|
|
print "<tr>\n";
|
|
|
|
|
|
|
|
print "<td>\n";
|
|
|
|
# Scale Y-axis
|
2001-12-07 14:31:10 +03:00
|
|
|
my $neg_autoscale = !$AUTOSCALE;
|
2001-12-13 05:10:16 +03:00
|
|
|
if($AUTOSCALE) {
|
|
|
|
print "Y-axis: (<b>zoom</b>|";
|
|
|
|
print "<a href=\"query.cgi?tbox=$TBOX&testname=$TESTNAME&autoscale=$neg_autoscale&days=$DAYS&units=$UNITS\">100%</a>";
|
2001-12-13 07:53:03 +03:00
|
|
|
print ") \n";
|
2001-12-13 05:10:16 +03:00
|
|
|
} else {
|
|
|
|
print "Y-axis: (";
|
|
|
|
print "<a href=\"query.cgi?tbox=$TBOX&testname=$TESTNAME&autoscale=$neg_autoscale&days=$DAYS&units=$UNITS\">zoom</a>";
|
2001-12-13 07:53:03 +03:00
|
|
|
print "|<b>100%</b>) \n";
|
2001-12-13 05:10:16 +03:00
|
|
|
}
|
2001-12-13 07:53:03 +03:00
|
|
|
print "</td>\n";
|
|
|
|
|
|
|
|
print "<td>\n";
|
|
|
|
# Days, Time-axis
|
|
|
|
print "<form method=\"get\" action=\"query.cgi?tbox=$TBOX&testname=$TESTNAME&autoscale=$AUTOSCALE&units=$UNITS\">\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 "Days:";
|
|
|
|
if($DAYS) {
|
|
|
|
print "(<a href=\"query.cgi?tbox=$TBOX&testname=$TESTNAME&autoscale=$AUTOSCALE&days=0&units=$UNITS\">all data</a>|";
|
2001-12-13 07:58:55 +03:00
|
|
|
print "<input type=text value=$DAYS name=\"days\" size=3 maxlength=10>\n";
|
2001-12-13 07:53:03 +03:00
|
|
|
print ")";
|
|
|
|
} else {
|
|
|
|
print "(<b>all data</b>|";
|
2001-12-13 07:58:55 +03:00
|
|
|
print "<input type=text value=\"\" name=\"days\" size=3 maxlength=10>\n";
|
2001-12-13 07:53:03 +03:00
|
|
|
print ")";
|
|
|
|
}
|
|
|
|
print "</form>\n";
|
|
|
|
print "</td>\n";
|
|
|
|
|
|
|
|
print "</tr>\n";
|
|
|
|
print "</table>\n";
|
2001-12-07 13:02:32 +03:00
|
|
|
|
2001-12-13 05:10:16 +03:00
|
|
|
print "<br>\n";
|
|
|
|
|
2001-12-07 13:02:32 +03:00
|
|
|
# graph
|
2001-12-08 06:09:41 +03:00
|
|
|
print "<img src=\"graph.cgi?tbox=$TBOX&testname=$TESTNAME&autoscale=$AUTOSCALE&days=$DAYS&units=$UNITS\" alt=\"$TBOX $TESTNAME graph\">";
|
2001-12-13 07:53:03 +03:00
|
|
|
|
|
|
|
print "</body>\n";
|
2001-12-07 13:02:32 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if(!$TESTNAME) {
|
|
|
|
print_testnames();
|
|
|
|
} elsif(!$TBOX) {
|
|
|
|
print_machines($TESTNAME);
|
|
|
|
} else {
|
|
|
|
show_graph();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
exit 0;
|
|
|
|
|