Forgot to commit this file.
[llvm/msp430.git] / utils / plotNLT.pl
blob55d503d68933fad5d1c7e3c73c6d3528f5e102c1
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
5 use DBI;
7 # database information
8 $db="llvmalpha";
9 $host="localhost";
10 $userid="llvmdbuser";
11 $passwd=shift @ARGV;
12 $connectionInfo="dbi:mysql:$db;$host";
14 # make connection to database
15 $dbh = DBI->connect($connectionInfo,$userid,$passwd) or die DBI->errstr;
18 $count = @ARGV / 2;
20 print "set xdata time\n";
21 print 'set timefmt "%Y-%m-%d"';
22 print "\nplot";
23 for ($iter = 0; $iter < $count; $iter++) {
24 if ($iter)
25 { print ","; }
26 print " '-' using 1:2 with lines";
29 print "\n";
31 for ($iter = 0; $iter < $count; $iter++) {
33 $prog = shift @ARGV;
34 $test = shift @ARGV;
36 $query = "Select RUN, VALUE from Tests where TEST = '$test' AND NAME = '$prog' ORDER BY RUN";
37 #print "\n$query\n";
39 my $sth = $dbh->prepare( $query) || die "Can't prepare statement: $DBI::errstr";;
41 my $rc = $sth->execute or die DBI->errstr;
43 while(($da,$v) = $sth->fetchrow_array)
45 print "$da $v\n";
48 print "e\n";
52 # disconnect from database
53 $dbh->disconnect;