From 9232eb69d4034bbe4fcdf81f0ea4ad28d4376623 Mon Sep 17 00:00:00 2001 From: Alexander Barton Date: Tue, 12 Apr 2022 10:54:25 +0200 Subject: [PATCH] Initial commit This code dates back to Sep 28 2017 but was never committed to Git! Oops! --- 7zip-bench.sh | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100755 7zip-bench.sh diff --git a/7zip-bench.sh b/7zip-bench.sh new file mode 100755 index 0000000..e52bcff --- /dev/null +++ b/7zip-bench.sh @@ -0,0 +1,72 @@ +#!/bin/sh + +# Intro ... +echo "This script tries to benchmark your machine using 7-zip, by calling" +echo "the \"7za b\" command. See for" +echo "existing results. It generates an \"result file\" that is suitable" +echo "for submission to the site mentioned above, but you have to do this" +echo "on your own, there is NO automatic submission." +echo +echo "Please make sure that your machine is \"mostly idle\"!" +echo "All commands run will be shown below." +echo + +# Check prerequisites +if ! command -v "7za" >/dev/null 2>&1; then + echo "Command \"$1\" not found - please install 7-Zip first!" >&2 + exit 1 +fi + +# Check & create "result file" ... +RESULT_FILE="$(uname -n)-7zip-bench.txt" +if [ -e "$RESULT_FILE" ]; then + echo "Result file \"$RESULT_FILE\" already exists. Aborting!" >&2 + exit 1 +fi + +# Confirmation ... +echo "Ready to go? Hit CTRL-C if not!" +for i in 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1; do + printf "\033[2K\r(%s)" "$i" + sleep 1 +done +printf "\033[2K\n" + +echo "------------------------------------------------------------------------------" >"$RESULT_FILE" +set -ex + +{ + uname -a + 7za b + echo + case "$(uname)" in + "Darwin") + sysctl hw.model hw.memsize hw.machine hw.ncpu machdep.cpu.brand_string + sw_vers + ;; + "Linux") + free + cat /proc/cpuinfo + ;; + esac +} >>"$RESULT_FILE" + +set +x +echo "------------------------------------------------------------------------------" >>"$RESULT_FILE" +echo + +echo "Results are:" +less "$RESULT_FILE" + +echo +echo "Please send the results stored in \"$RESULT_FILE\"" +echo "to Goetz Hoffart for inclusion on ." +echo +if command -v "sendfile" >/dev/null 2>&1; then + echo "For example by running this command:" + echo; echo " sendfile \"$RESULT_FILE\" goetz@s1.hoffart.de"; echo +fi +echo "You can send it via email to:" +echo; echo " bench@hoffart.de"; echo +echo "Thanks a lot!" +exit 0 -- 2.39.2