docs: cpu-freq: convert cpufreq-stats.txt to ReST

- Add a SPDX header;
- Add a document title, based on the original contents of
  cpu-freq/index.txt;
- Use lists where needed;
- Comment out the existing text-only index;
- Adjust some title marks;
- Use bold on some places;
- Mark literal blocks as such;
- Some whitespace fixes and new line breaks;
- Add it to cpu-freq/index.rst.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
Mauro Carvalho Chehab 2020-03-03 14:52:06 +01:00 committed by Rafael J. Wysocki
parent 8f92058987
commit aadfa206e9
2 changed files with 65 additions and 55 deletions

View File

@ -1,21 +1,23 @@
.. SPDX-License-Identifier: GPL-2.0
CPU frequency and voltage scaling statistics in the Linux(TM) kernel ==========================================
General Description of sysfs CPUFreq Stats
==========================================
information for users
L i n u x c p u f r e q - s t a t s d r i v e r Author: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
- information for users - .. Contents
1. Introduction
Venkatesh Pallipadi <venkatesh.pallipadi@intel.com> 2. Statistics Provided (with example)
3. Configuring cpufreq-stats
Contents
1. Introduction
2. Statistics Provided (with example)
3. Configuring cpufreq-stats
1. Introduction 1. Introduction
===============
cpufreq-stats is a driver that provides CPU frequency statistics for each CPU. cpufreq-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. This These statistics are provided in /sysfs as a bunch of read_only interfaces. This
@ -28,8 +30,10 @@ that may be running on your CPU. So, it will work with any cpufreq_driver.
2. Statistics Provided (with example) 2. Statistics Provided (with example)
=====================================
cpufreq stats provides following statistics (explained in detail below). cpufreq stats provides following statistics (explained in detail below).
- time_in_state - time_in_state
- total_trans - total_trans
- trans_table - trans_table
@ -39,53 +43,57 @@ All the statistics will be from the time the stats driver has been inserted
statistic is done. Obviously, stats driver will not have any information statistic is done. Obviously, stats driver will not have any information
about the frequency transitions before the stats driver insertion. about the frequency transitions before the stats driver insertion.
-------------------------------------------------------------------------------- ::
<mysystem>:/sys/devices/system/cpu/cpu0/cpufreq/stats # ls -l
total 0 <mysystem>:/sys/devices/system/cpu/cpu0/cpufreq/stats # ls -l
drwxr-xr-x 2 root root 0 May 14 16:06 . total 0
drwxr-xr-x 3 root root 0 May 14 15:58 .. drwxr-xr-x 2 root root 0 May 14 16:06 .
--w------- 1 root root 4096 May 14 16:06 reset 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 --w------- 1 root root 4096 May 14 16:06 reset
-r--r--r-- 1 root root 4096 May 14 16:06 total_trans -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 trans_table -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**
- reset
Write-only attribute that can be used to reset the stat counters. This can be Write-only attribute that can be used to reset the stat counters. This can be
useful for evaluating system behaviour under different governors without the useful for evaluating system behaviour under different governors without the
need for a reboot. need for a reboot.
- time_in_state - **time_in_state**
This gives the amount of time spent in each of the frequencies supported by This gives the amount of time spent in each of the frequencies supported by
this CPU. The cat output will have "<frequency> <time>" pair in each line, which this CPU. The cat output will have "<frequency> <time>" pair in each line, which
will mean this CPU spent <time> usertime units of time at <frequency>. Output will mean this CPU spent <time> usertime units of time at <frequency>. Output
will have one line for each of the supported frequencies. usertime units here will have one line for each of the supported frequencies. usertime units here
is 10mS (similar to other time exported in /proc). is 10mS (similar to other time exported in /proc).
-------------------------------------------------------------------------------- ::
<mysystem>:/sys/devices/system/cpu/cpu0/cpufreq/stats # cat time_in_state
3600000 2089 <mysystem>:/sys/devices/system/cpu/cpu0/cpufreq/stats # cat time_in_state
3400000 136 3600000 2089
3200000 34 3400000 136
3000000 67 3200000 34
2800000 172488 3000000 67
-------------------------------------------------------------------------------- 2800000 172488
- total_trans - **total_trans**
This gives the total number of frequency transitions on this CPU. The cat
This gives the total number of frequency transitions on this CPU. The cat
output will have a single count which is the total number of frequency output will have a single count which is the total number of frequency
transitions. transitions.
-------------------------------------------------------------------------------- ::
<mysystem>:/sys/devices/system/cpu/cpu0/cpufreq/stats # cat total_trans
20 <mysystem>:/sys/devices/system/cpu/cpu0/cpufreq/stats # cat total_trans
-------------------------------------------------------------------------------- 20
- **trans_table**
- trans_table
This will give a fine grained information about all the CPU frequency This will give a fine grained information about all the CPU frequency
transitions. The cat output here is a two dimensional matrix, where an entry transitions. 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 <i,j> (row i, column j) represents the count of number of transitions from
Freq_i to Freq_j. Freq_i rows and Freq_j columns follow the sorting order in Freq_i to Freq_j. Freq_i rows and Freq_j columns follow the sorting order in
which the driver has provided the frequency table initially to the cpufreq core which the driver has provided the frequency table initially to the cpufreq core
and so can be sorted (ascending or descending) or unsorted. The output here and so can be sorted (ascending or descending) or unsorted. The output here
@ -95,26 +103,27 @@ readability.
If the transition table is bigger than PAGE_SIZE, reading this will If the transition table is bigger than PAGE_SIZE, reading this will
return an -EFBIG error. return an -EFBIG error.
-------------------------------------------------------------------------------- ::
<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
--------------------------------------------------------------------------------
<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-stats 3. Configuring cpufreq-stats
============================
To configure cpufreq-stats in your kernel To configure cpufreq-stats in your kernel::
Config Main Menu
Power management options (ACPI, APM) ---> Config Main Menu
CPU Frequency scaling ---> Power management options (ACPI, APM) --->
[*] CPU Frequency scaling CPU Frequency scaling --->
[*] CPU frequency translation statistics [*] CPU Frequency scaling
[*] CPU frequency translation statistics
"CPU Frequency scaling" (CONFIG_CPU_FREQ) should be enabled to configure "CPU Frequency scaling" (CONFIG_CPU_FREQ) should be enabled to configure

View File

@ -16,6 +16,7 @@ Author: Dominik Brodowski <linux@brodo.de>
core core
cpu-drivers cpu-drivers
cpufreq-stats
Mailing List Mailing List
------------ ------------