Advertisement
Guest User

dvfs-test-script

a guest
Apr 12th, 2013
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.46 KB | None | 0 0
  1. #!/bin/sh
  2. CPUFREQ=/sys/devices/system/cpu/cpu0/cpufreq/
  3.  
  4. OCONF=$1
  5. if [ -z "$OCONF" ]; then
  6.     OCONF=0
  7. fi
  8.  
  9. if [ ! -d "$CPUFREQ" ]; then
  10.     echo "Cpufreq not present??"
  11.     exit 1
  12. fi
  13.  
  14. echo userspace > $CPUFREQ/scaling_governor
  15. echo "==================="
  16. echo "System CPUFREQ Configuration:"
  17. echo "==================="
  18. echo "Scaling driver:" `cat $CPUFREQ/scaling_driver`
  19. REG=`ls -d /sys/class/regulator/*/cpufreq*`
  20. if [ -z "$REG" ]; then
  21.     echo "cpufreq-cpu0 Regulator not found. Checking for legacy mpu regulator"
  22.     REG=`find /sys/class/regulator -follow -maxdepth 2 -name name|xargs grep -i mpu|cut -d ':' -f1`
  23. fi
  24. if [ ! -z "$REG" ]; then
  25.     REG=`echo $REG|cut -d '/' -f1-5`
  26.     echo "Scaling Regulator: $REG :" `cat $REG/name`
  27. else
  28.     echo "Scaling Regulator: not found"
  29. fi
  30.  
  31. START=`date`
  32. STARTS=`date "+%s"`
  33. opp=`cat $CPUFREQ/scaling_available_frequencies`
  34. echo "$opp are the available frequencies"
  35.  
  36. echo "==================="
  37. echo "Boot Configuration:"
  38. echo "==================="
  39. if [ $OCONF -eq 1 ]; then
  40.     echo "System info:"
  41.     ./omapconf --cpuinfo
  42. fi
  43. echo "bogomips@ boot:"
  44. cat /proc/cpuinfo|grep -i bogomips
  45. echo "Boot scaling frequency ="`cat $CPUFREQ/scaling_cur_freq`
  46. if [ ! -z "$REG" ]; then
  47.     echo "Boot Scaling voltage(uV) ="`cat $REG/microvolts`
  48. fi
  49.  
  50. echo "==================="
  51. echo "Single OPP transition walk through test:"
  52. echo "==================="
  53. #1 second in each OPP
  54. FIRST_TEST_TIME=1
  55. idx=1
  56. for i in $opp
  57. do
  58.     echo -n "$i" > $CPUFREQ/scaling_setspeed
  59.     echo "$idx: TESTING for $FIRST_TEST_TIME seconds at" `cat $CPUFREQ/scaling_cur_freq`
  60.     if [ $OCONF -eq 1 ]; then
  61.         ./omapconf show opp
  62.     fi
  63.     echo "current scaling frequency(for $i) ="`cat $CPUFREQ/scaling_cur_freq`
  64.     if [ ! -z "$REG" ]; then
  65.         echo "current Scaling voltage(uV) ="`cat $REG/microvolts`
  66.     fi
  67.     echo "bogomips@ frequency $i:"
  68.     echo -n "$i" > $CPUFREQ/scaling_setspeed
  69.     cat /proc/cpuinfo|grep -i bogomips
  70.     sleep $FIRST_TEST_TIME
  71.     idx=`expr $idx + 1`
  72. done
  73.  
  74. j=0
  75. k=0
  76. rotate=1000
  77. echo "==================="
  78. echo "Rapid transitions test (print every $rotate all OPP combinations):"
  79. echo "==================="
  80. while [ 1 ]
  81. do
  82.     for i in $opp
  83.     do
  84.         for j in $opp
  85.         do
  86.             echo -n "$i" > $CPUFREQ/scaling_setspeed
  87.             echo -n "$j" > $CPUFREQ/scaling_setspeed
  88.         done
  89.     done
  90.     j=`expr $j + 1`
  91.     if [ $j -gt $rotate ]; then
  92.         STARTN=`date "+%s"`
  93.         DELTA=`expr $STARTN - $STARTS`
  94.         echo "[$k] $rotate: $DELTA Seconds: $START : time now =" `date`
  95.         k=`expr $k + 1`
  96.         j=0
  97.     fi
  98. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement