Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest Oct 11th, 2014 156 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  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
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top