Skip to content

Instantly share code, notes, and snippets.

@apinela
Last active February 22, 2016 17:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save apinela/1efc48835409a3356508 to your computer and use it in GitHub Desktop.
Save apinela/1efc48835409a3356508 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Run it like:
# bash <(curl -sk <THIS_FILE>)
tasks=0
i=0
(dd if=/dev/urandom of=testfile count=20 bs=1024 2>&1) > /dev/null
init_time=$(($(date +%s%N)/1000000))
function execProc {
md5sum testfile > /dev/null
expr $i + 1 > /dev/null
}
while [ $tasks -lt 1000 ]
do
execProc &
tasks=`expr $tasks + 1`
done
end_time=$(($(date +%s%N)/1000000))
calc_time=$(expr $end_time - $init_time)
echo time for 1000 interactions=${calc_time}ms
rm -f testfile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment