[llvm-commits] CVS: llvm/test/Programs/GetTraceTime.pl
Brian Gaeke
gaeke at cs.uiuc.edu
Mon Jul 21 17:01:05 PDT 2003
Changes in directory llvm/test/Programs:
GetTraceTime.pl updated: 1.1 -> 1.2
---
Log message:
Take out the garbage, dead code, statements with no effect, etc.
Remove hardcoded .../ashukla/runs path.
Avoid division by zero in what appears to be a relatively common case. :-(
---
Diffs of the changes:
Index: llvm/test/Programs/GetTraceTime.pl
diff -u llvm/test/Programs/GetTraceTime.pl:1.1 llvm/test/Programs/GetTraceTime.pl:1.2
--- llvm/test/Programs/GetTraceTime.pl:1.1 Fri Jul 18 10:57:12 2003
+++ llvm/test/Programs/GetTraceTime.pl Mon Jul 21 17:00:30 2003
@@ -1,83 +1,44 @@
#!/usr/bin/perl
-$prog = $ARGV[0];
-$llc = $ARGV[1];
-$trace = $ARGV[2];
-open(LLC,"< $llc");
-open(TRACE, "< $trace");
+($prog, $llc, $trace, @rest) = @ARGV;
+$runs = $llc; $runs =~ s/llc/runs/;
-$time_t;
-$sys1;
-$cycles;
-$instrCnt;
+open LLC, $llc;
foreach $line (<LLC>){
if($line =~ /(user[\s]+)([0-9\.]+)/){
- # if($line =~ /([0-9\.]*)([\s]*[0-9]*[\s]*exit[\s]*)([0-9]*)([\s]+)([0-9]*)/){
- #$time_t = $1;
$time_t = $2;
- $cycles = $3;
- $instrCnt = $5;
- #print "Time: $time_t \tCycles: $cycles \tInstrCnt: $instrCnt\n";
- end;
- }
- if($line =~ /(user[\s]+)([0-9]*)(:)([0-9\.]+)/){
+ } elsif ($line =~ /(user[\s]+)([0-9]*)(:)([0-9\.]+)/){
$time_t = $2*60+$4;
- }
- if($line =~ /(sys[\s]+)([0-9\.]+)/){
+ } elsif($line =~ /(sys[\s]+)([0-9\.]+)/){
$sys1=$2;
- }
- if($line =~ /(sys[\s]+)([0-9]*)(:)([0-9\.]+)/){
+ } elsif($line =~ /(sys[\s]+)([0-9]*)(:)([0-9\.]+)/){
$sys1 = $2*60+$4;
}
-
-
}
+close LLC;
-$time_t2;
-$sys2;
-$cycles2;
-$instrCnt2;
+open TRACE, $trace;
foreach $line (<TRACE>){
-
if($line =~ /(user[\s]+)([0-9\.]+)/){
- #if($line =~ /([0-9\.]*)([\s]*[0-9]*[\s]*exit[\s]*)([0-9]*)([\s]+)([0-9]*)/){
- #$time_t2 = $1;
$time_t2 = $2;
- $cycles2 = $3;
- $instrCnt2 = $5;
- #print "Time: $time_t \tCycles: $cycles \tInstrCnt: $instrCnt\n";
- end;
- }
- if($line =~ /(user[\s]+)([0-9]*)(:)([0-9\.]+)/){
+ } elsif($line =~ /(user[\s]+)([0-9]*)(:)([0-9\.]+)/){
$time_t2 = $2*60+$4;
- }
-
- if($line =~ /(sys[\s]+)([0-9\.]+)/){
+ } elsif($line =~ /(sys[\s]+)([0-9\.]+)/){
$sys2=$2;
- }
- if($line =~ /(sys[\s]+)([0-9]*)(:)([0-9\.]+)/){
+ } elsif($line =~ /(sys[\s]+)([0-9]*)(:)([0-9\.]+)/){
$sys2 = $2*60+$4;
}
}
+close TRACE;
$time_t = $sys1+$time_t;
$time_t2 = $sys2 + $time_t2;
-open(OUTPUT, ">> /home/vadve/ashukla/runs");
-$dt = `date`;
-print OUTPUT $dt."\n";
-print $prog.":\n---------------------\n";
-printf ("%0.2f\t",(($time_t2/$time_t)*100));
-#printf ("instrCnt: %0.2f\t",(($instrCnt2/$instrCnt)*100));
-printf ("time: %0.2f\n---------------------\n",$time_t2);
-
-
-print OUTPUT $prog.":\n---------------------\n";
-printf OUTPUT "%0.2f\t", (($time_t2/$time_t)*100);
-#printf OUTPUT "instrCnt: %0.2f\t",(($instrCnt2/$instrCnt)*100);
-printf OUTPUT "time: %0.2f\n---------------------\n",$time_t2;
-close(LLC);
-close(TRACE);
-close(OUTPUT);
-
-
-
+$pct = "n/a";
+$pct = sprintf("%.2f", ($time_t2/$time_t)*100.0) if ($time_t != 0);
+$report = "$prog percentage: $pct; time: $time_t2\n";
+if (open(OUTPUT, ">>$runs")) {
+ print OUTPUT $report;
+ close OUTPUT;
+}
+print $report;
+exit 0;
More information about the llvm-commits
mailing list