Skip to content

Instantly share code, notes, and snippets.

@academo
Created September 1, 2021 10:06
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save academo/30c781932b6b66adaacbc8932690f820 to your computer and use it in GitHub Desktop.
Save academo/30c781932b6b66adaacbc8932690f820 to your computer and use it in GitHub Desktop.
#!/bin/sh
log=/var/log/cpu_fix.log
printf "Log File - " >$log
while :; do
date >>$log
PLUGGED=$(acpi -a | grep on-line)
if [ ! -z "$PLUGGED" ]; then
echo setting values >>$log
# MSR
# PL1
echo 35000000 | sudo tee /sys/devices/virtual/powercap/intel-rapl/intel-rapl:0/constraint_0_power_limit_uw # 44 watt
echo 28000000 | sudo tee /sys/devices/virtual/powercap/intel-rapl/intel-rapl:0/constraint_0_time_window_us # 28 sec
# PL2
echo 35000000 | sudo tee /sys/devices/virtual/powercap/intel-rapl/intel-rapl:0/constraint_1_power_limit_uw # 44 watt
echo 2440 | sudo tee /sys/devices/virtual/powercap/intel-rapl/intel-rapl:0/constraint_1_time_window_us # 0.00244 sec
# MCHBAR
# PL1
echo 35000000 | sudo tee /sys/devices/virtual/powercap/intel-rapl-mmio/intel-rapl-mmio:0/constraint_0_power_limit_uw # 44 watt
# ^ Only required change on a ASUS Zenbook UX430UNR
echo 25000000 | sudo tee /sys/devices/virtual/powercap/intel-rapl-mmio/intel-rapl-mmio:0/constraint_0_time_window_us # 28 sec
# PL2
echo 35000000 | sudo tee /sys/devices/virtual/powercap/intel-rapl-mmio/intel-rapl-mmio:0/constraint_1_power_limit_uw # 44 watt
echo 2440 | sudo tee /sys/devices/virtual/powercap/intel-rapl-mmio/intel-rapl-mmio:0/constraint_1_time_window_us # 0.00244 sec
fi
sleep 2
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment