Skip to content

Instantly share code, notes, and snippets.

@jyxjjj
Last active January 7, 2025 04:43
Show Gist options
  • Save jyxjjj/46d687fca5b75fff0f5c480b71129b8d to your computer and use it in GitHub Desktop.
Save jyxjjj/46d687fca5b75fff0f5c480b71129b8d to your computer and use it in GitHub Desktop.
<CPU Freq Settings On Linux> (Updated to `Intel Core I3-13100`)
#!/bin/bash
for i in {0..7}; do
# min cpu freq to 3.4GHz
echo 3400000 > "/sys/devices/system/cpu/cpu$i/cpufreq/scaling_min_freq"
# set max cpu freq to 4.5GHz
echo 4500000 > "/sys/devices/system/cpu/cpu$i/cpufreq/scaling_max_freq"
# set cpu preference to performance
echo performance > "/sys/devices/system/cpu/cpu$i/cpufreq/energy_performance_preference"
# set cpu governor to performance
echo performance > "/sys/devices/system/cpu/cpu$i/cpufreq/scaling_governor"
done
# set min percent
echo 50 > /sys/devices/system/cpu/intel_pstate/min_perf_pct
# set max percent
echo 100 > /sys/devices/system/cpu/intel_pstate/max_perf_pct
sleep 1
# show current cpu freq
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_cur_freq
# show current cpu preference
cat /sys/devices/system/cpu/cpu*/cpufreq/energy_performance_preference
# show current cpu governor
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
# show min percent
cat /sys/devices/system/cpu/intel_pstate/min_perf_pct
# show max percent
cat /sys/devices/system/cpu/intel_pstate/max_perf_pct
#!/bin/bash
for i in {0..7}; do
# min cpu freq to 1.02GHz
echo 1020000 > "/sys/devices/system/cpu/cpu$i/cpufreq/scaling_min_freq"
# set max cpu freq to 3.4GHz
echo 3400000 > "/sys/devices/system/cpu/cpu$i/cpufreq/scaling_max_freq"
# set cpu preference to performance
echo balance_power > "/sys/devices/system/cpu/cpu$i/cpufreq/energy_performance_preference"
# set cpu governor to performance
echo powersave > "/sys/devices/system/cpu/cpu$i/cpufreq/scaling_governor"
done
# set min percent
echo 30 > /sys/devices/system/cpu/intel_pstate/min_perf_pct
# set max percent
echo 100 > /sys/devices/system/cpu/intel_pstate/max_perf_pct
sleep 1
# show current cpu freq
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_cur_freq
# show current cpu preference
cat /sys/devices/system/cpu/cpu*/cpufreq/energy_performance_preference
# show current cpu governor
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
# show min percent
cat /sys/devices/system/cpu/intel_pstate/min_perf_pct
# show max percent
cat /sys/devices/system/cpu/intel_pstate/max_perf_pct
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment