Documentation\cpu-freq\core.txt

2024-06-22 07:48
文章标签 core cpu txt freq documentation

本文主要是介绍Documentation\cpu-freq\core.txt,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

    如果想评论或更新本文的内容,请直接联系原文档的维护者。

如果你使用英文交流有困难的话,也可以向中文版维护者求助。

如果本翻译更新不及时或者翻译存在问题,请联系中文版维护者。

中文版维护者: 陶莹莉  tyl18768122426@163.com

中文版翻译者:  陶莹莉  tyl18768122426@163.com

中文版校译者:  陶莹莉  tyl18768122426@163.com

 

 CPU frequency and voltage scaling code in the Linux(TM) kernel
  在Linux(TM)内核的CPU频率和缩放代码

           L i n u x    C P U F r e q

     C P U F r e q    C o r e


      Dominik Brodowski  <linux@brodo.de>
       David Kimdon <dwhedon@debian.org>

 

   Clock scaling allows you to change the clock speed of the CPUs on the
    fly. This is a nice method to save battery power, because the lower
            the clock speed, the less power the CPU consumes.

 时钟分频,可以让你改变CPU的时钟飞逝速度。这是一个很好的节省电池电量方法,因为
           时钟速度越低,CPU消耗功率越少。
Contents:
---------
1.  CPUFreq core and interfaces
2.  CPUFreq notifiers

1. General Information

=======================
目录:
---------
1.CPUFreq的核心和接口
2.CPUFreq通知

1.一般信息
=======================

The CPUFreq core code is located in drivers/cpufreq/cpufreq.c. This
cpufreq code offers a standardized interface for the CPUFreq
architecture drivers (those pieces of code that do actual
frequency transitions), as well as to "notifiers". These are device
drivers or other part of the kernel that need to be informed of
policy changes (ex. thermal modules like ACPI) or of all
frequency changes (ex. timing code) or even need to force certain
speed limits (like LCD drivers on ARM architecture). Additionally, the
kernel "constant" loops_per_jiffy is updated on frequency changes
here.

CPUFreq的核心代码位于drivers/cpufreq/cpufreq.c。CPU频率代码为CPUFreq
架构驱动程序提供了一个标准化接口(这部分代码,实际一直在做频率转换),
以及“通知”。这些设备驱动程序或其他内核的一部分,需要被告知策略的变化
(例如热模块,如ACPI)或频率的变化(例如:计时码),甚至需要强制某些
速度限制(如LCD驱动器在ARM架构)。此外,该内核“常数”loops_per_jiffy在频繁的更新变化。

Reference counting is done by cpufreq_get_cpu and cpufreq_put_cpu,
which make sure that the cpufreq processor driver is correctly
registered with the core, and will not be unloaded until
cpufreq_put_cpu is called.
引用计数由cpufreq_get_cpu 和cpufreq_put_cpu完成,确保CPU频率的处理器驱动程序是正确
被注册到核心的,并且不会被卸载,直到被称cpufreq_put_cpu调用。

2. CPUFreq notifiers
====================
2.CPUFreq 通知
====================
CPUFreq notifiers conform to the standard kernel notifier interface.
See linux/include/linux/notifier.h for details on notifiers.

CPUFreq通知程序符合标准内核通知接口。
详细信息请参阅linux/include/linux/notifier.h。

There are two different CPUFreq notifiers - policy notifiers and
transition notifiers.

有两种不同的CPUFreq通知 - 策略通知和过渡通知。

2.1 CPUFreq policy notifiers
----------------------------
2.1 CPUFreq 策略通知
----------------------------

These are notified when a new policy is intended to be set. Each
CPUFreq policy notifier is called three times for a policy transition:

1.) During CPUFREQ_ADJUST all CPUFreq notifiers may change the limit if
    they see a need for this - may it be thermal considerations or
    hardware limitations.

2.) During CPUFREQ_INCOMPATIBLE only changes may be done in order to avoid
    hardware failure.

3.) And during CPUFREQ_NOTIFY all notifiers are informed of the new policy
   - if two hardware drivers failed to agree on a new policy before this
   stage, the incompatible hardware shall be shut down, and the user
   informed of this.
  
当一个新策略的打算实施时需要通知。为了策略的过渡,每个CPUFreq策略通知会被调用三次:
1)在CPUFREQ调整期间,所有的CPUFreq通知可能会改变限制,如果
    他们认为这一点有必要 - 这可能出于导热的考虑或硬件的限制。

2)在CPUFREQ不兼容时,可能做些改变,以避免硬件故障。

3)在CPUFREQ通知时,所有通知会被告知新的策略
    - 如果两个硬件驱动程序在此之前未能达成了新的政策,这个不兼容的硬件应该关机,用户会被
   通知这个。
  
The phase is specified in the second argument to the notifier.

The third argument, a void *pointer, points to a struct cpufreq_policy
consisting of five values: cpu, min, max, policy and max_cpu_freq. min
and max are the lower and upper frequencies (in kHz) of the new
policy, policy the new policy, cpu the number of the affected CPU; and
max_cpu_freq the maximum supported CPU frequency. This value is given
for informational purposes only.

这个阶段被指定为通知的第二个参数。

第三个参数是void *指针,指向一个cpufreq_policy的结构体,包括五个值:CPU,
最小值,最大值,策略和最大CPU频率的。最小和最大是新
方针频率(千赫)的下限和上限,实现新策略,CPU数量会影响CPU ;
最大CPU频率是支持的最大CPU频率。这个值仅供参考。
2.2 CPUFreq transition notifiers
--------------------------------

