aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--utils/Makefile2
-rwxr-xr-xutils/RegressionFinder.pl186
-rwxr-xr-xutils/userloc.pl216
3 files changed, 1 insertions, 403 deletions
diff --git a/utils/Makefile b/utils/Makefile
index 4f15ba3..1a4dcca 100644
--- a/utils/Makefile
+++ b/utils/Makefile
@@ -16,7 +16,7 @@ EXTRA_DIST := cgiplotNLT.pl check-each-file codegen-diff countloc.sh \
getsrcs.sh importNLT.pl llvmdo llvmgrep llvm-native-gcc \
llvm-native-gxx makellvm NightlyTest.gnuplot NightlyTest.pl \
NightlyTestTemplate.html NLT.schema OldenDataRecover.pl \
- parseNLT.pl plotNLT.pl profile.pl RegressionFinder.pl userloc.pl \
+ parseNLT.pl plotNLT.pl profile.pl \
webNLT.pl vim
include $(LEVEL)/Makefile.common
diff --git a/utils/RegressionFinder.pl b/utils/RegressionFinder.pl
deleted file mode 100755
index 86b0777..0000000
--- a/utils/RegressionFinder.pl
+++ /dev/null
@@ -1,186 +0,0 @@
-#! /usr/bin/perl
-# Script to find regressions by binary-searching a time interval in the
-# CVS tree. Written by Brian Gaeke on 2-Mar-2004.
-#
-
-require 5.6.0; # NOTE: This script not tested with earlier versions.
-use Getopt::Std;
-use POSIX;
-use Time::Local;
-use IO::Handle;
-
-sub usage {
- print STDERR <<END;
-findRegression [-I] -w WTIME -d DTIME -t TOOLS -c SCRIPT
-
-The -w, -d, -t, and -c options are required.
-Run findRegression in the top level of an LLVM tree.
-WTIME is a time when you are sure the regression does NOT exist ("Works").
-DTIME is a time when you are sure the regression DOES exist ("Doesntwork").
-WTIME and DTIME are both in the format: "YYYY/MM/DD HH:MM".
--I means run builds at WTIME and DTIME first to make sure.
-TOOLS is a comma separated list of tools to rebuild before running SCRIPT.
-SCRIPT exits 1 if the regression is present in TOOLS; 0 otherwise.
-END
- exit 1;
-}
-
-sub timeAsSeconds {
- my ($timestr) = @_;
-
- if ( $timestr =~ /(\d\d\d\d)\/(\d\d)\/(\d\d) (\d\d):(\d\d)/ ) {
- my ( $year, $mon, $mday, $hour, $min ) = ( $1, $2, $3, $4, $5 );
- return timegm( 0, $min, $hour, $mday, $mon - 1, $year );
- }
- else {
- die "** Can't parse date + time: $timestr\n";
- }
-}
-
-sub timeAsString {
- my ($secs) = @_;
- return strftime( "%Y/%m/%d %H:%M", gmtime($secs) );
-}
-
-sub run {
- my ($cmdline) = @_;
- print LOG "** Running: $cmdline\n";
- return system($cmdline);
-}
-
-sub buildLibrariesAndTools {
- run("sh /home/vadve/gaeke/scripts/run-configure");
- run("$MAKE -C lib/Support");
- run("$MAKE -C utils");
- run("$MAKE -C lib");
- foreach my $tool (@TOOLS) { run("$MAKE -C tools/$tool"); }
-}
-
-sub contains {
- my ( $file, $regex ) = @_;
- local (*FILE);
- open( FILE, "<$file" ) or die "** can't read $file: $!\n";
- while (<FILE>) {
- if (/$regex/) {
- close FILE;
- return 1;
- }
- }
- close FILE;
- return 0;
-}
-
-sub updateSources {
- my ($time) = @_;
- my $inst = "include/llvm/Instruction.h";
- unlink($inst);
- run( "cvs update -D'" . timeAsString($time) . "'" );
- if ( !contains( $inst, 'class Instruction.*Annotable' ) ) {
- run("patch -F100 -p0 < makeInstructionAnnotable.patch");
- }
-}
-
-sub regressionPresentAt {
- my ($time) = @_;
-
- updateSources($time);
- buildLibrariesAndTools();
- my $rc = run($SCRIPT);
- if ($rc) {
- print LOG "** Found that regression was PRESENT at "
- . timeAsString($time) . "\n";
- return 1;
- }
- else {
- print LOG "** Found that regression was ABSENT at "
- . timeAsString($time) . "\n";
- return 0;
- }
-}
-
-sub regressionAbsentAt {
- my ($time) = @_;
- return !regressionPresentAt($time);
-}
-
-sub closeTo {
- my ( $time1, $time2 ) = @_;
- return abs( $time1 - $time2 ) < 600; # 10 minutes seems reasonable.
-}
-
-sub halfWayPoint {
- my ( $time1, $time2 ) = @_;
- my $halfSpan = int( abs( $time1 - $time2 ) / 2 );
- if ( $time1 < $time2 ) {
- return $time1 + $halfSpan;
- }
- else {
- return $time2 + $halfSpan;
- }
-}
-
-sub checkBoundaryConditions {
- print LOG "** Checking for presence of regression at ", timeAsString($DTIME),
- "\n";
- if ( !regressionPresentAt($DTIME) ) {
- die ( "** Can't help you; $SCRIPT says regression absent at dtime: "
- . timeAsString($DTIME)
- . "\n" );
- }
- print LOG "** Checking for absence of regression at ", timeAsString($WTIME),
- "\n";
- if ( !regressionAbsentAt($WTIME) ) {
- die ( "** Can't help you; $SCRIPT says regression present at wtime: "
- . timeAsString($WTIME)
- . "\n" );
- }
-}
-
-##############################################################################
-
-# Set up log files
-open (STDERR, ">&STDOUT") || die "** Can't redirect std.err: $!\n";
-autoflush STDOUT 1;
-autoflush STDERR 1;
-open (LOG, ">RegFinder.log") || die "** can't write RegFinder.log: $!\n";
-autoflush LOG 1;
-# Check command line arguments and environment variables
-getopts('Iw:d:t:c:');
-if ( !( $opt_w && $opt_d && $opt_t && $opt_c ) ) {
- usage;
-}
-$MAKE = $ENV{'MAKE'};
-$MAKE = 'gmake' unless $MAKE;
-$WTIME = timeAsSeconds($opt_w);
-print LOG "** Assuming worked at ", timeAsString($WTIME), "\n";
-$DTIME = timeAsSeconds($opt_d);
-print LOG "** Assuming didn't work at ", timeAsString($DTIME), "\n";
-$opt_t =~ s/\s*//g;
-$SCRIPT = $opt_c;
-die "** $SCRIPT is not executable or not found\n" unless -x $SCRIPT;
-print LOG "** Checking for the regression using $SCRIPT\n";
-@TOOLS = split ( /,/, $opt_t );
-print LOG (
- "** Going to rebuild: ",
- ( join ", ", @TOOLS ),
- " before each $SCRIPT run\n"
-);
-if ($opt_I) { checkBoundaryConditions(); }
-# do the dirty work:
-while ( !closeTo( $DTIME, $WTIME ) ) {
- my $halfPt = halfWayPoint( $DTIME, $WTIME );
- print LOG "** Checking whether regression is present at ",
- timeAsString($halfPt), "\n";
- if ( regressionPresentAt($halfPt) ) {
- $DTIME = $halfPt;
- }
- else {
- $WTIME = $halfPt;
- }
-}
-# Tell them what we found
-print LOG "** Narrowed it down to:\n";
-print LOG "** Worked at: ", timeAsString($WTIME), "\n";
-print LOG "** Did not work at: ", timeAsString($DTIME), "\n";
-close LOG;
-exit 0;
diff --git a/utils/userloc.pl b/utils/userloc.pl
deleted file mode 100755
index 4da2f40..0000000
--- a/utils/userloc.pl
+++ /dev/null
@@ -1,216 +0,0 @@
-#!/usr/bin/perl -w
-#
-# Program: userloc.pl
-#
-# Synopsis: This program uses "cvs annotate" to get a summary of how many lines
-# of code the various developres are responsible for. It takes one
-# argument, the directory to process. If the argument is not specified
-# then the cwd is used. The directory must be an LLVM tree checked out
-# from cvs.
-#
-# Syntax: userloc.pl [-tag=tag|-html... <directory>...
-#
-# Options:
-# -tag=tag
-# Use "tag" to select the revision (as per cvs -r option)
-# -filedetails
-# Report details about lines of code in each file for each user
-# -html
-# Generate HTML output instead of text output
-# -topdir
-# Specify where the top llvm source directory is. Otherwise the
-# llvm-config tool is used to find it.
-# Directories:
-# The directories passed after the options should be relative paths to
-# directories of interest from the top of the llvm source tree, e.g. "lib"
-# or "include", etc.
-
-die "Usage userloc.pl [-tag=tag|-html] <directories>..."
- if ($#ARGV < 0);
-
-my $tag = "";
-my $html = 0;
-my $debug = 0;
-my $filedetails = "";
-my $srcroot = "";
-while ( defined($ARGV[0]) && substr($ARGV[0],0,1) eq '-' )
-{
- if ($ARGV[0] =~ /-tag=.*/) {
- $tag = $ARGV[0];
- $tag =~ s#-tag=(.*)#$1#;
- } elsif ($ARGV[0] =~ /-filedetails/) {
- $filedetails = 1;
- } elsif ($ARGV[0] eq "-html") {
- $html = 1;
- } elsif ($ARGV[0] eq "-debug") {
- $debug = 1;
- } elsif ($ARGV[0] eq "-topdir") {
- shift; $srcroot = $ARGV[0]; shift;
- } else {
- die "Invalid option: $ARGV[0]";
- }
- shift;
-}
-
-if (length($srcroot) == 0) {
- chomp($srcroot = `llvm-config --src-root`);
-}
-if (! -d "$srcroot") {
- die "Invalid source root: $srcroot\n";
-}
-chdir($srcroot);
-my $llvmdo = "$srcroot/utils/llvmdo -topdir '$srcroot'";
-my %Stats;
-my %FileStats;
-
-my $annotate = "cvs -z6 annotate -lf ";
-if (length($tag) > 0)
-{
- $annotate = $annotate . " -r" . $tag;
-}
-
-sub GetCVSFiles
-{
- my $d = $_[0];
- my $files ="";
- open FILELIST,
- "$llvmdo -dirs \"$d\" -code-only echo |" || die "Can't get list of files with llvmdo";
- while ( defined($line = <FILELIST>) ) {
- chomp($file = $line);
- print "File: $file\n" if ($debug);
- $files = "$files $file";
- }
- return $files;
-}
-
-sub ScanDir
-{
- my $Dir = $_[0];
- my $files = GetCVSFiles($Dir);
-
- open (DATA,"$annotate $files 2>&1 |")
- || die "Can't read cvs annotation data";
-
- my $curfile = "";
- while ( defined($line = <DATA>) )
- {
- chomp($line);
- if ($line =~ '^Annotations for.*') {
- $curfile = $line;
- $curfile =~ s#^Annotations for ([[:print:]]*)#$1#;
- print "Scanning: $curfile\n" if ($debug);
- } elsif ($line =~ /^[0-9.]*[ \t]*\([^)]*\):/) {
- $uname = $line;
- $uname =~ s#^[0-9.]*[ \t]*\(([a-zA-Z0-9_.-]*) [^)]*\):.*#$1#;
- $Stats{$uname}++;
- if ($filedetails) {
- $FileStats{$uname} = {} unless exists $FileStats{$uname};
- ${$FileStats{$uname}}{$curfile}++;
- }
- }
- }
- close DATA;
-}
-
-sub printStats
-{
- my $dir = $_[0];
- my $hash = $_[1];
- my $user;
- my $total = 0;
-
- foreach $user (keys %Stats) { $total += $Stats{$user}; }
-
- if ($html) {
- print "<p>Total Source Lines: $total<br/></p>\n";
- print "<table>";
- print " <tr><th style=\"text-align:right\">LOC</th>\n";
- print " <th style=\"text-align:right\">\%LOC</th>\n";
- print " <th style=\"text-align:left\">User</th>\n";
- print "</tr>\n";
- }
-
- foreach $user ( sort keys %Stats )
- {
- my $v = $Stats{$user};
- if (defined($v))
- {
- if ($html) {
- printf "<tr><td style=\"text-align:right\">%d</td><td style=\"text-align:right\">(%4.1f%%)</td><td style=\"text-align:left\">", $v, (100.0/$total)*$v;
- if ($filedetails) {
- print "<a href=\"#$user\">$user</a></td></tr>";
- } else {
- print $user,"</td></tr>";
- }
- } else {
- printf "%8d (%4.1f%%) %s\n", $v, (100.0/$total)*$v, $user;
- }
- }
- }
- print "</table>\n" if ($html);
-
- if ($filedetails) {
- foreach $user (sort keys %FileStats) {
- my $total = 0;
- foreach $file (sort keys %{$FileStats{$user}}) {
- $total += ${$FileStats{$user}}{$file}
- }
- if ($html) {
- print "<table><tr><th style=\"text-align:left\" colspan=\"3\"><a name=\"$user\">$user</a></th></tr>\n";
- } else {
- print $user,":\n";
- }
- foreach $file (sort keys %{$FileStats{$user}}) {
- my $v = ${$FileStats{$user}}{$file};
- if ($html) {
- printf "<tr><td style=\"text-align:right\">&nbsp;&nbsp;%d</td><td
- style=\"text-align:right\">&nbsp;%4.1f%%</td><td
- style=\"text-align:left\">%s</td></tr>",$v, (100.0/$total)*$v,$file;
- } else {
- printf "%8d (%4.1f%%) %s\n", $v, (100.0/$total)*$v, $file;
- }
- }
- if ($html) { print "</table>\n"; }
- }
- }
-}
-
-
-if ($html)
-{
-print "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">\n";
-print "<html>\n<head>\n";
-print " <title>LLVM LOC Based On CVS Annotation</title>\n";
-print " <link rel=\"stylesheet\" href=\"llvm.css\" type=\"text/css\"/>\n";
-print "</head>\n";
-print "<body><div class=\"doc_title\">LLVM LOC Based On CVS Annotation</div>\n";
-print "<p>This document shows the total lines of code per user in each\n";
-print "LLVM directory. Lines of code are attributed by the user that last\n";
-print "committed the line. This does not necessarily reflect authorship.</p>\n";
-}
-
-my @DIRS;
-if ($#ARGV > 0) {
- @DIRS = @ARGV;
-} else {
- push @DIRS, 'include';
- push @DIRS, 'lib';
- push @DIRS, 'tools';
- push @DIRS, 'runtime';
- push @DIRS, 'docs';
- push @DIRS, 'test';
- push @DIRS, 'utils';
- push @DIRS, 'examples';
- push @DIRS, 'projects/Stacker';
- push @DIRS, 'projects/sample';
- push @DIRS, 'autoconf';
-}
-
-for $Index ( 0 .. $#DIRS) {
- print "Scanning Dir: $DIRS[$Index]\n" if ($debug);
- ScanDir($DIRS[$Index]);
-}
-
-printStats;
-
-print "</body></html>\n" if ($html) ;