我在戴尔 XPS 9510 上运行带有最新更新的 Ubuntu 20.04,电池性能真的很差。在轻度使用(仅在简单网站上浏览网页)的情况下,我的电池续航时间最长约为 1 小时 30 小时,而在 Windows 下,笔记本电脑可以轻松达到 8 小时。差异是巨大的。
我检查了很多设置并安装了 TLP 以提高电池寿命而没有进行重大更改,但是我观察到一个奇怪的行为可能解释了这种高消耗。当核心处于空闲状态时,核心在负载下正确扩展时,频率会回到标称速度 (2,5Ghz) 而不是最低速度 (800Mhz)。
以下是一些输出:
$ sudo tlp-stat -p
--- TLP 1.3.1 --------------------------------------------
+++ Processor
CPU model = 11th Gen Intel(R) Core(TM) i9-11900H @ 2.50GHz
/sys/devices/system/cpu/cpu0/cpufreq/scaling_driver = intel_pstate
/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor = powersave
/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors = performance powersave
/sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq = 800000 [kHz]
/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq = 4800000 [kHz]
/sys/devices/system/cpu/cpu0/cpufreq/energy_performance_preference = balance_power [HWP.EPP]
/sys/devices/system/cpu/cpu0/cpufreq/energy_performance_available_preferences = default performance balance_performance balance_power power
/sys/devices/system/cpu/cpu1/cpufreq/scaling_driver = intel_pstate
/sys/devices/system/cpu/cpu1/cpufreq/scaling_governor = powersave
/sys/devices/system/cpu/cpu1/cpufreq/scaling_available_governors = performance powersave
/sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq = 800000 [kHz]
/sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq = 4800000 [kHz]
/sys/devices/system/cpu/cpu1/cpufreq/energy_performance_preference = balance_power [HWP.EPP]
/sys/devices/system/cpu/cpu1/cpufreq/energy_performance_available_preferences = default performance balance_performance balance_power power
/sys/devices/system/cpu/cpu10/cpufreq/scaling_driver = intel_pstate
/sys/devices/system/cpu/cpu10/cpufreq/scaling_governor = powersave
/sys/devices/system/cpu/cpu10/cpufreq/scaling_available_governors = performance powersave
/sys/devices/system/cpu/cpu10/cpufreq/scaling_min_freq = 800000 [kHz]
/sys/devices/system/cpu/cpu10/cpufreq/scaling_max_freq = 4800000 [kHz]
/sys/devices/system/cpu/cpu10/cpufreq/energy_performance_preference = balance_power [HWP.EPP]
/sys/devices/system/cpu/cpu10/cpufreq/energy_performance_available_preferences = default performance balance_performance balance_power power
/sys/devices/system/cpu/cpu11/cpufreq/scaling_driver = intel_pstate
/sys/devices/system/cpu/cpu11/cpufreq/scaling_governor = powersave
/sys/devices/system/cpu/cpu11/cpufreq/scaling_available_governors = performance powersave
/sys/devices/system/cpu/cpu11/cpufreq/scaling_min_freq = 800000 [kHz]
/sys/devices/system/cpu/cpu11/cpufreq/scaling_max_freq = 4800000 [kHz]
/sys/devices/system/cpu/cpu11/cpufreq/energy_performance_preference = balance_power [HWP.EPP]
/sys/devices/system/cpu/cpu11/cpufreq/energy_performance_available_preferences = default performance balance_performance balance_power power
/sys/devices/system/cpu/cpu12/cpufreq/scaling_driver = intel_pstate
/sys/devices/system/cpu/cpu12/cpufreq/scaling_governor = powersave
/sys/devices/system/cpu/cpu12/cpufreq/scaling_available_governors = performance powersave
/sys/devices/system/cpu/cpu12/cpufreq/scaling_min_freq = 800000 [kHz]
/sys/devices/system/cpu/cpu12/cpufreq/scaling_max_freq = 4900000 [kHz]
/sys/devices/system/cpu/cpu12/cpufreq/energy_performance_preference = balance_power [HWP.EPP]
/sys/devices/system/cpu/cpu12/cpufreq/energy_performance_available_preferences = default performance balance_performance balance_power power
/sys/devices/system/cpu/cpu13/cpufreq/scaling_driver = intel_pstate
/sys/devices/system/cpu/cpu13/cpufreq/scaling_governor = powersave
/sys/devices/system/cpu/cpu13/cpufreq/scaling_available_governors = performance powersave
/sys/devices/system/cpu/cpu13/cpufreq/scaling_min_freq = 800000 [kHz]
/sys/devices/system/cpu/cpu13/cpufreq/scaling_max_freq = 4900000 [kHz]
/sys/devices/system/cpu/cpu13/cpufreq/energy_performance_preference = balance_power [HWP.EPP]
/sys/devices/system/cpu/cpu13/cpufreq/energy_performance_available_preferences = default performance balance_performance balance_power power
/sys/devices/system/cpu/cpu14/cpufreq/scaling_driver = intel_pstate
/sys/devices/system/cpu/cpu14/cpufreq/scaling_governor = powersave
/sys/devices/system/cpu/cpu14/cpufreq/scaling_available_governors = performance powersave
/sys/devices/system/cpu/cpu14/cpufreq/scaling_min_freq = 800000 [kHz]
/sys/devices/system/cpu/cpu14/cpufreq/scaling_max_freq = 4800000 [kHz]
/sys/devices/system/cpu/cpu14/cpufreq/energy_performance_preference = balance_power [HWP.EPP]
/sys/devices/system/cpu/cpu14/cpufreq/energy_performance_available_preferences = default performance balance_performance balance_power power
/sys/devices/system/cpu/cpu15/cpufreq/scaling_driver = intel_pstate
/sys/devices/system/cpu/cpu15/cpufreq/scaling_governor = powersave
/sys/devices/system/cpu/cpu15/cpufreq/scaling_available_governors = performance powersave
/sys/devices/system/cpu/cpu15/cpufreq/scaling_min_freq = 800000 [kHz]
/sys/devices/system/cpu/cpu15/cpufreq/scaling_max_freq = 4800000 [kHz]
/sys/devices/system/cpu/cpu15/cpufreq/energy_performance_preference = balance_power [HWP.EPP]
/sys/devices/system/cpu/cpu15/cpufreq/energy_performance_available_preferences = default performance balance_performance balance_power power
/sys/devices/system/cpu/cpu2/cpufreq/scaling_driver = intel_pstate
/sys/devices/system/cpu/cpu2/cpufreq/scaling_governor = powersave
/sys/devices/system/cpu/cpu2/cpufreq/scaling_available_governors = performance powersave
/sys/devices/system/cpu/cpu2/cpufreq/scaling_min_freq = 800000 [kHz]
/sys/devices/system/cpu/cpu2/cpufreq/scaling_max_freq = 4800000 [kHz]
/sys/devices/system/cpu/cpu2/cpufreq/energy_performance_preference = balance_power [HWP.EPP]
/sys/devices/system/cpu/cpu2/cpufreq/energy_performance_available_preferences = default performance balance_performance balance_power power
/sys/devices/system/cpu/cpu3/cpufreq/scaling_driver = intel_pstate
/sys/devices/system/cpu/cpu3/cpufreq/scaling_governor = powersave
/sys/devices/system/cpu/cpu3/cpufreq/scaling_available_governors = performance powersave
/sys/devices/system/cpu/cpu3/cpufreq/scaling_min_freq = 800000 [kHz]
/sys/devices/system/cpu/cpu3/cpufreq/scaling_max_freq = 4800000 [kHz]
/sys/devices/system/cpu/cpu3/cpufreq/energy_performance_preference = balance_power [HWP.EPP]
/sys/devices/system/cpu/cpu3/cpufreq/energy_performance_available_preferences = default performance balance_performance balance_power power
/sys/devices/system/cpu/cpu4/cpufreq/scaling_driver = intel_pstate
/sys/devices/system/cpu/cpu4/cpufreq/scaling_governor = powersave
/sys/devices/system/cpu/cpu4/cpufreq/scaling_available_governors = performance powersave
/sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq = 800000 [kHz]
/sys/devices/system/cpu/cpu4/cpufreq/scaling_max_freq = 4900000 [kHz]
/sys/devices/system/cpu/cpu4/cpufreq/energy_performance_preference = balance_power [HWP.EPP]
/sys/devices/system/cpu/cpu4/cpufreq/energy_performance_available_preferences = default performance balance_performance balance_power power
/sys/devices/system/cpu/cpu5/cpufreq/scaling_driver = intel_pstate
/sys/devices/system/cpu/cpu5/cpufreq/scaling_governor = powersave
/sys/devices/system/cpu/cpu5/cpufreq/scaling_available_governors = performance powersave
/sys/devices/system/cpu/cpu5/cpufreq/scaling_min_freq = 800000 [kHz]
/sys/devices/system/cpu/cpu5/cpufreq/scaling_max_freq = 4900000 [kHz]
/sys/devices/system/cpu/cpu5/cpufreq/energy_performance_preference = balance_power [HWP.EPP]
/sys/devices/system/cpu/cpu5/cpufreq/energy_performance_available_preferences = default performance balance_performance balance_power power
/sys/devices/system/cpu/cpu6/cpufreq/scaling_driver = intel_pstate
/sys/devices/system/cpu/cpu6/cpufreq/scaling_governor = powersave
/sys/devices/system/cpu/cpu6/cpufreq/scaling_available_governors = performance powersave
/sys/devices/system/cpu/cpu6/cpufreq/scaling_min_freq = 800000 [kHz]
/sys/devices/system/cpu/cpu6/cpufreq/scaling_max_freq = 4800000 [kHz]
/sys/devices/system/cpu/cpu6/cpufreq/energy_performance_preference = balance_power [HWP.EPP]
/sys/devices/system/cpu/cpu6/cpufreq/energy_performance_available_preferences = default performance balance_performance balance_power power
/sys/devices/system/cpu/cpu7/cpufreq/scaling_driver = intel_pstate
/sys/devices/system/cpu/cpu7/cpufreq/scaling_governor = powersave
/sys/devices/system/cpu/cpu7/cpufreq/scaling_available_governors = performance powersave
/sys/devices/system/cpu/cpu7/cpufreq/scaling_min_freq = 800000 [kHz]
/sys/devices/system/cpu/cpu7/cpufreq/scaling_max_freq = 4800000 [kHz]
/sys/devices/system/cpu/cpu7/cpufreq/energy_performance_preference = balance_power [HWP.EPP]
/sys/devices/system/cpu/cpu7/cpufreq/energy_performance_available_preferences = default performance balance_performance balance_power power
/sys/devices/system/cpu/cpu8/cpufreq/scaling_driver = intel_pstate
/sys/devices/system/cpu/cpu8/cpufreq/scaling_governor = powersave
/sys/devices/system/cpu/cpu8/cpufreq/scaling_available_governors = performance powersave
/sys/devices/system/cpu/cpu8/cpufreq/scaling_min_freq = 800000 [kHz]
/sys/devices/system/cpu/cpu8/cpufreq/scaling_max_freq = 4800000 [kHz]
/sys/devices/system/cpu/cpu8/cpufreq/energy_performance_preference = balance_power [HWP.EPP]
/sys/devices/system/cpu/cpu8/cpufreq/energy_performance_available_preferences = default performance balance_performance balance_power power
/sys/devices/system/cpu/cpu9/cpufreq/scaling_driver = intel_pstate
/sys/devices/system/cpu/cpu9/cpufreq/scaling_governor = powersave
/sys/devices/system/cpu/cpu9/cpufreq/scaling_available_governors = performance powersave
/sys/devices/system/cpu/cpu9/cpufreq/scaling_min_freq = 800000 [kHz]
/sys/devices/system/cpu/cpu9/cpufreq/scaling_max_freq = 4800000 [kHz]
/sys/devices/system/cpu/cpu9/cpufreq/energy_performance_preference = balance_power [HWP.EPP]
/sys/devices/system/cpu/cpu9/cpufreq/energy_performance_available_preferences = default performance balance_performance balance_power power
/sys/devices/system/cpu/intel_pstate/min_perf_pct = 16 [%]
/sys/devices/system/cpu/intel_pstate/max_perf_pct = 100 [%]
/sys/devices/system/cpu/intel_pstate/no_turbo = 0
/sys/devices/system/cpu/intel_pstate/turbo_pct = 57 [%]
/sys/devices/system/cpu/intel_pstate/num_pstates = 41
/sys/module/workqueue/parameters/power_efficient = Y
/proc/sys/kernel/nmi_watchdog = 0
$paste <(ls /sys/devices/system/cpu/cpu0/cpufreq) <(cat /sys/devices/system/cpu/cpu0/cpufreq/*) | column -s $'\t' -t
affected_cpus 0
base_frequency 2500000
cpuinfo_max_freq 4800000
cpuinfo_min_freq 800000
cpuinfo_transition_latency 0
energy_performance_available_preferences default performance balance_performance balance_power power
energy_performance_preference balance_power
related_cpus 0
scaling_available_governors performance powersave
scaling_cur_freq 1103306
scaling_driver intel_pstate
scaling_governor powersave
scaling_max_freq 4800000
scaling_min_freq 800000
scaling_setspeed <unsupported>
$cat /proc/cpuinfo | grep "^[c]pu MHz"
cpu MHz : 2500.000
cpu MHz : 2500.000
cpu MHz : 2500.000
cpu MHz : 2500.000
cpu MHz : 2500.000
cpu MHz : 2500.000
cpu MHz : 2500.000
cpu MHz : 2500.000
cpu MHz : 2500.000
cpu MHz : 1070.651
cpu MHz : 2500.000
cpu MHz : 2500.000
cpu MHz : 1102.344
cpu MHz : 2500.000
cpu MHz : 2500.000
cpu MHz : 2500.000
当命令
cat /proc/cpuinfo | grep "^[c]pu MHz"
在 CPU 空闲时列出 2500.000 时,它只是一个默认的基本频率打印出来,因为实际的 CPU 频率信息是陈旧的,并且内核不想唤醒睡眠中的 CPU 只是为了确定它的工作频率。你可以看看
/sys/devices/system/cpu/cpu*/cpufreq/scaling_cur_freq
:但是,从内核 5.19 开始,它的响应将更改为与 /proc/cpuinfo 相同:
话虽如此,CPU频率无论如何都不是调查能耗的方法。通常,但并非总是如此,更高的 CPU 频率可以让任务更快地完成,从而导致更多的时间处于深度空闲状态,从而减少能源消耗。大多数英特尔处理器(过去十年内)以及最近一些 AMD 处理器电源监控的推荐工具是 turbostat(我认为是 linux-tools-common 包)。例子: