1
+ .. SPDX-License-Identifier: GPL-2.0
1
2
2
- CPU frequency and voltage scaling statistics in the Linux(TM) kernel
3
+ ==========================================
4
+ General Description of sysfs CPUFreq Stats
5
+ ==========================================
3
6
7
+ information for users
4
8
5
- L i n u x c p u f r e q - s t a t s d r i v e r
6
9
7
- - information for users -
10
+ Author: Venkatesh Pallipadi <[email protected] >
8
11
12
+ .. Contents
9
13
10
- Venkatesh Pallipadi <
[email protected] >
11
-
12
- Contents
13
- 1. Introduction
14
- 2. Statistics Provided (with example)
15
- 3. Configuring cpufreq-stats
14
+ 1. Introduction
15
+ 2. Statistics Provided (with example)
16
+ 3. Configuring cpufreq-stats
16
17
17
18
18
19
1. Introduction
20
+ ===============
19
21
20
22
cpufreq-stats is a driver that provides CPU frequency statistics for each CPU.
21
23
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.
28
30
29
31
30
32
2. Statistics Provided (with example)
33
+ =====================================
31
34
32
35
cpufreq stats provides following statistics (explained in detail below).
36
+
33
37
- time_in_state
34
38
- total_trans
35
39
- trans_table
@@ -39,53 +43,57 @@ All the statistics will be from the time the stats driver has been inserted
39
43
statistic is done. Obviously, stats driver will not have any information
40
44
about the frequency transitions before the stats driver insertion.
41
45
42
- --------------------------------------------------------------------------------
43
- <mysystem>:/sys/devices/system/cpu/cpu0/cpufreq/stats # ls -l
44
- total 0
45
- drwxr-xr-x 2 root root 0 May 14 16:06 .
46
- drwxr-xr-x 3 root root 0 May 14 15:58 ..
47
- --w------- 1 root root 4096 May 14 16:06 reset
48
- -r--r--r-- 1 root root 4096 May 14 16:06 time_in_state
49
- -r--r--r-- 1 root root 4096 May 14 16:06 total_trans
50
- -r--r--r-- 1 root root 4096 May 14 16:06 trans_table
51
- --------------------------------------------------------------------------------
52
-
53
- - reset
46
+ ::
47
+
48
+ <mysystem>:/sys/devices/system/cpu/cpu0/cpufreq/stats # ls -l
49
+ total 0
50
+ drwxr-xr-x 2 root root 0 May 14 16:06 .
51
+ drwxr-xr-x 3 root root 0 May 14 15:58 ..
52
+ --w------- 1 root root 4096 May 14 16:06 reset
53
+ -r--r--r-- 1 root root 4096 May 14 16:06 time_in_state
54
+ -r--r--r-- 1 root root 4096 May 14 16:06 total_trans
55
+ -r--r--r-- 1 root root 4096 May 14 16:06 trans_table
56
+
57
+ - **reset **
58
+
54
59
Write-only attribute that can be used to reset the stat counters. This can be
55
60
useful for evaluating system behaviour under different governors without the
56
61
need for a reboot.
57
62
58
- - time_in_state
63
+ - **time_in_state **
64
+
59
65
This gives the amount of time spent in each of the frequencies supported by
60
66
this CPU. The cat output will have "<frequency> <time>" pair in each line, which
61
67
will mean this CPU spent <time> usertime units of time at <frequency>. Output
62
- will have one line for each of the supported frequencies. usertime units here
68
+ will have one line for each of the supported frequencies. usertime units here
63
69
is 10mS (similar to other time exported in /proc).
64
70
65
- --------------------------------------------------------------------------------
66
- <mysystem>:/sys/devices/system/cpu/cpu0/cpufreq/stats # cat time_in_state
67
- 3600000 2089
68
- 3400000 136
69
- 3200000 34
70
- 3000000 67
71
- 2800000 172488
72
- --------------------------------------------------------------------------------
71
+ ::
73
72
73
+ <mysystem>:/sys/devices/system/cpu/cpu0/cpufreq/stats # cat time_in_state
74
+ 3600000 2089
75
+ 3400000 136
76
+ 3200000 34
77
+ 3000000 67
78
+ 2800000 172488
74
79
75
- - total_trans
76
- This gives the total number of frequency transitions on this CPU. The cat
80
+
81
+ - **total_trans **
82
+
83
+ This gives the total number of frequency transitions on this CPU. The cat
77
84
output will have a single count which is the total number of frequency
78
85
transitions.
79
86
80
- --------------------------------------------------------------------------------
81
- <mysystem>:/sys/devices/system/cpu/cpu0/cpufreq/stats # cat total_trans
82
- 20
83
- --------------------------------------------------------------------------------
87
+ ::
88
+
89
+ <mysystem>:/sys/devices/system/cpu/cpu0/cpufreq/stats # cat total_trans
90
+ 20
91
+
92
+ - **trans_table **
84
93
85
- - trans_table
86
94
This will give a fine grained information about all the CPU frequency
87
95
transitions. The cat output here is a two dimensional matrix, where an entry
88
- <i,j> (row i, column j) represents the count of number of transitions from
96
+ <i,j> (row i, column j) represents the count of number of transitions from
89
97
Freq_i to Freq_j. Freq_i rows and Freq_j columns follow the sorting order in
90
98
which the driver has provided the frequency table initially to the cpufreq core
91
99
and so can be sorted (ascending or descending) or unsorted. The output here
@@ -95,26 +103,27 @@ readability.
95
103
If the transition table is bigger than PAGE_SIZE, reading this will
96
104
return an -EFBIG error.
97
105
98
- --------------------------------------------------------------------------------
99
- <mysystem>:/sys/devices/system/cpu/cpu0/cpufreq/stats # cat trans_table
100
- From : To
101
- : 3600000 3400000 3200000 3000000 2800000
102
- 3600000: 0 5 0 0 0
103
- 3400000: 4 0 2 0 0
104
- 3200000: 0 1 0 2 0
105
- 3000000: 0 0 1 0 3
106
- 2800000: 0 0 0 2 0
107
- --------------------------------------------------------------------------------
106
+ ::
108
107
108
+ <mysystem>:/sys/devices/system/cpu/cpu0/cpufreq/stats # cat trans_table
109
+ From : To
110
+ : 3600000 3400000 3200000 3000000 2800000
111
+ 3600000: 0 5 0 0 0
112
+ 3400000: 4 0 2 0 0
113
+ 3200000: 0 1 0 2 0
114
+ 3000000: 0 0 1 0 3
115
+ 2800000: 0 0 0 2 0
109
116
110
117
3. Configuring cpufreq-stats
118
+ ============================
119
+
120
+ To configure cpufreq-stats in your kernel::
111
121
112
- To configure cpufreq-stats in your kernel
113
- Config Main Menu
114
- Power management options (ACPI, APM) --->
115
- CPU Frequency scaling --->
116
- [*] CPU Frequency scaling
117
- [*] CPU frequency translation statistics
122
+ Config Main Menu
123
+ Power management options (ACPI, APM) --->
124
+ CPU Frequency scaling --->
125
+ [*] CPU Frequency scaling
126
+ [*] CPU frequency translation statistics
118
127
119
128
120
129
"CPU Frequency scaling" (CONFIG_CPU_FREQ) should be enabled to configure
0 commit comments