Add scripts

This commit is contained in:
12b 2021-01-09 22:36:27 +01:00
parent 5ae2698dc6
commit 16076b1fe3
2 changed files with 110 additions and 0 deletions

15
bin/install-dependencies.sh Executable file
View file

@ -0,0 +1,15 @@
#!/bin/bash
apt -y install make automake libtool pkg-config libaio-dev libssl-dev
apt -y install libmysqlclient-dev
# alternatively use this if libmysqlclient-dev is not available on the linux distribution that is used :
# apt -y install libmariadb-dev libmariadb-dev-compat # libmariadb-dev-compat:amd64?
apt -y install libpq-dev
apt -y install lm-sensors
git clone https://github.com/akopytov/sysbench
cd sysbench/
./autogen.sh
./configure
make -j
make install
cd ..

95
bin/run-benchmark.sh Executable file
View file

@ -0,0 +1,95 @@
#!/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