Skip to content

Instantly share code, notes, and snippets.

Created April 18, 2013 05:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/5410449 to your computer and use it in GitHub Desktop.
Save anonymous/5410449 to your computer and use it in GitHub Desktop.
Simple CPU Benchmark
#!/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