Skip to content

Instantly share code, notes, and snippets.

@dmarcelino
Last active April 27, 2017 05:00
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dmarcelino/a64e43f3356a932ede4a to your computer and use it in GitHub Desktop.
Save dmarcelino/a64e43f3356a932ede4a to your computer and use it in GitHub Desktop.
Raspberry Overclock stability test
#!/bin/bash
# Simple stress test for system. If it survives this, it's probably stable.
# Free software, GPL2+
# Based on http://elinux.org/RPiconfig#Overclocking
# but using 'cat' instead of 'yes' since OpenELEC for Raspberry doesn't have yes
CORES=1
NO_READS=1
NO_WRITES=3
STARTTIME=`date +%s`
echo "Testing overclock stability... (started at `date +%T`)"
# Max out the CPU in the background (n cores). Heats it up, loads the power-supply.
#nice yes >/dev/null &
for i in `seq 1 $CORES`; do nice -n 19 cat /dev/zero > /dev/null & done
# Read the entire SD card 10x. Tests RAM and I/O
for i in `seq 1 $NO_READS`; do echo "reading: $i/$NO_READS"; dd if=/dev/mmcblk0 of=/dev/null bs=4M; done
# Writes 512 MB test file, 10x.
for i in `seq 1 $NO_WRITES`; do echo "writing: $i/$NO_WRITES"; dd if=/dev/zero of=deleteme.dat bs=1M count=512; sync; done
# Clean up
#killall yes
killall cat
rm deleteme.dat
# Print summary. Anything nasty will appear in dmesg.
echo -n "CPU freq: " ; cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
echo -n "CPU temp: " ; cat /sys/class/thermal/thermal_zone0/temp
echo "dmesg output:"
dmesg | tail
echo "Not crashed yet, probably stable."
ENDTIME=`date +%s`
ELAPSED_TIME=$(($ENDTIME - $STARTTIME))
echo "Total time: $(($ELAPSED_TIME/60)) min $(($ELAPSED_TIME%60)) sec"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment