diff options
Diffstat (limited to 'etc')
-rwxr-xr-x | etc/hyperthreading.sh | 24 | ||||
-rwxr-xr-x | etc/turboboost.sh | 8 |
2 files changed, 32 insertions, 0 deletions
diff --git a/etc/hyperthreading.sh b/etc/hyperthreading.sh new file mode 100755 index 000000000..82603c5a3 --- /dev/null +++ b/etc/hyperthreading.sh @@ -0,0 +1,24 @@ +#!/bin/bash +set -eu + +case $1 in + on) + for f in "/sys/devices/system/cpu/cpu"[0-9]*/online; do + echo 1 > "$f" + done + ;; + off) + cores="" + for cpu in "/sys/devices/system/cpu/cpu"[0-9]* ; do + if grep -vq '^1$' "$cpu/online" 2>/dev/null; then + continue + fi + coreid=$(cat "$cpu/topology/core_id") + if echo "$cores" | grep -- "$coreid" ; then + echo 0 > "$cpu/online" + fi + cores=$(printf "$cores\n$coreid") + done + ;; + *) echo "USAGE: hyperthreading.sh <on|off>" +esac diff --git a/etc/turboboost.sh b/etc/turboboost.sh new file mode 100755 index 000000000..f336660ec --- /dev/null +++ b/etc/turboboost.sh @@ -0,0 +1,8 @@ +#!/bin/sh +set -eu + +case $1 in + on) echo 0 > /sys/devices/system/cpu/intel_pstate/no_turbo ;; + off) echo 1 > /sys/devices/system/cpu/intel_pstate/no_turbo ;; + *) echo "USAGE: $0 <on|off>" ; exit 111 +esac |