Skip to content

Instantly share code, notes, and snippets.

@julian-klode
Created December 27, 2019 23:44
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 julian-klode/44df0ec6ac92c21a1fa75751f62e94b5 to your computer and use it in GitHub Desktop.
Save julian-klode/44df0ec6ac92c21a1fa75751f62e94b5 to your computer and use it in GitHub Desktop.
#!/bin/sh
write() {
file="$1"
shift
echo "$@" | sudo tee "$file"
}
case "$1" in
raise)
write /sys/bus/pci/drivers/proc_thermal/0000:00:04.0/tcc_offset_degree_celsius 5
write /sys/devices/virtual/powercap/intel-rapl/intel-rapl:0/constraint_0_power_limit_uw 44000000
write /sys/devices/virtual/powercap/intel-rapl-mmio/intel-rapl-mmio:0/constraint_0_power_limit_uw 44000000
;;
reset)
write /sys/bus/pci/drivers/proc_thermal/0000:00:04.0/tcc_offset_degree_celsius 20
write /sys/devices/virtual/powercap/intel-rapl/intel-rapl:0/constraint_0_power_limit_uw 15000000
write /sys/devices/virtual/powercap/intel-rapl-mmio/intel-rapl-mmio:0/constraint_0_power_limit_uw 15000000
;;
*)
echo "E: Missing/unknown argument: $1, expected 'raise' or 'reset'" >&2
exit 1
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment