tests,arch-alpha: Removing ALPHA ISA from testlib config
[gem5.git] / tests / diff-out
index 5ebe97dd78fb48a7dcc474ce5310b7112eac1704..6b0b23984402eb6ac160e1b365dd89d99ae8d8a4 100755 (executable)
@@ -24,8 +24,6 @@
 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-# Authors: Steve Reinhardt
 
 #
 # This script diffs two SimpleScalar statistics output files.
 
 use Getopt::Std;
 
-#
-# -t thresh sets threshold for ignoring differences (in %)
-# -p sorts differences by % chg (default is alphabetic)
-# -f ignores fetch-loss statistics
-# -d ignores all distributions
-#
-
-getopts('dfn:pt:h');
+getopts('adn:t:h');
 
 if ($#ARGV < 1)
 {
     print "\nError: need two file arguments (<reference> <new>).\n";
-    print "   Options: -d  =  Ignore distributions\n";
-    print "            -f  =  Ignore fetch-loss stats\n";
-    print "            -p  =  Sort errors by percentage\n";
-    print "            -h  =  Diff header info separately from stats\n";
-    print "            -n <num>  =  Print top <num> errors (default 20)\n";
-    print "            -t <num>  =  Error threshold in percent (default 1)\n\n";
-    die -1;
+    print "   Options: -d = Ignore distributions\n";
+    print "            -a = Sort errors alphabetically (default: by percentage)\n";
+    print "            -h = Diff header info separately from stats\n";
+    print "            -n <num> = Print top <num> errors (default 20, 0 for all)\n";
+    print "            -t <num> = Ignore errors below <num> percent (default 0)\n\n";
+    exit;
 }
 
 open(REF, "<$ARGV[0]") or die "Error: can't open $ARGV[0].\n";
@@ -63,10 +53,10 @@ open(NEW, "<$ARGV[1]") or die "Error: can't open $ARGV[1].\n";
 #
 
 # Ignorable error (in percent)
-$err_thresh = ($opt_t) ? $opt_t : 0;
+$err_thresh = defined($opt_t) ? $opt_t : 0;
 
 # Number of stats to print before omitting
-$omit_count = ($opt_n) ? $opt_n : 20;
+$omit_count = defined($opt_n) ? $opt_n : 20;
 
 
 #
@@ -130,7 +120,6 @@ sub parse_file
     while (<$stathandle>)
     {
        next if /^\s*$/;        # skip blank lines
-                next if /^\*\*Ignore/;   # temporary, to make totaling scripts easy for ISCA 03
        last if /End Simulation Statistics/;
 
        s/ *#.*//;              # strip comments
@@ -140,39 +129,20 @@ sub parse_file
            $value = $1;
        }
        elsif ($in_dist) {
-           if ($in_dist =~ /^fetch_loss_counters/) {
-               if (/^fetch_loss_counters_\d+\.end/) {
-                   # end line of distribution: clear $in_dist flag
-                   $in_dist = undef;
-                   next;
-               }
-               else {
-                   next if $opt_f;
-
-                   ($stat, $value) = /^(\S+)\s+(.*)/;
-               }
+           if (/(.*)\.end_dist/) {
+               # end line of distribution: clear $in_dist flag
+               $in_dist = undef;
+               next;
            }
-           else {
-               if (/(.*)\.end_dist/) {
-                   # end line of distribution: clear $in_dist flag
-                   $in_dist = undef;
-                   next;
-               }
-               if ($opt_d) {
-                   next;  #  bail out if we are ignoring dists...
-               }
-               elsif (/(.*)\.(min|max)_value/) {
-                   # treat these like normal stats
-                   ($stat, $value) = /^(\S+)\s+(.*)/;
-               }
-               else {
-                   # this is ugly because labels in the distribution
-                   # buckets don't start in column 0 and may include
-                   # embedded spaces
-                   ($stat, $value) =
-                     /^\s*(\S+(?:.*\S)?)\s+(\d+)\s+\d+\.\d+%/;
-                   $stat = $in_dist . '::' . $stat;
-               }
+           if ($opt_d) {
+               next;           #  bail out if we are ignoring dists...
+           } elsif (/(.*)\.(min|max)_value/) {
+               # treat these like normal stats
+               ($stat, $value) = /^(\S+)\s+(.*)/;
+           } else {
+               ($stat, $value) =
+                 /^(\S+(?:.*\S)?)\s+(\d+)\s+\d+\.\d+%/;
+               $stat = $in_dist . '::' . $stat;
            }
        }
        else {
@@ -183,12 +153,6 @@ sub parse_file
                $stat = $1;
                $value = 0;
            }
-           elsif (/^(fetch_loss_counters_\d+)\.start/) {
-               # treat fetch loss counters like distribution, sort of
-               $in_dist = $1;
-               $stat = $1;
-               $value = 0;
-           }
            else {
                ($stat, $value) = /^(\S+)\s+(.*)/;
            }
@@ -220,6 +184,7 @@ sub pct_diff
   'host_seconds' => 1,
   'host_tick_rate' => 1,
   'host_inst_rate' => 1,
+  'host_op_rate' => 1,
   'host_mem_usage' => 1
 );
 
@@ -228,12 +193,13 @@ sub pct_diff
 #  ==> list stats here WITHOUT trailing thread ID
 #
 @key_stat_list = (
-  'COM:IPC',
-  'ISSUE:MSIPC',
-  'COM:count',
-  'host_inst_rate',
+  'ipc',
+  'committedInsts',
+  'committedOps',
   'sim_insts',
+  'sim_ops',
   'sim_ticks',
+  'host_inst_rate',
   'host_mem_usage'
 );
 
@@ -319,16 +285,18 @@ foreach $key_stat (@key_stats)
           $newvalue - $refvalue, pct_diff($refvalue, $newvalue));
 }
 
