2 #takes a test and a program from a dp and produces a gnuplot script
3 #use like perl plotNLT.pl password Programs/MultiSource/Benchmarks/ASCI_Purple/SMG2000/smg2000 llc
13 $passwd=$q->param('pwd');
14 $connectionInfo="dbi:mysql:$db;$host";
16 # make connection to database
17 $dbh = DBI->connect($connectionInfo,$userid,$passwd) or die DBI->errstr;
21 while ($q->param('n' . $count))
27 print "Content-type: image/png", "\n\n";
29 open CMDSTREAM, "|gnuplot";
31 print CMDSTREAM "set terminal png\n";
32 print CMDSTREAM "set output\n";
33 print CMDSTREAM "set xdata time\n";
34 print CMDSTREAM 'set timefmt "%Y-%m-%d"';
35 print CMDSTREAM "\nplot";
36 for ($iter = 0; $iter < $count; $iter++) {
38 { print CMDSTREAM ","; }
39 print CMDSTREAM " '-' using 1:2 with lines";
44 for ($iter = 0; $iter < $count; $iter++) {
46 $prog = $q->param('n' . $iter);
47 $test = $q->param('t' . $iter);
49 $query = "Select RUN, VALUE from Tests where TEST = '$test' AND NAME = '$prog' ORDER BY RUN";
52 my $sth = $dbh->prepare( $query) || die "Can't prepare statement: $DBI::errstr";;
54 my $rc = $sth->execute or die DBI->errstr;
56 while(($da,$v) = $sth->fetchrow_array)
58 print CMDSTREAM "$da $v\n";
61 print CMDSTREAM "e\n";
63 print CMDSTREAM "exit\n";
66 # disconnect from database