mirror of
https://github.com/masonr/yet-another-bench-script.git
synced 2025-04-19 08:55:15 +00:00
Geekbench 5; local package (fio/iperf3) preference; help printout
This commit is contained in:
parent
19dd606f71
commit
90923210f6
10
README.md
10
README.md
@ -14,18 +14,20 @@ This script has been tested on CentOS 7, CentOS 8, Debian 9, Debian 10, Fedora 3
|
||||
|
||||
**IPv6-Only Machines**: The above command will not work on IPv6-only machines. [See below](#ipv6-only-machines)
|
||||
|
||||
|
||||
### Skipping Tests
|
||||
### Flags (Skipping Tests, Reducing iperf Locations, Geekbench 4, etc.)
|
||||
|
||||
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:
|
||||
|
||||
```
|
||||
curl -sL yabs.sh | bash -s -- -{fig}
|
||||
curl -sL yabs.sh | bash -s -- -{fdighr4}
|
||||
```
|
||||
|
||||
* `-f`/`-d` this option disables the fio (disk performance) test
|
||||
* `-i` this option disables the iperf (network performance) test
|
||||
* `-g` this option disables the Geekbench (system performance) test
|
||||
* `-h` this option prints the help message with usage, flags detected, and local package (fio/iperf) status
|
||||
* `-r` this option reduces the number of iperf locations (Online.net/WorldStream/HE.net) to lessen bandwidth usage
|
||||
* `-4` this option overrides the Geekbench 5 performance test and runs a Geekbench 4 test instead
|
||||
|
||||
Options can be grouped together to skip multiple tests, i.e. `-fg` to skip the disk and system performance tests (effectively only testing network performance).
|
||||
|
||||
@ -33,7 +35,7 @@ Options can be grouped together to skip multiple tests, i.e. `-fg` to skip the d
|
||||
|
||||
* **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).
|
||||
* **iperf3** - 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 10 tries, the speed test for that location/direction is skipped.
|
||||
* **Geekbench 4** - 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 4 result to your Geekbench profile is written to a file in the directory that this script is executed from.
|
||||
* **Geekbench 5** - 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 5 result to your Geekbench profile is written to a file in the directory that this script is executed from. You can run a Geekbench 4 test, instead of v5, by using the "-4" flag.
|
||||
|
||||
### Security Notice
|
||||
|
||||
|
348
yabs.sh
348
yabs.sh
@ -8,14 +8,14 @@
|
||||
#
|
||||
# Purpose: The purpose of this script is to quickly gauge the performance of a Linux-
|
||||
# based server by benchmarking network performance via iperf3, CPU and
|
||||
# overall system performance via Geekbench 4, and random disk
|
||||
# overall system performance via Geekbench 4/5, and random disk
|
||||
# performance via fio. The script is designed to not require any dependencies
|
||||
# - either compiled or installed - nor admin privileges to run.
|
||||
#
|
||||
|
||||
echo -e '# ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## #'
|
||||
echo -e '# Yet-Another-Bench-Script #'
|
||||
echo -e '# v2020-02-04 #'
|
||||
echo -e '# v2020-02-10 #'
|
||||
echo -e '# https://github.com/masonr/yet-another-bench-script #'
|
||||
echo -e '# ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## #'
|
||||
|
||||
@ -39,6 +39,69 @@ else
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# flags to skip certain performance tests
|
||||
unset SKIP_FIO SKIP_IPERF SKIP_GEEKBENCH PRINT_HELP REDUCE_NET GEEKBENCH_4_OVERRIDE
|
||||
|
||||
# get any arguments that were passed to the script and set the associated skip flags (if applicable)
|
||||
while getopts 'fdighr4' flag; do
|
||||
case "${flag}" in
|
||||
f) SKIP_FIO="True" ;;
|
||||
d) SKIP_FIO="True" ;;
|
||||
i) SKIP_IPERF="True" ;;
|
||||
g) SKIP_GEEKBENCH="True" ;;
|
||||
h) PRINT_HELP="True" ;;
|
||||
r) REDUCE_NET="True" ;;
|
||||
4) GEEKBENCH_4_OVERRIDE="True" ;;
|
||||
*) exit 1 ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# check for local fio/iperf installs
|
||||
command -v fio >/dev/null 2>&1 && LOCAL_FIO=true || unset LOCAL_FIO
|
||||
command -v iperf3 >/dev/null 2>&1 && LOCAL_IPERF=true || unset LOCAL_IPERF
|
||||
|
||||
# test if the host has IPv4/IPv6 connectivity
|
||||
IPV4_CHECK=$(curl -s -4 -m 4 icanhazip.com 2> /dev/null)
|
||||
IPV6_CHECK=$(curl -s -6 -m 4 icanhazip.com 2> /dev/null)
|
||||
|
||||
# print help and exit script, if help flag was passed
|
||||
if [ ! -z "$PRINT_HELP" ]; then
|
||||
echo -e
|
||||
echo -e "Usage: ./yabs.sh [-fdighr4]"
|
||||
echo -e " curl -sL yabs.sh | bash"
|
||||
echo -e " curl -sL yabs.sh | bash -s -- -{fdighr4}"
|
||||
echo -e
|
||||
echo -e "Flags:"
|
||||
echo -e " -f/d : skips the fio disk benchmark test"
|
||||
echo -e " -i : skips the iperf network test"
|
||||
echo -e " -g : skips the geekbench performance test"
|
||||
echo -e " -h : prints this lovely message, shows any flags you passed,"
|
||||
echo -e " shows if fio/iperf3 local packages have been detected,"
|
||||
echo -e " then exits"
|
||||
echo -e " -r : reduce number of iperf3 network locations (to only three)"
|
||||
echo -e " to lessen bandwidth usage"
|
||||
echo -e " -4 : use geekbench 4 instead of geekbench 5"
|
||||
echo -e
|
||||
echo -e "Detected Arch: $ARCH"
|
||||
echo -e
|
||||
echo -e "Detected Flags:"
|
||||
[[ ! -z $SKIP_FIO ]] && echo -e " -f/d, skipping fio disk benchmark test"
|
||||
[[ ! -z $SKIP_IPERF ]] && echo -e " -i, skipping iperf network test"
|
||||
[[ ! -z $SKIP_GEEKBENCH ]] && echo -e " -g, skipping geekbench test"
|
||||
[[ ! -z $REDUCE_NET ]] && echo -e " -r, using reduced (3) iperf3 locations"
|
||||
[[ ! -z $GEEKBENCH_4_OVERRIDE ]] && echo -e " -4, running geekbench 4 instead of 5"
|
||||
echo -e
|
||||
echo -e "Local Binary Check:"
|
||||
[[ -z $LOCAL_FIO ]] && echo -e " fio not detected, will download precompiled binary" ||
|
||||
echo -e " fio detected, using local package"
|
||||
[[ -z $LOCAL_IPERF ]] && echo -e " iperf3 not detected, will download precompiled binary" ||
|
||||
echo -e " iperf3 detected, using local package"
|
||||
echo -e
|
||||
echo -e "Exiting..."
|
||||
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# gather basic system information (inc. CPU, AES-NI/virt status, RAM + swap + disk size)
|
||||
echo -e
|
||||
echo -e "Basic System Information:"
|
||||
@ -75,26 +138,6 @@ fi
|
||||
rm $DATE.test
|
||||
mkdir -p $YABS_PATH
|
||||
|
||||
# flags to skip certain performance tests
|
||||
SKIP_FIO=""
|
||||
SKIP_IPERF=""
|
||||
SKIP_GEEKBENCH=""
|
||||
|
||||
# get any arguments that were passed to the script and set the associated skip flags (if applicable)
|
||||
while getopts 'fdig' flag; do
|
||||
case "${flag}" in
|
||||
f) SKIP_FIO="True" ;;
|
||||
d) SKIP_FIO="True" ;;
|
||||
i) SKIP_IPERF="True" ;;
|
||||
g) SKIP_GEEKBENCH="True" ;;
|
||||
*) exit 1 ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# test if the host has IPv4/IPv6 connectivity
|
||||
IPV4_CHECK=$(curl -s -4 -m 4 icanhazip.com 2> /dev/null)
|
||||
IPV6_CHECK=$(curl -s -6 -m 4 icanhazip.com 2> /dev/null)
|
||||
|
||||
# format_speed
|
||||
# Purpose: This method is a convienence function to format the output of the fio disk tests which
|
||||
# always returns a result in KB/s. If result is >= 1 GB/s, use GB/s. If result is < 1 GB/s
|
||||
@ -110,10 +153,10 @@ function format_speed {
|
||||
local UNIT="KB/s"
|
||||
|
||||
# ensure raw value is not null, if it is, return blank
|
||||
if [ -z "$RAW" ]; then
|
||||
echo ""
|
||||
return 0
|
||||
fi
|
||||
if [ -z "$RAW" ]; then
|
||||
echo ""
|
||||
return 0
|
||||
fi
|
||||
|
||||
# check if disk speed >= 1 GB/s
|
||||
if [ "$RAW" -ge 1000000 ]; then
|
||||
@ -170,12 +213,12 @@ function format_iops {
|
||||
function disk_test {
|
||||
# run a quick test to generate the fio test file to be used by the actual tests
|
||||
echo -en "Generating fio test file..."
|
||||
$DISK_PATH/fio --name=setup --ioengine=libaio --rw=read --bs=4k --iodepth=64 --numjobs=2 --size=2G --runtime=1 --gtod_reduce=1 --filename=$DISK_PATH/test.fio --direct=1 --minimal &> /dev/null
|
||||
$FIO_CMD --name=setup --ioengine=libaio --rw=read --bs=4k --iodepth=64 --numjobs=2 --size=2G --runtime=1 --gtod_reduce=1 --filename=$DISK_PATH/test.fio --direct=1 --minimal &> /dev/null
|
||||
echo -en "\r\033[0K"
|
||||
|
||||
# run rand read/write mixed 4kb fio test
|
||||
echo -en "Running fio random mixed read + write disk test with 4kb blocks..."
|
||||
DISK_RW4_TEST=$(timeout 35 $DISK_PATH/fio --name=rand_rw_4k --ioengine=libaio --rw=randrw --rwmixread=50 --bs=4k --iodepth=64 --numjobs=2 --size=2G --runtime=30 --gtod_reduce=1 --direct=1 --filename=$DISK_PATH/test.fio --group_reporting --minimal 2> /dev/null | grep rand_rw_4k)
|
||||
DISK_RW4_TEST=$(timeout 35 $FIO_CMD --name=rand_rw_4k --ioengine=libaio --rw=randrw --rwmixread=50 --bs=4k --iodepth=64 --numjobs=2 --size=2G --runtime=30 --gtod_reduce=1 --direct=1 --filename=$DISK_PATH/test.fio --group_reporting --minimal 2> /dev/null | grep rand_rw_4k)
|
||||
DISK_RW4_IOPS_R=$(echo $DISK_RW4_TEST | awk -F';' '{print $8}')
|
||||
DISK_RW4_IOPS_W=$(echo $DISK_RW4_TEST | awk -F';' '{print $49}')
|
||||
DISK_RW4_IOPS=$(format_iops $(awk -v a="$DISK_RW4_IOPS_R" -v b="$DISK_RW4_IOPS_W" 'BEGIN { print a + b }'))
|
||||
@ -189,49 +232,86 @@ function disk_test {
|
||||
echo -en "\r\033[0K"
|
||||
|
||||
# run rand read/write mixed 64kb fio test
|
||||
echo -en "Running fio random mixed read + write disk test with 64kb blocks..."
|
||||
DISK_RW64_TEST=$(timeout 35 $DISK_PATH/fio --name=rand_rw_64k --ioengine=libaio --rw=randrw --rwmixread=50 --bs=64k --iodepth=64 --numjobs=2 --size=2G --runtime=30 --gtod_reduce=1 --direct=1 --filename=$DISK_PATH/test.fio --group_reporting --minimal 2> /dev/null | grep rand_rw_64k)
|
||||
DISK_RW64_IOPS_R=$(echo $DISK_RW64_TEST | awk -F';' '{print $8}')
|
||||
DISK_RW64_IOPS_W=$(echo $DISK_RW64_TEST | awk -F';' '{print $49}')
|
||||
DISK_RW64_IOPS=$(format_iops $(awk -v a="$DISK_RW64_IOPS_R" -v b="$DISK_RW64_IOPS_W" 'BEGIN { print a + b }'))
|
||||
echo -en "Running fio random mixed read + write disk test with 64kb blocks..."
|
||||
DISK_RW64_TEST=$(timeout 35 $FIO_CMD --name=rand_rw_64k --ioengine=libaio --rw=randrw --rwmixread=50 --bs=64k --iodepth=64 --numjobs=2 --size=2G --runtime=30 --gtod_reduce=1 --direct=1 --filename=$DISK_PATH/test.fio --group_reporting --minimal 2> /dev/null | grep rand_rw_64k)
|
||||
DISK_RW64_IOPS_R=$(echo $DISK_RW64_TEST | awk -F';' '{print $8}')
|
||||
DISK_RW64_IOPS_W=$(echo $DISK_RW64_TEST | awk -F';' '{print $49}')
|
||||
DISK_RW64_IOPS=$(format_iops $(awk -v a="$DISK_RW64_IOPS_R" -v b="$DISK_RW64_IOPS_W" 'BEGIN { print a + b }'))
|
||||
DISK_RW64_IOPS_R=$(format_iops $DISK_RW64_IOPS_R)
|
||||
DISK_RW64_IOPS_W=$(format_iops $DISK_RW64_IOPS_W)
|
||||
DISK_RW64_TEST_R=$(echo $DISK_RW64_TEST | awk -F';' '{print $7}')
|
||||
DISK_RW64_TEST_W=$(echo $DISK_RW64_TEST | awk -F';' '{print $48}')
|
||||
DISK_RW64_TEST=$(format_speed $(awk -v a="$DISK_RW64_TEST_R" -v b="$DISK_RW64_TEST_W" 'BEGIN { print a + b }'))
|
||||
DISK_RW64_TEST_R=$(echo $DISK_RW64_TEST | awk -F';' '{print $7}')
|
||||
DISK_RW64_TEST_W=$(echo $DISK_RW64_TEST | awk -F';' '{print $48}')
|
||||
DISK_RW64_TEST=$(format_speed $(awk -v a="$DISK_RW64_TEST_R" -v b="$DISK_RW64_TEST_W" 'BEGIN { print a + b }'))
|
||||
DISK_RW64_TEST_R=$(format_speed $DISK_RW64_TEST_R)
|
||||
DISK_RW64_TEST_W=$(format_speed $DISK_RW64_TEST_W)
|
||||
echo -en "\r\033[0K"
|
||||
echo -en "\r\033[0K"
|
||||
|
||||
# run rand read/write mixed 512kb fio test
|
||||
echo -en "Running fio random mixed read + write disk test with 512kb blocks..."
|
||||
DISK_RW512_TEST=$(timeout 35 $DISK_PATH/fio --name=rand_rw_512k --ioengine=libaio --rw=randrw --rwmixread=50 --bs=512k --iodepth=64 --numjobs=2 --size=2G --runtime=30 --gtod_reduce=1 --direct=1 --filename=$DISK_PATH/test.fio --group_reporting --minimal 2> /dev/null | grep rand_rw_512k)
|
||||
DISK_RW512_IOPS_R=$(echo $DISK_RW512_TEST | awk -F';' '{print $8}')
|
||||
DISK_RW512_IOPS_W=$(echo $DISK_RW512_TEST | awk -F';' '{print $49}')
|
||||
DISK_RW512_IOPS=$(format_iops $(awk -v a="$DISK_RW512_IOPS_R" -v b="$DISK_RW512_IOPS_W" 'BEGIN { print a + b }'))
|
||||
DISK_RW512_IOPS_R=$(format_iops $DISK_RW512_IOPS_R)
|
||||
DISK_RW512_IOPS_W=$(format_iops $DISK_RW512_IOPS_W)
|
||||
DISK_RW512_TEST_R=$(echo $DISK_RW512_TEST | awk -F';' '{print $7}')
|
||||
DISK_RW512_TEST_W=$(echo $DISK_RW512_TEST | awk -F';' '{print $48}')
|
||||
DISK_RW512_TEST=$(format_speed $(awk -v a="$DISK_RW512_TEST_R" -v b="$DISK_RW512_TEST_W" 'BEGIN { print a + b }'))
|
||||
DISK_RW512_TEST_R=$(format_speed $DISK_RW512_TEST_R)
|
||||
DISK_RW512_TEST_W=$(format_speed $DISK_RW512_TEST_W)
|
||||
echo -en "\r\033[0K"
|
||||
echo -en "Running fio random mixed read + write disk test with 512kb blocks..."
|
||||
DISK_RW512_TEST=$(timeout 35 $FIO_CMD --name=rand_rw_512k --ioengine=libaio --rw=randrw --rwmixread=50 --bs=512k --iodepth=64 --numjobs=2 --size=2G --runtime=30 --gtod_reduce=1 --direct=1 --filename=$DISK_PATH/test.fio --group_reporting --minimal 2> /dev/null | grep rand_rw_512k)
|
||||
DISK_RW512_IOPS_R=$(echo $DISK_RW512_TEST | awk -F';' '{print $8}')
|
||||
DISK_RW512_IOPS_W=$(echo $DISK_RW512_TEST | awk -F';' '{print $49}')
|
||||
DISK_RW512_IOPS=$(format_iops $(awk -v a="$DISK_RW512_IOPS_R" -v b="$DISK_RW512_IOPS_W" 'BEGIN { print a + b }'))
|
||||
DISK_RW512_IOPS_R=$(format_iops $DISK_RW512_IOPS_R)
|
||||
DISK_RW512_IOPS_W=$(format_iops $DISK_RW512_IOPS_W)
|
||||
DISK_RW512_TEST_R=$(echo $DISK_RW512_TEST | awk -F';' '{print $7}')
|
||||
DISK_RW512_TEST_W=$(echo $DISK_RW512_TEST | awk -F';' '{print $48}')
|
||||
DISK_RW512_TEST=$(format_speed $(awk -v a="$DISK_RW512_TEST_R" -v b="$DISK_RW512_TEST_W" 'BEGIN { print a + b }'))
|
||||
DISK_RW512_TEST_R=$(format_speed $DISK_RW512_TEST_R)
|
||||
DISK_RW512_TEST_W=$(format_speed $DISK_RW512_TEST_W)
|
||||
echo -en "\r\033[0K"
|
||||
|
||||
# run rand read/write mixed 1mb fio test
|
||||
echo -en "Running fio random mixed read + write disk test with 1mb blocks..."
|
||||
DISK_RW1M_TEST=$(timeout 35 $DISK_PATH/fio --name=rand_rw_1m --ioengine=libaio --rw=randrw --rwmixread=50 --bs=1m --iodepth=64 --numjobs=2 --size=2G --runtime=30 --gtod_reduce=1 --direct=1 --filename=$DISK_PATH/test.fio --group_reporting --minimal 2> /dev/null | grep rand_rw_1m)
|
||||
DISK_RW1M_IOPS_R=$(echo $DISK_RW1M_TEST | awk -F';' '{print $8}')
|
||||
DISK_RW1M_IOPS_W=$(echo $DISK_RW1M_TEST | awk -F';' '{print $49}')
|
||||
DISK_RW1M_IOPS=$(format_iops $(awk -v a="$DISK_RW1M_IOPS_R" -v b="$DISK_RW1M_IOPS_W" 'BEGIN { print a + b }'))
|
||||
DISK_RW1M_IOPS_R=$(format_iops $DISK_RW1M_IOPS_R)
|
||||
DISK_RW1M_IOPS_W=$(format_iops $DISK_RW1M_IOPS_W)
|
||||
DISK_RW1M_TEST_R=$(echo $DISK_RW1M_TEST | awk -F';' '{print $7}')
|
||||
DISK_RW1M_TEST_W=$(echo $DISK_RW1M_TEST | awk -F';' '{print $48}')
|
||||
DISK_RW1M_TEST=$(format_speed $(awk -v a="$DISK_RW1M_TEST_R" -v b="$DISK_RW1M_TEST_W" 'BEGIN { print a + b }'))
|
||||
DISK_RW1M_TEST_R=$(format_speed $DISK_RW1M_TEST_R)
|
||||
DISK_RW1M_TEST_W=$(format_speed $DISK_RW1M_TEST_W)
|
||||
echo -en "\r\033[0K"
|
||||
echo -en "Running fio random mixed read + write disk test with 1mb blocks..."
|
||||
DISK_RW1M_TEST=$(timeout 35 $FIO_CMD --name=rand_rw_1m --ioengine=libaio --rw=randrw --rwmixread=50 --bs=1m --iodepth=64 --numjobs=2 --size=2G --runtime=30 --gtod_reduce=1 --direct=1 --filename=$DISK_PATH/test.fio --group_reporting --minimal 2> /dev/null | grep rand_rw_1m)
|
||||
DISK_RW1M_IOPS_R=$(echo $DISK_RW1M_TEST | awk -F';' '{print $8}')
|
||||
DISK_RW1M_IOPS_W=$(echo $DISK_RW1M_TEST | awk -F';' '{print $49}')
|
||||
DISK_RW1M_IOPS=$(format_iops $(awk -v a="$DISK_RW1M_IOPS_R" -v b="$DISK_RW1M_IOPS_W" 'BEGIN { print a + b }'))
|
||||
DISK_RW1M_IOPS_R=$(format_iops $DISK_RW1M_IOPS_R)
|
||||
DISK_RW1M_IOPS_W=$(format_iops $DISK_RW1M_IOPS_W)
|
||||
DISK_RW1M_TEST_R=$(echo $DISK_RW1M_TEST | awk -F';' '{print $7}')
|
||||
DISK_RW1M_TEST_W=$(echo $DISK_RW1M_TEST | awk -F';' '{print $48}')
|
||||
DISK_RW1M_TEST=$(format_speed $(awk -v a="$DISK_RW1M_TEST_R" -v b="$DISK_RW1M_TEST_W" 'BEGIN { print a + b }'))
|
||||
DISK_RW1M_TEST_R=$(format_speed $DISK_RW1M_TEST_R)
|
||||
DISK_RW1M_TEST_W=$(format_speed $DISK_RW1M_TEST_W)
|
||||
echo -en "\r\033[0K"
|
||||
}
|
||||
|
||||
# dd_test
|
||||
# Purpose: This method is invoked if the fio disk test failed. dd sequential speed tests are
|
||||
# not indiciative or real-world results, however, some form of disk speed measure
|
||||
# is better than nothing.
|
||||
# Parameters:
|
||||
# - (none)
|
||||
function dd_test {
|
||||
I=0
|
||||
DISK_WRITE_TEST_RES=()
|
||||
DISK_READ_TEST_RES=()
|
||||
DISK_WRITE_TEST_AVG=0
|
||||
DISK_READ_TEST_AVG=0
|
||||
|
||||
# run the disk speed tests (write and read) thrice over
|
||||
while [ $I -lt 3 ]
|
||||
do
|
||||
# write test using dd, "direct" flag is used to test direct I/O for data being stored to disk
|
||||
DISK_WRITE_TEST=$(dd if=/dev/zero of=$DISK_PATH/$DATE.test bs=64k count=16k oflag=direct |& grep copied | awk '{ print $(NF-1) " " $(NF)}')
|
||||
VAL=$(echo $DISK_WRITE_TEST | cut -d " " -f 1)
|
||||
[[ "$DISK_WRITE_TEST" == *"GB"* ]] && VAL=$(awk -v a="$VAL" 'BEGIN { print a * 1000 }')
|
||||
DISK_WRITE_TEST_RES+=( "$DISK_WRITE_TEST" )
|
||||
DISK_WRITE_TEST_AVG=$(awk -v a="$DISK_WRITE_TEST_AVG" -v b="$VAL" 'BEGIN { print a + b }')
|
||||
|
||||
# read test using dd using the 1G file written during the write test
|
||||
DISK_READ_TEST=$(dd if=$DISK_PATH/$DATE.test of=/dev/null bs=8k |& grep copied | awk '{ print $(NF-1) " " $(NF)}')
|
||||
VAL=$(echo $DISK_READ_TEST | cut -d " " -f 1)
|
||||
[[ "$DISK_READ_TEST" == *"GB"* ]] && VAL=$(awk -v a="$VAL" 'BEGIN { pring a * 1000 }')
|
||||
DISK_READ_TEST_RES+=( "$DISK_READ_TEST" )
|
||||
DISK_READ_TEST_AVG=$(awk -v a="$DISK_READ_TEST_AVG" -v b="$VAL" 'BEGIN { print a + b }')
|
||||
|
||||
I=$(( $I + 1 ))
|
||||
done
|
||||
# calculate the write and read speed averages using the results from the three runs
|
||||
DISK_WRITE_TEST_AVG=$(awk -v a="$DISK_WRITE_TEST_AVG" 'BEGIN { print a / 3 }')
|
||||
DISK_READ_TEST_AVG=$(awk -v a="$DISK_READ_TEST_AVG" 'BEGIN { print a / 3 }')
|
||||
}
|
||||
|
||||
# if the skip disk flag was set, skip the disk performance test, otherwise test disk performance
|
||||
@ -242,23 +322,53 @@ if [ -z "$SKIP_FIO" ]; then
|
||||
DISK_PATH=$YABS_PATH/disk
|
||||
mkdir -p $DISK_PATH
|
||||
|
||||
# download fio binary
|
||||
if [ ! -z "$IPV4_CHECK" ]; then # if IPv4 is enabled
|
||||
curl -s https://raw.githubusercontent.com/masonr/yet-another-bench-script/master/bin/fio_$ARCH -o $DISK_PATH/fio
|
||||
else # no IPv4, use IPv6 - below is necessary since raw.githubusercontent.com has no AAAA record
|
||||
curl -s -k -g --header 'Host: raw.githubusercontent.com' https://[2a04:4e42::133]/masonr/yet-another-bench-script/master/bin/fio_$ARCH -o $DISK_PATH/fio
|
||||
if [ ! -z "$LOCAL_FIO" ]; then # local fio has been detected, use instead of pre-compiled binary
|
||||
FIO_CMD=fio
|
||||
else
|
||||
# download fio binary
|
||||
if [ ! -z "$IPV4_CHECK" ]; then # if IPv4 is enabled
|
||||
curl -s https://raw.githubusercontent.com/masonr/yet-another-bench-script/master/bin/fio_$ARCH -o $DISK_PATH/fio
|
||||
else # no IPv4, use IPv6 - below is necessary since raw.githubusercontent.com has no AAAA record
|
||||
curl -s -k -g --header 'Host: raw.githubusercontent.com' https://[2a04:4e42::133]/masonr/yet-another-bench-script/master/bin/fio_$ARCH -o $DISK_PATH/fio
|
||||
fi
|
||||
chmod +x $DISK_PATH/fio
|
||||
|
||||
FIO_CMD=$DISK_PATH/fio
|
||||
fi
|
||||
chmod +x $DISK_PATH/fio
|
||||
|
||||
echo -en "\r\033[0K"
|
||||
|
||||
# execute disk performance test
|
||||
disk_test
|
||||
|
||||
if [ -z "$DISK_RW4_TEST_R" ]; then # fio was killed or returned an error
|
||||
echo -e "fio disk speed tests failed. Run manually to determine cause."
|
||||
if [ -z "$DISK_RW4_TEST_R" ]; then # fio was killed or returned an error, run dd test instead
|
||||
echo -e "fio disk speed tests failed. Run manually to determine cause.\nRunning dd test as fallback..."
|
||||
|
||||
dd_test
|
||||
|
||||
# format the speed averages by converting to GB/s if > 1000 MB/s
|
||||
if [ $(echo $DISK_WRITE_TEST_AVG | cut -d "." -f 1) -ge 1000 ]; then
|
||||
DISK_WRITE_TEST_AVG=$(awk -v a="$DISK_WRITE_TEST_AVG" 'BEGIN { print a / 1000 }')
|
||||
DISK_WRITE_TEST_UNIT="GB/s"
|
||||
else
|
||||
DISK_WRITE_TEST_UNIT="MB/s"
|
||||
fi
|
||||
if [ $(echo $DISK_READ_TEST_AVG | cut -d "." -f 1) -ge 1000 ]; then
|
||||
DISK_READ_TEST_AVG=$(awk -v a="$DISK_READ_TEST_AVG" 'BEGIN { print a / 1000 }')
|
||||
DISK_READ_TEST_UNIT="GB/s"
|
||||
else
|
||||
DISK_READ_TEST_UNIT="MB/s"
|
||||
fi
|
||||
|
||||
# print dd sequential disk speed test results
|
||||
echo -e
|
||||
echo -e "dd Sequential Disk Speed Tests:"
|
||||
echo -e "---------------------------------"
|
||||
printf "%-6s | %-6s %-4s | %-6s %-4s | %-6s %-4s | %-6s %-4s\n" "" "Test 1" "" "Test 2" "" "Test 3" "" "Avg" ""
|
||||
printf "%-6s | %-6s %-4s | %-6s %-4s | %-6s %-4s | %-6s %-4s\n"
|
||||
printf "%-6s | %-11s | %-11s | %-11s | %-6.2f %-4s\n" "Write" "${DISK_WRITE_TEST_RES[0]}" "${DISK_WRITE_TEST_RES[1]}" "${DISK_WRITE_TEST_RES[2]}" "${DISK_WRITE_TEST_AVG}" "${DISK_WRITE_TEST_UNIT}"
|
||||
printf "%-6s | %-11s | %-11s | %-11s | %-6.2f %-4s\n" "Read" "${DISK_READ_TEST_RES[0]}" "${DISK_READ_TEST_RES[1]}" "${DISK_READ_TEST_RES[2]}" "${DISK_READ_TEST_AVG}" "${DISK_READ_TEST_UNIT}"
|
||||
else # fio tests completed sucessfully, print results
|
||||
|
||||
# print disk speed test results
|
||||
echo -e "fio Disk Speed Tests (Mixed R/W 50/50):"
|
||||
echo -e "---------------------------------"
|
||||
@ -302,7 +412,7 @@ function iperf_test {
|
||||
# run the iperf test sending data from the host to the iperf server; includes
|
||||
# a timeout of 15s in case the iperf server is not responding; uses 8 parallel
|
||||
# threads for the network test
|
||||
IPERF_RUN_SEND="$(timeout 15 $IPERF_PATH/iperf3 $FLAGS -c $URL -p $PORT -P 8 2> /dev/null)"
|
||||
IPERF_RUN_SEND="$(timeout 15 $IPERF_CMD $FLAGS -c $URL -p $PORT -P 8 2> /dev/null)"
|
||||
# check if iperf exited cleanly and did not return an error
|
||||
if [[ "$IPERF_RUN_SEND" == *"receiver"* && "$IPERF_RUN_SEND" != *"error"* ]]; then
|
||||
# test did not result in an error, parse speed result
|
||||
@ -330,7 +440,7 @@ function iperf_test {
|
||||
# run the iperf test recieving data from the iperf server to the host; includes
|
||||
# a timeout of 15s in case the iperf server is not responding; uses 8 parallel
|
||||
# threads for the network test
|
||||
IPERF_RUN_RECV="$(timeout 15 $IPERF_PATH/iperf3 $FLAGS -c $URL -p $PORT -P 8 -R 2> /dev/null)"
|
||||
IPERF_RUN_RECV="$(timeout 15 $IPERF_CMD $FLAGS -c $URL -p $PORT -P 8 -R 2> /dev/null)"
|
||||
# check if iperf exited cleanly and did not return an error
|
||||
if [[ "$IPERF_RUN_RECV" == *"receiver"* && "$IPERF_RUN_RECV" != *"error"* ]]; then
|
||||
# test did not result in an error, parse speed result
|
||||
@ -388,18 +498,23 @@ function launch_iperf {
|
||||
# if the skip iperf flag was set, skip the network performance test, otherwise test network performance
|
||||
if [ -z "$SKIP_IPERF" ]; then
|
||||
|
||||
# create a temp directory to house the required iperf binary and library
|
||||
IPERF_PATH=$YABS_PATH/iperf
|
||||
mkdir -p $IPERF_PATH
|
||||
if [ ! -z "$LOCAL_IPERF" ]; then # local iperf has been detected, use instead of pre-compiled binary
|
||||
IPERF_CMD=iperf3
|
||||
else
|
||||
# create a temp directory to house the required iperf binary and library
|
||||
IPERF_PATH=$YABS_PATH/iperf
|
||||
mkdir -p $IPERF_PATH
|
||||
|
||||
# download iperf3 binary
|
||||
if [ ! -z "$IPV4_CHECK" ]; then # if IPv4 is enabled
|
||||
curl -s https://raw.githubusercontent.com/masonr/yet-another-bench-script/master/bin/iperf3_$ARCH -o $IPERF_PATH/iperf3
|
||||
else # no IPv4, use IPv6 - below is necessary since raw.githubusercontent.com has no AAAA record
|
||||
curl -s -k -g --header 'Host: raw.githubusercontent.com' https://[2a04:4e42::133]/masonr/yet-another-bench-script/master/bin/iperf3_$ARCH -o $IPERF_PATH/iperf3
|
||||
fi
|
||||
# download iperf3 binary
|
||||
if [ ! -z "$IPV4_CHECK" ]; then # if IPv4 is enabled
|
||||
curl -s https://raw.githubusercontent.com/masonr/yet-another-bench-script/master/bin/iperf3_$ARCH -o $IPERF_PATH/iperf3
|
||||
else # no IPv4, use IPv6 - below is necessary since raw.githubusercontent.com has no AAAA record
|
||||
curl -s -k -g --header 'Host: raw.githubusercontent.com' https://[2a04:4e42::133]/masonr/yet-another-bench-script/master/bin/iperf3_$ARCH -o $IPERF_PATH/iperf3
|
||||
fi
|
||||
|
||||
chmod +x $IPERF_PATH/iperf3
|
||||
chmod +x $IPERF_PATH/iperf3
|
||||
IPERF_CMD=$IPERF_PATH/iperf3
|
||||
fi
|
||||
|
||||
# array containing all currently available iperf3 public servers to use for the network test
|
||||
# format: "1" "2" "3" "4" "5" \
|
||||
@ -412,7 +527,7 @@ if [ -z "$SKIP_IPERF" ]; then
|
||||
"bouygues.iperf.fr" "5200-5209" "Bouygues Telecom" "Paris, FR (10G)" "IPv4|IPv6" \
|
||||
"ping.online.net" "5200-5209" "Online.net" "Paris, FR (10G)" "IPv4" \
|
||||
"ping6.online.net" "5200-5209" "Online.net" "Paris, FR (10G)" "IPv6" \
|
||||
"iperf.worldstream.nl" "5201-5201" "Worldstream" "The Netherlands (10G)" "IPv4|IPv6" \
|
||||
"iperf.worldstream.nl" "5201-5201" "WorldStream" "The Netherlands (10G)" "IPv4|IPv6" \
|
||||
"speedtest.wtnet.de" "5200-5209" "wilhelm.tel" "Hamburg, DE (10G)" "IPv4|IPv6" \
|
||||
"iperf.biznetnetworks.com" "5201-5203" "Biznet" "Bogor, Indonesia (1G)" "IPv4" \
|
||||
"speedtest.hostkey.ru" "5200-5203" "Hostkey" "Moscow, RU (1G)" "IPv4" \
|
||||
@ -420,6 +535,17 @@ if [ -z "$SKIP_IPERF" ]; then
|
||||
"iperf.airstreamcomm.net" "5201-5205" "Airstream Communications" "Eau Claire, WI, US (10G)" "IPv4|IPv6" \
|
||||
"iperf.he.net" "5201-5201" "Hurricane Electric" "Fremont, CA, US (10G)" "IPv4|IPv6" \
|
||||
)
|
||||
|
||||
# if the "REDUCE_NET" flag is activated, then do a shorter iperf test with only three locations
|
||||
# (Online.net, WorldStream, and Hurricane Electric)
|
||||
if [ ! -z "$REDUCE_NET" ]; then
|
||||
IPERF_LOCS=( \
|
||||
"ping.online.net" "5200-5209" "Online.net" "Paris, FR (10G)" "IPv4" \
|
||||
"ping6.online.net" "5200-5209" "Online.net" "Paris, FR (10G)" "IPv6" \
|
||||
"iperf.worldstream.nl" "5201-5201" "WorldStream" "The Netherlands (10G)" "IPv4|IPv6" \
|
||||
"iperf.he.net" "5201-5201" "Hurricane Electric" "Fremont, CA, US (10G)" "IPv4|IPv6" \
|
||||
)
|
||||
fi
|
||||
|
||||
# get the total number of iperf locations (total array size divided by 5 since each location has 5 elements)
|
||||
IPERF_LOCS_NUM=${#IPERF_LOCS[@]}
|
||||
@ -433,21 +559,34 @@ fi
|
||||
|
||||
# if the skip geekbench flag was set, skip the system performance test, otherwise test system performance
|
||||
if [ -z "$SKIP_GEEKBENCH" ]; then
|
||||
echo -en "\nPerforming Geekbench 4 benchmark test. This may take a couple minutes to complete..."
|
||||
|
||||
# create a temp directory to house all geekbench files
|
||||
GEEKBENCH_PATH=$YABS_PATH/geekbench
|
||||
mkdir -p $GEEKBENCH_PATH
|
||||
|
||||
# download the latest Geekbench 4 tarball and extract to geekbench temp directory
|
||||
curl -s http://cdn.geekbench.com/Geekbench-4.3.3-Linux.tar.gz | tar xz --strip-components=1 -C $GEEKBENCH_PATH &>/dev/null
|
||||
if [ -z $GEEKBENCH_4_OVERRIDE ]; then # run Geekbench 5 test
|
||||
if [[ $ARCH = *x86* ]]; then # don't run Geekbench 5 if on 32-bit arch
|
||||
echo -e "\nGeekbench 5 cannot run on 32-bit architectures. Re-run with -4 flag to use"
|
||||
echo -e "Geekbench 4, which can support 32-bit architecutes. Skipping Geekbench."
|
||||
else
|
||||
echo -en "\nPerforming Geekbench 5 benchmark test. This may take a couple minutes to complete..."
|
||||
# download the latest Geekbench 5 tarball and extract to geekbench temp directory
|
||||
curl -s http://cdn.geekbench.com/Geekbench-5.1.0-Linux.tar.gz | tar xz --strip-components=1 -C $GEEKBENCH_PATH &>/dev/null
|
||||
|
||||
if [[ "$ARCH" == *"x86"* ]]; then
|
||||
# run the Geekbench 4 test and grep the test results URL given at the end of the test
|
||||
GEEKBENCH_TEST=$($GEEKBENCH_PATH/geekbench_x86_32 2>/dev/null | grep "https://browser")
|
||||
else
|
||||
# run the Geekbench 4 test and grep the test results URL given at the end of the test
|
||||
GEEKBENCH_TEST=$($GEEKBENCH_PATH/geekbench4 2>/dev/null | grep "https://browser")
|
||||
GEEKBENCH_TEST=$($GEEKBENCH_PATH/geekbench5 2>/dev/null | grep "https://browser")
|
||||
fi
|
||||
else # run Geekbench 4 test
|
||||
echo -en "\nPerforming Geekbench 4 benchmark test. This may take a couple minutes to complete..."
|
||||
# download the latest Geekbench 4 tarball and extract to geekbench temp directory
|
||||
curl -s http://cdn.geekbench.com/Geekbench-4.3.3-Linux.tar.gz | tar xz --strip-components=1 -C $GEEKBENCH_PATH &>/dev/null
|
||||
|
||||
if [[ "$ARCH" == *"x86"* ]]; then
|
||||
# run the Geekbench 4 test and grep the test results URL given at the end of the test
|
||||
GEEKBENCH_TEST=$($GEEKBENCH_PATH/geekbench_x86_32 2>/dev/null | grep "https://browser")
|
||||
else
|
||||
# run the Geekbench 4 test and grep the test results URL given at the end of the test
|
||||
GEEKBENCH_TEST=$($GEEKBENCH_PATH/geekbench4 2>/dev/null | grep "https://browser")
|
||||
fi
|
||||
fi
|
||||
|
||||
# ensure the test ran successfully
|
||||
@ -456,24 +595,27 @@ if [ -z "$SKIP_GEEKBENCH" ]; then
|
||||
# Geekbench 4 test failed to download because host lacks IPv4 (cdn.geekbench.com = IPv4 only)
|
||||
echo -e "\r\033[0KGeekbench releases can only be downloaded over IPv4. FTP the Geekbench files and run manually."
|
||||
else
|
||||
# if the Geekbench 4 test failed for any reason, exit cleanly and print error message
|
||||
echo -e "\r\033[0KGeekbench 4 test failed. Run manually to determine cause."
|
||||
# if the Geekbench test failed for any reason, exit cleanly and print error message
|
||||
[[ -z "$GEEKBENCH_4_OVERRIDE" ]] && echo -e "\r\033[0KGeekbench 5 test failed. Run manually to determine cause." ||
|
||||
echo -e "\r\033[0KGeekbench 4 test failed. Run manually to determine cause."
|
||||
fi
|
||||
else
|
||||
# if the Geekbench 4 test succeeded, parse the test results URL
|
||||
# if the Geekbench test succeeded, parse the test results URL
|
||||
GEEKBENCH_URL=$(echo -e $GEEKBENCH_TEST | head -1)
|
||||
GEEKBENCH_URL_CLAIM=$(echo $GEEKBENCH_URL | awk '{ print $2 }')
|
||||
GEEKBENCH_URL=$(echo $GEEKBENCH_URL | awk '{ print $1 }')
|
||||
# sleep a bit to wait for results to be made available on the geekbench website
|
||||
sleep 10
|
||||
# parse the public results page for the single and multi core geekench scores
|
||||
GEEKBENCH_SCORES=$(curl -s $GEEKBENCH_URL | grep "class='score' rowspan")
|
||||
# parse the public results page for the single and multi core geekbench scores
|
||||
[[ -z "$GEEKBENCH_4_OVERRIDE" ]] && GEEKBENCH_SCORES=$(curl -s $GEEKBENCH_URL | grep "div class='score'") ||
|
||||
GEEKBENCH_SCORES=$(curl -s $GEEKBENCH_URL | grep "class='score' rowspan")
|
||||
GEEKBENCH_SCORES_SINGLE=$(echo $GEEKBENCH_SCORES | awk -v FS="(>|<)" '{ print $3 }')
|
||||
GEEKBENCH_SCORES_MULTI=$(echo $GEEKBENCH_SCORES | awk -v FS="(<|>)" '{ print $7 }')
|
||||
|
||||
# print the Geekbench 4 results
|
||||
# print the Geekbench results
|
||||
echo -en "\r\033[0K"
|
||||
echo -e "Geekbench 4 Benchmark Test:"
|
||||
[[ -z "$GEEKBENCH_4_OVERRIDE" ]] && echo -e "Geekbench 5 Benchmark Test:" ||
|
||||
echo -e "Geekbench 4 Benchmark Test:"
|
||||
echo -e "---------------------------------"
|
||||
printf "%-15s | %-30s\n" "Test" "Value"
|
||||
printf "%-15s | %-30s\n"
|
||||
@ -481,8 +623,8 @@ if [ -z "$SKIP_GEEKBENCH" ]; then
|
||||
printf "%-15s | %-30s\n" "Multi Core" "$GEEKBENCH_SCORES_MULTI"
|
||||
printf "%-15s | %-30s\n" "Full Test" "$GEEKBENCH_URL"
|
||||
|
||||
# write the geekbench 4 claim URL to a file so the user can add the results to their profile (if desired)
|
||||
[ ! -z "$GEEKBENCH_URL_CLAIM" ] && echo -e "$GEEKBENCH_URL_CLAIM" > geekbench4_claim.url 2> /dev/null
|
||||
# write the geekbench claim URL to a file so the user can add the results to their profile (if desired)
|
||||
[ ! -z "$GEEKBENCH_URL_CLAIM" ] && echo -e "$GEEKBENCH_URL_CLAIM" > geekbench_claim.url 2> /dev/null
|
||||
fi
|
||||
fi
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user