Documentation/power/interface.txt

Chinese translated version of Documentation/power/interface.txt


If you have any comment or update to the content, please contact the
original document maintainer directly.  However, if you have a problem
communicating in English you can also ask the Chinese maintainer for
help.  Contact the Chinese maintainer if this translation is outdated
or if there is a problem with the translation.


Chinese maintainer: keyingjing <342311642@qq.com>
---------------------------------------------------------------------
Documentation/power/interface.txt 的中文翻译


如果想评论或更新本文的内容,请直接联系原文档的维护者。如果你使用英文
交流有困难的话,也可以向中文版维护者求助。如果本翻译更新不及时或者翻
译存在问题,请联系中文版维护者。


中文版维护者: 柯莹璟  <342311642@qq.com>
中文版翻译者: 柯莹璟  <342311642@qq.com>
中文版校译者: 柯莹璟  <342311642@qq.com>


Power Management Interface


The power management subsystem provides a unified sysfs interface to userspace, 
regardless of what architecture or platform one is running. The interface exists 
in /sys/power/ directory (assuming sysfs is mounted at /sys). 


电源管理接口
电源管理子系统提供了一个统一的sysfs接口到用户空间,无论体系结构或平台运行。该接口
寻在/sys/power/目录中(假设sysfs安装在/sys目录)。


/sys/power/state controls system power state. Reading from this file returns 
what states are supported, which is hard-coded to 'freeze', 'standby' 
(Power-On Suspend), 'mem' (Suspend-to-RAM), and 'disk'(Suspend-to-Disk). 
Writing to this file one of those strings causes the system to transition into
that state. Please see the file
Documentation/power/states.txt for a description of each of those
states.
/sys/power/disk controls the operating mode of the suspend-to-disk mechanism. 
Suspend-to-disk can be handled in several ways. We have a few options for putting 
the system to sleep - using the platform driver(e.g. ACPI or other suspend_ops), 
powering off the system or rebooting the system (for testing).


/sys/power/state控制系统电源状态。从这个文件中读取返回哪种状态被支持。这是硬编码
的“冻结”、“待机”(开机挂起)、“记忆”(挂载到内存)和“磁盘”(挂载到磁盘)。
这些字符串写入到本文件会导致系统过渡到该状态。请参阅文件Documentation/power/states.txt
对每种状态的描述。
/sys/power/disk 控制挂载到磁盘的机器的运行模式。挂载到磁盘能被一些方法处理,我们有几
种选择使用平台驱动程序将系统休眠(如ACPI 或其他 suspend_ops),关闭系统或者重启系统
(测试)。


Additionally, /sys/power/disk can be used to turn on one of the two testing modes
of the suspend-to-disk mechanism: 'testproc' or 'test'.  If the suspend-to-disk 
mechanism is in the 'testproc' mode, writing 'disk' to /sys/power/state will cause 
the kernel to disable nonboot CPUs and freeze tasks, wait for 5 seconds, unfreeze 
tasks and enable nonboot CPUs.  If it is in the 'test' mode, writing 'disk' to 
/sys/power/state will cause the kernel to disable nonboot CPUs and freeze tasks, 
shrink memory, suspend devices, wait for 5 seconds, resume devices, unfreeze tasks 
and enable nonboot CPUs.  Then, we are able to look in the log messages and work out, 
for example, which code is being slow and which device drivers are misbehaving.
 
此外,/sys/power/disk 可以用来打开挂载到磁盘机制的两种测试模式中的一个:'testproc' 
或 'test'。如果挂起到磁盘机制是在'testproc'模式中,写“磁盘”到/sys/power/state 会导致
内核禁用非引导的CPU并冻结任务,需要等待5秒钟来解冻任务和启用非引导CPU。如果是在'test'
模式中,写“磁盘”到/sys/power/state 会导致内核禁用非引导的CPU、冻结任务并缩小内存,需要
等待5秒钟恢复设备、解冻任务和启用非引导CPU。然后,我们可以在日志消息中看到并解决。例如,
可以知道哪些代码缓慢,哪个设备驱动异常。
 
