diff options
author | Filipp Lepalaan <filipp@mac.com> | 2010-03-14 08:31:49 +0200 |
---|---|---|
committer | Filipp Lepalaan <filipp@mac.com> | 2010-03-14 08:31:49 +0200 |
commit | 7e0e116d4fc2a3d57e125770266e402f67ee815f (patch) | |
tree | 4921e673518630a91b6bbee0a8bb1f2da29bc261 /hellyes.command | |
parent | 75e8f5f66e32aecf06e8817c2c91c9da543e87a5 (diff) | |
download | mtk-7e0e116d4fc2a3d57e125770266e402f67ee815f.tar.gz mtk-7e0e116d4fc2a3d57e125770266e402f67ee815f.tar.bz2 mtk-7e0e116d4fc2a3d57e125770266e402f67ee815f.zip |
Converted bloop to Bash
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 |