Documentation/cpu-freq/boost.txt

本文介绍了处理器Boost功能,包括其原理及如何通过系统文件进行控制。Boost功能可在满足一定条件时提升多核处理器的运行频率,无需操作系统干预。文章还讨论了用户为何需要控制此功能以及如何在Linux环境下操作。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Chinese translated version of Documentation/cpu-freq/boost.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: Liemin Ma <maliemin.jj@gmail.com>
---------------------------------------------------------------------
Documentation/cpu-freq/boost.txt 
的中文翻译

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

中文版维护者:  马列敏 <maliemin.jj@gmail.com>
中文版翻译者:  马列敏<maliemin.jj@gmail.com>
中文版校译者:  马列敏<maliemin.jj@gmail.com>

 

 

以下为正文
---------------------------------------------------------------------

Processor boosting control

 

         - information for users -

处理器boost控制,用户信息

 Quick guide for the impatient:

快速指南

 --------------------

 /sys/devices/system/cpu/cpufreq/boost

 controls the boost setting for the whole system. You can read and write

 that file with either "0" (boosting disabled) or "1" (boosting allowed).

 Reading or writing 1 does not mean that the system is boosting at this

 very moment, but only that the CPU _may_ raise the frequency at it's

 discretion.

 /sys/devices/system/cpu/cpufreq/boost

控制boost设置为了整个系统,你可以读或写这个文件用“0”(禁用boost)或“1”(启用boost)。

读或写1并不意味着系统正在boost仅仅只有cpu会在自己的判断下提高频率。

 --------------------

 

 Introduction

介绍

 -------------

 Some CPUs support a functionality to raise the operating frequency of

 some cores in a multi-core package if certain conditions apply, mostly

 if the whole chip is not fully utilized and below it's intended thermal

 budget. This is done without operating system control by a combination

 of hardware and firmware.

 On Intel CPUs this is called "Turbo Boost", AMD calls it "Turbo-Core",

 in technical documentation "Core performance boost". In Linux we use

 the term "boost" for convenience.

 

如果特定的条件支持的话,一些cpu支持一种功能,去提高一些在一个多核心包中的核的操作频率,大多数是在芯片未完全利用且低于预期的热预算(产热在支持范围内)的情况下。这些完成是不需要操作系统的控制的,而是硬件和固件完成的。

在因特尔处理器上这被称为“Turbo Boost” AMD处理器称它为“Turbo-Core”,在科技文档中称为“Core performance boost”。在linux中,为了方便,我们称它“boost”

 Rationale for disable switch

禁用开关的理由

 ----------------------------

 

 Though the idea is to just give better performance without any user

 intervention, sometimes the need arises to disable this functionality.

 Most systems offer a switch in the (BIOS)firmware to disable the

 functionality at all, but a more fine-grained and dynamic control would

 be desirable:

虽然这个想法只是给出更好的性能,而没有用户的介入,但是有时,也出现了禁用这个功能的需求。大多数系统在固件中(BIOS)提供了一个开关来完全禁用这个功能,但是一个更细粒度的且动态控制的方法更好。

 1. While running benchmarks, reproducible results are important. Since

    the boosting functionality depends on the load of the whole package,

    single thread performance can vary. By explicitly disabling the boost

    functionality at least for the benchmark's run-time the system will run

    at a fixed frequency and results are reproducible again.

当运行标准检查程序,可复写的结果十分重要。因为boost功能依赖于整个包的载入,单线程的性能会变化不定。通过确保禁用boost功能,至少在运行检查标准程序时,系统会运行在一个固定的频率,并且结果会重现。

 2. To examine the impact of the boosting functionality it is helpful

    to do tests with and without boosting.

用或者不用boost来做测试,是对检测boost功能的影响,十分有帮助的。

 3. Boosting means overclocking the processor,though under controlled

    conditions. By raising the frequency and the voltage the processor

    will consume more power than without the boosting, which may be

    undesirable for instance for mobile users.Disabling boosting may

    save power here, though this depends on the workload.

 

 boost意味着处理器超频工作,虽然是在受控制的条件下。通过提高频率和电压,处理器会比不用boost消耗更多的电。这样可能对移动用户会不太好。禁用boost可能会节省电能,虽然这取决于工作量。

 User controlled switch

