[llvm-commits] CVS: llvm/utils/NLT.schema cgiplotNLT.pl webNLT.pl

Andrew Lenharth alenhar2 at cs.uiuc.edu
Fri May 20 10:33:53 PDT 2005



Changes in directory llvm/utils:

NLT.schema added (r1.1)
cgiplotNLT.pl added (r1.1)
webNLT.pl added (r1.1)
---
Log message:

OK, the simple scheme for the db plus a couple of cgi scripts that 
do the dynamic plotting of stuff.  Still being tested, but makes graphs



---
Diffs of the changes:  (+154 -0)

 NLT.schema    |    7 +++++
 cgiplotNLT.pl |   67 ++++++++++++++++++++++++++++++++++++++++++++++++
 webNLT.pl     |   80 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 154 insertions(+)


Index: llvm/utils/NLT.schema
diff -c /dev/null llvm/utils/NLT.schema:1.1
*** /dev/null	Fri May 20 12:33:52 2005
--- llvm/utils/NLT.schema	Fri May 20 12:33:42 2005
***************
*** 0 ****
--- 1,7 ----
+ CREATE TABLE `Tests` (
+   `NAME` varchar(255) NOT NULL default '',
+   `RUN` date NOT NULL default '0000-00-00',
+   `TEST` varchar(32) NOT NULL default '',
+   `VALUE` double NOT NULL default '0',
+   KEY `name_index` (`NAME`)
+ ) ENGINE=MyISAM DEFAULT CHARSET=latin1


Index: llvm/utils/cgiplotNLT.pl
diff -c /dev/null llvm/utils/cgiplotNLT.pl:1.1
*** /dev/null	Fri May 20 12:33:53 2005
--- llvm/utils/cgiplotNLT.pl	Fri May 20 12:33:42 2005
***************
*** 0 ****
--- 1,67 ----
+ #!/usr/bin/perl
+ #takes a test and a program from a dp and produces a gnuplot script
+ #use like perl plotNLT.pl password Programs/MultiSource/Benchmarks/ASCI_Purple/SMG2000/smg2000 llc
+ 
+ use CGI;
+ use DBI;
+ my $q = new CGI;
+ 
+ # database information
+ $db="llvmalpha";
+ $host="localhost";
+ $userid="llvmdbuser";
+ $passwd=$q->param('pwd');
+ $connectionInfo="dbi:mysql:$db;$host";
+ 
+ # make connection to database
+ $dbh = DBI->connect($connectionInfo,$userid,$passwd) or die DBI->errstr;
+ 
+ 
+ $count = 0;
+ while ($q->param('n' . $count))
+   {
+     $count++;
+   }
+ 
+ $| = 1;
+ print "Content-type: image/png", "\n\n";
+ 
+ open CMDSTREAM, "|gnuplot";
+ 
+ print CMDSTREAM "set terminal png\n";
+ print CMDSTREAM "set output\n";
+ print CMDSTREAM "set xdata time\n";
+ print CMDSTREAM 'set timefmt "%Y-%m-%d"';
+ print CMDSTREAM "\nplot";
+ for ($iter = 0; $iter < $count; $iter++) {
+   if ($iter)
+     { print CMDSTREAM ","; }
+   print CMDSTREAM " '-' using 1:2 with lines";
+ }
+ 
+ print CMDSTREAM "\n";
+ 
+ for ($iter = 0; $iter < $count; $iter++) {
+ 
+   $prog = $q->param('n' . $iter);
+   $test = $q->param('t' . $iter);
+ 
+   $query = "Select RUN, VALUE from Tests where TEST = '$test' AND NAME = '$prog' ORDER BY RUN";
+   #print "\n$query\n";
+   
+   my $sth = $dbh->prepare( $query) || die "Can't prepare statement: $DBI::errstr";;
+   
+   my $rc = $sth->execute or die DBI->errstr;
+   
+   while(($da,$v) = $sth->fetchrow_array)
+     {
+       print CMDSTREAM "$da $v\n";
+     }
+   
+   print CMDSTREAM "e\n";
+ }
+ print CMDSTREAM "exit\n";
+ close CMDSTREAM;
+ 
+ # disconnect from database
+ $dbh->disconnect;


Index: llvm/utils/webNLT.pl
diff -c /dev/null llvm/utils/webNLT.pl:1.1
*** /dev/null	Fri May 20 12:33:53 2005
--- llvm/utils/webNLT.pl	Fri May 20 12:33:42 2005
***************
*** 0 ****
--- 1,80 ----
+ #!/usr/bin/perl
+ 
+ use DBI;
+ use CGI;
+ 
+ $q = new CGI;
+ print $q->header();
+ print $q->start_html(-title=>"Nightly Tester DB");
+ 
+ unless($q->param('pwd'))
+   {
+     print $q->startform();
+     print $q->password_field(-name=>"pwd", -size=>20, -maxlength=>20);
+     print $q->submit();
+     print $q->endform();
+   }
+ else
+   {
+     # database information
+     $db="llvmalpha";
+     $host="localhost";
+     $userid="llvmdbuser";
+     $passwd=$q->param('pwd');
+     $connectionInfo="dbi:mysql:$db;$host";
+     
+     # make connection to database
+     $dbh = DBI->connect($connectionInfo,$userid,$passwd) or die DBI->errstr;
+     $query = "Select DISTINCT(NAME) from Tests";
+     my $sth = $dbh->prepare($query) || die "Can't prepare statement: $DBI::errstr";
+     my $rc = $sth->execute or die DBI->errstr;
+     while (($n) = $sth->fetchrow_array)
+       {
+         push @names, ($n);
+ #        print "$n<P>";
+       }
+     $query = "Select DISTINCT(TEST) from Tests";
+     my $sth = $dbh->prepare($query) || die "Can't prepare statement: $DBI::errstr";
+     my $rc = $sth->execute or die DBI->errstr;
+     while (($n) = $sth->fetchrow_array)
+       {
+         push @tests, ($n);
+ #        print "$n\n";
+       }
+ 
+ #    print join "<BR>", @names;
+ 
+     print $q->startform();
+     print $q->scrolling_list(-name=>"test", -values=>\@tests, -multiple=>'true');
+     print "<P>";
+     print $q->scrolling_list(-name=>"name", -values=>\@names, -multiple=>'true');
+     print "<P>";
+     print $q->submit();
+     print $q->hidden("pwd", $q->param('pwd'));
+     print $q->endform();
+ 
+     # disconnect from database
+     $dbh->disconnect;
+ 
+     #now generate the urls to the chart
+     if ($q->param('test') && $q->param('name'))
+       {
+         my @names = $q->param('name');
+         my @tests = $q->param('test');
+         $str = "pwd=" . $q->param('pwd');
+         $count = 0;
+         while (@names)
+           {
+             $n = pop @names;
+             while (@tests)
+               {
+                 $t = pop @tests;
+                 $str .= "&t$count=$t&n$count=$n";
+                 $count++;
+               }
+           }
+         print "<img src=\"cgiplotNLT.pl?$str\">";
+       }
+   }
+ 
+ print $q->end_html();






More information about the llvm-commits mailing list