Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2017
924
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.44 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. if [[ "$1" =~ ^(powersave|performance)$ ]]; then
  4.  
  5. #echo "$1 is in the list"
  6.  
  7. n_cpus=`nproc --all`
  8.  
  9. echo "Found $n_cpus cores"
  10.  
  11. let upper_limit=$n_cpus-1
  12.  
  13. #echo $upper_limit
  14.  
  15. echo "Setting the CPU to \"$1\" mode"
  16.  
  17.  
  18. for i in $(seq 0 1 $upper_limit)
  19. do
  20.   `cpufreq-set -c $i -g $1`
  21. done
  22.  
  23. else
  24.     echo "Usage: ./set_cpu.sh \"governor\". governor should be either \"powesave\" or \"performance\" (without the quotes)"
  25. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement