Handle failed executions

This commit is contained in:
Diomidis Spinellis
2025-05-24 16:15:24 +03:00
parent b31d9d15db
commit a4cee5127d
2 changed files with 13 additions and 5 deletions
+5 -1
View File
@@ -17,7 +17,11 @@ paste -d , "$1" "$2" |
awk -F, 'FNR != 1 {
printf("%22s ", $3);
if ($4 / $12 > 1.1)
if (!$4)
printf("%12s encountered an error\n", $1);
else if (!$12)
printf("%12s encountered an error\n", $2);
else if ($4 / $12 > 1.1)
printf("%12s is %5.1f times faster than %s\n", $2, $4 / $12, $1);
else if ($12 / $4 > 1.1)
printf("%12s is %5.1f times faster than %s\n", $1, $12 / $4, $2);
+8 -4
View File
@@ -22,14 +22,18 @@ SCRIPTS=tests/fixtures/sed/script
# Run hyperfine with the specified name and command and collect the results.
bench_run()
{
hyperfine --command-name "$1" --warmup 2 --export-csv out.csv "$2"
# Append the results sans-heading
sed 1d out.csv >>"$OUT"
if hyperfine --command-name "$1" --warmup 2 --export-csv out.csv "$2" ; then
# Output the results sans-heading.
sed 1d out.csv >>"$OUT"
else
# Unable to run; output a named empty record.
echo "$1,,,,,,," >>"$OUT"
fi
rm out.csv
}
# Shared heading
echo 'command,mean,stddev,median,user,system,min,max' >"$OUT"
# Short line processing