Skip to content

Commit 06eaa2a

Browse files
committed
added Geekbench 6 as default test; refactored geekbench code
1 parent e4e65d2 commit 06eaa2a

File tree

2 files changed

+108
-100
lines changed

2 files changed

+108
-100
lines changed

README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ This script has been tested on the following Linux distributions: CentOS 6+, Deb
2929

3030
**High Bandwidth Usage Notice**: By default, this script will perform many iperf network tests, which will try to max out the network port for ~20s per location (10s in each direction). Low-bandwidth servers (such as a NAT VPS) should consider running this script with the `-r` flag (for reduced iperf locations) or the `-i` flag (to disable network tests entirely).
3131

32-
### Flags (Skipping Tests, Reducing iperf Locations, Geekbench 4, etc.)
32+
### Flags (Skipping Tests, Reducing iperf Locations, Geekbench 4/5/6, etc.)
3333

3434
By default, the script runs all three tests described in the next section below. In the event that you wish to skip one or more of the tests, use the commands below:
3535

@@ -43,9 +43,11 @@ curl -sL yabs.sh | bash -s -- -flags
4343
* `-g` this option disables the Geekbench (system performance) test
4444
* `-n` this option skips the network information lookup and print out
4545
* `-h` this option prints the help message with usage, flags detected, and local package (fio/iperf) status
46-
* `-r` this option reduces the number of iperf locations (Online.net/Clouvider LON+NYC) to lessen bandwidth usage
47-
* `-4` this option overrides the Geekbench 5 performance test and runs a Geekbench 4 test instead
48-
* `-9` this option runs the Geekbench 4 test in addition to the Geekbench 5 test
46+
* `-r` this option reduces the number of iperf locations (Scaleway/Clouvider LON+NYC) to lessen bandwidth usage
47+
* `-4` this option runs a Geekbench 4 test and disables the Geekbench 6 test
48+
* `-5` this option runs a Geekbench 5 test and disables the Geekbench 6 test
49+
* `-9` this option runs both the Geekbench 4 and 5 tests instead of the Geekbench 6 test
50+
* `-6` this option re-enables the Geekbench 6 test if any of the following were used: -4, -5, or -9 (-6 flag must be last to not be overridden)
4951
* `-j` this option prints a JSON representation of the results to the screen
5052
* `-w <filename>` this option writes the JSON results to a file using the file name provided
5153
* `-s <url>` this option sends a JSON representation of the results to the designated URL(s) (see section below)
@@ -70,7 +72,7 @@ A list of websites supporting acceptance of YABS JSON results will be posted her
7072

