diff options
Diffstat (limited to 'Documentation/cpu-freq')
-rw-r--r-- | Documentation/cpu-freq/cpufreq-stats.txt | 128 | ||||
-rw-r--r-- | Documentation/cpu-freq/governors.txt | 14 |
2 files changed, 140 insertions, 2 deletions
diff --git a/Documentation/cpu-freq/cpufreq-stats.txt b/Documentation/cpu-freq/cpufreq-stats.txt new file mode 100644 index 000000000000..e2d1e760b4ba --- /dev/null +++ b/Documentation/cpu-freq/cpufreq-stats.txt | |||
@@ -0,0 +1,128 @@ | |||
1 | |||
2 | CPU frequency and voltage scaling statictics in the Linux(TM) kernel | ||
3 | |||
4 | |||
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 | |||
7 | - information for users - | ||
8 | |||
9 | |||
10 | Venkatesh Pallipadi <venkatesh.pallipadi@intel.com> | ||
11 | |||
12 | Contents | ||
13 | 1. Introduction | ||
14 | 2. Statistics Provided (with example) | ||
15 | 3. Configuring cpufreq-stats | ||
16 | |||
17 | |||
18 | 1. Introduction | ||
19 | |||
20 | cpufreq-stats is a driver that provices CPU frequency statistics for each CPU. | ||
21 | This statistics is provided in /sysfs as a bunch of read_only interfaces. This | ||
22 | interface (when configured) will appear in a seperate directory under cpufreq | ||
23 | in /sysfs (<sysfs root>/devices/system/cpu/cpuX/cpufreq/stats/) for each CPU. | ||
24 | Various statistics will form read_only files under this directory. | ||
25 | |||
26 | This driver is designed to be independent of any particular cpufreq_driver | ||
27 | that may be running on your CPU. So, it will work with any cpufreq_driver. | ||
28 | |||
29 | |||
30 | 2. Statistics Provided (with example) | ||
31 | |||
32 | cpufreq stats provides following statistics (explained in detail below). | ||
33 | - time_in_state | ||
34 | - total_trans | ||
35 | - trans_table | ||
36 | |||
37 | All the statistics will be from the time the stats driver has been inserted | ||
38 | to the time when a read of a particular statistic is done. Obviously, stats | ||
39 | driver will not have any information about the the frequcny transitions before | ||
40 | the stats driver insertion. | ||
41 | |||
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 | -r--r--r-- 1 root root 4096 May 14 16:06 time_in_state | ||
48 | -r--r--r-- 1 root root 4096 May 14 16:06 total_trans | ||
49 | -r--r--r-- 1 root root 4096 May 14 16:06 trans_table | ||
50 | -------------------------------------------------------------------------------- | ||
51 | |||
52 | - time_in_state | ||
53 | This gives the amount of time spent in each of the frequencies supported by | ||
54 | this CPU. The cat output will have "<frequency> <time>" pair in each line, which | ||
55 | will mean this CPU spent <time> usertime units of time at <frequency>. Output | ||
56 | will have one line for each of the supported freuencies. usertime units here | ||
57 | is 10mS (similar to other time exported in /proc). | ||
58 | |||
59 | -------------------------------------------------------------------------------- | ||
60 | <mysystem>:/sys/devices/system/cpu/cpu0/cpufreq/stats # cat time_in_state | ||
61 | 3600000 2089 | ||
62 | 3400000 136 | ||
63 | 3200000 34 | ||
64 | 3000000 67 | ||
65 | 2800000 172488 | ||
66 | -------------------------------------------------------------------------------- | ||
67 | |||
68 | |||
69 | - total_trans | ||
70 | This gives the total number of frequency transitions on this CPU. The cat | ||
71 | output will have a single count which is the total number of frequency | ||
72 | transitions. | ||
73 | |||
74 | -------------------------------------------------------------------------------- | ||
75 | <mysystem>:/sys/devices/system/cpu/cpu0/cpufreq/stats # cat total_trans | ||
76 | 20 | ||
77 | -------------------------------------------------------------------------------- | ||
78 | |||
79 | - trans_table | ||
80 | This will give a fine grained information about all the CPU frequency | ||
81 | transitions. The cat output here is a two dimensional matrix, where an entry | ||
82 | <i,j> (row i, column j) represents the count of number of transitions from | ||
83 | Freq_i to Freq_j. Freq_i is in descending order with increasing rows and | ||
84 | Freq_j is in descending order with increasing columns. The output here also | ||
85 | contains the actual freq values for each row and column for better readability. | ||
86 | |||
87 | -------------------------------------------------------------------------------- | ||
88 | <mysystem>:/sys/devices/system/cpu/cpu0/cpufreq/stats # cat trans_table | ||
89 | From : To | ||
90 | : 3600000 3400000 3200000 3000000 2800000 | ||
91 | 3600000: 0 5 0 0 0 | ||
92 | 3400000: 4 0 2 0 0 | ||
93 | 3200000: 0 1 0 2 0 | ||
94 | 3000000: 0 0 1 0 3 | ||
95 | 2800000: 0 0 0 2 0 | ||
96 | -------------------------------------------------------------------------------- | ||
97 | |||
98 | |||
99 | 3. Configuring cpufreq-stats | ||
100 | |||
101 | To configure cpufreq-stats in your kernel | ||
102 | Config Main Menu | ||
103 | Power management options (ACPI, APM) ---> | ||
104 | CPU Frequency scaling ---> | ||
105 | [*] CPU Frequency scaling | ||
106 | <*> CPU frequency translation statistics | ||
107 | [*] CPU frequency translation statistics details | ||
108 | |||
109 | |||
110 | "CPU Frequency scaling" (CONFIG_CPU_FREQ) should be enabled to configure | ||
111 | cpufreq-stats. | ||
112 | |||
113 | "CPU frequency translation statistics" (CONFIG_CPU_FREQ_STAT) provides the | ||
114 | basic statistics which includes time_in_state and total_trans. | ||
115 | |||
116 | "CPU frequency translation statistics details" (CONFIG_CPU_FREQ_STAT_DETAILS) | ||
117 | provides fine grained cpufreq stats by trans_table. The reason for having a | ||
118 | seperate config option for trans_table is: | ||
119 | - trans_table goes against the traditional /sysfs rule of one value per | ||
120 | interface. It provides a whole bunch of value in a 2 dimensional matrix | ||
121 | form. | ||
122 | |||
123 | Once these two options are enabled and your CPU supports cpufrequency, you | ||
124 | will be able to see the CPU frequency statistics in /sysfs. | ||
125 | |||
126 | |||
127 | |||
128 | |||
diff --git a/Documentation/cpu-freq/governors.txt b/Documentation/cpu-freq/governors.txt index b85481acd0ca..933fae74c337 100644 --- a/Documentation/cpu-freq/governors.txt +++ b/Documentation/cpu-freq/governors.txt | |||
@@ -9,6 +9,7 @@ | |||
9 | 9 | ||
10 | 10 | ||
11 | Dominik Brodowski <linux@brodo.de> | 11 | Dominik Brodowski <linux@brodo.de> |
12 | some additions and corrections by Nico Golde <nico@ngolde.de> | ||
12 | 13 | ||
13 | 14 | ||
14 | 15 | ||
@@ -25,6 +26,7 @@ Contents: | |||
25 | 2.1 Performance | 26 | 2.1 Performance |
26 | 2.2 Powersave | 27 | 2.2 Powersave |
27 | 2.3 Userspace | 28 | 2.3 Userspace |
29 | 2.4 Ondemand | ||
28 | 30 | ||
29 | 3. The Governor Interface in the CPUfreq Core | 31 | 3. The Governor Interface in the CPUfreq Core |
30 | 32 | ||
@@ -86,7 +88,7 @@ highest frequency within the borders of scaling_min_freq and | |||
86 | scaling_max_freq. | 88 | scaling_max_freq. |
87 | 89 | ||
88 | 90 | ||
89 | 2.1 Powersave | 91 | 2.2 Powersave |
90 | ------------- | 92 | ------------- |
91 | 93 | ||
92 | The CPUfreq governor "powersave" sets the CPU statically to the | 94 | The CPUfreq governor "powersave" sets the CPU statically to the |
@@ -94,7 +96,7 @@ lowest frequency within the borders of scaling_min_freq and | |||
94 | scaling_max_freq. | 96 | scaling_max_freq. |
95 | 97 | ||
96 | 98 | ||
97 | 2.2 Userspace | 99 | 2.3 Userspace |
98 | ------------- | 100 | ------------- |
99 | 101 | ||
100 | The CPUfreq governor "userspace" allows the user, or any userspace | 102 | The CPUfreq governor "userspace" allows the user, or any userspace |
@@ -103,6 +105,14 @@ by making a sysfs file "scaling_setspeed" available in the CPU-device | |||
103 | directory. | 105 | directory. |
104 | 106 | ||
105 | 107 | ||
108 | 2.4 Ondemand | ||
109 | ------------ | ||
110 | |||
111 | The CPUfreq govenor "ondemand" sets the CPU depending on the | ||
112 | current usage. To do this the CPU must have the capability to | ||
113 | switch the frequency very fast. | ||
114 | |||
115 | |||
106 | 116 | ||
107 | 3. The Governor Interface in the CPUfreq Core | 117 | 3. The Governor Interface in the CPUfreq Core |
108 | ============================================= | 118 | ============================================= |