mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-14 21:35:49 +00:00
Convert tools/speedtest to 4-space indentation.
And improve the format of its output a bit.
This commit is contained in:
@@ -1,4 +1,6 @@
|
|||||||
#!/usr/bin/awk -f
|
#!/usr/bin/awk -f
|
||||||
|
# vim: ts=4 sw=4 et
|
||||||
|
#
|
||||||
# This script is intended to summarize timing results such as those produced
|
# This script is intended to summarize timing results such as those produced
|
||||||
# by the speedtest script.
|
# by the speedtest script.
|
||||||
#
|
#
|
||||||
@@ -64,9 +66,7 @@ END {
|
|||||||
# perform insertion sort on times[variant "@" *]
|
# perform insertion sort on times[variant "@" *]
|
||||||
for (i = 1; i < count; i++) {
|
for (i = 1; i < count; i++) {
|
||||||
for (j = 0; j < i; j++) {
|
for (j = 0; j < i; j++) {
|
||||||
if (times[variant "@" j] > \
|
if (times[variant "@" j] > times[variant "@" i]) {
|
||||||
times[variant "@" i])
|
|
||||||
{
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -87,9 +87,7 @@ END {
|
|||||||
|
|
||||||
printf "%s", texts[variant];
|
printf "%s", texts[variant];
|
||||||
|
|
||||||
for (ignore = 1; ignore <= 1 && ignore * 2 < count;
|
for (ignore = 1; ignore <= 1 && ignore * 2 < count; ignore++) {
|
||||||
ignore++)
|
|
||||||
{
|
|
||||||
num = 0;
|
num = 0;
|
||||||
total = 0;
|
total = 0;
|
||||||
|
|
||||||
@@ -98,14 +96,13 @@ END {
|
|||||||
total += times[variant "@" i];
|
total += times[variant "@" i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
avg = total/num;
|
||||||
printf "%s average of %d with ignore=%d %9.2f",
|
printf "%s average of %d with ignore=%d %9.2f",
|
||||||
variant, count, ignore, total/num;
|
variant, count, ignore, avg
|
||||||
if (BASE + 0 != 0) {
|
if (BASE + 0 != 0) {
|
||||||
percent = (100 * total/num) / BASE;
|
percent = (100 * avg) / BASE;
|
||||||
printf " (%6.2f%%)", percent;
|
printf " (%6.2f%%)", percent;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf "\n"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
printf "\n";
|
printf "\n";
|
||||||
|
|||||||
Reference in New Issue
Block a user