These are notified twice when the CPUfreq driver switches the CPU core
frequency and this change has any external implications.

The second argument specifies the phase - CPUFREQ_PRECHANGE or
CPUFREQ_POSTCHANGE.

2.2 CPUFreq过渡通知
这些都是通知两次当cpufreq驱动CPU核心频率而这种变化有对任何外部有影响。

第二个参数指定的阶段是 CPUFREQ_PRECHANGE或CPUFREQ_POSTCHANGE。

The third argument is a struct cpufreq_freqs with the following
values:
cpu - number of the affected CPU
old - old frequency
new - new frequency
CPUFREQ_POSTCHANGE。
第三个参数是一个结构体类型的cpufreq_freqs,含有以下的值:
CPU -受影响的CPU数量
old- 旧频率
new - 新频率
CPUFREQ_POSTCHANGE。

If the cpufreq core detects the frequency has changed while the system
was suspended, these notifiers are called with CPUFREQ_RESUMECHANGE as
second argument.
如果CPU频率核心检测的频率发生了变化,但被系统禁止,这些通知会被称为CPUFREQ_RESUMECHANGE作为
第二个参数。

这篇关于Documentation\cpu-freq\core.txt的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/1083694

相关文章

批量导入txt数据到的redis过程

《批量导入txt数据到的redis过程》用户通过将Redis命令逐行写入txt文件,利用管道模式运行客户端,成功执行批量删除以Product*匹配的Key操作,提高了数据清理效率... 目录批量导入txt数据到Redisjs把redis命令按一条 一行写到txt中管道命令运行redis客户端成功了批量删除k

C#监听txt文档获取新数据方式

《C#监听txt文档获取新数据方式》文章介绍通过监听txt文件获取最新数据,并实现开机自启动、禁用窗口关闭按钮、阻止Ctrl+C中断及防止程序退出等功能,代码整合于主函数中,供参考学习... 目录前言一、监听txt文档增加数据二、其他功能1. 设置开机自启动2. 禁止控制台窗口关闭按钮3. 阻止Ctrl +

Linux进程CPU绑定优化与实践过程

《Linux进程CPU绑定优化与实践过程》Linux支持进程绑定至特定CPU核心,通过sched_setaffinity系统调用和taskset工具实现,优化缓存效率与上下文切换,提升多核计算性能,适... 目录1. 多核处理器及并行计算概念1.1 多核处理器架构概述1.2 并行计算的含义及重要性1.3 并

Linux下进程的CPU配置与线程绑定过程

《Linux下进程的CPU配置与线程绑定过程》本文介绍Linux系统中基于进程和线程的CPU配置方法,通过taskset命令和pthread库调整亲和力,将进程/线程绑定到特定CPU核心以优化资源分配... 目录1 基于进程的CPU配置1.1 对CPU亲和力的配置1.2 绑定进程到指定CPU核上运行2 基于

Java进程CPU使用率过高排查步骤详细讲解

《Java进程CPU使用率过高排查步骤详细讲解》:本文主要介绍Java进程CPU使用率过高排查的相关资料,针对Java进程CPU使用率高的问题,我们可以遵循以下步骤进行排查和优化,文中通过代码介绍... 目录前言一、初步定位问题1.1 确认进程状态1.2 确定Java进程ID1.3 快速生成线程堆栈二、分析

conda安装GPU版pytorch默认却是cpu版本

《conda安装GPU版pytorch默认却是cpu版本》本文主要介绍了遇到Conda安装PyTorchGPU版本却默认安装CPU的问题,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的... 目录一、问题描述二、网上解决方案罗列【此节为反面方案罗列!!!】三、发现的根本原因[独家]3.1 p

Linux CPU飙升排查五步法解读

《LinuxCPU飙升排查五步法解读》:本文主要介绍LinuxCPU飙升排查五步法,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录排查思路-五步法1. top命令定位应用进程pid2.php top-Hp[pid]定位应用进程对应的线程tid3. printf"%

无法启动此程序因为计算机丢失api-ms-win-core-path-l1-1-0.dll修复方案

《无法启动此程序因为计算机丢失api-ms-win-core-path-l1-1-0.dll修复方案》:本文主要介绍了无法启动此程序,详细内容请阅读本文,希望能对你有所帮助... 在计算机使用过程中,我们经常会遇到一些错误提示,其中之一就是"api-ms-win-core-path-l1-1-0.dll丢失

判断PyTorch是GPU版还是CPU版的方法小结

《判断PyTorch是GPU版还是CPU版的方法小结》PyTorch作为当前最流行的深度学习框架之一,支持在CPU和GPU(NVIDIACUDA)上运行,所以对于深度学习开发者来说,正确识别PyTor... 目录前言为什么需要区分GPU和CPU版本?性能差异硬件要求如何检查PyTorch版本?方法1:使用命

Python如何将大TXT文件分割成4KB小文件

《Python如何将大TXT文件分割成4KB小文件》处理大文本文件是程序员经常遇到的挑战,特别是当我们需要把一个几百MB甚至几个GB的TXT文件分割成小块时,下面我们来聊聊如何用Python自动完成这... 目录为什么需要分割TXT文件基础版:按行分割进阶版:精确控制文件大小完美解决方案:支持UTF-8编码