CPU 一直卡在 800Mhz
我输入watch -n1 “cat /proc/cpuinfo | grep MHz”(查看 CPU)
无论我做什么,我都会启动一个大型程序并在 Blender 中渲染动画或使用 Octave 来处理数字,但 CPU 不会超过 800Mhz
Computer
Summary
Computer
Processor Intel(R) Core(TM) i7-4700MQ CPU @ 2.40GHz
Memory 16315MB (4407MB used)
Machine Type Laptop
Operating System Ubuntu 20.04.3 LTS
User Name rt (rt)
Date/Time Mon 30 Aug 2021 02:33:09 PM EDT
Display
Resolution 1920x1080 pixels
OpenGL Renderer Mesa DRI Intel(R) HD Graphics 4600 (HSW GT2)
X11 Vendor The X.Org Foundation
Audio Devices
Audio Adapter HDA-Intel - HDA Intel HDMI
Audio Adapter HDA-Intel - HDA Intel PCH
Audio Adapter USB-Audio - USB Audio Device
Input Devices
Power Button
Sleep Button
Lid Switch
Power Button
AT Translated Set 2 keyboard
USB Audio Device
ETPS/2 Elantech Touchpad
Logitech Anywhere MX
Video Bus
HDA Intel PCH Mic
HDA Intel PCH Front Headphone
HDA Intel HDMI HDMI/DP,pcm:3
HDA Intel HDMI HDMI/DP,pcm:7
HDA Intel HDMI HDMI/DP,pcm:8
HDA Intel HDMI HDMI/DP,pcm:9
HDA Intel HDMI HDMI/DP,pcm:10
Printers (CUPS)
OfficeJet_Pro_6978 Default
SCSI Disks
TSSTcorp CDDVDW SN-208DB
ATA INTEL SSDMCEAC12
ATA ST1000LM014-1EJ1
Operating System
Version
Kernel Linux 5.4.0-81-generic (x86_64)
Version #91-Ubuntu SMP Thu Jul 15 19:09:17 UTC 2021
C Library GNU C Library / (Ubuntu GLIBC 2.31-0ubuntu9.2) 2.31
Distribution Ubuntu 20.04.3 LTS
Current Session
Computer Name sys76
User Name rt (rt)
Language en_US.UTF-8 ()
Home Directory /home/rt
Misc
Uptime 20 minutes
Load Average 0.83, 1.37, 1.62
Available entropy in /dev/random 3649 bits (healthy)
rt@sys76:/sys/devices/system/cpu/cpu0/cpufreq$ grep -r .
scaling_min_freq:800000
scaling_available_governors:performance powersave
scaling_governor:performance
cpuinfo_max_freq:3400000
related_cpus:0
scaling_cur_freq:798264
scaling_setspeed:<unsupported>
affected_cpus:0
scaling_max_freq:2400000
cpuinfo_transition_latency:0
scaling_driver:intel_pstate
cpuinfo_min_freq:800000
rt@sys76:/sys/devices/system/cpu/cpufreq/policy0$ sensors
coretemp-isa-0000
Adapter: ISA adapter
Package id 0: +50.0°C (high = +84.0°C, crit = +100.0°C)
Core 0: +50.0°C (high = +84.0°C, crit = +100.0°C)
Core 1: +48.0°C (high = +84.0°C, crit = +100.0°C)
Core 2: +45.0°C (high = +84.0°C, crit = +100.0°C)
Core 3: +46.0°C (high = +84.0°C, crit = +100.0°C)
BAT0-acpi-0
Adapter: ACPI interface
in0: 0.00 V
curr1: 0.00 A
acpitz-acpi-0
Adapter: ACPI interface
temp1: +14.0°C (crit = +120.0°C)
按照要求:
rt@sys76:~$ grep . /sys/devices/system/cpu/intel_pstate/*
/sys/devices/system/cpu/intel_pstate/max_perf_pct:100
/sys/devices/system/cpu/intel_pstate/min_perf_pct:23
/sys/devices/system/cpu/intel_pstate/no_turbo:1
/sys/devices/system/cpu/intel_pstate/num_pstates:27
/sys/devices/system/cpu/intel_pstate/status:active
/sys/devices/system/cpu/intel_pstate/turbo_pct:38
rt@sys76:~$ for file in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do echo "powersave" > $file; done
bash: /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor: Permission denied
bash: /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor: Permission denied
bash: /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor: Permission denied
bash: /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor: Permission denied
bash: /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor: Permission denied
bash: /sys/devices/system/cpu/cpu5/cpufreq/scaling_governor: Permission denied
bash: /sys/devices/system/cpu/cpu6/cpufreq/scaling_governor: Permission denied
bash: /sys/devices/system/cpu/cpu7/cpufreq/scaling_governor: Permission denied
rt@sys76:~$ cpupower frequency-info --policy
analyzing CPU 0:
current policy: frequency should be within 800 MHz and 2.40 GHz.
The governor "performance" may decide which speed to use
within this range.
答案1
以下是如何让你的 CPU 以最大速度运行的方法:
创建一个名为 cpumaxspeed.sh 或任何您喜欢的名称的文件并输入以下代码:
#!/bin/bash
#Getting and setting variables
echo Getting info....
CPUMIN=$(cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq)
CPUMAX=$(cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq)
CPUMAXGHZ=$(echo "scale=1; $CPUMAX / 1000000" | bc)
CPUMINGHZ=$(echo "scale=1; $CPUMIN / 1000000" | bc)
#Display min and max CPU frequency in MHz
echo CPU min frequency: $CPUMIN" MHz" / $CPUMINGHZ" GHz"
echo CPU max frequency: $CPUMAX" MHz" / $CPUMAXGHZ" GHz"
#Setting CPU governor
echo Setting governor to performance
sudo cpufreq-set -r -g performance
echo Set governor to performance
#Setting to max frequency
echo Setting CPU frequency to be $CPUMAX" MHz" / $CPUMAXGHZ" GHz"
sudo cpufreq-set -r -f $CPUMAXGHZ"GHz"
echo Set CPU frequency to $CPUMAXGHZ"GHz"
done
要执行该文件,请运行以下命令:
sudo sh yourfilename.sh
将 [yourfilename] 替换为您输入的名称。