Sysbench is a multithreaded benchmarking tool available for many systems including Raspian. We’ll use it to run stress tests.

Install Sysbench on Raspberry Pi

sudo apt-get install sysbench

If you run into issues, see Sysbench’s official install documentation.

Run a basic CPU stress test

To run a basic CPU stress test using sysbench, use the following command:

sysbench --test=cpu --cpu-max-prime=20000 --validate run

Optionally specify how many threads to run the test with by adding --num-threads=4 to the command above.

Temperature test

The YouTube channel ExplainingComputers demonstrated a nice way of measuring temperature throughout a stress test in this video. The script is reproduced below:

#!/bin/bash
clear
vcgencmd measure_temp
sysbench --test=cpu --cpu-max-prime=20000 run >/dev/null 2>&1
vcgencmd measure_temp
sysbench --test=cpu --cpu-max-prime=20000 run >/dev/null 2>&1
vcgencmd measure_temp
sysbench --test=cpu --cpu-max-prime=20000 run >/dev/null 2>&1
vcgencmd measure_temp

The script essentially runs multiple sysbench stress tests, and takes the CPU temperature between runs. You can replace any of the sysbench lines with stress tests of your choice.

To run this test, copy the above contents into a bash file (in my case I named the file temptest.sh) and run it using the command below:

./temptest.sh

Further reading