.. SPDX-License-Identifier: GPL-2.0 .. include:: ../disclaimer-zh_CN.rst :Original: Documentation/cpu-freq/cpufreq-stats.rst :翻译: 司延腾 Yanteng Si :校译: 唐艺舟 Tang Yizhou ========================================== sysfs CPUFreq Stats的一般说明 ========================================== 为使用者准备的信息 作者: Venkatesh Pallipadi .. Contents 1. 简介 2. 提供的统计数据(举例说明) 3. 配置cpufreq-stats 1. 简介 =============== cpufreq-stats是一种为每个CPU提供CPU频率统计的驱动。 这些统计数据以/sysfs中一系列只读接口的形式呈现。cpufreq-stats接口(若已配置)将为每个CPU生成 /sysfs(/devices/system/cpu/cpuX/cpufreq/stats/)中cpufreq目录下的stats目录。 各项统计数据将在stats目录下形成对应的只读文件。 此驱动是以独立于任何可能运行在你所用CPU上的特定cpufreq_driver的方式设计的。因此,它将能和任何 cpufreq_driver协同工作。 2. 已提供的统计数据(有例子) ===================================== cpufreq stats提供了以下统计数据(在下面详细解释)。 - time_in_state - total_trans - trans_table 所有统计数据来自以下时间范围:从统计驱动被加载的时间(或统计数据被重置的时间)开始,到某一统计数据被读取的时间为止。 显然,统计驱动不会保存它被加载之前的任何频率转换信息。 :: :/sys/devices/system/cpu/cpu0/cpufreq/stats # ls -l total 0 drwxr-xr-x 2 root root 0 May 14 16:06 . drwxr-xr-x 3 root root 0 May 14 15:58 .. --w------- 1 root root 4096 May 14 16:06 reset -r--r--r-- 1 root root 4096 May 14 16:06 time_in_state -r--r--r-- 1 root root 4096 May 14 16:06 total_trans -r--r--r-- 1 root root 4096 May 14 16:06 trans_table - **reset** 只写属性,可用于重置统计计数器。这对于评估不同调节器的系统行为非常有用,且无需重启。 - **time_in_state** 此文件给出了在本CPU支持的每个频率上分别花费的时间。cat输出的每一行都是一个"