Skip to content

Instantly share code, notes, and snippets.

@kymair
Forked from anonymous/cpu-bench.sh
Created April 18, 2013 05:53
Show Gist options
  • Save kymair/5410451 to your computer and use it in GitHub Desktop.
Save kymair/5410451 to your computer and use it in GitHub Desktop.
#!/bin/bash
CONCURRENCY=8
TIME_START=`date`
for ((idx = 0; idx < $CONCURRENCY; idx++))
do
time echo "scale=5000; a(1)*4" | bc -l > /dev/null &
done
echo "$TIME_START Start"
RUNNING_PROCESS_NUM=1
while [ $RUNNING_PROCESS_NUM -gt 0 ]
do
printf ".";
sleep 1
RUNNING_PROCESS_NUM=$(ps ax | grep ' bc -l' | grep -v 'grep' | wc -l)
done
TIME_STOP=`date`
echo "$TIME_STOP Stop"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment