added fix for dd tests on centos; use awk for arithmetic ops

This commit is contained in:
Mason Rowe 2019-10-06 00:55:18 -04:00
parent 0bc678933d
commit 397fb313ef
2 changed files with 15 additions and 10 deletions

View File

@ -10,11 +10,13 @@ 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`
Script has been tested on: CentOS 7, Debian 9, Debian 10, Fedora 30, Ubuntu 16.04, Ubuntu 18.04
## Tests Conducted
* **dd** - the dd utility is utilized to test disk performance. Both write and read speeds are evaluated by writing to and reading from a test file. __\*Disclaimer__: read speeds may be heavily influenced by cache depending on configuration of the host.
* **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 meastures 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 be compare 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 4** - Geekbench is a benchmarking program that meastures 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.
## Example Output

21
yabs.sh
View File

@ -42,23 +42,26 @@ function dd_test {
DD_READ_TEST_RES=()
DD_WRITE_TEST_AVG=0
DD_READ_TEST_AVG=0
OS=$(awk -F= '/^NAME/{print $2}' /etc/os-release)
while [ $I -lt 3 ]
do
DD_WRITE_TEST=$(dd if=/dev/zero of=$DATE.test bs=64k count=16k oflag=direct |& grep copied | awk '{ print $10 " " $11 }')
DD_WRITE_TEST=$(dd if=/dev/zero of=$DATE.test bs=64k count=16k oflag=direct |& grep copied)
[[ "$OS" == *"CentOS"* ]] && DD_WRITE_TEST=$(echo $DD_WRITE_TEST | awk '{ print $8 " " $9 }') || DD_WRITE_TEST=$(echo $DD_WRITE_TEST | awk '{ print $10 " " $11 }')
DD_WRITE_TEST_RES+=( "$DD_WRITE_TEST" )
VAL=$(echo $DD_WRITE_TEST | cut -d " " -f 1 | cut -d "." -f 1)
DD_WRITE_TEST_AVG=$(( DD_WRITE_TEST_AVG + VAL ))
VAL=$(echo $DD_WRITE_TEST | cut -d " " -f 1)
DD_WRITE_TEST_AVG=$(awk -v a="$DD_WRITE_TEST_AVG" -v b="$VAL" 'BEGIN { print a + b }')
DD_READ_TEST=$(dd if=$DATE.test of=/dev/null bs=64k |& grep copied | awk '{ print $10 " " $11 }')
DD_READ_TEST=$(dd if=$DATE.test of=/dev/null bs=64k |& grep copied)
[[ "$OS" == *"CentOS"* ]] && DD_READ_TEST=$(echo $DD_READ_TEST | awk '{ print $8 " " $9 }') || DD_READ_TEST=$(echo $DD_READ_TEST | awk '{ print $10 " " $11 }')
DD_READ_TEST_RES+=( "$DD_READ_TEST" )
VAL=$(echo $DD_READ_TEST | cut -d " " -f 1 | cut -d "." -f 1)
DD_READ_TEST_AVG=$(( DD_READ_TEST_AVG + VAL ))
VAL=$(echo $DD_READ_TEST | cut -d " " -f 1)
DD_READ_TEST_AVG=$(awk -v a="$DD_READ_TEST_AVG" -v b="$VAL" 'BEGIN { print a + b }')
I=$(( $I + 1 ))
done
DD_WRITE_TEST_AVG=$((DD_WRITE_TEST_AVG/3))
DD_WRITE_TEST_AVG=$(awk -v a="$DD_WRITE_TEST_AVG" 'BEGIN { print a / 3 }')
DD_WRITE_TEST_UNIT=$(echo $DD_WRITE_TEST | awk '{ print $2 }')
DD_READ_TEST_AVG=$((DD_READ_TEST_AVG/3))
DD_READ_TEST_AVG=$(awk -v a="$DD_READ_TEST_AVG" 'BEGIN { print a / 3 }')
DD_READ_TEST_UNIT=$(echo $DD_READ_TEST | awk '{ print $2 }')
}
@ -171,7 +174,7 @@ GEEKBENCH_SCORES_SINGLE=$(echo $GEEKBENCH_SCORES | awk -v FS="(>|<)" '{ print $3
GEEKBENCH_SCORES_MULTI=$(echo $GEEKBENCH_SCORES | awk -v FS="(<|>)" '{ print $7 }')
echo -en "\e[1A"; echo -e "\e[0K\r"
echo -e "Geekbench 4 CPU Performance Test:"
echo -e "Geekbench 4 Benchmark Test:"
echo -e "---------------------------------"
printf "%-15s | %-30s\n" "Test" "Value"
printf "%-15s | %-30s\n"