use Getopt::Std;
-#
-# -t thresh sets threshold for ignoring differences (in %)
-# -p sorts differences by % chg (default is alphabetic)
-# -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 " -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";
#
# 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;
#
'host_seconds' => 1,
'host_tick_rate' => 1,
'host_inst_rate' => 1,
+ 'host_op_rate' => 1,
'host_mem_usage' => 1
);
# ==> 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'
);
$newvalue - $refvalue, pct_diff($refvalue, $newvalue));
}
-printf("\nLargest $omit_count relative errors (> %d%%):\n\n", $err_thresh);
+printf("\nDifferences > %d%%:\n\n", $err_thresh);
-$num_errs = 0;
-
-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;
$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;
}
}
}
cleanup();
-# Exit code is 0 if all stats are found (with no extras) & no stats error, 1 otherwise
-$status = ($missing_stats == 0 && $added_stats == 0 && $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