Created
April 18, 2013 05:52
-
-
Save anonymous/5410449 to your computer and use it in GitHub Desktop.
Simple CPU Benchmark
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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