Last active
August 29, 2015 14:05
-
-
Save keithchambers/bbb9f9b3587a93e845d1 to your computer and use it in GitHub Desktop.
Generate system load.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -e | |
TIMEOUT=${1:-120} | |
CPU_UNITS=$(cat /proc/cpuinfo | grep processor | wc -l) | |
until [[ ${COUNT} -eq ${CPU_UNITS} ]] | |
do | |
timeout ${TIMEOUT} dd if=/dev/zero bs=10 | gzip | gzip -d > /dev/null & | |
COUNT=$((COUNT+1)) | |
done | |
until [[ ${SECONDS} -eq ${TIMEOUT} ]] | |
do | |
LOAD=$(uptime | sed 's/,//g' | awk '{ print $(NF-2)}') | |
echo "1m load average: ${LOAD}" | |
sleep 1 | |
done | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment