Windows 10/Power Management

Windows 10/Power Management

ACPI 状态

  • S0 : 正常工作状态,所有设备正常运转。
  • S1 : Sleeping with Processor Context Maintained。CPU停止工作,不执行任何指令,但是CPU,芯片组以及DRAM内容没有遗失。此状态可以快速恢复到工作状态。
  • S2 : 比S1的睡眠状态更深更省电,CPU停止工作,但是CPU和cache的内容已丢失。DRAM仍处于带电状态。
  • S3 : Suspend to RAM (Sleep)。功耗更低,内存信息得以保持,CPU, Cache, Chipset的内容均丢失。DRAM仍处于带电状态。
  • S4 : Suspend to Disk (hibernate)。功耗最低,唤醒需要的时间最长,所有设备都不再工作。Memory的资料被保存在Disk中。当系统收到唤醒信号后,首先从 Disk 中恢复memory。UEFI固件对于S4不需要做任何特殊处理,memory被保存到disk,S4回来后从Disk恢复的动作全部由操作系统完成,UEFI可以将其作为一般启动即可。这和S3有很大不同。
  • S5 : 彻底关闭电源。

Windows 10

  • 仅关闭显示器 : scrnsave.scr /s 。任何键鼠操作立即恢复打开屏幕。
  • Sleep (睡眠) : 进入 S3 (Standby) 状态。
    • 对于笔记本电脑,如果在S3情况下电力消耗殆尽,UEFI固件会在电力下降到一个阈值后自动开机并把S3转换到S4。但一些小厂商的本子 UEFI 固件做的不好导致这个功能问题很多。
  • Hybrid Sleep (混合睡眠模式) : 微软发明的。
    1. 合上盖子的时候进入混合睡眠模式,即虽然要进入S3,但也把S4需要的内容存储下来了。
    2. 如果在电源消耗完之前从S3回来,例如开启盖子等。就按照S3启动路径。
    3. 如果电源消耗结束后再回来,就按照S4的路径启动。
  • Hibernate (休眠): 进入 S4 状态。开启或禁用关机菜单里的 hibernate 选项:
    • powercfg /hibernate off
    • powercfg /hibernate on
    • 休眠文件 hiberfil.sys 默认是内存的 75% 大小。可以用 powercfg /h /type reduced 缩小休眠文件大小,这样做以后只支持内核会话(快速启动)的休眠,禁用传统(全内存)休眠。
  • Shutdown : 默认使用"快速启动(Fast Startup)", 可在控制面板电源管理里关闭。开启 Fast Startup 时的关机菜单的 Shutdown = Sign out + Hibernate。
    • 强制传统方式关机 : shutdown /s /full / t 0
    • 如果安装了多系统,建议关闭 Fast Startup。
    • Fast Startup 不影响 reboot 行为。
  • 使用 powercfg /a 查看当前系统支持的睡眠模式。通常 Windows 10 笔记本默认支持 Standby (S3), Hibernate, Fast Startup 这3种睡眠状态(sleep states)。

Wake

powercfg -DEVICEQUERY wake_armed

Bluetooth wake

文档

Windows Vista with Service Pack 2 (SP2) and later provides software support that lets Bluetooth-enabled keyboards and mouse devices wake the computer from sleep (S3) or hibernate (S4) system power states. For such a wake to be successful, the Bluetooth module must be self-powered and must have enough power to wake the computer. Even if Windows enables wake from the S4 system power state, the computer will not wake if the Bluetooth module has no power when the computer is in S4.

To enable Remote Wake in software, verify that the Bluetooth module can support wake and set the following registry values:

  • HKLM\System\CurrentControlSet\Services\Bthport\Parameters \SystemRemoteWakeSupported : (DWORD) 1
  • HKLM\System\CurrentControlSet\Enum\USB\\ \Device Parameters\RemoteWakeEnabled : (DWORD) 1
  • HKLM\System\CurrentControlSet\Enum\USB\\ \Device Parameters\DeviceRemoteWakeSupported : (DWORD) 1

Note If the Bluetooth radio's property page in Device Manager has a Power Management tab, the radio can support wake. If no Power Management tab exists, the radio might support wake, but it is unlikely.

Network wake (Wake-on-LAN)

Wake-on-LAN (WOL) / Wake-on-WLAN 需要主板和BIOS的支持。机器在休眠或关机时主板和网卡还保持微弱的供电,网卡会监听广播包,并对其进行解析。如果发现符合协议,并且MAC地址就是该网卡的MAC地址,则通知主板进行唤醒。这种唤醒数据包被称为Magic Packet,格式为:"FF FF FF FF FF FF MAC地址"。

WOL is supported from sleep (S3) or hibernate (S4). It is not supported from fast startup or soft off (S5) shutdown states. NICs are not armed for wake in these states because users do not expect their systems to wake up on their own.

启用 WOL:

  1. 在 BIOS 里开启 Wake on WLAN
  2. 在 Windows 10 的 Device Manager - Network Interface - Power Management 里开启 allow this device to wake the computer 和 only allow a magic packet to wake the computer 这2个选项。

Last update: 2021-04-09 11:41:24 UTC