| Andrew Lenharth | e43b3fb | 2005-04-27 16:41:50 +0000 | [diff] [blame] | 1 | #!/usr/bin/perl | 
 | 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 | 
 | 4 |  | 
 | 5 | use DBI; | 
 | 6 |  | 
 | 7 | # database information | 
 | 8 | $db="llvmalpha"; | 
 | 9 | $host="localhost"; | 
 | 10 | $userid="llvmdbuser"; | 
 | 11 | $passwd=shift @ARGV; | 
 | 12 | $connectionInfo="dbi:mysql:$db;$host"; | 
 | 13 |  | 
 | 14 | # make connection to database | 
 | 15 | $dbh = DBI->connect($connectionInfo,$userid,$passwd) or die DBI->errstr; | 
 | 16 |  | 
| Andrew Lenharth | e3142be | 2005-04-27 17:32:41 +0000 | [diff] [blame] | 17 |  | 
 | 18 | $count = @ARGV / 2; | 
| Andrew Lenharth | e43b3fb | 2005-04-27 16:41:50 +0000 | [diff] [blame] | 19 |  | 
 | 20 | print "set xdata time\n"; | 
 | 21 | print 'set timefmt "%Y-%m-%d"'; | 
| Andrew Lenharth | e3142be | 2005-04-27 17:32:41 +0000 | [diff] [blame] | 22 | print "\nplot"; | 
 | 23 | for ($iter = 0; $iter < $count; $iter++) { | 
 | 24 |   if ($iter) | 
 | 25 |     { print ","; } | 
 | 26 |   print " '-' using 1:2 with lines"; | 
| Andrew Lenharth | e43b3fb | 2005-04-27 16:41:50 +0000 | [diff] [blame] | 27 | } | 
 | 28 |  | 
| Andrew Lenharth | e3142be | 2005-04-27 17:32:41 +0000 | [diff] [blame] | 29 | print "\n"; | 
 | 30 |  | 
 | 31 | for ($iter = 0; $iter < $count; $iter++) { | 
 | 32 |  | 
 | 33 |   $prog = shift @ARGV; | 
 | 34 |   $test = shift @ARGV; | 
 | 35 |  | 
 | 36 |   $query = "Select RUN, VALUE from Tests where TEST = '$test' AND NAME = '$prog' ORDER BY RUN"; | 
 | 37 |   #print "\n$query\n"; | 
 | 38 |    | 
 | 39 |   my $sth = $dbh->prepare( $query) || die "Can't prepare statement: $DBI::errstr";; | 
 | 40 |    | 
 | 41 |   my $rc = $sth->execute or die DBI->errstr; | 
 | 42 |    | 
 | 43 |   while(($da,$v) = $sth->fetchrow_array) | 
 | 44 |     { | 
 | 45 |       print "$da $v\n"; | 
 | 46 |     } | 
 | 47 |    | 
 | 48 |   print "e\n"; | 
 | 49 | } | 
 | 50 |  | 
| Andrew Lenharth | e43b3fb | 2005-04-27 16:41:50 +0000 | [diff] [blame] | 51 |  | 
 | 52 | # disconnect from database | 
 | 53 | $dbh->disconnect; |