mirror of
https://github.com/masonr/yet-another-bench-script.git
synced 2025-04-19 08:55:15 +00:00
added options to skip any test(s)
This commit is contained in:
parent
eb0703500a
commit
9499aac6f7
17
README.md
17
README.md
@ -10,7 +10,22 @@ This script isn't an attempt to be a golden standard. It's just yet another benc
|
|||||||
|
|
||||||
`curl -s https://raw.githubusercontent.com/masonr/yet-another-bench-script/master/yabs.sh | bash`
|
`curl -s https://raw.githubusercontent.com/masonr/yet-another-bench-script/master/yabs.sh | bash`
|
||||||
|
|
||||||
This script has been tested on CentOS 7, Debian 9, Debian 10, Fedora 30, Ubuntu 16.04, and Ubuntu 18.04. It is designed to not require any external dependencies nor elevated privileges.
|
This script has been tested on CentOS 7, Debian 9, Debian 10, Fedora 30, Ubuntu 16.04, and Ubuntu 18.04. It is designed to not require any external dependencies to be installed nor elevated privileges.
|
||||||
|
|
||||||
|
### Skipping Tests
|
||||||
|
|
||||||
|
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 https://raw.githubusercontent.com/masonr/yet-another-bench-script/master/yabs.sh -o yabs.sh; chmod +x yabs.sh
|
||||||
|
./yabs.sh -{dig}
|
||||||
|
```
|
||||||
|
|
||||||
|
* `-d` this option disables the dd (disk performance) test
|
||||||
|
* `-i` this option disables the iperf (network performance) test
|
||||||
|
* `-g` this option disables the Geekbench (system performance) test
|
||||||
|
|
||||||
|
Options can be grouped together to skip multiple tests, i.e. `./yabs -dg` to skip the dd and Geekbench tests (effectively only performing the iperf test).
|
||||||
|
|
||||||
## Tests Conducted
|
## Tests Conducted
|
||||||
|
|
||||||
|
103
yabs.sh
103
yabs.sh
@ -34,7 +34,18 @@ DATE=`date -Iseconds | sed -e "s/:/_/g"`
|
|||||||
YABS_PATH=/tmp/$DATE/
|
YABS_PATH=/tmp/$DATE/
|
||||||
mkdir -p $YABS_PATH
|
mkdir -p $YABS_PATH
|
||||||
|
|
||||||
echo -e "Performing dd disk performance test. This may take a couple minutes to complete..."
|
SKIP_DD=""
|
||||||
|
SHIP_IPERF=""
|
||||||
|
SKIP_GEEKBENCH=""
|
||||||
|
|
||||||
|
while getopts 'dig' flag; do
|
||||||
|
case "${flag}" in
|
||||||
|
d) SKIP_DD="True" ;;
|
||||||
|
i) SKIP_IPERF="True" ;;
|
||||||
|
g) SKIP_GEEKBENCH="True" ;;
|
||||||
|
*) exit 1 ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
function dd_test {
|
function dd_test {
|
||||||
I=0
|
I=0
|
||||||
@ -65,8 +76,11 @@ function dd_test {
|
|||||||
DD_READ_TEST_AVG=$(awk -v a="$DD_READ_TEST_AVG" 'BEGIN { print a / 3 }')
|
DD_READ_TEST_AVG=$(awk -v a="$DD_READ_TEST_AVG" 'BEGIN { print a / 3 }')
|
||||||
}
|
}
|
||||||
|
|
||||||
touch $DATE.test 2> /dev/null
|
if [ -z "$SKIP_DD" ]; then
|
||||||
if [ -f "$DATE.test" ]; then
|
echo -e "Performing dd disk performance test. This may take a couple minutes to complete..."
|
||||||
|
|
||||||
|
touch $DATE.test 2> /dev/null
|
||||||
|
if [ -f "$DATE.test" ]; then
|
||||||
dd_test
|
dd_test
|
||||||
rm $DATE.test
|
rm $DATE.test
|
||||||
|
|
||||||
@ -91,17 +105,12 @@ if [ -f "$DATE.test" ]; then
|
|||||||
printf "%-6s | %-10s | %-10s | %-10s | %-10s\n" "Write" "${DD_WRITE_TEST_RES[0]}" "${DD_WRITE_TEST_RES[1]}" "${DD_WRITE_TEST_RES[2]}" "${DD_WRITE_TEST_AVG} ${DD_WRITE_TEST_UNIT}"
|
printf "%-6s | %-10s | %-10s | %-10s | %-10s\n" "Write" "${DD_WRITE_TEST_RES[0]}" "${DD_WRITE_TEST_RES[1]}" "${DD_WRITE_TEST_RES[2]}" "${DD_WRITE_TEST_AVG} ${DD_WRITE_TEST_UNIT}"
|
||||||
printf "%-6s | %-10s | %-10s | %-10s | %-10s\n" "Read*" "${DD_READ_TEST_RES[0]}" "${DD_READ_TEST_RES[1]}" "${DD_READ_TEST_RES[2]}" "${DD_READ_TEST_AVG} ${DD_READ_TEST_UNIT}"
|
printf "%-6s | %-10s | %-10s | %-10s | %-10s\n" "Read*" "${DD_READ_TEST_RES[0]}" "${DD_READ_TEST_RES[1]}" "${DD_READ_TEST_RES[2]}" "${DD_READ_TEST_AVG} ${DD_READ_TEST_UNIT}"
|
||||||
|
|
||||||
else
|
else
|
||||||
echo -en "\e[1A"; echo -e "\e[0K\r"
|
echo -en "\e[1A"; echo -e "\e[0K\r"
|
||||||
echo -e "You do not have write permission in this directory\nSwitch to a different directory to test disk speed.\nSkipping dd tests."
|
echo -e "You do not have write permission in this directory\nSwitch to a different directory to test disk speed.\nSkipping dd tests."
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
IPERF_PATH=$YABS_PATH/iperf
|
|
||||||
mkdir -p $IPERF_PATH
|
|
||||||
curl -s -o $IPERF_PATH/libiperf.so.0 https://iperf.fr/download/ubuntu/libiperf.so.0_3.1.3 > /dev/null
|
|
||||||
curl -s -o $IPERF_PATH/iperf3 https://iperf.fr/download/ubuntu/iperf3_3.1.3 > /dev/null
|
|
||||||
chmod +x $IPERF_PATH/iperf3
|
|
||||||
|
|
||||||
function iperf_test {
|
function iperf_test {
|
||||||
URL=$1
|
URL=$1
|
||||||
PORTS=$2
|
PORTS=$2
|
||||||
@ -161,13 +170,20 @@ function launch_iperf {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
PING_FLAG=$(man ping | grep -- " -4")
|
if [ -z "$SKIP_IPERF" ]; then
|
||||||
[ -z "$PING_FLAG" ] && IPV4_CHECK=$(ping -c 1 -W 4 google.com) || IPV4_CHECK=$(ping -c 1 -W 4 -4 google.com)
|
IPERF_PATH=$YABS_PATH/iperf
|
||||||
[[ "$IPV4_CHECK" == *"1 received"* ]] && IPV4_CHECK="True" || IPV4_CHECK=""
|
mkdir -p $IPERF_PATH
|
||||||
[ -z "$PING_FLAG" ] && IPV6_CHECK=$(ping6 -c 1 -W 4 ipv6.google.com) || IPV6_CHECK=$(ping -c 1 -W 4 -6 ipv6.google.com)
|
curl -s -o $IPERF_PATH/libiperf.so.0 https://iperf.fr/download/ubuntu/libiperf.so.0_3.1.3 > /dev/null
|
||||||
[[ "$IPV6_CHECK" == *"1 received"* ]] && IPV6_CHECK="True" || IPV6_CHECK=""
|
curl -s -o $IPERF_PATH/iperf3 https://iperf.fr/download/ubuntu/iperf3_3.1.3 > /dev/null
|
||||||
|
chmod +x $IPERF_PATH/iperf3
|
||||||
|
|
||||||
IPERF_LOCS=( \
|
PING_FLAG=$(man ping | grep -- " -4")
|
||||||
|
[ -z "$PING_FLAG" ] && IPV4_CHECK=$(ping -c 1 -W 4 google.com 2> /dev/null) || IPV4_CHECK=$(ping -c 1 -W 4 -4 google.com 2> /dev/null)
|
||||||
|
[[ "$IPV4_CHECK" == *"1 received"* ]] && IPV4_CHECK="True" || IPV4_CHECK=""
|
||||||
|
[ -z "$PING_FLAG" ] && IPV6_CHECK=$(ping6 -c 1 -W 4 ipv6.google.com 2> /dev/null) || IPV6_CHECK=$(ping -c 1 -W 4 -6 ipv6.google.com 2> /dev/null)
|
||||||
|
[[ "$IPV6_CHECK" == *"1 received"* ]] && IPV6_CHECK="True" || IPV6_CHECK=""
|
||||||
|
|
||||||
|
IPERF_LOCS=( \
|
||||||
"bouygues.iperf.fr" "5200-5209" "Bouygues Telecom" "Paris, FR (10G)" "IPv4|IPv6" \
|
"bouygues.iperf.fr" "5200-5209" "Bouygues Telecom" "Paris, FR (10G)" "IPv4|IPv6" \
|
||||||
"ping.online.net" "5200-5209" "Online.net" "Paris, FR (10G)" "IPv4" \
|
"ping.online.net" "5200-5209" "Online.net" "Paris, FR (10G)" "IPv4" \
|
||||||
"ping6.online.net" "5200-5209" "Online.net" "Paris, FR (10G)" "IPv6" \
|
"ping6.online.net" "5200-5209" "Online.net" "Paris, FR (10G)" "IPv6" \
|
||||||
@ -179,37 +195,40 @@ IPERF_LOCS=( \
|
|||||||
"iperf3.velocityonline.net" "5201-5210" "Velocity Online" "Tallahassee, FL, US (1G)" "IPv4" \
|
"iperf3.velocityonline.net" "5201-5210" "Velocity Online" "Tallahassee, FL, US (1G)" "IPv4" \
|
||||||
"iperf.airstreamcomm.net" "5201-5205" "Airstream Communications" "Eau Claire, WI, US (10G)" "IPv4|IPv6" \
|
"iperf.airstreamcomm.net" "5201-5205" "Airstream Communications" "Eau Claire, WI, US (10G)" "IPv4|IPv6" \
|
||||||
"iperf.he.net" "5201-5201" "Hurricane Electric" "Fremont, CA, US (1G)" "IPv4|IPv6" \
|
"iperf.he.net" "5201-5201" "Hurricane Electric" "Fremont, CA, US (1G)" "IPv4|IPv6" \
|
||||||
)
|
)
|
||||||
|
|
||||||
IPERF_LOCS_NUM=${#IPERF_LOCS[@]}
|
IPERF_LOCS_NUM=${#IPERF_LOCS[@]}
|
||||||
IPERF_LOCS_NUM=$((IPERF_LOCS_NUM / 5))
|
IPERF_LOCS_NUM=$((IPERF_LOCS_NUM / 5))
|
||||||
|
|
||||||
[ -z "$IPv4_CHECK" ] && launch_iperf "IPv4"
|
[ -z "$IPv4_CHECK" ] && launch_iperf "IPv4"
|
||||||
[ -z "$IPv6_CHECK" ] && launch_iperf "IPv6"
|
[ -z "$IPv6_CHECK" ] && launch_iperf "IPv6"
|
||||||
|
fi
|
||||||
|
|
||||||
echo -e "Performing Geekbench 4 benchmark test. This may take a couple minutes to complete..."
|
if [ -z "$SKIP_GEEKBENCH" ]; then
|
||||||
|
echo -e "Performing Geekbench 4 benchmark test. This may take a couple minutes to complete..."
|
||||||
|
|
||||||
GEEKBENCH_PATH=$YABS_PATH/geekbench
|
GEEKBENCH_PATH=$YABS_PATH/geekbench
|
||||||
mkdir -p $GEEKBENCH_PATH
|
mkdir -p $GEEKBENCH_PATH
|
||||||
curl -s http://cdn.geekbench.com/Geekbench-4.3.3-Linux.tar.gz | tar xz --strip-components=1 -C $GEEKBENCH_PATH
|
curl -s http://cdn.geekbench.com/Geekbench-4.3.3-Linux.tar.gz | tar xz --strip-components=1 -C $GEEKBENCH_PATH
|
||||||
GEEKBENCH_TEST=$($GEEKBENCH_PATH/geekbench4 | grep "https://browser")
|
GEEKBENCH_TEST=$($GEEKBENCH_PATH/geekbench4 | grep "https://browser")
|
||||||
GEEKBENCH_URL=$(echo -e $GEEKBENCH_TEST | head -1)
|
GEEKBENCH_URL=$(echo -e $GEEKBENCH_TEST | head -1)
|
||||||
GEEKBENCH_URL_CLAIM=$(echo $GEEKBENCH_URL | awk '{ print $2 }')
|
GEEKBENCH_URL_CLAIM=$(echo $GEEKBENCH_URL | awk '{ print $2 }')
|
||||||
GEEKBENCH_URL=$(echo $GEEKBENCH_URL | awk '{ print $1 }')
|
GEEKBENCH_URL=$(echo $GEEKBENCH_URL | awk '{ print $1 }')
|
||||||
sleep 10
|
sleep 10
|
||||||
GEEKBENCH_SCORES=$(curl -s $GEEKBENCH_URL | grep "class='score' rowspan")
|
GEEKBENCH_SCORES=$(curl -s $GEEKBENCH_URL | grep "class='score' rowspan")
|
||||||
GEEKBENCH_SCORES_SINGLE=$(echo $GEEKBENCH_SCORES | awk -v FS="(>|<)" '{ print $3 }')
|
GEEKBENCH_SCORES_SINGLE=$(echo $GEEKBENCH_SCORES | awk -v FS="(>|<)" '{ print $3 }')
|
||||||
GEEKBENCH_SCORES_MULTI=$(echo $GEEKBENCH_SCORES | awk -v FS="(<|>)" '{ print $7 }')
|
GEEKBENCH_SCORES_MULTI=$(echo $GEEKBENCH_SCORES | awk -v FS="(<|>)" '{ print $7 }')
|
||||||
|
|
||||||
echo -en "\e[1A"; echo -e "\e[0K\r"
|
echo -en "\e[1A"; echo -e "\e[0K\r"
|
||||||
echo -e "Geekbench 4 Benchmark Test:"
|
echo -e "Geekbench 4 Benchmark Test:"
|
||||||
echo -e "---------------------------------"
|
echo -e "---------------------------------"
|
||||||
printf "%-15s | %-30s\n" "Test" "Value"
|
printf "%-15s | %-30s\n" "Test" "Value"
|
||||||
printf "%-15s | %-30s\n"
|
printf "%-15s | %-30s\n"
|
||||||
printf "%-15s | %-30s\n" "Single Core" "$GEEKBENCH_SCORES_SINGLE"
|
printf "%-15s | %-30s\n" "Single Core" "$GEEKBENCH_SCORES_SINGLE"
|
||||||
printf "%-15s | %-30s\n" "Multi Core" "$GEEKBENCH_SCORES_MULTI"
|
printf "%-15s | %-30s\n" "Multi Core" "$GEEKBENCH_SCORES_MULTI"
|
||||||
printf "%-15s | %-30s\n" "Full Test" "$GEEKBENCH_URL"
|
printf "%-15s | %-30s\n" "Full Test" "$GEEKBENCH_URL"
|
||||||
[ ! -z "$GEEKBENCH_URL_CLAIM" ] && echo -e "$GEEKBENCH_URL_CLAIM" > geekbench4_claim.url 2> /dev/null
|
[ ! -z "$GEEKBENCH_URL_CLAIM" ] && echo -e "$GEEKBENCH_URL_CLAIM" > geekbench4_claim.url 2> /dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
echo -e
|
echo -e
|
||||||
rm -rf /tmp/$DATE
|
rm -rf /tmp/$DATE
|
||||||
|
Loading…
x
Reference in New Issue
Block a user