Improve the benchmark scripts

This commit is contained in:
12b 2021-01-11 00:40:11 +01:00
parent c69eab70c8
commit aba79ffca4
6 changed files with 228 additions and 101 deletions

48
bin/disk-test.sh Executable file
View file

@ -0,0 +1,48 @@
#!/bin/bash
if [[ $# -lt 3 ]] ; then
echo "\\o/"
echo "Not enough arguments supplied" >&2
echo "You need to pass a log file name to store the test results, the disk space to use and the number of files to use " >&2
echo " |" >&2
echo "syntax: " >&2
echo " $(basename $0) <log file name> <test disk space> <test file num>" >&2
echo "example: " >&2
echo " $(basename $0) test.log 64G 512 " >&2
echo "/!\\" >&2
exit 1
fi
LOGFILE=$1
TEST_DISK_SPACE=$2
TEST_FILE_NUM=$3
#FILE_IO_MODE=async
FILE_IO_MODE=sync
THREADS=8
#BLOCK_SIZE=16384
BLOCK_SIZE=1048576
#BLOCK_SIZE=4194304
echo ' '
echo "#### Disk test ####" | tee -a $LOGFILE
BLOCK_DEVICES=$(lsblk | grep -v loop | grep disk | cut -f1 -d ' ')
for d in $BLOCK_DEVICES
do
echo "# block device /dev/$d => hdparm -tT #" | tee -a $LOGFILE
sudo hdparm -tT /dev/$d 2>&1 | tee -a $LOGFILE
sudo hdparm -tT /dev/$d 2>&1 | tee -a $LOGFILE
sudo hdparm -tT /dev/$d 2>&1 | tee -a $LOGFILE
done
/usr/local/bin/sysbench fileio prepare --file-num=$TEST_FILE_NUM --file-total-size=$TEST_DISK_SPACE 2>&1 | tee -a $LOGFILE
echo "# sysbench random read/write test in current directory #" | tee -a $LOGFILE
/usr/local/bin/sysbench fileio run --threads=$THREADS --file-test-mode=rndrw --file-block-size=$BLOCK_SIZE --file-io-mode=$FILE_IO_MODE --file-num=$TEST_FILE_NUM --file-total-size=$TEST_DISK_SPACE --file-rw-ratio=2 2>&1 | tee -a $LOGFILE
/usr/local/bin/sysbench fileio prepare --file-num=$TEST_FILE_NUM --file-total-size=$TEST_DISK_SPACE 2>&1 | tee -a $LOGFILE
echo "# sysbench sequential read test in current directory #" | tee -a $LOGFILE
/usr/local/bin/sysbench fileio run --threads=$THREADS --file-test-mode=seqrd --file-block-size=$BLOCK_SIZE --file-io-mode=$FILE_IO_MODE --file-num=$TEST_FILE_NUM --file-total-size=$TEST_DISK_SPACE 2>&1 | tee -a $LOGFILE
/usr/local/bin/sysbench fileio prepare --file-num=$TEST_FILE_NUM --file-total-size=$TEST_DISK_SPACE 2>&1 | tee -a $LOGFILE
echo "# sysbench sequential write test in current directory #" | tee -a $LOGFILE
/usr/local/bin/sysbench fileio run --threads=$THREADS --file-test-mode=seqwr --file-block-size=$BLOCK_SIZE --file-io-mode=async --file-num=$TEST_FILE_NUM --file-total-size=$TEST_DISK_SPACE 2>&1 | tee -a $LOGFILE
/usr/local/bin/sysbench fileio cleanup --file-num=$TEST_FILE_NUM --file-total-size=$TEST_DISK_SPACE 2>&1 | tee -a $LOGFILE

View file

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
apt -y install make automake libtool pkg-config libaio-dev libssl-dev apt -y install make automake libtool pkg-config libaio-dev libssl-dev smartmontools hdparm nvme-cli
#apt -y install libmysqlclient-dev #apt -y install libmysqlclient-dev
apt -y install libmariadb-dev libmariadb-dev-compat apt -y install libmariadb-dev libmariadb-dev-compat
apt -y install libpq-dev apt -y install libpq-dev

View file

@ -1,95 +0,0 @@
#!/bin/bash
if [[ $# -lt 1 ]] ; then
echo "\\o/"
echo "Not enough arguments supplied" >&2
echo "You need to pass a name to store the test results" >&2
echo " |" >&2
echo "syntax: " >&2
echo " $(basename $0) <test-name> " >&2
echo "example: " >&2
echo " $(basename $0) odroid-h2+-emmc " >&2
echo "/!\\" >&2
exit 1
fi
LOGFILE="test_$1_$(date '+%Y-%m-%d_%H-%M-%S').log"
echo ' '
echo "#### Starting benchmark ####" | tee $LOGFILE
echo TS=$(date --rfc-3339=ns) | tee -a $LOGFILE
echo ' ' | tee -a $LOGFILE
sensors 2>&1 | tee -a $LOGFILE
echo ' ' | tee -a $LOGFILE
echo "### Sleeping for a 3 minutes cooldown period ###" | tee -a $LOGFILE
echo "!!! Stop all other activities on the machine until the end of the test to avoid biasing the benchmark results !!!"
sleep 3m
echo ' ' | tee -a $LOGFILE
echo "#### Cold test - CPU ####" | tee -a $LOGFILE
sensors 2>&1 | tee -a $LOGFILE
/usr/local/bin/sysbench cpu run --threads=8 2>&1 | tee -a $LOGFILE
sensors 2>&1 | tee -a $LOGFILE
echo ' ' | tee -a $LOGFILE
echo "### Sleeping for a 3 minutes cooldown period ###" | tee -a $LOGFILE
sleep 3m
echo ' ' | tee -a $LOGFILE
echo "#### Cold test - RAM ####" | tee -a $LOGFILE
sensors 2>&1 | tee -a $LOGFILE
/usr/local/bin/sysbench memory run --threads=8 2>&1 | tee -a $LOGFILE
sensors 2>&1 | tee -a $LOGFILE
echo ' ' | tee -a $LOGFILE
echo "### Sleeping for a 3 minutes cooldown period ###" | tee -a $LOGFILE
sleep 3m
echo ' ' | tee -a $LOGFILE
echo "#### cold test - disk ####" | tee -a $LOGFILE
/usr/local/bin/sysbench fileio prepare 2>&1 | tee -a $LOGFILE
sensors 2>&1 | tee -a $LOGFILE
/usr/local/bin/sysbench fileio run --threads=4 --file-test-mode=rndrw --file-io-mode=async 2>&1 | tee -a $LOGFILE
sensors 2>&1 | tee -a $LOGFILE
/usr/local/bin/sysbench fileio cleanup 2>&1 | tee -a $LOGFILE
echo ' ' | tee -a $LOGFILE
echo "### Stressing the CPU for a 10 minutes warmup period ###" | tee -a $LOGFILE
sensors 2>&1 | tee -a $LOGFILE
for i in {1..10}
do
/usr/local/bin/sysbench cpu run --threads=8 --time=60 2>&1 | tee -a $LOGFILE
sensors 2>&1 | tee -a $LOGFILE
done
echo ' ' | tee -a $LOGFILE
echo "#### Hot test - CPU ####" | tee -a $LOGFILE
/usr/local/bin/sysbench cpu run --threads=8 2>&1 | tee -a $LOGFILE
sensors 2>&1 | tee -a $LOGFILE
echo ' ' | tee -a $LOGFILE
echo "#### Hot test - RAM ####" | tee -a $LOGFILE
/usr/local/bin/sysbench memory run --threads=8 2>&1 | tee -a $LOGFILE
sensors 2>&1 | tee -a $LOGFILE
echo ' ' | tee -a $LOGFILE
echo "#### Hot test - disk ####" | tee -a $LOGFILE
/usr/local/bin/sysbench fileio prepare 2>&1 | tee -a $LOGFILE
sensors 2>&1 | tee -a $LOGFILE
/usr/local/bin/sysbench fileio run --threads=4 --file-test-mode=rndrw --file-io-mode=async 2>&1 | tee -a $LOGFILE
sensors 2>&1 | tee -a $LOGFILE
/usr/local/bin/sysbench fileio cleanup 2>&1 | tee -a $LOGFILE
echo ' ' | tee -a $LOGFILE
echo "#### Continue stressing CPU to consume power for a while ####" | tee -a $LOGFILE
sensors 2>&1 | tee -a $LOGFILE
for i in {1..6}
do
/usr/local/bin/sysbench cpu run --threads=8 --time=300 2>&1 | tee -a $LOGFILE
sensors 2>&1 | tee -a $LOGFILE
done
echo ' ' | tee -a $LOGFILE
echo TS=$(date --rfc-3339=ns) | tee -a $LOGFILE
echo "#### Tests complete ####" | tee -a $LOGFILE

110
bin/run-full-benchmark.sh Executable file
View file

@ -0,0 +1,110 @@
#!/bin/bash
TEST_DISK_SPACE="64G"
TEST_FILE_NUM=512
COOL_DOWN_TIME="3m"
WARMUP_TIME=600
if [[ $# -lt 1 ]] ; then
echo "\\o/"
echo "Not enough arguments supplied" >&2
echo "You need to pass a name to store the test results" >&2
echo " |" >&2
echo "syntax: " >&2
echo " $(basename $0) <test-name> " >&2
echo "example: " >&2
echo " $(basename $0) odroid-h2+-emmc " >&2
echo "/!\\" >&2
exit 1
fi
LOGFILE="full_test_$1_$(hostname)-$(date '+%Y-%m-%d_%H-%M-%S').log"
echo ' '
echo "#### Starting benchmark ####" | tee $LOGFILE
echo TS=$(date --rfc-3339=ns) | tee -a $LOGFILE
echo TEST_DISK_SPACE=$TEST_DISK_SPACE | tee -a $LOGFILE
echo TEST_FILE_NUM=$TEST_FILE_NUM | tee -a $LOGFILE
echo COOL_DOWN_TIME=$COOL_DOWN_TIME | tee -a $LOGFILE
echo WARMUP_TIME=$WARMUP_TIME | tee -a $LOGFILE
echo ' ' | tee -a $LOGFILE
sensors 2>&1 | tee -a $LOGFILE
echo ' ' | tee -a $LOGFILE
echo "### System information ###" | tee -a $LOGFILE
echo "# uname -a #" | tee -a $LOGFILE
uname -a | tee -a $LOGFILE
echo "# /proc/version #" | tee -a $LOGFILE
cat /proc/version | tee -a $LOGFILE
echo "# /proc/meminfo #" | tee -a $LOGFILE
grep MemTotal /proc/meminfo | tee -a $LOGFILE
echo "# /proc/cpuinfo #" | tee -a $LOGFILE
cat /proc/cpuinfo | tee -a $LOGFILE
echo "# Block devices #" | tee -a $LOGFILE
lsblk | grep -v loop | tee -a $LOGFILE
echo "# df --block-size=G $(pwd) #" | tee -a $LOGFILE
df --block-size=G $(pwd) | tee -a $LOGFILE
BLOCK_DEVICES=$(lsblk | grep -v loop | grep disk | cut -f1 -d ' ')
for d in $BLOCK_DEVICES
do
echo "# block device /dev/$d => hdparm -Iv #" | tee -a $LOGFILE
sudo hdparm -Iv /dev/$d 2>&1 | tee -a $LOGFILE
echo "# block device /dev/$d => smartctl --all #" | tee -a $LOGFILE
sudo smartctl --all /dev/$d
done
echo ' ' | tee -a $LOGFILE
echo "### Sleeping for a $COOL_DOWN_TIME cooldown period ###" | tee -a $LOGFILE
echo "!!! Stop all other activities on the machine until the end of the test to avoid biasing the benchmark results !!!"
sleep $COOL_DOWN_TIME
echo ' ' | tee -a $LOGFILE
echo "#### Cold test - CPU ####" | tee -a $LOGFILE
sensors 2>&1 | tee -a $LOGFILE
/usr/local/bin/sysbench cpu run --threads=8 2>&1 | tee -a $LOGFILE
sensors 2>&1 | tee -a $LOGFILE
echo ' ' | tee -a $LOGFILE
echo "### Sleeping for a $COOL_DOWN_TIME cooldown period ###" | tee -a $LOGFILE
sleep $COOL_DOWN_TIME
echo ' ' | tee -a $LOGFILE
echo "#### Cold test - RAM ####" | tee -a $LOGFILE
sensors 2>&1 | tee -a $LOGFILE
/usr/local/bin/sysbench memory run --threads=8 2>&1 | tee -a $LOGFILE
sensors 2>&1 | tee -a $LOGFILE
echo ' ' | tee -a $LOGFILE
echo "### Sleeping for a $COOL_DOWN_TIME cooldown period ###" | tee -a $LOGFILE
sleep $COOL_DOWN_TIME
echo calling $(dirname $0)/disk-test.sh $LOGFILE $TEST_DISK_SPACE $TEST_FILE_NUM | tee -a $LOGFILE
$(dirname $0)/disk-test.sh $LOGFILE $TEST_DISK_SPACE $TEST_FILE_NUM
echo ' ' | tee -a $LOGFILE
echo "### Stressing the CPU for a $WARMUP_TIME seconds warmup period ###" | tee -a $LOGFILE
sensors 2>&1 | tee -a $LOGFILE
/usr/local/bin/sysbench cpu run --threads=8 --time=$WARMUP_TIME --report-interval=10 2>&1 | tee -a $LOGFILE
sensors 2>&1 | tee -a $LOGFILE
echo ' ' | tee -a $LOGFILE
echo "#### Hot test - CPU ####" | tee -a $LOGFILE
/usr/local/bin/sysbench cpu run --threads=8 2>&1 | tee -a $LOGFILE
sensors 2>&1 | tee -a $LOGFILE
echo ' ' | tee -a $LOGFILE
echo "#### Hot test - RAM ####" | tee -a $LOGFILE
/usr/local/bin/sysbench memory run --threads=8 2>&1 | tee -a $LOGFILE
sensors 2>&1 | tee -a $LOGFILE
echo ' ' | tee -a $LOGFILE
echo "#### Continue stressing CPU to consume power for a while ####" | tee -a $LOGFILE
for i in {1..6}
do
/usr/local/bin/sysbench cpu run --threads=8 --time=300 --report-interval=30 2>&1 | tee -a $LOGFILE
sensors 2>&1 | tee -a $LOGFILE
done
echo ' ' | tee -a $LOGFILE
echo TS=$(date --rfc-3339=ns) | tee -a $LOGFILE
echo "#### Tests complete ####" | tee -a $LOGFILE

69
bin/run-quick-benchmark.sh Executable file
View file

@ -0,0 +1,69 @@
#!/bin/bash
TEST_DISK_SPACE="64G"
TEST_FILE_NUM=512
if [[ $# -lt 1 ]] ; then
echo "\\o/"
echo "Not enough arguments supplied" >&2
echo "You need to pass a name to store the test results" >&2
echo " |" >&2
echo "syntax: " >&2
echo " $(basename $0) <test-name> " >&2
echo "example: " >&2
echo " $(basename $0) odroid-h2+-emmc " >&2
echo "/!\\" >&2
exit 1
fi
LOGFILE="quick_test_$1_$(hostname)-$(date '+%Y-%m-%d_%H-%M-%S').log"
echo ' '
echo "#### Starting benchmark ####" | tee $LOGFILE
echo TS=$(date --rfc-3339=ns) | tee -a $LOGFILE
echo TEST_DISK_SPACE=$TEST_DISK_SPACE | tee -a $LOGFILE
echo TEST_FILE_NUM=$TEST_FILE_NUM | tee -a $LOGFILE
echo COOL_DOWN_TIME=$COOL_DOWN_TIME | tee -a $LOGFILE
echo WARMUP_TIME=$WARMUP_TIME | tee -a $LOGFILE
echo ' ' | tee -a $LOGFILE
sensors 2>&1 | tee -a $LOGFILE
echo ' ' | tee -a $LOGFILE
echo "### System information ###" | tee -a $LOGFILE
echo "# uname -a #" | tee -a $LOGFILE
uname -a | tee -a $LOGFILE
echo "# /proc/version #" | tee -a $LOGFILE
cat /proc/version | tee -a $LOGFILE
echo "# /proc/meminfo #" | tee -a $LOGFILE
grep MemTotal /proc/meminfo | tee -a $LOGFILE
echo "# /proc/cpuinfo #" | tee -a $LOGFILE
cat /proc/cpuinfo | tee -a $LOGFILE
echo "# Block devices #" | tee -a $LOGFILE
lsblk | grep -v loop | tee -a $LOGFILE
echo "# df --block-size=G $(pwd) #" | tee -a $LOGFILE
df --block-size=G $(pwd) | tee -a $LOGFILE
BLOCK_DEVICES=$(lsblk | grep -v loop | grep disk | cut -f1 -d ' ')
for d in $BLOCK_DEVICES
do
echo "# block device /dev/$d => hdparm -Iv #" | tee -a $LOGFILE
sudo hdparm -Iv /dev/$d 2>&1 | tee -a $LOGFILE
echo "# block device /dev/$d => smartctl --all #" | tee -a $LOGFILE
sudo smartctl --all /dev/$d
done
echo ' ' | tee -a $LOGFILE
echo "#### CPU ####" | tee -a $LOGFILE
sensors 2>&1 | tee -a $LOGFILE
/usr/local/bin/sysbench cpu run --threads=8 2>&1 | tee -a $LOGFILE
sensors 2>&1 | tee -a $LOGFILE
echo "#### RAM ####" | tee -a $LOGFILE
sensors 2>&1 | tee -a $LOGFILE
/usr/local/bin/sysbench memory run --threads=8 2>&1 | tee -a $LOGFILE
sensors 2>&1 | tee -a $LOGFILE
echo calling $(dirname $0)/disk-test.sh $LOGFILE $TEST_DISK_SPACE $TEST_FILE_NUM | tee -a $LOGFILE
$(dirname $0)/disk-test.sh $LOGFILE $TEST_DISK_SPACE $TEST_FILE_NUM
echo TS=$(date --rfc-3339=ns) | tee -a $LOGFILE
echo "#### Tests complete ####" | tee -a $LOGFILE

View file

@ -1,5 +0,0 @@
#!/bin/bash
/usr/local/bin/sysbench fileio prepare
/usr/local/bin/sysbench fileio run --threads=4 --file-test-mode=rndrw --file-io-mode=async
/usr/local/bin/sysbench fileio cleanup