[m-rev.] diff: speed_summary rewrite
Zoltan Somogyi
zs at cs.mu.OZ.AU
Wed Jan 9 18:11:04 AEDT 2002
tools/speed_summary:
Rewrite this script. The new version is better because:
- it works for test runs of programs other than the Mercury compiler;
- it prints the average after discarding the highest and lowest N
times, where N can now be 0, 1 or 2 (in the old version, it could
only be 0 or 1); and
- it has better structure than the old version.
The new version of the file:
#!/usr/bin/awk -f
NF == 8 {
variant = $1;
time = substr($2, 1, length($2) - 1);
# printf "read %s %9.2f\n", variant, time;
i = times_count[variant] + 0;
times[variant "@" i] = time;
times_count[variant]++;
texts[variant] = texts[variant] text;
text = "";
# printf "assigned %s %d %s %9.2f\n", \
# variant, i, variant "@" i, times[variant "@" i];
next;
}
{
text = text $0 "\n";
next;
}
END {
for (variant in times_count) {
count = times_count[variant];
# perform insertion sort on times[variant "@" *]
for (i = 1; i < count; i++) {
for (j = 0; j < i; j++) {
if (times[variant "@" j] > \
times[variant "@" i])
{
break;
}
}
insert = times[variant "@" i];
for (k = i - 1; k >= j; k--) {
times[variant "@" k+1] = \
times[variant "@" k];
}
times[variant "@" j] = insert;
}
# for (i = 0; i < count; i++) {
# printf "sorted %s %d %9.2f\n", \
# variant, i, times[variant "@" i];
# }
printf "%s", texts[variant];
for (ignore = 0; ignore <= 2 && ignore * 2 < count;
ignore++)
{
num = 0;
total = 0;
for (i = ignore; i < count - ignore; i++) {
num++;
total += times[variant "@" i];
}
printf "%s average of %d with ignore=%d %9.2f\n",
variant, count, ignore, total/num;
}
}
}
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list