7173
* **[fio](https://github.com/axboe/fio)** - the most comprehensive I/O testing software available, fio grants the ability to evaluate disk performance in a variety of methods with a variety of options. Four random read and write fio disk tests are conducted as part of this script with 4k, 64k, 512k, and 1m block sizes. The tests are designed to evaluate disk throughput in near-real world (using random) scenarios with a 50/50 split (50% reads and 50% writes per test).
7274
* **[iperf3](https://github.com/esnet/iperf)** - the industry standard for testing download and upload speeds to various locations. This script utilizes iperf3 with 8 parallel threads and tests both download and upload speeds. If an iperf server is busy after 5 tries, the speed test for that location/direction is skipped.
73-
* **[Geekbench](https://www.geekbench.com/)** - Geekbench is a benchmarking program that measures system performance, which is widely used in the tech community. The web URL is displayed to be able to see complete test and individual benchmark results and allow comparison to other geekbench'd systems. The claim URL to add the Geekbench result to your Geekbench profile is written to a file in the directory that this script is executed from. By default, Geekbench 5 is the only Geekbench test performed, however, Geekbench 4 can also be toggled on by passing the appropriate flag.
75+
* **[Geekbench](https://www.geekbench.com/)** - Geekbench is a benchmarking program that measures system performance, which is widely used in the tech community. The web URL is displayed to be able to see complete test and individual benchmark results and allow comparison to other geekbench'd systems. The claim URL to add the Geekbench result to your Geekbench profile is written to a file in the directory that this script is executed from. By default, Geekbench 6 is the only Geekbench test performed, however, Geekbench 4 and/or 5 can also be toggled on by passing the appropriate flag.
7476

7577
### Security Notice
7678

yabs.sh

Lines changed: 101 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
# overall system performance via Geekbench 4/5, and random disk
1212
# performance via fio. The script is designed to not require any dependencies
1313
# - either compiled or installed - nor admin privileges to run.
14-
#
15-
YABS_VERSION="v2023-02-26"
14+
15+
YABS_VERSION="v2023-02-27"
1616

1717
echo -e '# ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## #'
1818
echo -e '# Yet-Another-Bench-Script #'
@@ -59,11 +59,11 @@ else
5959
fi
6060

6161
# flags to skip certain performance tests
62-
unset PREFER_BIN SKIP_FIO SKIP_IPERF SKIP_GEEKBENCH SKIP_NET PRINT_HELP REDUCE_NET GEEKBENCH_4 GEEKBENCH_5 DD_FALLBACK IPERF_DL_FAIL JSON JSON_SEND JSON_RESULT JSON_FILE
63-
GEEKBENCH_5="True" # gb5 test enabled by default
62+
unset PREFER_BIN SKIP_FIO SKIP_IPERF SKIP_GEEKBENCH SKIP_NET PRINT_HELP REDUCE_NET GEEKBENCH_4 GEEKBENCH_5 GEEKBENCH_6 DD_FALLBACK IPERF_DL_FAIL JSON JSON_SEND JSON_RESULT JSON_FILE
63+
GEEKBENCH_6="True" # gb6 test enabled by default
6464

6565
# get any arguments that were passed to the script and set the associated skip flags (if applicable)
66-
while getopts 'bfdignhr49jw:s:' flag; do
66+
while getopts 'bfdignhr4596jw:s:' flag; do
6767
case "${flag}" in
6868
b) PREFER_BIN="True" ;;
6969
f) SKIP_FIO="True" ;;
@@ -73,8 +73,10 @@ while getopts 'bfdignhr49jw:s:' flag; do
7373
n) SKIP_NET="True" ;;
7474
h) PRINT_HELP="True" ;;
7575
r) REDUCE_NET="True" ;;
76-
4) GEEKBENCH_4="True" && unset GEEKBENCH_5 ;;
77-
9) GEEKBENCH_4="True" && GEEKBENCH_5="True" ;;
76+
4) GEEKBENCH_4="True" && unset GEEKBENCH_6 ;;
77+
5) GEEKBENCH_5="True" && unset GEEKBENCH_6 ;;
78+
9) GEEKBENCH_4="True" && GEEKBENCH_5="True" && unset GEEKBENCH_6 ;;
79+
6) GEEKBENCH_6="True" ;;
7880
j) JSON+="j" ;;
7981
w) JSON+="w" && JSON_FILE=${OPTARG} ;;
8082
s) JSON+="s" && JSON_SEND=${OPTARG} ;;
@@ -121,8 +123,10 @@ if [ ! -z "$PRINT_HELP" ]; then
121123
echo -e " then exits"
122124
echo -e " -r : reduce number of iperf3 network locations (to only three)"
123125
echo -e " to lessen bandwidth usage"
124-
echo -e " -4 : use geekbench 4 instead of geekbench 5"
125-
echo -e " -9 : use both geekbench 4 AND geekbench 5"
126+
echo -e " -4 : use geekbench 4 instead of geekbench 6"
127+
echo -e " -5 : use geekbench 5 instead of geekbench 6"
128+
echo -e " -9 : use both geekbench 4 AND geekbench 5 instead of geekbench 6"
129+
echo -e " -6 : user geekbench 6 in addition to 4 and/or 5 (only needed if -4, -5, or -9 are set; -6 must come last)"
126130
echo -e " -j : print jsonified YABS results at conclusion of test"
127131
echo -e " -w <filename> : write jsonified YABS results to disk using file name provided"
128132
echo -e " -s <url> : send jsonified YABS results to URL"
@@ -138,6 +142,7 @@ if [ ! -z "$PRINT_HELP" ]; then
138142
[[ ! -z $REDUCE_NET ]] && echo -e " -r, using reduced (3) iperf3 locations"
139143
[[ ! -z $GEEKBENCH_4 ]] && echo -e " running geekbench 4"
140144
[[ ! -z $GEEKBENCH_5 ]] && echo -e " running geekbench 5"
145+
[[ ! -z $GEEKBENCH_6 ]] && echo -e " running geekbench 6"
141146
echo -e
142147
echo -e "Local Binary Check:"
143148
[[ -z $LOCAL_FIO ]] && echo -e " fio not detected, will download precompiled binary" ||
@@ -280,7 +285,7 @@ function ip_info() {
280285
281286
local as=$(echo "$response" | grep -Po '"as": *\K"[^"]*"')
282287
local as=${as//\"}
283-
288+
284289
if [[ -n "$net_type" ]]; then
285290
echo "Protocol : $net_type"
286291
fi
@@ -847,98 +852,95 @@ function launch_geekbench {
847852
GEEKBENCH_PATH=$YABS_PATH/geekbench_$VERSION
848853
mkdir -p $GEEKBENCH_PATH
849854

855+
GB_URL=""
856+
GB_CMD=""
857+
GB_RUN=""
858+
850859
# check for curl vs wget
851860
[[ ! -z $LOCAL_CURL ]] && DL_CMD="curl -s" || DL_CMD="wget -qO-"
852861

853862
if [[ $VERSION == *4* && ($ARCH = *aarch64* || $ARCH = *arm*) ]]; then
854-
echo -e "\nARM architecture not supported by Geekbench 4, use Geekbench 5."
863+
echo -e "\nARM architecture not supported by Geekbench 4, use Geekbench 5 or 6."
855864
elif [[ $VERSION == *4* && $ARCH != *aarch64* && $ARCH != *arm* ]]; then # Geekbench v4
856-
echo -en "\nRunning GB4 benchmark test... *cue elevator music*"
857-
# download the latest Geekbench 4 tarball and extract to geekbench temp directory
858-
$DL_CMD https://cdn.geekbench.com/Geekbench-4.4.4-Linux.tar.gz | tar xz --strip-components=1 -C $GEEKBENCH_PATH &>/dev/null
859-
860-
if [[ "$ARCH" == *"x86"* ]]; then
861-
# check if geekbench file exists
862-
if test -f "geekbench.license"; then
863-
$GEEKBENCH_PATH/geekbench_x86_32 --unlock $(cat geekbench.license) > /dev/null 2>&1
864-
fi
865-
866-
# run the Geekbench 4 test and grep the test results URL given at the end of the test
867-
GEEKBENCH_TEST=$($GEEKBENCH_PATH/geekbench_x86_32 --upload 2>/dev/null | grep "https://browser")
865+
GB_URL="https://cdn.geekbench.com/Geekbench-4.4.4-Linux.tar.gz"
866+
[[ "$ARCH" == *"x86"* ]] && GB_CMD="geekbench_x86_32" || GB_CMD="geekbench4"
867+
GB_RUN="True"
868+
elif [[ $VERSION == *5* || $VERSION == *6* ]]; then # Geekbench v5/6
869+
if [[ $ARCH = *x86* && $GEEKBENCH_4 == *False* ]]; then # don't run Geekbench 5 if on 32-bit arch
870+
echo -e "\nGeekbench $VERSION cannot run on 32-bit architectures. Re-run with -4 flag to use"
871+
echo -e "Geekbench 4, which can support 32-bit architectures. Skipping Geekbench $VERSION."
872+
elif [[ $ARCH = *x86* && $GEEKBENCH_4 == *True* ]]; then
873+
echo -e "\nGeekbench $VERSION cannot run on 32-bit architectures. Skipping test."
868874
else
869-
# check if geekbench file exists
870-
if test -f "geekbench.license"; then
871-
$GEEKBENCH_PATH/geekbench4 --unlock $(cat geekbench.license) > /dev/null 2>&1
875+
if [[ $VERSION == *5* ]]; then # Geekbench v5
876+
[[ $ARCH = *aarch64* || $ARCH = *arm* ]] && GB_URL="https://cdn.geekbench.com/Geekbench-5.5.1-LinuxARMPreview.tar.gz" \
877+
|| GB_URL="https://cdn.geekbench.com/Geekbench-5.5.1-Linux.tar.gz"
878+
GB_CMD="geekbench5"
879+
else # Geekbench v6
880+
[[ $ARCH = *aarch64* || $ARCH = *arm* ]] && GB_URL="https://cdn.geekbench.com/Geekbench-6.0.0-LinuxARMPreview.tar.gz" \
881+
|| GB_URL="https://cdn.geekbench.com/Geekbench-6.0.0-Linux.tar.gz"
882+
GB_CMD="geekbench6"
872883
fi
873-
874-
# run the Geekbench 4 test and grep the test results URL given at the end of the test
875-
GEEKBENCH_TEST=$($GEEKBENCH_PATH/geekbench4 --upload 2>/dev/null | grep "https://browser")
884+
GB_RUN="True"
876885
fi
877886
fi
878887

879-
if [[ $VERSION == *5* ]]; then # Geekbench v5
880-
if [[ $ARCH = *x86* && $GEEKBENCH_4 == *False* ]]; then # don't run Geekbench 5 if on 32-bit arch
881-
echo -e "\nGeekbench 5 cannot run on 32-bit architectures. Re-run with -4 flag to use"
882-
echo -e "Geekbench 4, which can support 32-bit architectures. Skipping Geekbench 5."
883-
elif [[ $ARCH = *x86* && $GEEKBENCH_4 == *True* ]]; then
884-
echo -e "\nGeekbench 5 cannot run on 32-bit architectures. Skipping test."
885-
else
886-
echo -en "\nRunning GB5 benchmark test... *cue elevator music*"
887-
# download the latest Geekbench 5 tarball and extract to geekbench temp directory
888-
if [[ $ARCH = *aarch64* || $ARCH = *arm* ]]; then
889-
$DL_CMD https://cdn.geekbench.com/Geekbench-5.5.1-LinuxARMPreview.tar.gz | tar xz --strip-components=1 -C $GEEKBENCH_PATH &>/dev/null
890-
else
891-
$DL_CMD https://cdn.geekbench.com/Geekbench-5.5.1-Linux.tar.gz | tar xz --strip-components=1 -C $GEEKBENCH_PATH &>/dev/null
888+
if [[ $GB_RUN == *True* ]]; then # run GB test
889+
echo -en "\nRunning GB$VERSION benchmark test... *cue elevator music*"
890+
891+
# download the desired Geekbench tarball and extract to geekbench temp directory
892+
$DL_CMD $GB_URL | tar xz --strip-components=1 -C $GEEKBENCH_PATH &>/dev/null
893+
894+
# unlock if license file detected
895+
test -f "geekbench.license" && $GEEKBENCH_PATH/$GB_CMD --unlock $(cat geekbench.license) > /dev/null 2>&1
896+
897+
# run the Geekbench test and grep the test results URL given at the end of the test
898+
GEEKBENCH_TEST=$($GEEKBENCH_PATH/$GB_CMD --upload 2>/dev/null | grep "https://browser")
899+
900+
# ensure the test ran successfully
901+
if [ -z "$GEEKBENCH_TEST" ]; then
902+
if [[ -z "$IPV4_CHECK" ]]; then
903+
# Geekbench test failed to download because host lacks IPv4 (cdn.geekbench.com = IPv4 only)
904+
echo -e "\r\033[0KGeekbench releases can only be downloaded over IPv4. FTP the Geekbench files and run manually."
905+
elif [[ $VERSION != *4* && $TOTAL_RAM_RAW -le 1048576 ]]; then
906+
# Geekbench 5/6 test failed with low memory (<=1GB)
907+
echo -e "\r\033[0KGeekbench test failed and low memory was detected. Add at least 1GB of SWAP or use GB4 instead (higher compatibility with low memory systems)."
908+
elif [[ $ARCH != *x86* ]]; then
909+
# if the Geekbench test failed for any other reason, exit cleanly and print error message
910+
echo -e "\r\033[0KGeekbench $VERSION test failed. Run manually to determine cause."
892911
fi
912+
else
913+
# if the Geekbench test succeeded, parse the test results URL
914+
GEEKBENCH_URL=$(echo -e $GEEKBENCH_TEST | head -1)
915+
GEEKBENCH_URL_CLAIM=$(echo $GEEKBENCH_URL | awk '{ print $2 }')
916+
GEEKBENCH_URL=$(echo $GEEKBENCH_URL | awk '{ print $1 }')
917+
# sleep a bit to wait for results to be made available on the geekbench website
918+
sleep 10
919+
# parse the public results page for the single and multi core geekbench scores
920+
[[ $VERSION == *4* ]] && GEEKBENCH_SCORES=$($DL_CMD $GEEKBENCH_URL | grep "span class='score'") || \
921+
GEEKBENCH_SCORES=$($DL_CMD $GEEKBENCH_URL | grep "div class='score'")
922+
923+
GEEKBENCH_SCORES_SINGLE=$(echo $GEEKBENCH_SCORES | awk -v FS="(>|<)" '{ print $3 }')
924+
GEEKBENCH_SCORES_MULTI=$(echo $GEEKBENCH_SCORES | awk -v FS="(>|<)" '{ print $7 }')
925+
926+
# print the Geekbench results
927+
echo -en "\r\033[0K"
928+
echo -e "Geekbench $VERSION Benchmark Test:"
929+
echo -e "---------------------------------"
930+
printf "%-15s | %-30s\n" "Test" "Value"
931+
printf "%-15s | %-30s\n"
932+
printf "%-15s | %-30s\n" "Single Core" "$GEEKBENCH_SCORES_SINGLE"
933+
printf "%-15s | %-30s\n" "Multi Core" "$GEEKBENCH_SCORES_MULTI"
934+
printf "%-15s | %-30s\n" "Full Test" "$GEEKBENCH_URL"
893935

894-
# check if geekbench file exists
895-
if test -f "geekbench.license"; then
896-
$GEEKBENCH_PATH/geekbench5 --unlock $(cat geekbench.license) > /dev/null 2>&1
936+
if [ ! -z $JSON ]; then
937+
JSON_RESULT+='{"version":'$VERSION',"single":'$GEEKBENCH_SCORES_SINGLE',"multi":'$GEEKBENCH_SCORES_MULTI
938+
JSON_RESULT+=',"url":"'$GEEKBENCH_URL'"},'
897939
fi
898940

899-
GEEKBENCH_TEST=$($GEEKBENCH_PATH/geekbench5 --upload 2>/dev/null | grep "https://browser")
900-
fi
901-
fi
902-
903-
# ensure the test ran successfully
904-
if [ -z "$GEEKBENCH_TEST" ]; then
905-
if [[ -z "$IPV4_CHECK" ]]; then
906-
# Geekbench test failed to download because host lacks IPv4 (cdn.geekbench.com = IPv4 only)
907-
echo -e "\r\033[0KGeekbench releases can only be downloaded over IPv4. FTP the Geekbench files and run manually."
908-
elif [[ $ARCH != *x86* ]]; then
909-
# if the Geekbench test failed for any reason, exit cleanly and print error message
910-
echo -e "\r\033[0KGeekbench $VERSION test failed. Run manually to determine cause."
911-
fi
912-
else
913-
# if the Geekbench test succeeded, parse the test results URL
914-
GEEKBENCH_URL=$(echo -e $GEEKBENCH_TEST | head -1)
915-
GEEKBENCH_URL_CLAIM=$(echo $GEEKBENCH_URL | awk '{ print $2 }')
916-
GEEKBENCH_URL=$(echo $GEEKBENCH_URL | awk '{ print $1 }')
917-
# sleep a bit to wait for results to be made available on the geekbench website
918-
sleep 20
919-
# parse the public results page for the single and multi core geekbench scores
920-
[[ $VERSION == *5* ]] && GEEKBENCH_SCORES=$($DL_CMD $GEEKBENCH_URL | grep "div class='score'") ||
921-
GEEKBENCH_SCORES=$($DL_CMD $GEEKBENCH_URL | grep "span class='score'")
922-
GEEKBENCH_SCORES_SINGLE=$(echo $GEEKBENCH_SCORES | awk -v FS="(>|<)" '{ print $3 }')
923-
GEEKBENCH_SCORES_MULTI=$(echo $GEEKBENCH_SCORES | awk -v FS="(>|<)" '{ print $7 }')
924-
925-
# print the Geekbench results
926-
echo -en "\r\033[0K"
927-
echo -e "Geekbench $VERSION Benchmark Test:"
928-
echo -e "---------------------------------"
929-
printf "%-15s | %-30s\n" "Test" "Value"
930-
printf "%-15s | %-30s\n"
931-
printf "%-15s | %-30s\n" "Single Core" "$GEEKBENCH_SCORES_SINGLE"
932-
printf "%-15s | %-30s\n" "Multi Core" "$GEEKBENCH_SCORES_MULTI"
933-
printf "%-15s | %-30s\n" "Full Test" "$GEEKBENCH_URL"
934-
935-
if [ ! -z $JSON ]; then
936-
JSON_RESULT+='{"version":'$VERSION',"single":'$GEEKBENCH_SCORES_SINGLE',"multi":'$GEEKBENCH_SCORES_MULTI
937-
JSON_RESULT+=',"url":"'$GEEKBENCH_URL'"},'
941+
# write the geekbench claim URL to a file so the user can add the results to their profile (if desired)
942+
[ ! -z "$GEEKBENCH_URL_CLAIM" ] && echo -e "$GEEKBENCH_URL_CLAIM" >> geekbench_claim.url 2> /dev/null
938943
fi
939-
940-
# write the geekbench claim URL to a file so the user can add the results to their profile (if desired)
941-
[ ! -z "$GEEKBENCH_URL_CLAIM" ] && echo -e "$GEEKBENCH_URL_CLAIM" >> geekbench_claim.url 2> /dev/null
942944
fi
943945
}
944946

@@ -952,6 +954,10 @@ if [ -z "$SKIP_GEEKBENCH" ]; then
952954
if [[ $GEEKBENCH_5 == *True* ]]; then
953955
launch_geekbench 5
954956
fi
957+
958+
if [[ $GEEKBENCH_6 == *True* ]]; then
959+
launch_geekbench 6
960+
fi
955961
[[ ! -z $JSON ]] && [[ $(echo -n $JSON_RESULT | tail -c 1) == ',' ]] && JSON_RESULT=${JSON_RESULT::${#JSON_RESULT}-1}
956962
[[ ! -z $JSON ]] && JSON_RESULT+=']'
957963
fi
@@ -966,19 +972,19 @@ YABS_END_TIME=$(date +%s)
966972
# Purpose: This method is designed to find the time taken for the completion of a YABS run.
967973
# Parameters:
968974
# 1. YABS_END_TIME - time when GB has completed and all files are removed
969-
# 2. YABS_START_TIME - time when YABS is started
975+
# 2. YABS_START_TIME - time when YABS is started
970976
function calculate_time_taken() {
971977
end_time=$1
972978
start_time=$2
973979

974980
time_taken=$(( ${end_time} - ${start_time} ))
975-
if [ ${time_taken} -gt 60 ]; then
976-
min=$(expr $time_taken / 60)
977-
sec=$(expr $time_taken % 60)
978-
echo "YABS completed in ${min} min ${sec} sec"
979-
else
980-
echo "YABS completed in ${time_taken} sec"
981-
fi
981+
if [ ${time_taken} -gt 60 ]; then
982+
min=$(expr $time_taken / 60)
983+
sec=$(expr $time_taken % 60)
984+
echo "YABS completed in ${min} min ${sec} sec"
985+
else
986+
echo "YABS completed in ${time_taken} sec"
987+
fi
982988
}
983989

984990
calculate_time_taken $YABS_END_TIME $YABS_START_TIME

0 commit comments

Comments
 (0)