#!/usr/bin/perl # -*- Mode: perl; indent-tabs-mode: nil -*- 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 $SIZE = lc($req->param('size')); my $DAYS = lc($req->param('days')); my $LTYPE = lc($req->param('ltype')); my $POINTS = lc($req->param('points')); my $AVG = lc($req->param('avg')); # Testing only: # #$TESTNAME = "testname"; #$UNITS = "units"; #$TBOX = "tbox"; #$AUTOSCALE = 1; #$DAYS = 1; 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 ($tbox, $autoscale, $days, $units, $ltype, $points, $avg) = @_; # HTTP header print "Content-type: text/html\n\n\n"; print "testnames"; print "

testnames

"; print "

"; print ""; print "
Select one of the following tests:
\n"; print "
    \n"; my @machines = make_filenames_list("db"); my $machines_string = join(" ", @machines); foreach (@machines) { print "
  • $_\n"; } print "
"; } # Print out a list of machines in db/ directory, with links. sub print_machines { my ($testname, $autoscale, $days, $units, $ltype, $points, $avg) = @_; # HTTP header print "Content-type: text/html\n\n\n"; print "$TESTNAME machines"; print "

$TESTNAME machines:

"; print "

"; print ""; print "
Select one of the following machines:
\n"; print "
    \n"; my @machines = make_filenames_list("db/$testname"); my $machines_string = join(" ", @machines); foreach (@machines) { print "
  • $_\n"; } print "
"; } sub show_graph { # HTTP header print "Content-type: text/html\n\n\n"; print "$TBOX $TESTNAME
\n"; print "\n"; # JS refresh every 30min print "\n"; print "\n"; print "\n"; # Scale Y-axis print "\n"; # Days, Time-axis print "\n"; # Line style (lines|steps) print "\n"; # Points (on|off) print "\n"; # Average (on|off) print "\n"; print "\n"; print "
\n"; print "\n"; if($AUTOSCALE) { print "Y-axis: (zoom|"; print "100%"; print ") \n"; } else { print "Y-axis: ("; print "zoom"; print "|100%) \n"; } print "\n"; print "\n"; print "
\n"; print "\n"; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print "Days:"; if($DAYS) { print "(all data|"; print ""; print ")\n"; } else { print "(all data|"; print ""; print ")\n"; } print "\n"; print "
\n"; print "
\n"; print "\n"; print "Style:"; if($LTYPE eq "steps") { print "("; print "lines"; print "|steps"; print ")"; } else { print "(lines|"; print "steps"; print ")"; } print "\n"; print "\n"; print "\n"; print "Points:"; if($POINTS) { print "(on|"; print "off"; print ")\n"; } else { print "("; print "on"; print "|off)\n"; } print "\n"; print "\n"; print "\n"; print "Average:"; if($AVG) { print "(on|"; print "off"; print ")\n"; } else { print "("; print "on"; print "|off)\n"; } print "\n"; print "
\n"; print "
\n"; # graph print "\"$TBOX"; print "
\n"; print "
\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
\n"; # # Links at the bottom # # Other machines print ""; print "
  • \n"; print "Other machines running the $TESTNAME test"; print "
  • \n"; # Other tests print "
  • \n"; print "Other $TBOX tests: (startup, xulwinopen, pageload, show all tests)"; print "
  • \n"; # Multiplots, hard-coded for now. print "
  • \n"; print "Multiqueries: (startup, xulwinopen, pageload, build your own multiquery)"; print "
  • \n"; # Raw data. print "
  • \n"; print "Show the raw data for this plot"; print "
  • \n"; # Mailto print "
  • \n"; print "Mail m.performance about regressions for this test"; print "
  • \n"; # Newsgroup print "
  • \n"; print "performance newsgroup"; print "
  • \n"; print "
    "; print "
    \n"; # Graph size print "\n"; print "
    \n"; print "\n"; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print "Graph size:"; if($SIZE) { print "\n"; } else { print "\n"; } print "\n"; print "
    \n"; print "
    \n"; print "\n"; } # main { if(!$TESTNAME) { print_testnames($TBOX, $AUTOSCALE, $DAYS, $UNITS, $LTYPE, $POINTS, $AVG); } elsif(!$TBOX) { print_machines($TESTNAME, $AUTOSCALE, $DAYS, $UNITS, $LTYPE, $POINTS, $AVG); } else { show_graph(); } } exit 0;