用户控制开关

 ----------------------

 

 To allow the user to toggle the boosting functionality, the acpi-cpufreq

 driver exports a sysfs knob to disable it.There is a file:

 /sys/devices/system/cpu/cpufreq/boost

 which can either read "0" (boosting disabled) or "1" (boosting enabled).

 Reading the file is always supported, even if the processor does not

 support boosting. In this case the file will be read-only and always

 reads as "0". Explicitly changing the permissions and writing to that

 file anyway will return EINVAL.

 为了允许用户切换boost功能,acpi-cpufreq驱动器输出一个sysfs来禁用它。有一个文件:

 /sys/devices/system/cpu/cpufreq/boost

它可以被读为“0”(禁用boost)或“1”(启用boost)。读取这个文件总是被支持的,即使在不支持boost的情况下。在这种情况下这个文件会是只读的并且总是被读为“0”,如果改变权限强行写入那个文件将会返回错误EINVAD。

 On supported CPUs one can write either a"0" or a "1" into this file.

 This will either disable the boost functionality on all cores in the

 whole system (0) or will allow the hardware to boost at will (1).

 在支持boost的cpu上,则可以写“0”或“1”在那个文件里。这将会在整个系统所有的核上禁用boost功能(0)或将会允许硬件boost(1)。

 Writing a "1" does not explicitly boost the system, but just allows the

 CPU (and the firmware) to boost at their discretion. Some implementations

 take external factors like the chip's temperature into account, so

 boosting once does not necessarily mean that it will occur every time

 even using the exact same software setup.

 写入“1”并不是boost系统,而是允许cpu(还有固件)在自己的判断下boost。

 一些实现还把一些外部考虑进来了,比如芯片的温度,所以boost一次并不意味着它会每次都出现,即使用一些软件来启动。

 AMD legacy cpb switch

AMD cpb开关

 ---------------------

 The AMD powernow-k8 driver used to support a very similar switch to

 disable or enable the "Core Performance Boost" feature of some AMD CPUs.

 This switch was instantiated in each CPU's cpufreq directory

 (/sys/devices/system/cpu[0-9]*/cpufreq) and was called "cpb".

 Though the per CPU existence hints at a more fine grained control, the

 actual implementation only supported a system-global switch semantics,

 which was simply reflected into each CPU's file. Writing a 0 or 1 into it

 would pull the other CPUs to the same state.

 For compatibility reasons this file and its behavior is still supported

 on AMD CPUs, though it is now protected by aconfig switch

 (X86_ACPI_CPUFREQ_CPB). On Intel CPUs this file will never be created,

 even with the config option set.

 This functionality is considered legacy and will be removed in some future

 kernel version.

 AMD powernow-k8驱动器过去支持一种非常类似的开关,来禁用或启用一些AMD cpu的 "Core Performance Boost"特性。举例来说,这个开关在每个cpu的cpufreq路径下 (/sys/devices/system/cpu[0-9]*/cpufreq),并且被称为“cpb”。虽然每个cpu的存在表明一个更细粒度的控制,但是实际的实现只支持一个系统全局开关,它只是简单的映射到每一个cpu的文件里。写入0或1会使其他的cpu同样的状态。

出于兼容性考虑,在AMDcpu上这个文件和它的操作仍是被支持的,虽然它现在被一个配置开关保护 (X86_ACPI_CPUFREQ_CPB)。在因特尔cpu上这个文件将不会被创建,即使设置了配置选项。

这个功能被认为是旧时的,将会在将来的内核版本中移除。

 More fine grained boosting control

更细粒度的boost控制

 ----------------------------------

 

 Technically it is possible to switch the boosting functionality at least

 on a per package basis, for some CPUs even per core. Currently the driver

 does not support it, but this may be implemented in the future.

至少在每个包基础上开关boost功能,这在技术上是可能的,并且甚至在每个核上。现在驱动器并不支持,将来可能会实现。

 

