blob: 55d503d68933fad5d1c7e3c73c6d3528f5e102c1 [file] [log] [blame]
Andrew Lenharthe43b3fb2005-04-27 16:41:50 +00001#!/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
5use 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 Lenharthe3142be2005-04-27 17:32:41 +000017
18$count = @ARGV / 2;
Andrew Lenharthe43b3fb2005-04-27 16:41:50 +000019
20print "set xdata time\n";
21print 'set timefmt "%Y-%m-%d"';
Andrew Lenharthe3142be2005-04-27 17:32:41 +000022print "\nplot";
23for ($iter = 0; $iter < $count; $iter++) {
24 if ($iter)
25 { print ","; }
26 print " '-' using 1:2 with lines";
Andrew Lenharthe43b3fb2005-04-27 16:41:50 +000027}
28
Andrew Lenharthe3142be2005-04-27 17:32:41 +000029print "\n";
30
31for ($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 Lenharthe43b3fb2005-04-27 16:41:50 +000051
52# disconnect from database
53$dbh->disconnect;