File: powerpolicy.sh

package info (click to toggle)
simdjson 4.2.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 27,936 kB
  • sloc: cpp: 171,612; ansic: 19,122; sh: 1,126; python: 842; makefile: 47; ruby: 25; javascript: 13
file content (32 lines) | stat: -rwxr-xr-x 826 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env bash
# sudo /usr/bin/cpupower frequency-set -g performance
#######
# taken from http://hbfs.wordpress.com/2013/06/18/fast-path-finding-part-ii/
# might require sudo apt-get install cpufrequtils
# invoke with performance or ondemand
# type cpufreq-info to check results, you can also verify with cat /proc/cpuinfo
# enumerate found CPUs
cpus=$( grep processor /proc/cpuinfo | cut -d: -f 2 )


if [ "$1" = "ondemand" ]; then
  echo "setting up ondemand"
  policy="ondemand"
elif [ "$1" = "performance" ]; then
  echo "setting up for performance"
  policy="performance"
elif [ "$1" = "list" ]; then
  cpufreq-info
  exit 0
else
  echo "usage: powerpolicy.sh ondemand | performance list"
  exit -1
fi

echo "chosen policy " $1
# set governor for each CPU
#
for cpu in ${cpus[@]}
do
  cpufreq-set -c $cpu -g $1
done