diff options
Diffstat (limited to 'hellyes.command')
-rwxr-xr-x | hellyes.command | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/hellyes.command b/hellyes.command new file mode 100755 index 0000000..cd857a0 --- /dev/null +++ b/hellyes.command @@ -0,0 +1,30 @@ +#!/usr/bin/env bash +# hellyeah.command +# Do some stress testing +# @author Filipp Lepalaan <filipp@mcare.fi> + +MYDIR=/private/tmp/_hellyeah +CORES=$(sysctl hw.logicalcpu_max | cut -d : -f 2 | sed 's/ //') + +for (( i = 0; i < ${CORES}; i++ )); do + yes > /dev/null 2>&1 & +done + +if [[ ! -d "${MYDIR}" ]]; then + mkdir "${MYDIR}" +fi + +trap "killall yes; rm ${MYDIR}; echo 'Cleaning up...'; exit 255" SIGINT SIGTERM + +while true; do + for k in 10 100 1000 10000; do + BLOCKS=$(($k*1024/512)) + OF="${MYDIR}/$(uuidgen)" + dd if=/dev/random of=${OF} count=${BLOCKS} > /dev/null 2>&1 + sleep 2 + echo "Wrote ${BLOCKS} blocks" + rm -rf "${OF}" + done +done + +exit 0 |