⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cpufreq-stats.txt

📁 linux 内核源代码
💻 TXT
字号:
     CPU frequency and voltage scaling statistics in the Linux(TM) kernel             L i n u x    c p u f r e q - s t a t s   d r i v e r                       - information for users -             Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>Contents1. Introduction2. Statistics Provided (with example)3. Configuring cpufreq-stats1. Introductioncpufreq-stats is a driver that provides CPU frequency statistics for each CPU.These statistics are provided in /sysfs as a bunch of read_only interfaces. Thisinterface (when configured) will appear in a separate directory under cpufreqin /sysfs (<sysfs root>/devices/system/cpu/cpuX/cpufreq/stats/) for each CPU.Various statistics will form read_only files under this directory.This driver is designed to be independent of any particular cpufreq_driverthat may be running on your CPU. So, it will work with any cpufreq_driver.2. Statistics Provided (with example)cpufreq stats provides following statistics (explained in detail below).-  time_in_state-  total_trans-  trans_tableAll the statistics will be from the time the stats driver has been inserted to the time when a read of a particular statistic is done. Obviously, stats driver will not have any information about the frequency transitions beforethe stats driver insertion.--------------------------------------------------------------------------------<mysystem>:/sys/devices/system/cpu/cpu0/cpufreq/stats # ls -ltotal 0drwxr-xr-x  2 root root    0 May 14 16:06 .drwxr-xr-x  3 root root    0 May 14 15:58 ..-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---------------------------------------------------------------------------------  time_in_stateThis gives the amount of time spent in each of the frequencies supported bythis CPU. The cat output will have "<frequency> <time>" pair in each line, whichwill mean this CPU spent <time> usertime units of time at <frequency>. Outputwill have one line for each of the supported frequencies. usertime units here is 10mS (similar to other time exported in /proc).--------------------------------------------------------------------------------<mysystem>:/sys/devices/system/cpu/cpu0/cpufreq/stats # cat time_in_state 3600000 20893400000 1363200000 343000000 672800000 172488---------------------------------------------------------------------------------  total_transThis gives the total number of frequency transitions on this CPU. The cat output will have a single count which is the total number of frequencytransitions.--------------------------------------------------------------------------------<mysystem>:/sys/devices/system/cpu/cpu0/cpufreq/stats # cat total_trans20---------------------------------------------------------------------------------  trans_tableThis will give a fine grained information about all the CPU frequencytransitions. The cat output here is a two dimensional matrix, where an entry<i,j> (row i, column j) represents the count of number of transitions from Freq_i to Freq_j. Freq_i is in descending order with increasing rows and Freq_j is in descending order with increasing columns. The output here also contains the actual freq values for each row and column for better readability.--------------------------------------------------------------------------------<mysystem>:/sys/devices/system/cpu/cpu0/cpufreq/stats # cat trans_table   From  :    To         :   3600000   3400000   3200000   3000000   2800000   3600000:         0         5         0         0         0   3400000:         4         0         2         0         0   3200000:         0         1         0         2         0   3000000:         0         0         1         0         3   2800000:         0         0         0         2         0 --------------------------------------------------------------------------------3. Configuring cpufreq-statsTo configure cpufreq-stats in your kernelConfig Main Menu	Power management options (ACPI, APM)  --->		CPU Frequency scaling  --->			[*] CPU Frequency scaling			<*>   CPU frequency translation statistics 			[*]     CPU frequency translation statistics details"CPU Frequency scaling" (CONFIG_CPU_FREQ) should be enabled to configurecpufreq-stats."CPU frequency translation statistics" (CONFIG_CPU_FREQ_STAT) provides thebasic statistics which includes time_in_state and total_trans."CPU frequency translation statistics details" (CONFIG_CPU_FREQ_STAT_DETAILS)provides fine grained cpufreq stats by trans_table. The reason for having aseparate config option for trans_table is:- trans_table goes against the traditional /sysfs rule of one value per  interface. It provides a whole bunch of value in a 2 dimensional matrix  form.Once these two options are enabled and your CPU supports cpufrequency, youwill be able to see the CPU frequency statistics in /sysfs.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -