Commit 3819c1bd authored by Andreas Schmidt's avatar Andreas Schmidt
Browse files

Add sh scripts for processor speed manipulation.

parent 19afb41f
Loading
Loading
Loading
Loading

set-processor-speed.sh

0 → 100644
+44 −0
Original line number Diff line number Diff line
#!/bin/sh

# Script to "fix" the cpu performance to a given frequency

self="$0"

## sudo cpupower -c 0-3 frequency-set -d 1000000 -u 1000000 && sudo cpupower -c 0-3 frequency-info -f

die() {
	echo >&2 "$@"
	exit 1
}

need() {
	which "$1" >/dev/null 2>/dev/null || die "need executable: $1"
}

need cpupower
need nproc
need sleep
need cat
need id

uid=$(id -u)

numproc=$(nproc)
maxproc=$(($numproc - 1))


if [ "$uid" -ne 0 ]; then
	die "not root"
fi

if [ -z "$1" ]; then
	min=$(cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq)
	max=$(cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq)
else
	min="$1"
	max="$1"
fi

cpupower -c "0-$maxproc" frequency-set -d "$min" -u "$max"
sleep 1
cpupower -c "0-$maxproc" frequency-info -f

turbo-boost.sh

0 → 100644
+27 −0
Original line number Diff line number Diff line
#!/bin/sh

# activate or deactivate turbo boost

self="$0"

die() {
	echo >&2 "$@"
	exit 1
}

usage() {
	die "usage: $self [a|d]"
}

uid=$(id -u)

if [ "$uid" -ne 0 ]; then
	die "not root"
fi

case "$1" in
a*) echo 0 >/sys/devices/system/cpu/intel_pstate/no_turbo ;;
d*) echo 1 >/sys/devices/system/cpu/intel_pstate/no_turbo ;;
*) usage ;;
esac