Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # trivial CPU speed tester
- # usage
- # taskset -c PROCESSORID ./cputest.sh PROCESSID
- # examples:
- #
- # taskset -c 0 ./cputest.sh 0
- # taskset -c 4 ./cputest.sh 4
- #
- # taskset -c 0 ./cputest.sh 01
- # taskset -c 0 ./cputest.sh 02
- trap ctrl_c INT
- function ctrl_c() {
- #echo "Exiting..."
- rm -f $TIMEFILE
- exit
- }
- MYID=$1
- TIMEFILE=/tmp/timeresult_$MYID
- TESTBIN=/usr/local/AS/bin/mathtest
- REPS=50
- ETIME=0
- while true; do
- ETIME="0"
- for i in `seq 1 $REPS` ; do
- echo "" | time -o $TIMEFILE -f "%e" $TESTBIN >/dev/null
- STR="$ETIME+`cat $TIMEFILE`"
- # echo str is $STR
- ETIME="`echo $STR |bc`"
- done
- OPSPERSEC=`echo "scale=2; $REPS/$ETIME" | bc`
- echo proc id $MYID time $ETIME ops per sec $OPSPERSEC
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement