Guest User

disable_intel_pstates.sh

a guest
Oct 15th, 2016
160
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/sh
  2.  
  3. PSTATE_DEVICE_PATH="/sys/devices/system/cpu/intel_pstate"
  4. TRUE="1"
  5. FALSE="0"
  6.  
  7. if [ ! "$UID" == "0"  ]; then echo ; echo "This script must be run as root" ; echo ; exit ; fi
  8.  
  9. if [ ! -e "$PSTATE_DEVICE_PATH"  ]; then echo ; echo "There is no PSTATE support in the kernel cannot continue." ; echo "If you have PSTATE support in your kernel, then this path exists: $PSTATE_DEVICE_PATH" ; echo ; fi
  10.  
  11. echo
  12.  
  13. # Disable Turbo Boost
  14. if [ "`cat /sys/devices/system/cpu/intel_pstate/no_turbo`" == "0" ] ; then
  15.  
  16.         echo 1 > /sys/devices/system/cpu/intel_pstate/no_turbo
  17.         echo "Processor No_Turbo Mode ---> 1"
  18.     else
  19.         echo 0 > /sys/devices/system/cpu/intel_pstate/no_turbo
  20.         echo "Processor No_Turbo Mode ---> 0"
  21. fi
  22.  
  23. # Disable PSTATEs
  24. for PROCESSOR_NUMBER in /sys/devices/system/cpu/cpu?
  25.     do
  26.         for CPU_IDLE_ITEM_NUMBER in $PROCESSOR_NUMBER/cpuidle
  27.             do
  28.                 for CPU_STATE in $PROCESSOR_NUMBER/cpuidle/state?
  29.                     do
  30.                         # Leave PSTATE 0 enabled
  31.                         ITEM="`basename $CPU_STATE`"
  32.                         if [ "`basename $CPU_STATE`" == "state0" ] ; then
  33.                             echo "$CPU_STATE/disable was left in state: `cat $CPU_STATE/disable`"
  34.                             continue
  35.                         fi
  36.  
  37.                         # Leave PSTATE 1 enabled
  38.                         if [ "`basename $CPU_STATE`" == "state1" ] ; then
  39.                             echo "$CPU_STATE/disable was left in state: `cat $CPU_STATE/disable`"
  40.                             continue
  41.                         fi
  42.  
  43.                         # Leave PSTATE 2 enabled
  44.                         if [ "`basename $CPU_STATE`" == "state2" ] ; then
  45.                             echo "$CPU_STATE/disable was left in state: `cat $CPU_STATE/disable`"
  46.                             continue
  47.                         fi
  48.                        
  49.                         # # Leave PSTATE 3 enabled
  50.                         # if [ "`basename $CPU_STATE`" == "state3" ] ; then
  51.                         #   echo "$CPU_STATE/disable was left in state: `cat $CPU_STATE/disable`"
  52.                         #   continue
  53.                         # fi
  54.                        
  55.                         # Disable a PSTATE
  56.                         echo 1 > $CPU_STATE/disable
  57.                         echo -n "$CPU_STATE/disable ---> "
  58.                         cat $CPU_STATE/disable
  59.                     done
  60.             done
  61.     done
  62. echo
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.

×