正文

深度学习MacBook Pro休眠睡觉术

(2017-12-06 14:19:08) 下一个

学习研究对象:2009中期MacBook Pro

目的:电池延寿减少充电循环次数

方法:休眠,睡眠,关机

MacBook Pro以2012年为分界线,2012年之前的本不支持 Standby功能。

解释下苹果有关电池节能选项:

Sleep:此方式只是关闭主要硬件但内存仍处于加电状态,所以唤醒很快但电池仍有耗电。

Shut Down:关机当然最省电,但开机唤醒慢。

2012年前的苹果本在Sleep模式下如果电池电量过低会自动进入Safe Sleep,这个模式类似视窗的Hibernate休眠,待存储完内存数据后会关闭RAM的供电进一步减少电量消耗。

从目前获取的信息来看,由于老本[2012以前]硬件不支持类似视窗的休眠功能,即使使用Terminal的命令人为改变苹果的hibernate模式,但结果仍然无效。

2009 MacBook Pro OS X EL Capitan下测试及结果

【几条命令

pmset -g 显示节能设置状态

sudo pmset -a hibernatemode 3 [ 3 Sleep 系统缺省默认或 25 Hibernate]  更改能源设置】

 

将默认hibernatemode 3 【类似视窗睡眠功能】更改为 hibernatemode 25【[类似视窗休眠功能】

强制从Sleep进入休眠模式没有问题,但加电启动在读取内存映像后不能正常进入系统,此时系统会报错crash并自动重启加载系统,类似视窗的冷启动和休眠之间混合操作。

如改为系统默认的hibernatemode 3使用Shut Down关机,并具有类似视窗休眠功能可以恢复关闭前的工作状态,但这种关机并不是简单地从内存映像中恢复,是类似正常冷启动后再加载关机前的应用程序,虽其结果类似视窗的休眠但要比真正从休眠中恢复要慢很多,如果以Sleep即时进入为1秒,正常冷开机不加载应用为7-8秒,则自动加载应用需要更长的时间,其长短取决于加载应用的多少和大小,这个机制有点类似正常启动后再去内存映像调取打开的应用,所以时间比正常开机要长。

结论:2012年以前的老本因硬件不能很好的支持休眠,所以要么保持默认的Sleep睡眠模式加速电池老化,要么用开机时间换取电池的延长寿命,即想延长电池寿命又能快速进入系统的纯休眠模式是个不可能的任务。

基于十年前的设计要求,现在兼容电池好一些大致50美刀一块,新电池大致可以支撑一般性使用6小时左右的续航,这个和新本还是没法比。

2012年以后MacBook Pro具备Standby功能,据说这是一个极其类似视窗休眠的模式能待机30天!虽然和视窗的休眠还是有一些差异,但功能实现和快速进入几无差异,如果要坚持使用纯hibernate模式,也可通过修改缺省参数就能达到视窗的休眠完全断电,只是这是后话。

 

不死心的update:

You HAVE TO reset the SMC and then the NVRAM / PRAM first:

Reset the SMC (http://support.apple.com/kb/ht3964):

  1. Shut down the computer.
  2. Plug in the MagSafe power adapter to a power source, connecting it to the Mac if its not already connected.
  3. On the built-in keyboard, press the (left side) Shift-Control-Option keys and the power button at the same time.
  4. Release all the keys and the power button at the same time.
  5. Press the power button to turn on the computer.

Note: The LED on the MagSafe power adapter may change states or temporarily turn off when you reset the SMC.

Resetting NVRAM / PRAM (http://support.apple.com/kb/HT1379):

  1. Shut down your Mac.
  2. Locate the following keys on the keyboard: Command, Option, P, and R. You will need to hold these keys down simultaneously in step 4.
  3. Turn on the computer.
  4. Press and hold the Command-Option-P-R keys before the gray screen appears.
  5. Hold the keys down until the computer restarts and you hear the startup sound for the second time.
  6. Release the keys.

Now execute these:

AC:

sudo pmset -c sleep 0
sudo pmset -c standby 0
sudo pmset -c standbydelay 5
sudo pmset -c hibernatemode 25

Battery:

sudo pmset -b sleep 120
sudo pmset -b standby 1
sudo pmset -b standbydelay 5
sudo pmset -b hibernatemode 25

All:

sudo pmset -a acwake 0
sudo pmset -a lidwake 0
sudo pmset -a ttyskeepawake 0
sudo pmset -a darkwakes 0

All done! Set the Macbook to sleep and when you wake it up you will see a progress bar before the computer is done. That means, the macbook was hibernating! (note: I hate they removed the sleeping light from the macbook pro, that was very useful)

I tried to summarize all the settings in a picture.

Sleep Standbysource

I would say there are just two "modes": Sleep and Hibernation

  • Sleep: data will be kept in memory.
  • Hibernation: (or Standby? SafeSleep? DeepSleep?) data will kept in hard disk and requires significant less power consumption.

Here are summaries of my understanding..

  1. if [sleep == 0], the computer will not sleep or hibernate any more.
  2. if [standby == 1] and [hibernatemode == 3], the computer will wait another [standbydelay]minutes before really entering hibernation.
  3. [autopoweroff] is just an extra implementation to fulfill regulatory requirement and has the same impact equivalent to 2)
  4. either 2) or 3) takes effect if one of them is reached at first.
  5. if [standby == 1] and [hibernatemode == 25], the computer will enter hibernation immediately after [sleep] minutes.

Can someone review and confirm the interpretation                             source

SMC+VARAM+Terminal, 休眠没问题复苏仍然崩溃的说!

 

[ 打印 ]
阅读 ()评论 (0)
评论
博主已隐藏评论
博主已关闭评论