Guest User

Untitled

a guest
Oct 11th, 2014
223
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2.  
  3. # trivial CPU speed tester
  4.  
  5. # usage
  6. # taskset -c PROCESSORID ./cputest.sh PROCESSID
  7. # examples:
  8. #
  9. # taskset -c 0 ./cputest.sh 0
  10. # taskset -c 4 ./cputest.sh 4
  11. #
  12. # taskset -c 0 ./cputest.sh 01
  13. # taskset -c 0 ./cputest.sh 02
  14.  
  15. trap ctrl_c INT
  16. function ctrl_c() {
  17.   #echo "Exiting..."
  18.   rm -f $TIMEFILE
  19.   exit
  20. }
  21.  
  22. MYID=$1
  23. TIMEFILE=/tmp/timeresult_$MYID
  24. TESTBIN=/usr/local/AS/bin/mathtest
  25. REPS=50
  26. ETIME=0
  27.  
  28. while true; do
  29.  ETIME="0"
  30.   for i in `seq 1 $REPS` ; do
  31.     echo "" | time -o $TIMEFILE -f "%e" $TESTBIN >/dev/null
  32.     STR="$ETIME+`cat $TIMEFILE`"
  33. #    echo str is $STR
  34.     ETIME="`echo $STR |bc`"
  35.   done
  36.  
  37.  OPSPERSEC=`echo "scale=2; $REPS/$ETIME" | bc`
  38.  echo proc id $MYID time $ETIME ops per sec $OPSPERSEC
  39.  
  40. done
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×