[llvm-commits] CVS: llvm/test/Programs/Makefile.TEST.dsgraph generate_report.pl
Chris Lattner
lattner at cs.uiuc.edu
Fri Jan 17 16:53:05 PST 2003
Changes in directory llvm/test/Programs:
Makefile.TEST.dsgraph updated: 1.3 -> 1.4
generate_report.pl updated: 1.3 -> 1.4
---
Log message:
Genericize reporting
---
Diffs of the changes:
Index: llvm/test/Programs/Makefile.TEST.dsgraph
diff -u llvm/test/Programs/Makefile.TEST.dsgraph:1.3 llvm/test/Programs/Makefile.TEST.dsgraph:1.4
--- llvm/test/Programs/Makefile.TEST.dsgraph:1.3 Fri Jan 17 16:16:41 2003
+++ llvm/test/Programs/Makefile.TEST.dsgraph Fri Jan 17 16:52:15 2003
@@ -27,28 +27,18 @@
ANALYZE_OPTS := -stats -time-passes -only-print-main-ds -dsstats -instcount
-$(PROGRAMS_TO_TEST:%=Output/%.report.txt): \
-Output/%.report.txt: Output/%.lib.bc $(LANALYZE)
+$(PROGRAMS_TO_TEST:%=Output/%.$(TEST).report.txt): \
+Output/%.$(TEST).report.txt: Output/%.lib.bc $(LANALYZE)
-(time -p $(LANALYZE) -$(PASS)datastructure $(ANALYZE_OPTS) $<)> $@ 2>&1
$(PROGRAMS_TO_TEST:%=test.$(TEST).%): \
-test.dsgraph.%: Output/%.report.txt
+test.dsgraph.%: Output/%.$(TEST).report.txt
@echo "---------------------------------------------------------------"
@echo ">>> ========= '$*' Program"
@echo "---------------------------------------------------------------"
@cat $<
+# Define REPORT_DEPENDENCIES so that the report is regenerated if analyze or
+# dummylib is updated.
#
-# Rules for building a report from 'make report TEST=dsgraph' at Programs level
-#
-
-report.raw.out: $(DUMMYLIB) $(LANALYZE)
- gmake TEST=$(TEST) 2>&1 | tee $@
-
-## FIXME: This should be genericized and put into Programs/Makefile as a nice
-## report target.
-report: report.raw.out
- ./generate_report.pl report.raw.out | tee report.txt
-
-clean::
- rm -f report.raw.out report.txt
\ No newline at end of file
+REPORT_DEPENDENCIES := $(DUMMYLIB) $(LANALYZE)
\ No newline at end of file
Index: llvm/test/Programs/generate_report.pl
diff -u llvm/test/Programs/generate_report.pl:1.3 llvm/test/Programs/generate_report.pl:1.4
--- llvm/test/Programs/generate_report.pl:1.3 Fri Jan 17 16:16:41 2003
+++ llvm/test/Programs/generate_report.pl Fri Jan 17 16:52:15 2003
@@ -1,43 +1,14 @@
#!/usr/dcs/software/supported/bin/perl -w
-# Default values for arguments
-$SHOW_TIMES = 1;
-
-# Parse arguments...
-while ($_ = $ARGV[0], /^[-+]/) {
- shift;
- last if /^--$/; # Stop processing arguments on --
-
- # List command line options here...
- if (/^-no-times$/) { $SHOW_TIMES = 0; next; }
-
- print "Unknown option: $_ : ignoring!\n";
-}
-
-my $InputFN = $ARGV[0];
-#print "Reading input from $InputFN\n";
-
-open(INPUT, $InputFN) or die "Couldn't open '$InputFN'!";
-
-# Read all input...
-my @Lines = <INPUT>;
-
-# Turn it into one big string...
-my $FILE = join "\n", @Lines;
-
-# Now split it up into records. Each benchmarks starts with a line with a >>>
-# prefix
-
-my @Records = split />>> ========= /, $FILE;
-
-# Delete the first "entry" which is really stuff printed prior to starting the
-# first test.
-shift @Records;
+#
+# Parameters which may be overriden by the report description file.
+#
# The column to sort by, to be overridden as neccesary by the report description
-my $SortCol = 2;
-my $SortReverse = 1;
+my $SortCol = 0;
+my $SortReverse = 0;
+# Helper functions which may be called by the report description files...
sub SumCols {
my ($Cols, $Col, $NumRows) = @_;
$Val = 0;
@@ -48,59 +19,36 @@
return $Val;
}
-sub Ratio {
- my ($Cols, $Col) = @_;
- if ($Cols->[$Col-2] ne "*" and
- $Cols->[$Col-2] != "0") {
- return $Cols->[$Col-1]/$Cols->[$Col-2];
- } else {
- return "n/a";
- }
-}
+# Check command line arguments...
+die "Must specify a report description option" if (scalar(@ARGV) < 1);
-my @Fields = (
-# Name
- ["Name:" , '\'([^\']+)\' Program'],
- [],
-# Times
- ["Anlyz:", '([0-9.]+) \([^)]+\)[ 0-9]+TOTAL'],
- ["LocTm:", '([0-9.]+) \([^)]+\)[ 0-9]+Local'],
- ["BUTim:", '([0-9.]+) \([^)]+\)[ 0-9]+Bottom'],
- ["TDTim:", '([0-9.]+) \([^)]+\)[ 0-9]+Top'],
- ["SumTm:", sub { return SumCols(@_, 3); }],
- [],
-# Sizes
- ["LocSize:", '([0-9]+) Local'],
- ["BUSize:" , '([0-9]+) Bottom-up'],
- ["TDSize:" , '([0-9]+) Top-down'],
- ["BU+TDSz:", sub { return SumCols(@_, 3); }],
- [],
-# Misc stuff
- ["NumFold" , '([0-9]+).*Number of folded nodes '],
- ["NumNodes", 'Graphs contain \\[([0-9+]+)\\] nodes total'],
- ["MaxSz" , '([0-9]+).*Maximum graph size'],
- ["GlobGr" , '\\.GlobalsGraph\\.dot\'... \\[([0-9+]+)\\]'],
- ["MaxSCC" , '([0-9]+).*Maximum SCC Size in Call Graph'],
- [],
- ["Loads" , '([0-9]+).*Number of Load insts'],
- ["Store" , '([0-9]+).*Number of Store insts'],
- ["Calls" , '([0-9]+).*Number of Call insts'],
- ["Allca" , '([0-9]+).*Number of Alloca insts'],
- ["Mallc" , '([0-9]+).*Number of Malloc insts'],
- [" Sum " , sub { return SumCols(@_, 5); }],
- #[" Sum " , sub { return $_[0]->[$_[1]-1]; }],
- [],
- ["num/ind" , '([0-9]+).*number of indirect call sites'],
- ["indcallee",'([0-9]+).*number of callee functions at'],
- ["ratio" , \&Ratio], # B / A if A != 0 else "n/a"
- []
- );
+# Read file input in one big gulp...
+undef $/;
+
+# Read raw data file and split it up into records. Each benchmarks starts with
+# a line with a >>> prefix
+#
+my @Records = split />>> ========= /, <STDIN>;
+
+# Delete the first "entry" which is really stuff printed prior to starting the
+# first test.
+shift @Records;
+
+# Read and eval the report description file now. This defines the Fields array
+# and may potentially modify some of our global settings like the sort key.
+#
+my $ReportFN = $ARGV[0];
+#print "Reading report description from $ReportFN\n";
+open(REPORTDESC, $ReportFN) or
+ die "Couldn't open report description '$ReportFN'!";
+
+my @Fields = eval <REPORTDESC>;
-my @Values;
#
# Read data into the table of values...
#
+my @Values;
foreach $Record (@Records) {
my @RowValues;
my $Col = 0;
More information about the llvm-commits
mailing list