1
0
Fork 0
mirror of https://github.com/SinTan1729/random.git synced 2024-12-25 04:48:37 -06:00
random/turbo-boost

32 lines
786 B
Text
Raw Permalink Normal View History

2021-12-28 02:54:26 -06:00
#!/bin/sh
2021-04-19 13:54:49 -05:00
2022-01-02 22:35:07 -06:00
# This is to toggle intel turbo boost.
2021-04-19 13:54:49 -05:00
if [[ -z $(which rdmsr) ]]; then
2022-07-19 19:06:28 -05:00
echo "msr-tools is not installed. Please install it and try again." >&2
2021-04-19 13:54:49 -05:00
exit 1
fi
if [[ ! -z $1 && $1 != "enable" && $1 != "disable" ]]; then
echo "Invalid argument: $1" >&2
echo ""
echo "Usage: $(basename $0) [disable|enable]"
exit 1
fi
cores=$(cat /proc/cpuinfo | grep processor | awk '{print $3}')
for core in $cores; do
if [[ $1 == "disable" ]]; then
sudo wrmsr -p${core} 0x1a0 0x4000850089
fi
if [[ $1 == "enable" ]]; then
sudo wrmsr -p${core} 0x1a0 0x850089
fi
state=$(sudo rdmsr -p${core} 0x1a0 -f 38:38)
if [[ $state -eq 1 ]]; then
echo "core ${core}: disabled"
else
echo "core ${core}: enabled"
fi
done