]> arthur.barton.de Git - 7zip-bench.git/commitdiff
Initial commit
authorAlexander Barton <alex@barton.de>
Tue, 12 Apr 2022 08:54:25 +0000 (10:54 +0200)
committerAlexander Barton <alex@barton.de>
Tue, 12 Apr 2022 08:54:25 +0000 (10:54 +0200)
This code dates back to Sep 28 2017 but was never committed to Git!
Oops!

7zip-bench.sh [new file with mode: 0755]

diff --git a/7zip-bench.sh b/7zip-bench.sh
new file mode 100755 (executable)
index 0000000..e52bcff
--- /dev/null
@@ -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 <https://s1.hoffart.de/7zip-bench/> 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 <https://s1.hoffart.de/7zip-bench/>."
+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