<think>我们正在解决Boost编译过程中遇到的问题,特别是关于Unicode/ICU支持未找到的情况。根据引用[2]中的信息,提示信息【Unicode/ICUsupportforBoost.Regex?...notfound.】对应的依赖包是【libiculibicu-devel】。因此,我们需要安装这些依赖包来提供Unicode/ICU支持。另外,引用[3]中提到了Boost库的编译步骤,在运行bootstrap.sh之后,会列出需要单独构建的库,其中就包括regex(正则表达式库),而regex库需要ICU支持。解决方案步骤:1.安装ICU开发包(包括头文件和库)。在基于RPM的系统(如CentOS、Fedora)中,使用以下命令:sudoyuminstalllibicu-devel或者在基于Debian的系统(如Ubuntu)中,使用:sudoapt-getinstalllibicu-dev2.确保安装后,重新运行bootstrap.sh。在Boost源码目录中执行:./bootstrap.sh3.然后,在编译Boost时,需要指定ICU支持。可以通过在project-config.jam中设置或使用命令行参数。例如,在运行b2时,可以指定:./b2-sICU_PATH=/usr/include/icu-sICU_LINK=-licuuc-sICU_ICUUC_LIB_NAME=icuuc但更简单的方式是,让b2自动检测。因为安装libicu-devel后,通常b2可以自动找到ICU。4.如果自动检测失败,可以尝试在project-config.jam中明确指定ICU路径。打开project-config.jam(在Boost根目录),在开头添加:usinggcc:::<include>/usr/include<library>/usr/lib64;#根据实际路径调整或者专门为regex指定ICU:optionsregex:::<library>icuuc<library>icudata<library>icui18n;但通常不需要手动指定,因为安装开发包后,系统默认路径会被找到。5.然后进行编译安装:./b2sudo./b2install注意:引用[4]中提到了一个编译错误,但该错误是关于匿名可变参数宏的,与ICU无关。如果遇到该错误,可能需要升级Boost版本或调整编译器选项(如去掉-Werror=variadic-macros),但当前问题先解决ICU。如果按照上述步骤安装依赖后仍然提示未找到,请检查:-是否成功安装了libicu-devel(或libicu-dev)?-检查/usr/include下是否有icu目录,以及/usr/lib64(或/usr/lib)下是否有libicuuc.so等库文件。另外,引用[3]中还提到,除了regex库,还有其他库可能需要单独构建,但当前问题集中在regex的ICU支持。因此,主要步骤是安装ICU开发包并重新编译。如果问题仍然存在,可能需要查看具体的编译日志,以确定b2为什么没有找到ICU。生成相关问题:1.如何验证ICU库是否正确安装?2.在非标准路径下安装ICU,如何让Boost找到?3.除了ICU,Boost编译还可能遇到哪些常见依赖问题?4.如何只编译Boost.Regex库并测试ICU支持?</think>### Boost编译时Unicode/ICU支持未找到的解决方案 在编译Boost库时出现`Unicode/ICU support for Boost.Regex?... not found`错误,是由于缺少Unicode/ICU库支持导致的。以下是详细解决步骤: #### 1. **安装ICU依赖库** 根据系统类型执行对应命令: ```bash # Ubuntu/Debian sudo apt-get install libicu-dev # CentOS/RHEL sudo yum install libicu-devel # Fedora sudo dnf install libicu-devel ``` 安装后系统将提供ICU头文件(`/usr/include/unicode`)和库文件(`libicuuc.so`, `libicui18n.so`等)[^2]。 #### 2. **验证ICU安装** 检查ICU版本和文件路径: ```bash # 查看ICU版本 icu-config --version # 检查头文件路径 ls /usr/include/unicode # 检查库文件 ls /usr/lib*/libicuuc.so* ``` #### 3. **重新配置Boost** 在Boost源码目录中重新生成构建配置: ```bash ./bootstrap.sh --with-libraries=regex # 重点编译regex库 ``` 此时应出现`Unicode/ICU support for Boost.Regex?... found`提示[^3]。 #### 4. **指定ICU路径(可选)** 若ICU安装在非标准路径,需在`project-config.jam`中显式声明: ```jam using gcc : : : <include>/path/to/icu/include <library>/path/to/icu/lib <find-shared-library>icuuc <find-shared-library>icudata ; ``` #### 5. **编译并测试** 执行编译并验证ICU支持: ```bash # 编译regex库 ./b2 --with-regex # 测试ICU支持 ./b2 -d+2 | grep "ICU" # 应显示ICU链接信息 ``` #### 常见问题排查 - **错误提示持续存在**:检查`libicu-devel`是否安装完整,尝试重建Boost配置: ```bash rm project-config.jam b2 ./bootstrap.sh --clean ``` - **链接错误**:确保编译时包含ICU库: ```bash ./b2 cxxflags="-DU_CHARSET_IS_UTF8=1" linkflags="-licuuc -licudata" ``` - **版本冲突**:ICU版本需兼容Boost版本,建议使用Boost 1.75+(修复了C++11兼容性问题)[^4]。 > **关键说明**:Boost.Regex依赖ICU实现完整的Unicode支持,缺少该库会导致正则表达式功能受限(如无法处理UTF-8字符)[^3]。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值