sbc-performance-test-kit/bin/run-benchmark.sh

96 lines
3.2 KiB
Bash
Raw Normal View History

2021-01-09 21:36:27 +00:00
#!/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