-printf("\nLargest $omit_count relative errors (> %d%%):\n\n", $err_thresh);
-
-$num_errs = 0;
+printf("\nDifferences > %d%%:\n\n", $err_thresh);
 
-if ($opt_p)
-{
+if ($opt_a) {
+    # leave stats sorted alphabetically, doesn't make sense to cut them off
+    $omit_count = 0;
+} else {
     # sort differences by percent change
     @errs = sort { abs($$b[3]) <=> abs($$a[3]) } @errs;
 }
 
+$num_errs = 0;
+
 foreach $err (@errs)
 {
     ($statname, $refvalue, $newvalue, $reldiff) = @$err;
@@ -346,19 +314,16 @@ foreach $err (@errs)
           $statname, $refvalue, $newvalue, $newvalue - $refvalue, $reldiff);
 
     # only print top N errors
-    if (++$num_errs >= $omit_count)
+    if ($omit_count > 0 && ++$num_errs >= $omit_count)
     {
-       print "[... additional errors omitted ...]\n";
+       print "[... showing top $omit_count errors only, additional errors omitted ...]\n";
        last;
     }
 }
 
 #
-# Report missing stats, but first filter out distribution buckets:
-# these are mostly noise
-
-@missing_stats = grep { !/::(\d+|overflows)?$/ } @missing_stats;
-
+# Report missing stats
+#
 # get count
 $missing_stats = scalar(@missing_stats);
 
@@ -379,10 +344,6 @@ if ($missing_stats)
 
 @added_stats = keys %$newhash;
 
-# first filter out distribution buckets: mostly noise
-
-@added_stats = grep { !/::(\d+|overflows)?$/ } @added_stats;
-
 # get count
 $added_stats = scalar(@added_stats);
 
@@ -398,8 +359,12 @@ if ($added_stats)
 }
 
 cleanup();
-# Exit code is 0 if no stats error, 1 otherwise
-$status = ($max_err_mag == 0.0) ? 0 : 1;
+# Exit codes:
+# 0 if all stats are found (with no extras) & no stats error
+# 1 if there are additional stats, but no stat errors
+# 2 otherwise
+$no_hard_errors = $missing_stats == 0 && $max_err_mag == 0.0;
+$status = $no_hard_errors ? ($added_stats == 0 ? 0 : 1) : 2;
 exit $status;
 
 sub cleanup