随笔-处理器微架构-固定CPU频率

固定cpu频率

测试环境cpu频率管理是intel_pstate:

no_turbo.sh

#!/bin/bash

echo "disable turbo"
echo 1 | sudo tee /sys/devices/system/cpu/intel_pstate/no_turbo; echo 100 | sudo tee /sys/devices/system/cpu/intel_pstate/min_perf_pct;echo 100 | sudo tee /sys/devices/system/cpu/intel_pstate/max_perf_pct

sleep 1s

sudo cpufreq-info -c 0

grep "cpu MHz" /proc/cpuinfo
sudo bash no_turbo.sh

固定cpu频率 on arm

# 查看所支持的频率
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_available_frequencies
# 查看当前频率
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_cur_freq
# 查看支持的频率工作模式
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_available_governors
# 查看当前的频率工作模式
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
# 或者
sudo cpufreq-info -c 7
+++
# 设置频率工作模式(正常只要设置模式,不需要设置频率)
xcpu=cpu7; echo performance | sudo tee /sys/devices/system/cpu/$xcpu/cpufreq/scaling_governor; sleep 1; cat /sys/devices/system/cpu/$xcpu/cpufreq/scaling_cur_freq
# 恢复
xcpu=cpu7; echo ondemand | sudo tee /sys/devices/system/cpu/$xcpu/cpufreq/scaling_governor
posted @ 2025-01-15 23:15  LiYanbin  阅读(35)  评论(0)    收藏  举报