stats: fix stats diff script

Previously the return value ignored missing/added stats,
making the regressions not tell you when you needed to
update the reference stats because of these changes.
Also stop filtering distributions when reporting these;
not sure why we did that in the first place.
Also get rid of obsolete hacks for the "fetch-loss" stats
that have been gone for a long time.
This commit is contained in:
Steve Reinhardt 2010-06-06 01:22:14 -04:00
parent d0af5e9df6
commit 30deac9050

View file

@ -36,7 +36,6 @@ use Getopt::Std;
# #
# -t thresh sets threshold for ignoring differences (in %) # -t thresh sets threshold for ignoring differences (in %)
# -p sorts differences by % chg (default is alphabetic) # -p sorts differences by % chg (default is alphabetic)
# -f ignores fetch-loss statistics
# -d ignores all distributions # -d ignores all distributions
# #
@ -46,7 +45,6 @@ if ($#ARGV < 1)
{ {
print "\nError: need two file arguments (<reference> <new>).\n"; print "\nError: need two file arguments (<reference> <new>).\n";
print " Options: -d = Ignore distributions\n"; print " Options: -d = Ignore distributions\n";
print " -f = Ignore fetch-loss stats\n";
print " -p = Sort errors by percentage\n"; print " -p = Sort errors by percentage\n";
print " -h = Diff header info separately from stats\n"; print " -h = Diff header info separately from stats\n";
print " -n <num> = Print top <num> errors (default 20)\n"; print " -n <num> = Print top <num> errors (default 20)\n";
@ -130,7 +128,6 @@ sub parse_file
while (<$stathandle>) while (<$stathandle>)
{ {
next if /^\s*$/; # skip blank lines next if /^\s*$/; # skip blank lines
next if /^\*\*Ignore/; # temporary, to make totaling scripts easy for ISCA 03
last if /End Simulation Statistics/; last if /End Simulation Statistics/;
s/ *#.*//; # strip comments s/ *#.*//; # strip comments
@ -140,39 +137,20 @@ sub parse_file
$value = $1; $value = $1;
} }
elsif ($in_dist) { elsif ($in_dist) {
if ($in_dist =~ /^fetch_loss_counters/) { if (/(.*)\.end_dist/) {
if (/^fetch_loss_counters_\d+\.end/) { # end line of distribution: clear $in_dist flag
# end line of distribution: clear $in_dist flag $in_dist = undef;
$in_dist = undef; next;
next;
}
else {
next if $opt_f;
($stat, $value) = /^(\S+)\s+(.*)/;
}
} }
else { if ($opt_d) {
if (/(.*)\.end_dist/) { next; # bail out if we are ignoring dists...
# end line of distribution: clear $in_dist flag } elsif (/(.*)\.(min|max)_value/) {
$in_dist = undef; # treat these like normal stats
next; ($stat, $value) = /^(\S+)\s+(.*)/;
} } else {
if ($opt_d) { ($stat, $value) =
next; # bail out if we are ignoring dists... /^(\S+(?:.*\S)?)\s+(\d+)\s+\d+\.\d+%/;
} $stat = $in_dist . '::' . $stat;
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;
}
} }
} }
else { else {
@ -183,12 +161,6 @@ sub parse_file
$stat = $1; $stat = $1;
$value = 0; $value = 0;
} }
elsif (/^(fetch_loss_counters_\d+)\.start/) {
# treat fetch loss counters like distribution, sort of
$in_dist = $1;
$stat = $1;
$value = 0;
}
else { else {
($stat, $value) = /^(\S+)\s+(.*)/; ($stat, $value) = /^(\S+)\s+(.*)/;
} }
@ -354,11 +326,8 @@ foreach $err (@errs)
} }
# #
# Report missing stats, but first filter out distribution buckets: # Report missing stats
# these are mostly noise #
@missing_stats = grep { !/::(\d+|overflows)?$/ } @missing_stats;
# get count # get count
$missing_stats = scalar(@missing_stats); $missing_stats = scalar(@missing_stats);
@ -379,10 +348,6 @@ if ($missing_stats)
@added_stats = keys %$newhash; @added_stats = keys %$newhash;
# first filter out distribution buckets: mostly noise
@added_stats = grep { !/::(\d+|overflows)?$/ } @added_stats;
# get count # get count
$added_stats = scalar(@added_stats); $added_stats = scalar(@added_stats);
@ -398,8 +363,8 @@ if ($added_stats)
} }
cleanup(); cleanup();
# Exit code is 0 if some stats found & no stats error, 1 otherwise # Exit code is 0 if all stats are found (with no extras) & no stats error, 1 otherwise
$status = ($#key_stats >= 0 && $max_err_mag == 0.0) ? 0 : 1; $status = ($missing_stats == 0 && $added_stats == 0 && $max_err_mag == 0.0) ? 0 : 1;
exit $status; exit $status;
sub cleanup sub cleanup