Reading from this file will display all supported modes and the currently selected 
one in brackets, for example
从该文件中读取显示所有支持的模式并在括号中显示当前选定的模式,例如:


         [shutdown] reboot test testproc
 
 Writing to this file will accept one of 
  写这个文件将接受一个
  
         'platform' (only if the platform supports it)
         'shutdown'
         'reboot'
         'testproc'
         'test'
  
/sys/power/image_size controls the size of the image created by the suspend-to-disk 
mechanism.  It can be written a string representing a non-negative integer that will 
be used as an upper limit of the image size, in bytes.  The suspend-to-disk mechanism 
will do its best to ensure the image size will not exceed that number.  However, if 
this turns out to be impossible, it will try to suspend anyway using the smallest 
image possible.  In particular, if "0" is written to this file, the suspend image 
will be as small as possible.
Reading from this file will display the current image size limit, which is set to 
2/5 of available RAM by default.


/sys/power/image_size控制被挂载到磁盘机制创建的图像大小。它可以用一个非负整数字符串
表示图像大小的上限,以字节为单位。挂载到磁盘机制将竭尽所能以确保图像的大小不超过这个
数值。然而,如果事实证明不可能,它会尽可能尝试挂起使用了的最小图像。特别是,当“0”被写入
该文件中,挂起图像尽可能的小。
从这个文件中读取显示当前图像的大小限制,默认设置为2/5可用RAM。


/sys/power/pm_trace controls the code which saves the last PM event point in the RTC 
across reboots, so that you can debug a machine that just hangs during suspend 
(or more commonly, during resume).  Namely, the RTC is only used to save the last 
PM event point if this file contains '1'.  Initially it contains '0' which may be 
changed to '1' by writing a string representing a nonzero integer into it.
To use this debugging feature you should attempt to suspend the machine, then reboot
it and run
/sys/power/pm_trace 控制保存在RTC重启后最后一个PM事件点的代码,所以,你可以调试一台正
在挂载期间的机器(或更常见地,在恢复期间)。也就是说,如果文件中包含“1”,那么RTC是唯一
用来保存最后PM事件节点的。最初,它包含“0”,可能在写入一个非负整数字符串时更改为“1”。
要使用这个调试功能,你应该尝试暂停机器,然后重新启动并运行。


         dmesg -s 1000000 | grep 'hash matches'


CAUTION: Using it will cause your machine's real-time (CMOS) clock to be set to a 
random invalid time after a resume.
注意:使用它会使你机器上的实际时钟(CMOS)在恢复后被设置为随机的无效时间。
Python网络爬虫与推荐算法新闻推荐平台:网络爬虫:通过Python实现新浪新闻的爬取,可爬取新闻页面上的标题、文本、图片、视频链接(保留排版) 推荐算法:权重衰减+标签推荐+区域推荐+热点推荐.zip项目工程资源经过严格测试可直接运行成功且功能正常的情况才上传,可轻松复刻,拿到资料包后可轻松复现出一样的项目,本人系统开发经验充足(全领域),有任何使用问题欢迎随时与我联系,我会及时为您解惑,提供帮助。 【资源内容】:包含完整源码+工程文件+说明(如有)等。答辩评审平均分达到96分,放心下载使用!可轻松复现,设计报告也可借鉴此项目,该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的。 【提供帮助】:有任何使用问题欢迎随时与我联系,我会及时解答解惑,提供帮助 【附带帮助】:若还需要相关开发工具、学习资料等,我会提供帮助,提供资料,鼓励学习进步 【项目价值】:可用在相关项目设计中,皆可应用在项目、毕业设计、课程设计、期末/期中/大作业、工程实训、大创等学科竞赛比赛、初期项目立项、学习/练手等方面,可借鉴此优质项目实现复刻,设计报告也可借鉴此项目,也可基于此项目来扩展开发出更多功能 下载后请首先打开README文件(如有),项目工程可直接复现复刻,如果基础还行,也可在此程序基础上进行修改,以实现其它功能。供开源学习/技术交流/学习参考,勿用于商业用途。质量优质,放心下载使用。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值