diff options
73 files changed, 14423 insertions, 0 deletions
diff --git a/MAINTAINERS b/MAINTAINERS index 187282da921..64b919667c5 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -1908,6 +1908,12 @@ S: Maintained | |||
1908 | F: arch/x86/kernel/cpuid.c | 1908 | F: arch/x86/kernel/cpuid.c |
1909 | F: arch/x86/kernel/msr.c | 1909 | F: arch/x86/kernel/msr.c |
1910 | 1910 | ||
1911 | CPU POWER MONITORING SUBSYSTEM | ||
1912 | M: Dominik Brodowski <linux@dominikbrodowski.net> | ||
1913 | M: Thomas Renninger <trenn@suse.de> | ||
1914 | S: Maintained | ||
1915 | F: tools/power/cpupower | ||
1916 | |||
1911 | CPUSETS | 1917 | CPUSETS |
1912 | M: Paul Menage <menage@google.com> | 1918 | M: Paul Menage <menage@google.com> |
1913 | W: http://www.bullopensource.org/cpuset/ | 1919 | W: http://www.bullopensource.org/cpuset/ |
diff --git a/tools/power/cpupower/.gitignore b/tools/power/cpupower/.gitignore new file mode 100644 index 00000000000..f8d7b5ac271 --- /dev/null +++ b/tools/power/cpupower/.gitignore | |||
@@ -0,0 +1,21 @@ | |||
1 | .libs | ||
2 | libcpufreq.so | ||
3 | libcpufreq.so.0 | ||
4 | libcpufreq.so.0.0.0 | ||
5 | build/ccdv | ||
6 | cpufreq-info | ||
7 | cpufreq-set | ||
8 | cpufreq-aperf | ||
9 | lib/.libs | ||
10 | lib/cpufreq.lo | ||
11 | lib/cpufreq.o | ||
12 | lib/proc.lo | ||
13 | lib/proc.o | ||
14 | lib/sysfs.lo | ||
15 | lib/sysfs.o | ||
16 | libcpufreq.la | ||
17 | po/cpufrequtils.pot | ||
18 | po/*.gmo | ||
19 | utils/cpufreq-info.o | ||
20 | utils/cpufreq-set.o | ||
21 | utils/cpufreq-aperf.o \ No newline at end of file | ||
diff --git a/tools/power/cpupower/AUTHORS b/tools/power/cpupower/AUTHORS new file mode 100644 index 00000000000..090af2cb81b --- /dev/null +++ b/tools/power/cpupower/AUTHORS | |||
@@ -0,0 +1,18 @@ | |||
1 | Dominik Brodowski | ||
2 | <linux@brodo.de> | ||
3 | |||
4 | Mattia Dongili | ||
5 | via Latisana, 8 | ||
6 | 00177 Rome | ||
7 | Italy | ||
8 | <malattia@gmail.com> | ||
9 | |||
10 | Goran Koruga | ||
11 | Slovenia | ||
12 | <korugag@siol.net> | ||
13 | |||
14 | Thomas Renninger | ||
15 | SUSE Linux GmbH | ||
16 | Germany | ||
17 | <trenn@suse.de> | ||
18 | |||
diff --git a/tools/power/cpupower/COPYING b/tools/power/cpupower/COPYING new file mode 100644 index 00000000000..d60c31a97a5 --- /dev/null +++ b/tools/power/cpupower/COPYING | |||
@@ -0,0 +1,340 @@ | |||
1 | GNU GENERAL PUBLIC LICENSE | ||
2 | Version 2, June 1991 | ||
3 | |||
4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc. | ||
5 | 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
6 | Everyone is permitted to copy and distribute verbatim copies | ||
7 | of this license document, but changing it is not allowed. | ||
8 | |||
9 | Preamble | ||
10 | |||
11 | The licenses for most software are designed to take away your | ||
12 | freedom to share and change it. By contrast, the GNU General Public | ||
13 | License is intended to guarantee your freedom to share and change free | ||
14 | software--to make sure the software is free for all its users. This | ||
15 | General Public License applies to most of the Free Software | ||
16 | Foundation's software and to any other program whose authors commit to | ||
17 | using it. (Some other Free Software Foundation software is covered by | ||
18 | the GNU Library General Public License instead.) You can apply it to | ||
19 | your programs, too. | ||
20 | |||
21 | When we speak of free software, we are referring to freedom, not | ||
22 | price. Our General Public Licenses are designed to make sure that you | ||
23 | have the freedom to distribute copies of free software (and charge for | ||
24 | this service if you wish), that you receive source code or can get it | ||
25 | if you want it, that you can change the software or use pieces of it | ||
26 | in new free programs; and that you know you can do these things. | ||
27 | |||
28 | To protect your rights, we need to make restrictions that forbid | ||
29 | anyone to deny you these rights or to ask you to surrender the rights. | ||
30 | These restrictions translate to certain responsibilities for you if you | ||
31 | distribute copies of the software, or if you modify it. | ||
32 | |||
33 | For example, if you distribute copies of such a program, whether | ||
34 | gratis or for a fee, you must give the recipients all the rights that | ||
35 | you have. You must make sure that they, too, receive or can get the | ||
36 | source code. And you must show them these terms so they know their | ||
37 | rights. | ||
38 | |||
39 | We protect your rights with two steps: (1) copyright the software, and | ||
40 | (2) offer you this license which gives you legal permission to copy, | ||
41 | distribute and/or modify the software. | ||
42 | |||
43 | Also, for each author's protection and ours, we want to make certain | ||
44 | that everyone understands that there is no warranty for this free | ||
45 | software. If the software is modified by someone else and passed on, we | ||
46 | want its recipients to know that what they have is not the original, so | ||
47 | that any problems introduced by others will not reflect on the original | ||
48 | authors' reputations. | ||
49 | |||
50 | Finally, any free program is threatened constantly by software | ||
51 | patents. We wish to avoid the danger that redistributors of a free | ||
52 | program will individually obtain patent licenses, in effect making the | ||
53 | program proprietary. To prevent this, we have made it clear that any | ||
54 | patent must be licensed for everyone's free use or not licensed at all. | ||
55 | |||
56 | The precise terms and conditions for copying, distribution and | ||
57 | modification follow. | ||
58 | |||
59 | GNU GENERAL PUBLIC LICENSE | ||
60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION | ||
61 | |||
62 | 0. This License applies to any program or other work which contains | ||
63 | a notice placed by the copyright holder saying it may be distributed | ||
64 | under the terms of this General Public License. The "Program", below, | ||
65 | refers to any such program or work, and a "work based on the Program" | ||
66 | means either the Program or any derivative work under copyright law: | ||
67 | that is to say, a work containing the Program or a portion of it, | ||
68 | either verbatim or with modifications and/or translated into another | ||
69 | language. (Hereinafter, translation is included without limitation in | ||
70 | the term "modification".) Each licensee is addressed as "you". | ||
71 | |||
72 | Activities other than copying, distribution and modification are not | ||
73 | covered by this License; they are outside its scope. The act of | ||
74 | running the Program is not restricted, and the output from the Program | ||
75 | is covered only if its contents constitute a work based on the | ||
76 | Program (independent of having been made by running the Program). | ||
77 | Whether that is true depends on what the Program does. | ||
78 | |||
79 | 1. You may copy and distribute verbatim copies of the Program's | ||
80 | source code as you receive it, in any medium, provided that you | ||
81 | conspicuously and appropriately publish on each copy an appropriate | ||
82 | copyright notice and disclaimer of warranty; keep intact all the | ||
83 | notices that refer to this License and to the absence of any warranty; | ||
84 | and give any other recipients of the Program a copy of this License | ||
85 | along with the Program. | ||
86 | |||
87 | You may charge a fee for the physical act of transferring a copy, and | ||
88 | you may at your option offer warranty protection in exchange for a fee. | ||
89 | |||
90 | 2. You may modify your copy or copies of the Program or any portion | ||
91 | of it, thus forming a work based on the Program, and copy and | ||
92 | distribute such modifications or work under the terms of Section 1 | ||
93 | above, provided that you also meet all of these conditions: | ||
94 | |||
95 | a) You must cause the modified files to carry prominent notices | ||
96 | stating that you changed the files and the date of any change. | ||
97 | |||
98 | b) You must cause any work that you distribute or publish, that in | ||
99 | whole or in part contains or is derived from the Program or any | ||
100 | part thereof, to be licensed as a whole at no charge to all third | ||
101 | parties under the terms of this License. | ||
102 | |||
103 | c) If the modified program normally reads commands interactively | ||
104 | when run, you must cause it, when started running for such | ||
105 | interactive use in the most ordinary way, to print or display an | ||
106 | announcement including an appropriate copyright notice and a | ||
107 | notice that there is no warranty (or else, saying that you provide | ||
108 | a warranty) and that users may redistribute the program under | ||
109 | these conditions, and telling the user how to view a copy of this | ||
110 | License. (Exception: if the Program itself is interactive but | ||
111 | does not normally print such an announcement, your work based on | ||
112 | the Program is not required to print an announcement.) | ||
113 | |||
114 | These requirements apply to the modified work as a whole. If | ||
115 | identifiable sections of that work are not derived from the Program, | ||
116 | and can be reasonably considered independent and separate works in | ||
117 | themselves, then this License, and its terms, do not apply to those | ||
118 | sections when you distribute them as separate works. But when you | ||
119 | distribute the same sections as part of a whole which is a work based | ||
120 | on the Program, the distribution of the whole must be on the terms of | ||
121 | this License, whose permissions for other licensees extend to the | ||
122 | entire whole, and thus to each and every part regardless of who wrote it. | ||
123 | |||
124 | Thus, it is not the intent of this section to claim rights or contest | ||
125 | your rights to work written entirely by you; rather, the intent is to | ||
126 | exercise the right to control the distribution of derivative or | ||
127 | collective works based on the Program. | ||
128 | |||
129 | In addition, mere aggregation of another work not based on the Program | ||
130 | with the Program (or with a work based on the Program) on a volume of | ||
131 | a storage or distribution medium does not bring the other work under | ||
132 | the scope of this License. | ||
133 | |||
134 | 3. You may copy and distribute the Program (or a work based on it, | ||
135 | under Section 2) in object code or executable form under the terms of | ||
136 | Sections 1 and 2 above provided that you also do one of the following: | ||
137 | |||
138 | a) Accompany it with the complete corresponding machine-readable | ||
139 | source code, which must be distributed under the terms of Sections | ||
140 | 1 and 2 above on a medium customarily used for software interchange; or, | ||
141 | |||
142 | b) Accompany it with a written offer, valid for at least three | ||
143 | years, to give any third party, for a charge no more than your | ||
144 | cost of physically performing source distribution, a complete | ||
145 | machine-readable copy of the corresponding source code, to be | ||
146 | distributed under the terms of Sections 1 and 2 above on a medium | ||
147 | customarily used for software interchange; or, | ||
148 | |||
149 | c) Accompany it with the information you received as to the offer | ||
150 | to distribute corresponding source code. (This alternative is | ||
151 | allowed only for noncommercial distribution and only if you | ||
152 | received the program in object code or executable form with such | ||
153 | an offer, in accord with Subsection b above.) | ||
154 | |||
155 | The source code for a work means the preferred form of the work for | ||
156 | making modifications to it. For an executable work, complete source | ||
157 | code means all the source code for all modules it contains, plus any | ||
158 | associated interface definition files, plus the scripts used to | ||
159 | control compilation and installation of the executable. However, as a | ||
160 | special exception, the source code distributed need not include | ||
161 | anything that is normally distributed (in either source or binary | ||
162 | form) with the major components (compiler, kernel, and so on) of the | ||
163 | operating system on which the executable runs, unless that component | ||
164 | itself accompanies the executable. | ||
165 | |||
166 | If distribution of executable or object code is made by offering | ||
167 | access to copy from a designated place, then offering equivalent | ||
168 | access to copy the source code from the same place counts as | ||
169 | distribution of the source code, even though third parties are not | ||
170 | compelled to copy the source along with the object code. | ||
171 | |||
172 | 4. You may not copy, modify, sublicense, or distribute the Program | ||
173 | except as expressly provided under this License. Any attempt | ||
174 | otherwise to copy, modify, sublicense or distribute the Program is | ||
175 | void, and will automatically terminate your rights under this License. | ||
176 | However, parties who have received copies, or rights, from you under | ||
177 | this License will not have their licenses terminated so long as such | ||
178 | parties remain in full compliance. | ||
179 | |||
180 | 5. You are not required to accept this License, since you have not | ||
181 | signed it. However, nothing else grants you permission to modify or | ||
182 | distribute the Program or its derivative works. These actions are | ||
183 | prohibited by law if you do not accept this License. Therefore, by | ||
184 | modifying or distributing the Program (or any work based on the | ||
185 | Program), you indicate your acceptance of this License to do so, and | ||
186 | all its terms and conditions for copying, distributing or modifying | ||
187 | the Program or works based on it. | ||
188 | |||
189 | 6. Each time you redistribute the Program (or any work based on the | ||
190 | Program), the recipient automatically receives a license from the | ||
191 | original licensor to copy, distribute or modify the Program subject to | ||
192 | these terms and conditions. You may not impose any further | ||
193 | restrictions on the recipients' exercise of the rights granted herein. | ||
194 | You are not responsible for enforcing compliance by third parties to | ||
195 | this License. | ||
196 | |||
197 | 7. If, as a consequence of a court judgment or allegation of patent | ||
198 | infringement or for any other reason (not limited to patent issues), | ||
199 | conditions are imposed on you (whether by court order, agreement or | ||
200 | otherwise) that contradict the conditions of this License, they do not | ||
201 | excuse you from the conditions of this License. If you cannot | ||
202 | distribute so as to satisfy simultaneously your obligations under this | ||
203 | License and any other pertinent obligations, then as a consequence you | ||
204 | may not distribute the Program at all. For example, if a patent | ||
205 | license would not permit royalty-free redistribution of the Program by | ||
206 | all those who receive copies directly or indirectly through you, then | ||
207 | the only way you could satisfy both it and this License would be to | ||
208 | refrain entirely from distribution of the Program. | ||
209 | |||
210 | If any portion of this section is held invalid or unenforceable under | ||
211 | any particular circumstance, the balance of the section is intended to | ||
212 | apply and the section as a whole is intended to apply in other | ||
213 | circumstances. | ||
214 | |||
215 | It is not the purpose of this section to induce you to infringe any | ||
216 | patents or other property right claims or to contest validity of any | ||
217 | such claims; this section has the sole purpose of protecting the | ||
218 | integrity of the free software distribution system, which is | ||
219 | implemented by public license practices. Many people have made | ||
220 | generous contributions to the wide range of software distributed | ||
221 | through that system in reliance on consistent application of that | ||
222 | system; it is up to the author/donor to decide if he or she is willing | ||
223 | to distribute software through any other system and a licensee cannot | ||
224 | impose that choice. | ||
225 | |||
226 | This section is intended to make thoroughly clear what is believed to | ||
227 | be a consequence of the rest of this License. | ||
228 | |||
229 | 8. If the distribution and/or use of the Program is restricted in | ||
230 | certain countries either by patents or by copyrighted interfaces, the | ||
231 | original copyright holder who places the Program under this License | ||
232 | may add an explicit geographical distribution limitation excluding | ||
233 | those countries, so that distribution is permitted only in or among | ||
234 | countries not thus excluded. In such case, this License incorporates | ||
235 | the limitation as if written in the body of this License. | ||
236 | |||
237 | 9. The Free Software Foundation may publish revised and/or new versions | ||
238 | of the General Public License from time to time. Such new versions will | ||
239 | be similar in spirit to the present version, but may differ in detail to | ||
240 | address new problems or concerns. | ||
241 | |||
242 | Each version is given a distinguishing version number. If the Program | ||
243 | specifies a version number of this License which applies to it and "any | ||
244 | later version", you have the option of following the terms and conditions | ||
245 | either of that version or of any later version published by the Free | ||
246 | Software Foundation. If the Program does not specify a version number of | ||
247 | this License, you may choose any version ever published by the Free Software | ||
248 | Foundation. | ||
249 | |||
250 | 10. If you wish to incorporate parts of the Program into other free | ||
251 | programs whose distribution conditions are different, write to the author | ||
252 | to ask for permission. For software which is copyrighted by the Free | ||
253 | Software Foundation, write to the Free Software Foundation; we sometimes | ||
254 | make exceptions for this. Our decision will be guided by the two goals | ||
255 | of preserving the free status of all derivatives of our free software and | ||
256 | of promoting the sharing and reuse of software generally. | ||
257 | |||
258 | NO WARRANTY | ||
259 | |||
260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY | ||
261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN | ||
262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES | ||
263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED | ||
264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS | ||
266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE | ||
267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, | ||
268 | REPAIR OR CORRECTION. | ||
269 | |||
270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING | ||
271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR | ||
272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, | ||
273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING | ||
274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED | ||
275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY | ||
276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER | ||
277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE | ||
278 | POSSIBILITY OF SUCH DAMAGES. | ||
279 | |||
280 | END OF TERMS AND CONDITIONS | ||
281 | |||
282 | How to Apply These Terms to Your New Programs | ||
283 | |||
284 | If you develop a new program, and you want it to be of the greatest | ||
285 | possible use to the public, the best way to achieve this is to make it | ||
286 | free software which everyone can redistribute and change under these terms. | ||
287 | |||
288 | To do so, attach the following notices to the program. It is safest | ||
289 | to attach them to the start of each source file to most effectively | ||
290 | convey the exclusion of warranty; and each file should have at least | ||
291 | the "copyright" line and a pointer to where the full notice is found. | ||
292 | |||
293 | <one line to give the program's name and a brief idea of what it does.> | ||
294 | Copyright (C) <year> <name of author> | ||
295 | |||
296 | This program is free software; you can redistribute it and/or modify | ||
297 | it under the terms of the GNU General Public License as published by | ||
298 | the Free Software Foundation; either version 2 of the License, or | ||
299 | (at your option) any later version. | ||
300 | |||
301 | This program is distributed in the hope that it will be useful, | ||
302 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
304 | GNU General Public License for more details. | ||
305 | |||
306 | You should have received a copy of the GNU General Public License | ||
307 | along with this program; if not, write to the Free Software | ||
308 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
309 | |||
310 | |||
311 | Also add information on how to contact you by electronic and paper mail. | ||
312 | |||
313 | If the program is interactive, make it output a short notice like this | ||
314 | when it starts in an interactive mode: | ||
315 | |||
316 | Gnomovision version 69, Copyright (C) year name of author | ||
317 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. | ||
318 | This is free software, and you are welcome to redistribute it | ||
319 | under certain conditions; type `show c' for details. | ||
320 | |||
321 | The hypothetical commands `show w' and `show c' should show the appropriate | ||
322 | parts of the General Public License. Of course, the commands you use may | ||
323 | be called something other than `show w' and `show c'; they could even be | ||
324 | mouse-clicks or menu items--whatever suits your program. | ||
325 | |||
326 | You should also get your employer (if you work as a programmer) or your | ||
327 | school, if any, to sign a "copyright disclaimer" for the program, if | ||
328 | necessary. Here is a sample; alter the names: | ||
329 | |||
330 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program | ||
331 | `Gnomovision' (which makes passes at compilers) written by James Hacker. | ||
332 | |||
333 | <signature of Ty Coon>, 1 April 1989 | ||
334 | Ty Coon, President of Vice | ||
335 | |||
336 | This General Public License does not permit incorporating your program into | ||
337 | proprietary programs. If your program is a subroutine library, you may | ||
338 | consider it more useful to permit linking proprietary applications with the | ||
339 | library. If this is what you want to do, use the GNU Library General | ||
340 | Public License instead of this License. | ||
diff --git a/tools/power/cpupower/Makefile b/tools/power/cpupower/Makefile new file mode 100644 index 00000000000..aef1e3b4179 --- /dev/null +++ b/tools/power/cpupower/Makefile | |||
@@ -0,0 +1,273 @@ | |||
1 | # Makefile for cpupowerutils | ||
2 | # | ||
3 | # Copyright (C) 2005,2006 Dominik Brodowski <linux@dominikbrodowski.net> | ||
4 | # | ||
5 | # Based largely on the Makefile for udev by: | ||
6 | # | ||
7 | # Copyright (C) 2003,2004 Greg Kroah-Hartman <greg@kroah.com> | ||
8 | # | ||
9 | # This program is free software; you can redistribute it and/or modify | ||
10 | # it under the terms of the GNU General Public License as published by | ||
11 | # the Free Software Foundation; version 2 of the License. | ||
12 | # | ||
13 | # This program is distributed in the hope that it will be useful, | ||
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
16 | # General Public License for more details. | ||
17 | # | ||
18 | # You should have received a copy of the GNU General Public License | ||
19 | # along with this program; if not, write to the Free Software | ||
20 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
21 | # | ||
22 | |||
23 | # --- CONFIGURATION BEGIN --- | ||
24 | |||
25 | # Set the following to `true' to make a unstripped, unoptimized | ||
26 | # binary. Leave this set to `false' for production use. | ||
27 | DEBUG ?= true | ||
28 | |||
29 | # make the build silent. Set this to something else to make it noisy again. | ||
30 | V ?= false | ||
31 | |||
32 | # Internationalization support (output in different languages). | ||
33 | # Requires gettext. | ||
34 | NLS ?= true | ||
35 | |||
36 | # Set the following to 'true' to build/install the | ||
37 | # cpufreq-bench benchmarking tool | ||
38 | CPUFRQ_BENCH ?= true | ||
39 | |||
40 | # Prefix to the directories we're installing to | ||
41 | DESTDIR ?= | ||
42 | |||
43 | # --- CONFIGURATION END --- | ||
44 | |||
45 | |||
46 | |||
47 | # Package-related definitions. Distributions can modify the version | ||
48 | # and _should_ modify the PACKAGE_BUGREPORT definition | ||
49 | |||
50 | VERSION = 009p1 | ||
51 | LIB_MAJ= 0.0.0 | ||
52 | LIB_MIN= 0 | ||
53 | |||
54 | PACKAGE = cpupowerutils | ||
55 | PACKAGE_BUGREPORT = cpufreq@vger.kernel.org | ||
56 | LANGUAGES = de fr it cs pt | ||
57 | |||
58 | |||
59 | # Directory definitions. These are default and most probably | ||
60 | # do not need to be changed. Please note that DESTDIR is | ||
61 | # added in front of any of them | ||
62 | |||
63 | bindir ?= /usr/bin | ||
64 | sbindir ?= /usr/sbin | ||
65 | mandir ?= /usr/man | ||
66 | includedir ?= /usr/include | ||
67 | libdir ?= /usr/lib | ||
68 | localedir ?= /usr/share/locale | ||
69 | docdir ?= /usr/share/doc/packages/cpupowerutils | ||
70 | confdir ?= /etc/ | ||
71 | |||
72 | # Toolchain: what tools do we use, and what options do they need: | ||
73 | |||
74 | CP = cp -fpR | ||
75 | INSTALL = /usr/bin/install -c | ||
76 | INSTALL_PROGRAM = ${INSTALL} | ||
77 | INSTALL_DATA = ${INSTALL} -m 644 | ||
78 | INSTALL_SCRIPT = ${INSTALL_PROGRAM} | ||
79 | |||
80 | # If you are running a cross compiler, you may want to set this | ||
81 | # to something more interesting, like "arm-linux-". If you want | ||
82 | # to compile vs uClibc, that can be done here as well. | ||
83 | CROSS = #/usr/i386-linux-uclibc/usr/bin/i386-uclibc- | ||
84 | CC = $(CROSS)gcc | ||
85 | LD = $(CROSS)gcc | ||
86 | AR = $(CROSS)ar | ||
87 | STRIP = $(CROSS)strip | ||
88 | RANLIB = $(CROSS)ranlib | ||
89 | HOSTCC = gcc | ||
90 | |||
91 | |||
92 | # Now we set up the build system | ||
93 | # | ||
94 | |||
95 | # set up PWD so that older versions of make will work with our build. | ||
96 | PWD = $(shell pwd) | ||
97 | |||
98 | export CROSS CC AR STRIP RANLIB CFLAGS LDFLAGS LIB_OBJS | ||
99 | |||
100 | # check if compiler option is supported | ||
101 | cc-supports = ${shell if $(CC) ${1} -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo "$(1)"; fi;} | ||
102 | |||
103 | # use '-Os' optimization if available, else use -O2 | ||
104 | OPTIMIZATION := $(call cc-supports,-Os,-O2) | ||
105 | |||
106 | WARNINGS := -Wall -Wchar-subscripts -Wpointer-arith -Wsign-compare | ||
107 | WARNINGS += $(call cc-supports,-Wno-pointer-sign) | ||
108 | WARNINGS += $(call cc-supports,-Wdeclaration-after-statement) | ||
109 | WARNINGS += -Wshadow | ||
110 | |||
111 | CPPFLAGS += -DVERSION=\"$(VERSION)\" -DPACKAGE=\"$(PACKAGE)\" \ | ||
112 | -DPACKAGE_BUGREPORT=\"$(PACKAGE_BUGREPORT)\" -D_GNU_SOURCE | ||
113 | |||
114 | UTIL_OBJS = utils/helpers/amd.o utils/helpers/topology.o utils/helpers/msr.o \ | ||
115 | utils/helpers/sysfs.o utils/helpers/misc.o utils/helpers/cpuid.o \ | ||
116 | utils/helpers/pci.o utils/helpers/bitmask.o \ | ||
117 | utils/idle_monitor/nhm_idle.o utils/idle_monitor/snb_idle.o \ | ||
118 | utils/idle_monitor/amd_fam14h_idle.o utils/idle_monitor/cpuidle_sysfs.o \ | ||
119 | utils/idle_monitor/mperf_monitor.o utils/idle_monitor/cpupower-monitor.o \ | ||
120 | utils/cpupower.o utils/cpufreq-info.o utils/cpufreq-set.o \ | ||
121 | utils/cpupower-set.o utils/cpupower-info.o utils/cpuidle-info.o | ||
122 | |||
123 | UTIL_HEADERS = utils/helpers/helpers.h utils/idle_monitor/cpupower-monitor.h \ | ||
124 | utils/helpers/bitmask.h \ | ||
125 | utils/idle_monitor/idle_monitors.h utils/idle_monitor/idle_monitors.def | ||
126 | |||
127 | UTIL_SRC := $(UTIL_OBJS:.o=.c) | ||
128 | |||
129 | LIB_HEADERS = lib/cpufreq.h lib/sysfs.h | ||
130 | LIB_SRC = lib/cpufreq.c lib/sysfs.c | ||
131 | LIB_OBJS = lib/cpufreq.o lib/sysfs.o | ||
132 | |||
133 | CFLAGS += -pipe | ||
134 | |||
135 | ifeq ($(strip $(NLS)),true) | ||
136 | INSTALL_NLS += install-gmo | ||
137 | COMPILE_NLS += update-gmo | ||
138 | endif | ||
139 | |||
140 | ifeq ($(strip $(CPUFRQ_BENCH)),true) | ||
141 | INSTALL_BENCH += install-bench | ||
142 | COMPILE_BENCH += compile-bench | ||
143 | endif | ||
144 | |||
145 | CFLAGS += $(WARNINGS) | ||
146 | |||
147 | ifeq ($(strip $(V)),false) | ||
148 | QUIET=@$(PWD)/build/ccdv | ||
149 | HOST_PROGS=build/ccdv | ||
150 | else | ||
151 | QUIET= | ||
152 | HOST_PROGS= | ||
153 | endif | ||
154 | |||
155 | # if DEBUG is enabled, then we do not strip or optimize | ||
156 | ifeq ($(strip $(DEBUG)),true) | ||
157 | CFLAGS += -O1 -g | ||
158 | CPPFLAGS += -DDEBUG | ||
159 | STRIPCMD = /bin/true -Since_we_are_debugging | ||
160 | else | ||
161 | CFLAGS += $(OPTIMIZATION) -fomit-frame-pointer | ||
162 | STRIPCMD = $(STRIP) -s --remove-section=.note --remove-section=.comment | ||
163 | endif | ||
164 | |||
165 | |||
166 | # the actual make rules | ||
167 | |||
168 | all: ccdv libcpufreq cpupower $(COMPILE_NLS) $(COMPILE_BENCH) | ||
169 | |||
170 | ccdv: build/ccdv | ||
171 | build/ccdv: build/ccdv.c | ||
172 | @echo "Building ccdv" | ||
173 | @$(HOSTCC) -O1 $< -o $@ | ||
174 | |||
175 | lib/%.o: $(LIB_SRC) $(LIB_HEADERS) build/ccdv | ||
176 | $(QUIET) $(CC) $(CPPFLAGS) $(CFLAGS) -fPIC -o $@ -c lib/$*.c | ||
177 | |||
178 | libcpufreq.so.$(LIB_MAJ): $(LIB_OBJS) | ||
179 | $(QUIET) $(CC) -shared $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ \ | ||
180 | -Wl,-soname,libcpufreq.so.$(LIB_MIN) $(LIB_OBJS) | ||
181 | @ln -sf $@ libcpufreq.so | ||
182 | @ln -sf $@ libcpufreq.so.$(LIB_MIN) | ||
183 | |||
184 | libcpufreq: libcpufreq.so.$(LIB_MAJ) | ||
185 | |||
186 | # Let all .o files depend on its .c file and all headers | ||
187 | # Might be worth to put this into utils/Makefile at some point of time | ||
188 | $(UTIL_OBJS): $(UTIL_HEADERS) | ||
189 | |||
190 | .c.o: | ||
191 | $(QUIET) $(CC) $(CFLAGS) $(CPPFLAGS) -I./lib -I ./utils -o $@ -c $*.c | ||
192 | |||
193 | cpupower: $(UTIL_OBJS) libcpufreq | ||
194 | $(QUIET) $(CC) $(CFLAGS) $(LDFLAGS) -lcpufreq -lrt -lpci -L. -o $@ $(UTIL_OBJS) | ||
195 | $(STRIPCMD) $@ | ||
196 | |||
197 | po/$(PACKAGE).pot: $(UTIL_SRC) | ||
198 | @xgettext --default-domain=$(PACKAGE) --add-comments \ | ||
199 | --keyword=_ --keyword=N_ $(UTIL_SRC) && \ | ||
200 | test -f $(PACKAGE).po && \ | ||
201 | mv -f $(PACKAGE).po po/$(PACKAGE).pot | ||
202 | |||
203 | update-gmo: po/$(PACKAGE).pot | ||
204 | @for HLANG in $(LANGUAGES); do \ | ||
205 | echo -n "Translating $$HLANG "; \ | ||
206 | if msgmerge po/$$HLANG.po po/$(PACKAGE).pot -o \ | ||
207 | po/$$HLANG.new.po; then \ | ||
208 | mv -f po/$$HLANG.new.po po/$$HLANG.po; \ | ||
209 | else \ | ||
210 | echo "msgmerge for $$HLANG failed!"; \ | ||
211 | rm -f po/$$HLANG.new.po; \ | ||
212 | fi; \ | ||
213 | msgfmt --statistics -o po/$$HLANG.gmo po/$$HLANG.po; \ | ||
214 | done; | ||
215 | |||
216 | compile-bench: libcpufreq.so.$(LIB_MAJ) | ||
217 | @V=$(V) confdir=$(confdir) $(MAKE) -C bench | ||
218 | |||
219 | clean: | ||
220 | -find . \( -not -type d \) -and \( -name '*~' -o -name '*.[oas]' \) -type f -print \ | ||
221 | | xargs rm -f | ||
222 | -rm -f $(UTIL_BINS) | ||
223 | -rm -f $(IDLE_OBJS) | ||
224 | -rm -f cpupower | ||
225 | -rm -f libcpufreq.so* | ||
226 | -rm -f build/ccdv | ||
227 | -rm -rf po/*.gmo po/*.pot | ||
228 | $(MAKE) -C bench clean | ||
229 | |||
230 | |||
231 | install-lib: | ||
232 | $(INSTALL) -d $(DESTDIR)${libdir} | ||
233 | $(CP) libcpufreq.so* $(DESTDIR)${libdir}/ | ||
234 | $(INSTALL) -d $(DESTDIR)${includedir} | ||
235 | $(INSTALL_DATA) lib/cpufreq.h $(DESTDIR)${includedir}/cpufreq.h | ||
236 | |||
237 | install-tools: | ||
238 | $(INSTALL) -d $(DESTDIR)${bindir} | ||
239 | $(INSTALL_PROGRAM) cpupower $(DESTDIR)${bindir} | ||
240 | |||
241 | install-man: | ||
242 | $(INSTALL_DATA) -D man/cpupower.1 $(DESTDIR)${mandir}/man1/cpupower.1 | ||
243 | $(INSTALL_DATA) -D man/cpupower-frequency-set.1 $(DESTDIR)${mandir}/man1/cpupower-frequency-set.1 | ||
244 | $(INSTALL_DATA) -D man/cpupower-frequency-info.1 $(DESTDIR)${mandir}/man1/cpupower-frequency-info.1 | ||
245 | $(INSTALL_DATA) -D man/cpupower-set.1 $(DESTDIR)${mandir}/man1/cpupower-set.1 | ||
246 | $(INSTALL_DATA) -D man/cpupower-info.1 $(DESTDIR)${mandir}/man1/cpupower-info.1 | ||
247 | $(INSTALL_DATA) -D man/cpupower-monitor.1 $(DESTDIR)${mandir}/man1/cpupower-monitor.1 | ||
248 | |||
249 | install-gmo: | ||
250 | $(INSTALL) -d $(DESTDIR)${localedir} | ||
251 | for HLANG in $(LANGUAGES); do \ | ||
252 | echo '$(INSTALL_DATA) -D po/$$HLANG.gmo $(DESTDIR)${localedir}/$$HLANG/LC_MESSAGES/cpupowerutils.mo'; \ | ||
253 | $(INSTALL_DATA) -D po/$$HLANG.gmo $(DESTDIR)${localedir}/$$HLANG/LC_MESSAGES/cpupowerutils.mo; \ | ||
254 | done; | ||
255 | |||
256 | install-bench: | ||
257 | @#DESTDIR must be set from outside to survive | ||
258 | @sbindir=$(sbindir) bindir=$(bindir) docdir=$(docdir) confdir=$(confdir) $(MAKE) -C bench install | ||
259 | |||
260 | install: all install-lib install-tools install-man $(INSTALL_NLS) $(INSTALL_BENCH) | ||
261 | |||
262 | uninstall: | ||
263 | - rm -f $(DESTDIR)${libdir}/libcpufreq.* | ||
264 | - rm -f $(DESTDIR)${includedir}/cpufreq.h | ||
265 | - rm -f $(DESTDIR)${bindir}/utils/cpupower | ||
266 | - rm -f $(DESTDIR)${mandir}/man1/cpufreq-set.1 | ||
267 | - rm -f $(DESTDIR)${mandir}/man1/cpufreq-info.1 | ||
268 | - for HLANG in $(LANGUAGES); do \ | ||
269 | rm -f $(DESTDIR)${localedir}/$$HLANG/LC_MESSAGES/cpupowerutils.mo; \ | ||
270 | done; | ||
271 | |||
272 | .PHONY: all utils libcpufreq ccdv update-po update-gmo install-lib install-tools install-man install-gmo install uninstall \ | ||
273 | clean | ||
diff --git a/tools/power/cpupower/README b/tools/power/cpupower/README new file mode 100644 index 00000000000..fd9d4c0d668 --- /dev/null +++ b/tools/power/cpupower/README | |||
@@ -0,0 +1,49 @@ | |||
1 | The cpufrequtils package (homepage: | ||
2 | http://www.kernel.org/pub/linux/utils/kernel/cpufreq/cpufrequtils.html ) | ||
3 | consists of the following elements: | ||
4 | |||
5 | requirements | ||
6 | ------------ | ||
7 | |||
8 | On x86 pciutils is needed at runtime (-lpci). | ||
9 | For compilation pciutils-devel (pci/pci.h) and a gcc version | ||
10 | providing cpuid.h is needed. | ||
11 | For both it's not explicitly checked for (yet). | ||
12 | |||
13 | |||
14 | libcpufreq | ||
15 | ---------- | ||
16 | |||
17 | "libcpufreq" is a library which offers a unified access method for userspace | ||
18 | tools and programs to the cpufreq core and drivers in the Linux kernel. This | ||
19 | allows for code reduction in userspace tools, a clean implementation of | ||
20 | the interaction to the cpufreq core, and support for both the sysfs and proc | ||
21 | interfaces [depending on configuration, see below]. | ||
22 | |||
23 | |||
24 | compilation and installation | ||
25 | ---------------------------- | ||
26 | |||
27 | make | ||
28 | su | ||
29 | make install | ||
30 | |||
31 | should suffice on most systems. It builds default libcpufreq, | ||
32 | cpufreq-set and cpufreq-info files and installs them in /usr/lib and | ||
33 | /usr/bin, respectively. If you want to set up the paths differently and/or | ||
34 | want to configure the package to your specific needs, you need to open | ||
35 | "Makefile" with an editor of your choice and edit the block marked | ||
36 | CONFIGURATION. | ||
37 | |||
38 | |||
39 | THANKS | ||
40 | ------ | ||
41 | Many thanks to Mattia Dongili who wrote the autotoolization and | ||
42 | libtoolization, the manpages and the italian language file for cpufrequtils; | ||
43 | to Dave Jones for his feedback and his dump_psb tool; to Bruno Ducrot for his | ||
44 | powernow-k8-decode and intel_gsic tools as well as the french language file; | ||
45 | and to various others commenting on the previous (pre-)releases of | ||
46 | cpufrequtils. | ||
47 | |||
48 | |||
49 | Dominik Brodowski | ||
diff --git a/tools/power/cpupower/ToDo b/tools/power/cpupower/ToDo new file mode 100644 index 00000000000..874b78b586e --- /dev/null +++ b/tools/power/cpupower/ToDo | |||
@@ -0,0 +1,11 @@ | |||
1 | ToDos sorted by priority: | ||
2 | |||
3 | - Use bitmask functions to parse CPU topology more robust | ||
4 | (current implementation has issues on AMD) | ||
5 | - Try to read out boost states and frequencies on Intel | ||
6 | - Adjust README | ||
7 | - Somewhere saw the ability to read power consumption of | ||
8 | RAM from HW on Intel SandyBridge -> another monitor? | ||
9 | - Add another c1e debug idle monitor | ||
10 | -> Is by design racy with BIOS, but could be added | ||
11 | with a --force option and some "be careful" messages | ||
diff --git a/tools/power/cpupower/bench/Makefile b/tools/power/cpupower/bench/Makefile new file mode 100644 index 00000000000..3d8fa21855f --- /dev/null +++ b/tools/power/cpupower/bench/Makefile | |||
@@ -0,0 +1,30 @@ | |||
1 | LIBS = -L../ -lm -lcpufreq | ||
2 | |||
3 | OBJS = main.o parse.o system.o benchmark.o | ||
4 | CFLAGS += -D_GNU_SOURCE -I../lib -DDEFAULT_CONFIG_FILE=\"$(confdir)/cpufreq-bench.conf\" | ||
5 | |||
6 | ifeq ($(strip $(V)),false) | ||
7 | CC=@../build/ccdv gcc | ||
8 | else | ||
9 | CC=gcc | ||
10 | endif | ||
11 | |||
12 | cpufreq-bench: $(OBJS) | ||
13 | $(CC) -o $@ $(CFLAGS) $(OBJS) $(LIBS) | ||
14 | |||
15 | all: cpufreq-bench | ||
16 | |||
17 | install: | ||
18 | mkdir -p $(DESTDIR)/$(sbindir) | ||
19 | mkdir -p $(DESTDIR)/$(bindir) | ||
20 | mkdir -p $(DESTDIR)/$(docdir) | ||
21 | mkdir -p $(DESTDIR)/$(confdir) | ||
22 | install -m 755 cpufreq-bench $(DESTDIR)/$(sbindir)/cpufreq-bench | ||
23 | install -m 755 cpufreq-bench_plot.sh $(DESTDIR)/$(bindir)/cpufreq-bench_plot.sh | ||
24 | install -m 644 README-BENCH $(DESTDIR)/$(docdir)/README-BENCH | ||
25 | install -m 755 cpufreq-bench_script.sh $(DESTDIR)/$(docdir)/cpufreq-bench_script.sh | ||
26 | install -m 644 example.cfg $(DESTDIR)/$(confdir)/cpufreq-bench.conf | ||
27 | |||
28 | clean: | ||
29 | rm -f *.o | ||
30 | rm -f cpufreq-bench | ||
diff --git a/tools/power/cpupower/bench/README-BENCH b/tools/power/cpupower/bench/README-BENCH new file mode 100644 index 00000000000..8093ec73817 --- /dev/null +++ b/tools/power/cpupower/bench/README-BENCH | |||
@@ -0,0 +1,124 @@ | |||
1 | This is cpufreq-bench, a microbenchmark for the cpufreq framework. | ||
2 | |||
3 | Purpose | ||
4 | ======= | ||
5 | |||
6 | What is this benchmark for: | ||
7 | - Identify worst case performance loss when doing dynamic frequency | ||
8 | scaling using Linux kernel governors | ||
9 | - Identify average reaction time of a governor to CPU load changes | ||
10 | - (Stress) Testing whether a cpufreq low level driver or governor works | ||
11 | as expected | ||
12 | - Identify cpufreq related performance regressions between kernels | ||
13 | - Possibly Real time priority testing? -> what happens if there are | ||
14 | processes with a higher prio than the governor's kernel thread | ||
15 | - ... | ||
16 | |||
17 | What this benchmark does *not* cover: | ||
18 | - Power saving related regressions (In fact as better the performance | ||
19 | throughput is, the worse the power savings will be, but the first should | ||
20 | mostly count more...) | ||
21 | - Real world (workloads) | ||
22 | |||
23 | |||
24 | Description | ||
25 | =========== | ||
26 | |||
27 | cpufreq-bench helps to test the condition of a given cpufreq governor. | ||
28 | For that purpose, it compares the performance governor to a configured | ||
29 | powersave module. | ||
30 | |||
31 | |||
32 | How it works | ||
33 | ============ | ||
34 | You can specify load (100% CPU load) and sleep (0% CPU load) times in us which | ||
35 | will be run X time in a row (cycles): | ||
36 | |||
37 | sleep=25000 | ||
38 | load=25000 | ||
39 | cycles=20 | ||
40 | |||
41 | This part of the configuration file will create 25ms load/sleep turns, | ||
42 | repeated 20 times. | ||
43 | |||
44 | Adding this: | ||
45 | sleep_step=25000 | ||
46 | load_step=25000 | ||
47 | rounds=5 | ||
48 | Will increase load and sleep time by 25ms 5 times. | ||
49 | Together you get following test: | ||
50 | 25ms load/sleep time repeated 20 times (cycles). | ||
51 | 50ms load/sleep time repeated 20 times (cycles). | ||
52 | .. | ||
53 | 100ms load/sleep time repeated 20 times (cycles). | ||
54 | |||
55 | First it is calibrated how long a specific CPU intensive calculation | ||
56 | takes on this machine and needs to be run in a loop using the performance | ||
57 | governor. | ||
58 | Then the above test runs are processed using the performance governor | ||
59 | and the governor to test. The time the calculation really needed | ||
60 | with the dynamic freq scaling governor is compared with the time needed | ||
61 | on full performance and you get the overall performance loss. | ||
62 | |||
63 | |||
64 | Example of expected results with ondemand governor: | ||
65 | |||
66 | This shows expected results of the first two test run rounds from | ||
67 | above config, you there have: | ||
68 | |||
69 | 100% CPU load (load) | 0 % CPU load (sleep) | round | ||
70 | 25 ms | 25 ms | 1 | ||
71 | 50 ms | 50 ms | 2 | ||
72 | |||
73 | For example if ondemand governor is configured to have a 50ms | ||
74 | sampling rate you get: | ||
75 | |||
76 | In round 1, ondemand should have rather static 50% load and probably | ||
77 | won't ever switch up (as long as up_threshold is above). | ||
78 | |||
79 | In round 2, if the ondemand sampling times exactly match the load/sleep | ||
80 | trigger of the cpufreq-bench, you will see no performance loss (compare with | ||
81 | below possible ondemand sample kick ins (1)): | ||
82 | |||
83 | But if ondemand always kicks in in the middle of the load sleep cycles, it | ||
84 | will always see 50% loads and you get worst performance impact never | ||
85 | switching up (compare with below possible ondemand sample kick ins (2)):: | ||
86 | |||
87 | 50 50 50 50ms ->time | ||
88 | load -----| |-----| |-----| |-----| | ||
89 | | | | | | | | | ||
90 | sleep |-----| |-----| |-----| |---- | ||
91 | |-----|-----|-----|-----|-----|-----|-----|---- ondemand sampling (1) | ||
92 | 100 0 100 0 100 0 100 load seen by ondemand(%) | ||
93 | |-----|-----|-----|-----|-----|-----|-----|-- ondemand sampling (2) | ||
94 | 50 50 50 50 50 50 50 load seen by ondemand(%) | ||
95 | |||
96 | You can easily test all kind of load/sleep times and check whether your | ||
97 | governor in average behaves as expected. | ||
98 | |||
99 | |||
100 | ToDo | ||
101 | ==== | ||
102 | |||
103 | Provide a gnuplot utility script for easy generation of plots to present | ||
104 | the outcome nicely. | ||
105 | |||
106 | |||
107 | cpufreq-bench Command Usage | ||
108 | =========================== | ||
109 | -l, --load=<long int> initial load time in us | ||
110 | -s, --sleep=<long int> initial sleep time in us | ||
111 | -x, --load-step=<long int> time to be added to load time, in us | ||
112 | -y, --sleep-step=<long int> time to be added to sleep time, in us | ||
113 | -c, --cpu=<unsigned int> CPU Number to use, starting at 0 | ||
114 | -p, --prio=<priority> scheduler priority, HIGH, LOW or DEFAULT | ||
115 | -g, --governor=<governor> cpufreq governor to test | ||
116 | -n, --cycles=<int> load/sleep cycles to get an avarage value to compare | ||
117 | -r, --rounds<int> load/sleep rounds | ||
118 | -f, --file=<configfile> config file to use | ||
119 | -o, --output=<dir> output dir, must exist | ||
120 | -v, --verbose verbose output on/off | ||
121 | |||
122 | Due to the high priority, the application may not be responsible for some time. | ||
123 | After the benchmark, the logfile is saved in OUTPUTDIR/benchmark_TIMESTAMP.log | ||
124 | |||
diff --git a/tools/power/cpupower/bench/benchmark.c b/tools/power/cpupower/bench/benchmark.c new file mode 100644 index 00000000000..f538633b8b4 --- /dev/null +++ b/tools/power/cpupower/bench/benchmark.c | |||
@@ -0,0 +1,184 @@ | |||
1 | /* cpufreq-bench CPUFreq microbenchmark | ||
2 | * | ||
3 | * Copyright (C) 2008 Christian Kornacker <ckornacker@suse.de> | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
18 | */ | ||
19 | |||
20 | #include <stdio.h> | ||
21 | #include <unistd.h> | ||
22 | #include <math.h> | ||
23 | |||
24 | #include "config.h" | ||
25 | #include "system.h" | ||
26 | #include "benchmark.h" | ||
27 | |||
28 | /* Print out progress if we log into a file */ | ||
29 | #define show_progress(total_time, progress_time) \ | ||
30 | if (config->output != stdout) { \ | ||
31 | fprintf(stdout, "Progress: %02lu %%\r", \ | ||
32 | (progress_time * 100) / total_time); \ | ||
33 | fflush(stdout); \ | ||
34 | } | ||
35 | |||
36 | /** | ||
37 | * compute how many rounds of calculation we should do | ||
38 | * to get the given load time | ||
39 | * | ||
40 | * @param load aimed load time in µs | ||
41 | * | ||
42 | * @retval rounds of calculation | ||
43 | **/ | ||
44 | |||
45 | unsigned int calculate_timespace(long load, struct config *config) | ||
46 | { | ||
47 | int i; | ||
48 | long long now, then; | ||
49 | unsigned int estimated = GAUGECOUNT; | ||
50 | unsigned int rounds = 0; | ||
51 | unsigned int timed = 0; | ||
52 | |||
53 | if (config->verbose) | ||
54 | printf("calibrating load of %lius, please wait...\n", load); | ||
55 | |||
56 | /* get the initial calculation time for a specific number of rounds */ | ||
57 | now = get_time(); | ||
58 | ROUNDS(estimated); | ||
59 | then = get_time(); | ||
60 | |||
61 | timed = (unsigned int)(then - now); | ||
62 | |||
63 | /* approximation of the wanted load time by comparing with the | ||
64 | * initial calculation time */ | ||
65 | for (i= 0; i < 4; i++) | ||
66 | { | ||
67 | rounds = (unsigned int)(load * estimated / timed); | ||
68 | dprintf("calibrating with %u rounds\n", rounds); | ||
69 | now = get_time(); | ||
70 | ROUNDS(rounds); | ||
71 | then = get_time(); | ||
72 | |||
73 | timed = (unsigned int)(then - now); | ||
74 | estimated = rounds; | ||
75 | } | ||
76 | if (config->verbose) | ||
77 | printf("calibration done\n"); | ||
78 | |||
79 | return estimated; | ||
80 | } | ||
81 | |||
82 | /** | ||
83 | * benchmark | ||
84 | * generates a specific sleep an load time with the performance | ||
85 | * governor and compares the used time for same calculations done | ||
86 | * with the configured powersave governor | ||
87 | * | ||
88 | * @param config config values for the benchmark | ||
89 | * | ||
90 | **/ | ||
91 | |||
92 | void start_benchmark(struct config *config) | ||
93 | { | ||
94 | unsigned int _round, cycle; | ||
95 | long long now, then; | ||
96 | long sleep_time = 0, load_time = 0; | ||
97 | long performance_time = 0, powersave_time = 0; | ||
98 | unsigned int calculations; | ||
99 | unsigned long total_time = 0, progress_time = 0; | ||
100 | |||
101 | sleep_time = config->sleep; | ||
102 | load_time = config->load; | ||
103 | |||
104 | /* For the progress bar */ | ||
105 | for (_round=1; _round <= config->rounds; _round++) | ||
106 | total_time += _round * (config->sleep + config->load); | ||
107 | total_time *= 2; /* powersave and performance cycles */ | ||
108 | |||
109 | for (_round=0; _round < config->rounds; _round++) { | ||
110 | performance_time = 0LL; | ||
111 | powersave_time = 0LL; | ||
112 | |||
113 | show_progress(total_time, progress_time); | ||
114 | |||
115 | /* set the cpufreq governor to "performance" which disables | ||
116 | * P-State switching. */ | ||
117 | if (set_cpufreq_governor("performance", config->cpu) != 0) | ||
118 | return; | ||
119 | |||
120 | /* calibrate the calculation time. the resulting calculation | ||
121 | * _rounds should produce a load which matches the configured | ||
122 | * load time */ | ||
123 | calculations = calculate_timespace(load_time, config); | ||
124 | |||
125 | if (config->verbose) | ||
126 | printf("_round %i: doing %u cycles with %u calculations" | ||
127 | " for %lius\n", _round + 1, config->cycles, | ||
128 | calculations, load_time); | ||
129 | |||
130 | fprintf(config->output, "%u %li %li ", | ||
131 | _round, load_time, sleep_time); | ||
132 | |||
133 | if (config->verbose) { | ||
134 | printf("avarage: %lius, rps:%li\n", load_time / calculations, 1000000 * calculations / load_time); | ||
135 | } | ||
136 | |||
137 | /* do some sleep/load cycles with the performance governor */ | ||
138 | for (cycle = 0; cycle < config->cycles; cycle++) { | ||
139 | now = get_time(); | ||
140 | usleep(sleep_time); | ||
141 | ROUNDS(calculations); | ||
142 | then = get_time(); | ||
143 | performance_time += then - now - sleep_time; | ||
144 | if (config->verbose) | ||
145 | printf("performance cycle took %lius, sleep: %lius, load: %lius, rounds: %u\n", | ||
146 | (long)(then - now), sleep_time, load_time, calculations); | ||
147 | } | ||
148 | fprintf(config->output, "%li ", performance_time / config->cycles); | ||
149 | |||
150 | progress_time += sleep_time + load_time; | ||
151 | show_progress(total_time, progress_time); | ||
152 | |||
153 | /* set the powersave governor which activates P-State switching | ||
154 | * again */ | ||
155 | if (set_cpufreq_governor(config->governor, config->cpu) != 0) | ||
156 | return; | ||
157 | |||
158 | /* again, do some sleep/load cycles with the powersave governor */ | ||
159 | for (cycle = 0; cycle < config->cycles; cycle++) { | ||
160 | now = get_time(); | ||
161 | usleep(sleep_time); | ||
162 | ROUNDS(calculations); | ||
163 | then = get_time(); | ||
164 | powersave_time += then - now - sleep_time; | ||
165 | if (config->verbose) | ||
166 | printf("powersave cycle took %lius, sleep: %lius, load: %lius, rounds: %u\n", | ||
167 | (long)(then - now), sleep_time, load_time, calculations); | ||
168 | } | ||
169 | |||
170 | progress_time += sleep_time + load_time; | ||
171 | |||
172 | /* compare the avarage sleep/load cycles */ | ||
173 | fprintf(config->output, "%li ", powersave_time / config->cycles); | ||
174 | fprintf(config->output, "%.3f\n", performance_time * 100.0 / powersave_time); | ||
175 | fflush(config->output); | ||
176 | |||
177 | if (config->verbose) | ||
178 | printf("performance is at %.2f%%\n", performance_time * 100.0 / powersave_time); | ||
179 | |||
180 | sleep_time += config->sleep_step; | ||
181 | load_time += config->load_step; | ||
182 | } | ||
183 | } | ||
184 | |||
diff --git a/tools/power/cpupower/bench/benchmark.h b/tools/power/cpupower/bench/benchmark.h new file mode 100644 index 00000000000..0691f91b720 --- /dev/null +++ b/tools/power/cpupower/bench/benchmark.h | |||
@@ -0,0 +1,27 @@ | |||
1 | /* cpufreq-bench CPUFreq microbenchmark | ||
2 | * | ||
3 | * Copyright (C) 2008 Christian Kornacker <ckornacker@suse.de> | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
18 | */ | ||
19 | |||
20 | /* load loop, this schould take about 1 to 2ms to complete */ | ||
21 | #define ROUNDS(x) {unsigned int rcnt; \ | ||
22 | for (rcnt = 0; rcnt< x*1000; rcnt++) { \ | ||
23 | (void)(((int)(pow(rcnt, rcnt) * sqrt(rcnt*7230970)) ^ 7230716) ^ (int)atan2(rcnt, rcnt)); \ | ||
24 | }} \ | ||
25 | |||
26 | |||
27 | void start_benchmark(struct config *config); | ||
diff --git a/tools/power/cpupower/bench/config.h b/tools/power/cpupower/bench/config.h new file mode 100644 index 00000000000..9690f1be32f --- /dev/null +++ b/tools/power/cpupower/bench/config.h | |||
@@ -0,0 +1,36 @@ | |||
1 | /* cpufreq-bench CPUFreq microbenchmark | ||
2 | * | ||
3 | * Copyright (C) 2008 Christian Kornacker <ckornacker@suse.de> | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
18 | */ | ||
19 | |||
20 | /* initial loop count for the load calibration */ | ||
21 | #define GAUGECOUNT 1500 | ||
22 | |||
23 | /* default scheduling policy SCHED_OTHER */ | ||
24 | #define SCHEDULER SCHED_OTHER | ||
25 | |||
26 | #define PRIORITY_DEFAULT 0 | ||
27 | #define PRIORITY_HIGH sched_get_priority_max(SCHEDULER) | ||
28 | #define PRIORITY_LOW sched_get_priority_min(SCHEDULER) | ||
29 | |||
30 | /* enable further debug messages */ | ||
31 | #ifdef DEBUG | ||
32 | #define dprintf printf | ||
33 | #else | ||
34 | #define dprintf( ... ) while(0) { } | ||
35 | #endif | ||
36 | |||
diff --git a/tools/power/cpupower/bench/cpufreq-bench_plot.sh b/tools/power/cpupower/bench/cpufreq-bench_plot.sh new file mode 100644 index 00000000000..410021a12f4 --- /dev/null +++ b/tools/power/cpupower/bench/cpufreq-bench_plot.sh | |||
@@ -0,0 +1,104 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | # This program is free software: you can redistribute it and/or modify | ||
4 | # it under the terms of the GNU General Public License as published by | ||
5 | # the Free Software Foundation; either version 2, or (at your option) | ||
6 | # any later version. | ||
7 | |||
8 | # This program is distributed in the hope that it will be useful, | ||
9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | # GNU General Public License for more details. | ||
12 | |||
13 | # You should have received a copy of the GNU General Public License | ||
14 | # along with this program; if not, write to the Free Software | ||
15 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
16 | # 02110-1301, USA. | ||
17 | |||
18 | # Author/Copyright(c): 2009, Thomas Renninger <trenn@suse.de>, Novell Inc. | ||
19 | |||
20 | # Helper script to easily create nice plots of your cpufreq-bench results | ||
21 | |||
22 | dir=`mktemp -d` | ||
23 | output_file="cpufreq-bench.png" | ||
24 | global_title="cpufreq-bench plot" | ||
25 | picture_type="jpeg" | ||
26 | file[0]="" | ||
27 | |||
28 | function usage() | ||
29 | { | ||
30 | echo "cpufreq-bench_plot.sh [OPTIONS] logfile [measure_title] [logfile [measure_title]] ...]" | ||
31 | echo | ||
32 | echo "Options" | ||
33 | echo " -o output_file" | ||
34 | echo " -t global_title" | ||
35 | echo " -p picture_type [jpeg|gif|png|postscript|...]" | ||
36 | exit 1 | ||
37 | } | ||
38 | |||
39 | if [ $# -eq 0 ];then | ||
40 | echo "No benchmark results file provided" | ||
41 | echo | ||
42 | usage | ||
43 | fi | ||
44 | |||
45 | while getopts o:t:p: name ; do | ||
46 | case $name in | ||
47 | o) | ||
48 | output_file="$OPTARG".$picture_type | ||
49 | ;; | ||
50 | t) | ||
51 | global_title="$OPTARG" | ||
52 | ;; | ||
53 | p) | ||
54 | picture_type="$OPTARG" | ||
55 | ;; | ||
56 | ?) | ||
57 | usage | ||
58 | ;; | ||
59 | esac | ||
60 | done | ||
61 | shift $(($OPTIND -1)) | ||
62 | |||
63 | plots=0 | ||
64 | while [ "$1" ];do | ||
65 | if [ ! -f "$1" ];then | ||
66 | echo "File $1 does not exist" | ||
67 | usage | ||
68 | fi | ||
69 | file[$plots]="$1" | ||
70 | title[$plots]="$2" | ||
71 | # echo "File: ${file[$plots]} - ${title[plots]}" | ||
72 | shift;shift | ||
73 | plots=$((plots + 1)) | ||
74 | done | ||
75 | |||
76 | echo "set terminal $picture_type" >> $dir/plot_script.gpl | ||
77 | echo "set output \"$output_file\"" >> $dir/plot_script.gpl | ||
78 | echo "set title \"$global_title\"" >> $dir/plot_script.gpl | ||
79 | echo "set xlabel \"sleep/load time\"" >> $dir/plot_script.gpl | ||
80 | echo "set ylabel \"Performance (%)\"" >> $dir/plot_script.gpl | ||
81 | |||
82 | for((plot=0;plot<$plots;plot++));do | ||
83 | |||
84 | # Sanity check | ||
85 | ###### I am to dump to get this redirected to stderr/stdout in one awk call... ##### | ||
86 | cat ${file[$plot]} |grep -v "^#" |awk '{if ($2 != $3) printf("Error in measure %d:Load time %s does not equal sleep time %s, plot will not be correct\n", $1, $2, $3); ERR=1}' | ||
87 | ###### I am to dump to get this redirected in one awk call... ##### | ||
88 | |||
89 | # Parse out load time (which must be equal to sleep time for a plot), divide it by 1000 | ||
90 | # to get ms and parse out the performance in percentage and write it to a temp file for plotting | ||
91 | cat ${file[$plot]} |grep -v "^#" |awk '{printf "%lu %.1f\n",$2/1000, $6}' >$dir/data_$plot | ||
92 | |||
93 | if [ $plot -eq 0 ];then | ||
94 | echo -n "plot " >> $dir/plot_script.gpl | ||
95 | fi | ||
96 | echo -n "\"$dir/data_$plot\" title \"${title[$plot]}\" with lines" >> $dir/plot_script.gpl | ||
97 | if [ $(($plot + 1)) -ne $plots ];then | ||
98 | echo -n ", " >> $dir/plot_script.gpl | ||
99 | fi | ||
100 | done | ||
101 | echo >> $dir/plot_script.gpl | ||
102 | |||
103 | gnuplot $dir/plot_script.gpl | ||
104 | rm -r $dir \ No newline at end of file | ||
diff --git a/tools/power/cpupower/bench/cpufreq-bench_script.sh b/tools/power/cpupower/bench/cpufreq-bench_script.sh new file mode 100644 index 00000000000..de20d2a0687 --- /dev/null +++ b/tools/power/cpupower/bench/cpufreq-bench_script.sh | |||
@@ -0,0 +1,101 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | # This program is free software: you can redistribute it and/or modify | ||
4 | # it under the terms of the GNU General Public License as published by | ||
5 | # the Free Software Foundation; either version 2, or (at your option) | ||
6 | # any later version. | ||
7 | |||
8 | # This program is distributed in the hope that it will be useful, | ||
9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | # GNU General Public License for more details. | ||
12 | |||
13 | # You should have received a copy of the GNU General Public License | ||
14 | # along with this program; if not, write to the Free Software | ||
15 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
16 | # 02110-1301, USA. | ||
17 | |||
18 | # Author/Copyright(c): 2009, Thomas Renninger <trenn@suse.de>, Novell Inc. | ||
19 | |||
20 | # Ondemand up_threshold and sampling rate test script for cpufreq-bench | ||
21 | # mircobenchmark. | ||
22 | # Modify the general variables at the top or extend or copy out parts | ||
23 | # if you want to test other things | ||
24 | # | ||
25 | |||
26 | # Default with latest kernels is 95, before micro account patches | ||
27 | # it was 80, cmp. with git commit 808009131046b62ac434dbc796 | ||
28 | UP_THRESHOLD="60 80 95" | ||
29 | # Depending on the kernel and the HW sampling rate could be restricted | ||
30 | # and cannot be set that low... | ||
31 | # E.g. before git commit cef9615a853ebc4972084f7 one could only set | ||
32 | # min sampling rate of 80000 if CONFIG_HZ=250 | ||
33 | SAMPLING_RATE="20000 80000" | ||
34 | |||
35 | function measure() | ||
36 | { | ||
37 | local -i up_threshold_set | ||
38 | local -i sampling_rate_set | ||
39 | |||
40 | for up_threshold in $UP_THRESHOLD;do | ||
41 | for sampling_rate in $SAMPLING_RATE;do | ||
42 | # Set values in sysfs | ||
43 | echo $up_threshold >/sys/devices/system/cpu/cpu0/cpufreq/ondemand/up_threshold | ||
44 | echo $sampling_rate >/sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate | ||
45 | up_threshold_set=$(cat /sys/devices/system/cpu/cpu0/cpufreq/ondemand/up_threshold) | ||
46 | sampling_rate_set=$(cat /sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate) | ||
47 | |||
48 | # Verify set values in sysfs | ||
49 | if [ ${up_threshold_set} -eq ${up_threshold} ];then | ||
50 | echo "up_threshold: $up_threshold, set in sysfs: ${up_threshold_set}" | ||
51 | else | ||
52 | echo "WARNING: Tried to set up_threshold: $up_threshold, set in sysfs: ${up_threshold_set}" | ||
53 | fi | ||
54 | if [ ${sampling_rate_set} -eq ${sampling_rate} ];then | ||
55 | echo "sampling_rate: $sampling_rate, set in sysfs: ${sampling_rate_set}" | ||
56 | else | ||
57 | echo "WARNING: Tried to set sampling_rate: $sampling_rate, set in sysfs: ${sampling_rate_set}" | ||
58 | fi | ||
59 | |||
60 | # Benchmark | ||
61 | cpufreq-bench -o /var/log/cpufreq-bench/up_threshold_${up_threshold}_sampling_rate_${sampling_rate} | ||
62 | done | ||
63 | done | ||
64 | } | ||
65 | |||
66 | function create_plots() | ||
67 | { | ||
68 | local command | ||
69 | |||
70 | for up_threshold in $UP_THRESHOLD;do | ||
71 | command="cpufreq-bench_plot.sh -o \"sampling_rate_${SAMPLING_RATE}_up_threshold_${up_threshold}\" -t \"Ondemand sampling_rate: ${SAMPLING_RATE} comparison - Up_threshold: $up_threshold %\"" | ||
72 | for sampling_rate in $SAMPLING_RATE;do | ||
73 | command="${command} /var/log/cpufreq-bench/up_threshold_${up_threshold}_sampling_rate_${sampling_rate}/* \"sampling_rate = $sampling_rate\"" | ||
74 | done | ||
75 | echo $command | ||
76 | eval "$command" | ||
77 | echo | ||
78 | done | ||
79 | |||
80 | for sampling_rate in $SAMPLING_RATE;do | ||
81 | command="cpufreq-bench_plot.sh -o \"up_threshold_${UP_THRESHOLD}_sampling_rate_${sampling_rate}\" -t \"Ondemand up_threshold: ${UP_THRESHOLD} % comparison - sampling_rate: $sampling_rate\"" | ||
82 | for up_threshold in $UP_THRESHOLD;do | ||
83 | command="${command} /var/log/cpufreq-bench/up_threshold_${up_threshold}_sampling_rate_${sampling_rate}/* \"up_threshold = $up_threshold\"" | ||
84 | done | ||
85 | echo $command | ||
86 | eval "$command" | ||
87 | echo | ||
88 | done | ||
89 | |||
90 | command="cpufreq-bench_plot.sh -o \"up_threshold_${UP_THRESHOLD}_sampling_rate_${SAMPLING_RATE}\" -t \"Ondemand up_threshold: ${UP_THRESHOLD} and sampling_rate ${SAMPLING_RATE} comparison\"" | ||
91 | for sampling_rate in $SAMPLING_RATE;do | ||
92 | for up_threshold in $UP_THRESHOLD;do | ||
93 | command="${command} /var/log/cpufreq-bench/up_threshold_${up_threshold}_sampling_rate_${sampling_rate}/* \"up_threshold = $up_threshold - sampling_rate = $sampling_rate\"" | ||
94 | done | ||
95 | done | ||
96 | echo "$command" | ||
97 | eval "$command" | ||
98 | } | ||
99 | |||
100 | measure | ||
101 | create_plots \ No newline at end of file | ||
diff --git a/tools/power/cpupower/bench/example.cfg b/tools/power/cpupower/bench/example.cfg new file mode 100644 index 00000000000..f91f6436068 --- /dev/null +++ b/tools/power/cpupower/bench/example.cfg | |||
@@ -0,0 +1,11 @@ | |||
1 | sleep = 50000 | ||
2 | load = 50000 | ||
3 | cpu = 0 | ||
4 | priority = LOW | ||
5 | output = /var/log/cpufreq-bench | ||
6 | sleep_step = 50000 | ||
7 | load_step = 50000 | ||
8 | cycles = 20 | ||
9 | rounds = 40 | ||
10 | verbose = 0 | ||
11 | governor = ondemand | ||
diff --git a/tools/power/cpupower/bench/main.c b/tools/power/cpupower/bench/main.c new file mode 100644 index 00000000000..60953fc9343 --- /dev/null +++ b/tools/power/cpupower/bench/main.c | |||
@@ -0,0 +1,203 @@ | |||
1 | /* cpufreq-bench CPUFreq microbenchmark | ||
2 | * | ||
3 | * Copyright (C) 2008 Christian Kornacker <ckornacker@suse.de> | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
18 | */ | ||
19 | |||
20 | #include <stdio.h> | ||
21 | #include <stdlib.h> | ||
22 | #include <string.h> | ||
23 | #include <unistd.h> | ||
24 | #include <getopt.h> | ||
25 | #include <errno.h> | ||
26 | |||
27 | #include "config.h" | ||
28 | #include "system.h" | ||
29 | #include "benchmark.h" | ||
30 | |||
31 | static struct option long_options[] = | ||
32 | { | ||
33 | {"output", 1, 0, 'o'}, | ||
34 | {"sleep", 1, 0, 's'}, | ||
35 | {"load", 1, 0, 'l'}, | ||
36 | {"verbose", 0, 0, 'v'}, | ||
37 | {"cpu", 1, 0, 'c'}, | ||
38 | {"governor", 1, 0, 'g'}, | ||
39 | {"prio", 1, 0, 'p'}, | ||
40 | {"file", 1, 0, 'f'}, | ||
41 | {"cycles", 1, 0, 'n'}, | ||
42 | {"rounds", 1, 0, 'r'}, | ||
43 | {"load-step", 1, 0, 'x'}, | ||
44 | {"sleep-step", 1, 0, 'y'}, | ||
45 | {"help", 0, 0, 'h'}, | ||
46 | {0, 0, 0, 0} | ||
47 | }; | ||
48 | |||
49 | /******************************************************************* | ||
50 | usage | ||
51 | *******************************************************************/ | ||
52 | |||
53 | void usage() | ||
54 | { | ||
55 | printf("usage: ./bench\n"); | ||
56 | printf("Options:\n"); | ||
57 | printf(" -l, --load=<long int>\t\tinitial load time in us\n"); | ||
58 | printf(" -s, --sleep=<long int>\t\tinitial sleep time in us\n"); | ||
59 | printf(" -x, --load-step=<long int>\ttime to be added to load time, in us\n"); | ||
60 | printf(" -y, --sleep-step=<long int>\ttime to be added to sleep time, in us\n"); | ||
61 | printf(" -c, --cpu=<cpu #>\t\t\tCPU Nr. to use, starting at 0\n"); | ||
62 | printf(" -p, --prio=<priority>\t\t\tscheduler priority, HIGH, LOW or DEFAULT\n"); | ||
63 | printf(" -g, --governor=<governor>\t\tcpufreq governor to test\n"); | ||
64 | printf(" -n, --cycles=<int>\t\t\tload/sleep cycles\n"); | ||
65 | printf(" -r, --rounds<int>\t\t\tload/sleep rounds\n"); | ||
66 | printf(" -f, --file=<configfile>\t\tconfig file to use\n"); | ||
67 | printf(" -o, --output=<dir>\t\t\toutput path. Filename will be OUTPUTPATH/benchmark_TIMESTAMP.log\n"); | ||
68 | printf(" -v, --verbose\t\t\t\tverbose output on/off\n"); | ||
69 | printf(" -h, --help\t\t\t\tPrint this help screen\n"); | ||
70 | exit (1); | ||
71 | } | ||
72 | |||
73 | /******************************************************************* | ||
74 | main | ||
75 | *******************************************************************/ | ||
76 | |||
77 | int main(int argc, char **argv) | ||
78 | { | ||
79 | int c; | ||
80 | int option_index = 0; | ||
81 | struct config *config = NULL; | ||
82 | |||
83 | config = prepare_default_config(); | ||
84 | |||
85 | if (config == NULL) | ||
86 | return EXIT_FAILURE; | ||
87 | |||
88 | while (1) { | ||
89 | c = getopt_long (argc, argv, "hg:o:s:l:vc:p:f:n:r:x:y:", | ||
90 | long_options, &option_index); | ||
91 | if (c == -1) | ||
92 | break; | ||
93 | |||
94 | switch (c) { | ||
95 | case 'o': | ||
96 | if (config->output != NULL) | ||
97 | fclose(config->output); | ||
98 | |||
99 | config->output = prepare_output(optarg); | ||
100 | |||
101 | if (config->output == NULL) | ||
102 | return EXIT_FAILURE; | ||
103 | |||
104 | dprintf("user output path -> %s\n", optarg); | ||
105 | break; | ||
106 | case 's': | ||
107 | sscanf(optarg, "%li", &config->sleep); | ||
108 | dprintf("user sleep time -> %s\n", optarg); | ||
109 | break; | ||
110 | case 'l': | ||
111 | sscanf(optarg, "%li", &config->load); | ||
112 | dprintf("user load time -> %s\n", optarg); | ||
113 | break; | ||
114 | case 'c': | ||
115 | sscanf(optarg, "%u", &config->cpu); | ||
116 | dprintf("user cpu -> %s\n", optarg); | ||
117 | break; | ||
118 | case 'g': | ||
119 | strncpy(config->governor, optarg, 14); | ||
120 | dprintf("user governor -> %s\n", optarg); | ||
121 | break; | ||
122 | case 'p': | ||
123 | if (string_to_prio(optarg) != SCHED_ERR) { | ||
124 | config->prio = string_to_prio(optarg); | ||
125 | dprintf("user prio -> %s\n", optarg); | ||
126 | } else { | ||
127 | if (config != NULL) { | ||
128 | if (config->output != NULL) | ||
129 | fclose(config->output); | ||
130 | free(config); | ||
131 | } | ||
132 | usage(); | ||
133 | } | ||
134 | break; | ||
135 | case 'n': | ||
136 | sscanf(optarg, "%u", &config->cycles); | ||
137 | dprintf("user cycles -> %s\n", optarg); | ||
138 | break; | ||
139 | case 'r': | ||
140 | sscanf(optarg, "%u", &config->rounds); | ||
141 | dprintf("user rounds -> %s\n", optarg); | ||
142 | break; | ||
143 | case 'x': | ||
144 | sscanf(optarg, "%li", &config->load_step); | ||
145 | dprintf("user load_step -> %s\n", optarg); | ||
146 | break; | ||
147 | case 'y': | ||
148 | sscanf(optarg, "%li", &config->sleep_step); | ||
149 | dprintf("user sleep_step -> %s\n", optarg); | ||
150 | break; | ||
151 | case 'f': | ||
152 | if (prepare_config(optarg, config)) | ||
153 | return EXIT_FAILURE; | ||
154 | break; | ||
155 | case 'v': | ||
156 | config->verbose = 1; | ||
157 | dprintf("verbose output enabled\n"); | ||
158 | break; | ||
159 | case 'h': | ||
160 | case '?': | ||
161 | default: | ||
162 | if (config != NULL) { | ||
163 | if (config->output != NULL) | ||
164 | fclose(config->output); | ||
165 | free(config); | ||
166 | } | ||
167 | usage(); | ||
168 | } | ||
169 | } | ||
170 | |||
171 | if (config->verbose) { | ||
172 | printf("starting benchmark with parameters:\n"); | ||
173 | printf("config:\n\t" | ||
174 | "sleep=%li\n\t" | ||
175 | "load=%li\n\t" | ||
176 | "sleep_step=%li\n\t" | ||
177 | "load_step=%li\n\t" | ||
178 | "cpu=%u\n\t" | ||
179 | "cycles=%u\n\t" | ||
180 | "rounds=%u\n\t" | ||
181 | "governor=%s\n\n", | ||
182 | config->sleep, | ||
183 | config->load, | ||
184 | config->sleep_step, | ||
185 | config->load_step, | ||
186 | config->cpu, | ||
187 | config->cycles, | ||
188 | config->rounds, | ||
189 | config->governor); | ||
190 | } | ||
191 | |||
192 | prepare_user(config); | ||
193 | prepare_system(config); | ||
194 | start_benchmark(config); | ||
195 | |||
196 | if (config->output != stdout) | ||
197 | fclose(config->output); | ||
198 | |||
199 | free(config); | ||
200 | |||
201 | return EXIT_SUCCESS; | ||
202 | } | ||
203 | |||
diff --git a/tools/power/cpupower/bench/parse.c b/tools/power/cpupower/bench/parse.c new file mode 100644 index 00000000000..3b270ac92c4 --- /dev/null +++ b/tools/power/cpupower/bench/parse.c | |||
@@ -0,0 +1,224 @@ | |||
1 | /* cpufreq-bench CPUFreq microbenchmark | ||
2 | * | ||
3 | * Copyright (C) 2008 Christian Kornacker <ckornacker@suse.de> | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
18 | */ | ||
19 | |||
20 | #include <stdio.h> | ||
21 | #include <stdlib.h> | ||
22 | #include <stdarg.h> | ||
23 | #include <string.h> | ||
24 | #include <time.h> | ||
25 | #include <dirent.h> | ||
26 | |||
27 | #include <sys/utsname.h> | ||
28 | #include <sys/types.h> | ||
29 | #include <sys/stat.h> | ||
30 | |||
31 | #include "parse.h" | ||
32 | #include "config.h" | ||
33 | |||
34 | /** | ||
35 | * converts priority string to priority | ||
36 | * | ||
37 | * @param str string that represents a scheduler priority | ||
38 | * | ||
39 | * @retval priority | ||
40 | * @retval SCHED_ERR when the priority doesn't exit | ||
41 | **/ | ||
42 | |||
43 | enum sched_prio string_to_prio(const char *str) | ||
44 | { | ||
45 | if (strncasecmp("high", str, strlen(str)) == 0) | ||
46 | return SCHED_HIGH; | ||
47 | else if (strncasecmp("default", str, strlen(str)) == 0) | ||
48 | return SCHED_DEFAULT; | ||
49 | else if (strncasecmp("low", str, strlen(str)) == 0) | ||
50 | return SCHED_LOW; | ||
51 | else | ||
52 | return SCHED_ERR; | ||
53 | } | ||
54 | |||
55 | /** | ||
56 | * create and open logfile | ||
57 | * | ||
58 | * @param dir directory in which the logfile should be created | ||
59 | * | ||
60 | * @retval logfile on success | ||
61 | * @retval NULL when the file can't be created | ||
62 | **/ | ||
63 | |||
64 | FILE *prepare_output(const char *dirname) | ||
65 | { | ||
66 | FILE *output = NULL; | ||
67 | int len; | ||
68 | char *filename; | ||
69 | struct utsname sysdata; | ||
70 | DIR *dir; | ||
71 | |||
72 | dir = opendir(dirname); | ||
73 | if (dir == NULL) { | ||
74 | if (mkdir(dirname, 0755)) { | ||
75 | perror("mkdir"); | ||
76 | fprintf(stderr, "error: Cannot create dir %s\n", | ||
77 | dirname); | ||
78 | return NULL; | ||
79 | } | ||
80 | } | ||
81 | |||
82 | len = strlen(dirname) + 30; | ||
83 | filename = malloc(sizeof(char) * len); | ||
84 | |||
85 | if (uname(&sysdata) == 0) { | ||
86 | len += strlen(sysdata.nodename) + strlen(sysdata.release); | ||
87 | filename = realloc(filename, sizeof(char) * len); | ||
88 | |||
89 | if(filename == NULL) { | ||
90 | perror("realloc"); | ||
91 | return NULL; | ||
92 | } | ||
93 | |||
94 | snprintf(filename, len - 1, "%s/benchmark_%s_%s_%li.log", | ||
95 | dirname, sysdata.nodename, sysdata.release, time(NULL)); | ||
96 | } else { | ||
97 | snprintf(filename, len -1, "%s/benchmark_%li.log", dirname, time(NULL)); | ||
98 | } | ||
99 | |||
100 | dprintf("logilename: %s\n", filename); | ||
101 | |||
102 | if ((output = fopen(filename, "w+")) == NULL) { | ||
103 | perror("fopen"); | ||
104 | fprintf(stderr, "error: unable to open logfile\n"); | ||
105 | } | ||
106 | |||
107 | fprintf(stdout, "Logfile: %s\n", filename); | ||
108 | |||
109 | free(filename); | ||
110 | fprintf(output, "#round load sleep performance powersave percentage\n"); | ||
111 | return output; | ||
112 | } | ||
113 | |||
114 | /** | ||
115 | * returns the default config | ||
116 | * | ||
117 | * @retval default config on success | ||
118 | * @retval NULL when the output file can't be created | ||
119 | **/ | ||
120 | |||
121 | struct config *prepare_default_config() | ||
122 | { | ||
123 | struct config *config = malloc(sizeof(struct config)); | ||
124 | |||
125 | dprintf("loading defaults\n"); | ||
126 | |||
127 | config->sleep = 500000; | ||
128 | config->load = 500000; | ||
129 | config->sleep_step = 500000; | ||
130 | config->load_step = 500000; | ||
131 | config->cycles = 5; | ||
132 | config->rounds = 50; | ||
133 | config->cpu = 0; | ||
134 | config->prio = SCHED_HIGH; | ||
135 | config->verbose = 0; | ||
136 | strncpy(config->governor, "ondemand", 8); | ||
137 | |||
138 | config->output = stdout; | ||
139 | |||
140 | #ifdef DEFAULT_CONFIG_FILE | ||
141 | if (prepare_config(DEFAULT_CONFIG_FILE, config)) | ||
142 | return NULL; | ||
143 | #endif | ||
144 | return config; | ||
145 | } | ||
146 | |||
147 | /** | ||
148 | * parses config file and returns the config to the caller | ||
149 | * | ||
150 | * @param path config file name | ||
151 | * | ||
152 | * @retval 1 on error | ||
153 | * @retval 0 on success | ||
154 | **/ | ||
155 | |||
156 | int prepare_config(const char *path, struct config *config) | ||
157 | { | ||
158 | size_t len = 0; | ||
159 | char *opt, *val, *line = NULL; | ||
160 | FILE *configfile = fopen(path, "r"); | ||
161 | |||
162 | if (config == NULL) { | ||
163 | fprintf(stderr, "error: config is NULL\n"); | ||
164 | return 1; | ||
165 | } | ||
166 | |||
167 | if (configfile == NULL) { | ||
168 | perror("fopen"); | ||
169 | fprintf(stderr, "error: unable to read configfile\n"); | ||
170 | free(config); | ||
171 | return 1; | ||
172 | } | ||
173 | |||
174 | while (getline(&line, &len, configfile) != -1) | ||
175 | { | ||
176 | if (line[0] == '#' || line[0] == ' ') | ||
177 | continue; | ||
178 | |||
179 | sscanf(line, "%as = %as", &opt, &val); | ||
180 | |||
181 | dprintf("parsing: %s -> %s\n", opt, val); | ||
182 | |||
183 | if (strncmp("sleep", opt, strlen(opt)) == 0) | ||
184 | sscanf(val, "%li", &config->sleep); | ||
185 | |||
186 | else if (strncmp("load", opt, strlen(opt)) == 0) | ||
187 | sscanf(val, "%li", &config->load); | ||
188 | |||
189 | else if (strncmp("load_step", opt, strlen(opt)) == 0) | ||
190 | sscanf(val, "%li", &config->load_step); | ||
191 | |||
192 | else if (strncmp("sleep_step", opt, strlen(opt)) == 0) | ||
193 | sscanf(val, "%li", &config->sleep_step); | ||
194 | |||
195 | else if (strncmp("cycles", opt, strlen(opt)) == 0) | ||
196 | sscanf(val, "%u", &config->cycles); | ||
197 | |||
198 | else if (strncmp("rounds", opt, strlen(opt)) == 0) | ||
199 | sscanf(val, "%u", &config->rounds); | ||
200 | |||
201 | else if (strncmp("verbose", opt, strlen(opt)) == 0) | ||
202 | sscanf(val, "%u", &config->verbose); | ||
203 | |||
204 | else if (strncmp("output", opt, strlen(opt)) == 0) | ||
205 | config->output = prepare_output(val); | ||
206 | |||
207 | else if (strncmp("cpu", opt, strlen(opt)) == 0) | ||
208 | sscanf(val, "%u", &config->cpu); | ||
209 | |||
210 | else if (strncmp("governor", opt, 14) == 0) | ||
211 | strncpy(config->governor, val, 14); | ||
212 | |||
213 | else if (strncmp("priority", opt, strlen(opt)) == 0) { | ||
214 | if (string_to_prio(val) != SCHED_ERR) | ||
215 | config->prio = string_to_prio(val); | ||
216 | } | ||
217 | } | ||
218 | |||
219 | free(line); | ||
220 | free(opt); | ||
221 | free(val); | ||
222 | |||
223 | return 0; | ||
224 | } | ||
diff --git a/tools/power/cpupower/bench/parse.h b/tools/power/cpupower/bench/parse.h new file mode 100644 index 00000000000..9fcdfa23dd9 --- /dev/null +++ b/tools/power/cpupower/bench/parse.h | |||
@@ -0,0 +1,50 @@ | |||
1 | /* cpufreq-bench CPUFreq microbenchmark | ||
2 | * | ||
3 | * Copyright (C) 2008 Christian Kornacker <ckornacker@suse.de> | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
18 | */ | ||
19 | |||
20 | /* struct that holds the required config parameters */ | ||
21 | struct config | ||
22 | { | ||
23 | long sleep; /* sleep time in µs */ | ||
24 | long load; /* load time in µs */ | ||
25 | long sleep_step; /* time value which changes the | ||
26 | * sleep time after every round in µs */ | ||
27 | long load_step; /* time value which changes the | ||
28 | * load time after every round in µs */ | ||
29 | unsigned int cycles; /* calculation cycles with the same sleep/load time */ | ||
30 | unsigned int rounds; /* calculation rounds with iterated sleep/load time */ | ||
31 | unsigned int cpu; /* cpu for which the affinity is set */ | ||
32 | char governor[15]; /* cpufreq governor */ | ||
33 | enum sched_prio /* possible scheduler priorities */ | ||
34 | { | ||
35 | SCHED_ERR=-1,SCHED_HIGH, SCHED_DEFAULT, SCHED_LOW | ||
36 | } prio; | ||
37 | |||
38 | unsigned int verbose; /* verbose output */ | ||
39 | FILE *output; /* logfile */ | ||
40 | char *output_filename; /* logfile name, must be freed at the end | ||
41 | if output != NULL and output != stdout*/ | ||
42 | }; | ||
43 | |||
44 | enum sched_prio string_to_prio(const char *str); | ||
45 | |||
46 | FILE *prepare_output(const char *dir); | ||
47 | |||
48 | int prepare_config(const char *path, struct config *config); | ||
49 | struct config *prepare_default_config(); | ||
50 | |||
diff --git a/tools/power/cpupower/bench/system.c b/tools/power/cpupower/bench/system.c new file mode 100644 index 00000000000..3e3a82e8bdd --- /dev/null +++ b/tools/power/cpupower/bench/system.c | |||
@@ -0,0 +1,188 @@ | |||
1 | /* cpufreq-bench CPUFreq microbenchmark | ||
2 | * | ||
3 | * Copyright (C) 2008 Christian Kornacker <ckornacker@suse.de> | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
18 | */ | ||
19 | |||
20 | #include <stdio.h> | ||
21 | #include <time.h> | ||
22 | #include <sys/time.h> | ||
23 | #include <sys/types.h> | ||
24 | #include <unistd.h> | ||
25 | |||
26 | #include <sched.h> | ||
27 | |||
28 | #include <cpufreq.h> | ||
29 | |||
30 | #include "config.h" | ||
31 | #include "system.h" | ||
32 | |||
33 | /** | ||
34 | * returns time since epoch in µs | ||
35 | * | ||
36 | * @retval time | ||
37 | **/ | ||
38 | |||
39 | long long int get_time() | ||
40 | { | ||
41 | struct timeval now; | ||
42 | |||
43 | gettimeofday(&now, NULL); | ||
44 | |||
45 | return (long long int)(now.tv_sec * 1000000LL + now.tv_usec); | ||
46 | } | ||
47 | |||
48 | /** | ||
49 | * sets the cpufreq governor | ||
50 | * | ||
51 | * @param governor cpufreq governor name | ||
52 | * @param cpu cpu for which the governor should be set | ||
53 | * | ||
54 | * @retval 0 on success | ||
55 | * @retval -1 when failed | ||
56 | **/ | ||
57 | |||
58 | int set_cpufreq_governor(char *governor, unsigned int cpu) | ||
59 | { | ||
60 | |||
61 | dprintf("set %s as cpufreq governor\n", governor); | ||
62 | |||
63 | if (cpufreq_cpu_exists(cpu) != 0) { | ||
64 | perror("cpufreq_cpu_exists"); | ||
65 | fprintf(stderr, "error: cpu %u does not exist\n", cpu); | ||
66 | return -1; | ||
67 | } | ||
68 | |||
69 | if (cpufreq_modify_policy_governor(cpu, governor) != 0) { | ||
70 | perror("cpufreq_modify_policy_governor"); | ||
71 | fprintf(stderr, "error: unable to set %s governor\n", governor); | ||
72 | return -1; | ||
73 | } | ||
74 | |||
75 | return 0; | ||
76 | } | ||
77 | |||
78 | /** | ||
79 | * sets cpu affinity for the process | ||
80 | * | ||
81 | * @param cpu cpu# to which the affinity should be set | ||
82 | * | ||
83 | * @retval 0 on success | ||
84 | * @retval -1 when setting the affinity failed | ||
85 | **/ | ||
86 | |||
87 | int set_cpu_affinity(unsigned int cpu) | ||
88 | { | ||
89 | cpu_set_t cpuset; | ||
90 | |||
91 | CPU_ZERO(&cpuset); | ||
92 | CPU_SET(cpu, &cpuset); | ||
93 | |||
94 | dprintf("set affinity to cpu #%u\n", cpu); | ||
95 | |||
96 | if (sched_setaffinity(getpid(), sizeof(cpu_set_t), &cpuset) < 0) { | ||
97 | perror("sched_setaffinity"); | ||
98 | fprintf(stderr, "warning: unable to set cpu affinity\n"); | ||
99 | return -1; | ||
100 | } | ||
101 | |||
102 | return 0; | ||
103 | } | ||
104 | |||
105 | /** | ||
106 | * sets the process priority parameter | ||
107 | * | ||
108 | * @param priority priority value | ||
109 | * | ||
110 | * @retval 0 on success | ||
111 | * @retval -1 when setting the priority failed | ||
112 | **/ | ||
113 | |||
114 | int set_process_priority(int priority) | ||
115 | { | ||
116 | struct sched_param param; | ||
117 | |||
118 | dprintf("set scheduler priority to %i\n", priority); | ||
119 | |||
120 | param.sched_priority = priority; | ||
121 | |||
122 | if (sched_setscheduler(0, SCHEDULER, ¶m) < 0) { | ||
123 | perror("sched_setscheduler"); | ||
124 | fprintf(stderr, "warning: unable to set scheduler priority\n"); | ||
125 | return -1; | ||
126 | } | ||
127 | |||
128 | return 0; | ||
129 | } | ||
130 | |||
131 | /** | ||
132 | * notifys the user that the benchmark may run some time | ||
133 | * | ||
134 | * @param config benchmark config values | ||
135 | * | ||
136 | **/ | ||
137 | |||
138 | void prepare_user(const struct config *config) | ||
139 | { | ||
140 | unsigned long sleep_time = 0; | ||
141 | unsigned long load_time = 0; | ||
142 | unsigned int round; | ||
143 | |||
144 | for (round = 0; round < config->rounds; round++) { | ||
145 | sleep_time += 2 * config->cycles * (config->sleep + config->sleep_step * round); | ||
146 | load_time += 2 * config->cycles * (config->load + config->load_step * round) + (config->load + config->load_step * round * 4); | ||
147 | } | ||
148 | |||
149 | if (config->verbose || config->output != stdout) | ||
150 | printf("approx. test duration: %im\n", | ||
151 | (int)((sleep_time + load_time) / 60000000)); | ||
152 | } | ||
153 | |||
154 | /** | ||
155 | * sets up the cpu affinity and scheduler priority | ||
156 | * | ||
157 | * @param config benchmark config values | ||
158 | * | ||
159 | **/ | ||
160 | |||
161 | void prepare_system(const struct config *config) | ||
162 | { | ||
163 | if (config->verbose) | ||
164 | printf("set cpu affinity to cpu #%u\n", config->cpu); | ||
165 | |||
166 | set_cpu_affinity(config->cpu); | ||
167 | |||
168 | switch (config->prio) { | ||
169 | case SCHED_HIGH: | ||
170 | if (config->verbose) | ||
171 | printf("high priority condition requested\n"); | ||
172 | |||
173 | set_process_priority(PRIORITY_HIGH); | ||
174 | break; | ||
175 | case SCHED_LOW: | ||
176 | if (config->verbose) | ||
177 | printf("low priority condition requested\n"); | ||
178 | |||
179 | set_process_priority(PRIORITY_LOW); | ||
180 | break; | ||
181 | default: | ||
182 | if (config->verbose) | ||
183 | printf("default priority condition requested\n"); | ||
184 | |||
185 | set_process_priority(PRIORITY_DEFAULT); | ||
186 | } | ||
187 | } | ||
188 | |||
diff --git a/tools/power/cpupower/bench/system.h b/tools/power/cpupower/bench/system.h new file mode 100644 index 00000000000..3a8c858b78f --- /dev/null +++ b/tools/power/cpupower/bench/system.h | |||
@@ -0,0 +1,29 @@ | |||
1 | /* cpufreq-bench CPUFreq microbenchmark | ||
2 | * | ||
3 | * Copyright (C) 2008 Christian Kornacker <ckornacker@suse.de> | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
18 | */ | ||
19 | |||
20 | #include "parse.h" | ||
21 | |||
22 | long long get_time(); | ||
23 | |||
24 | int set_cpufreq_governor(char *governor, unsigned int cpu); | ||
25 | int set_cpu_affinity(unsigned int cpu); | ||
26 | int set_process_priority(int priority); | ||
27 | |||
28 | void prepare_user(const struct config *config); | ||
29 | void prepare_system(const struct config *config); | ||
diff --git a/tools/power/cpupower/build/ccdv.c b/tools/power/cpupower/build/ccdv.c new file mode 100644 index 00000000000..e3ae9da91a5 --- /dev/null +++ b/tools/power/cpupower/build/ccdv.c | |||
@@ -0,0 +1,387 @@ | |||
1 | /* ccdv.c | ||
2 | * | ||
3 | * Copyright (C) 2002-2003, by Mike Gleason, NcFTP Software. | ||
4 | * All Rights Reserved. | ||
5 | * | ||
6 | * Licensed under the GNU Public License. | ||
7 | */ | ||
8 | #include <unistd.h> | ||
9 | #include <sys/types.h> | ||
10 | #include <sys/time.h> | ||
11 | #include <sys/wait.h> | ||
12 | #include <fcntl.h> | ||
13 | #include <stdio.h> | ||
14 | #include <string.h> | ||
15 | #include <stdlib.h> | ||
16 | #include <errno.h> | ||
17 | |||
18 | #define SETCOLOR_SUCCESS (gANSIEscapes ? "\033\1331;32m" : "") | ||
19 | #define SETCOLOR_FAILURE (gANSIEscapes ? "\033\1331;31m" : "") | ||
20 | #define SETCOLOR_WARNING (gANSIEscapes ? "\033\1331;33m" : "") | ||
21 | #define SETCOLOR_NORMAL (gANSIEscapes ? "\033\1330;39m" : "") | ||
22 | |||
23 | #define TEXT_BLOCK_SIZE 8192 | ||
24 | #define INDENT 2 | ||
25 | |||
26 | #define TERMS "vt100:vt102:vt220:vt320:xterm:xterm-color:ansi:linux:scoterm:scoansi:dtterm:cons25:cygwin" | ||
27 | |||
28 | size_t gNBufUsed = 0, gNBufAllocated = 0; | ||
29 | char *gBuf = NULL; | ||
30 | int gCCPID; | ||
31 | char gAction[200] = ""; | ||
32 | char gTarget[200] = ""; | ||
33 | char gAr[32] = ""; | ||
34 | char gArLibraryTarget[64] = ""; | ||
35 | int gDumpCmdArgs = 0; | ||
36 | char gArgsStr[1000]; | ||
37 | int gColumns = 80; | ||
38 | int gANSIEscapes = 0; | ||
39 | int gExitStatus = 95; | ||
40 | |||
41 | static void DumpFormattedOutput(void) | ||
42 | { | ||
43 | char *cp; | ||
44 | char spaces[8 + 1] = " "; | ||
45 | char *saved; | ||
46 | int curcol; | ||
47 | int i; | ||
48 | |||
49 | curcol = 0; | ||
50 | saved = NULL; | ||
51 | for (cp = gBuf + ((gDumpCmdArgs == 0) ? strlen(gArgsStr) : 0); ; cp++) { | ||
52 | if (*cp == '\0') { | ||
53 | if (saved != NULL) { | ||
54 | cp = saved; | ||
55 | saved = NULL; | ||
56 | } else break; | ||
57 | } | ||
58 | if (*cp == '\r') | ||
59 | continue; | ||
60 | if (*cp == '\t') { | ||
61 | saved = cp + 1; | ||
62 | cp = spaces + 8 - (8 - ((curcol - INDENT - 1) % 8)); | ||
63 | } | ||
64 | if (curcol == 0) { | ||
65 | for (i = INDENT; --i >= 0; ) | ||
66 | putchar(' '); | ||
67 | curcol = INDENT; | ||
68 | } | ||
69 | putchar(*cp); | ||
70 | if (++curcol == (gColumns - 1)) { | ||
71 | putchar('\n'); | ||
72 | curcol = 0; | ||
73 | } else if (*cp == '\n') | ||
74 | curcol = 0; | ||
75 | } | ||
76 | free(gBuf); | ||
77 | } /* DumpFormattedOutput */ | ||
78 | |||
79 | |||
80 | |||
81 | /* Difftime(), only for timeval structures. */ | ||
82 | static void TimeValSubtract(struct timeval *tdiff, struct timeval *t1, struct timeval *t0) | ||
83 | { | ||
84 | tdiff->tv_sec = t1->tv_sec - t0->tv_sec; | ||
85 | tdiff->tv_usec = t1->tv_usec - t0->tv_usec; | ||
86 | if (tdiff->tv_usec < 0) { | ||
87 | tdiff->tv_sec--; | ||
88 | tdiff->tv_usec += 1000000; | ||
89 | } | ||
90 | } /* TimeValSubtract */ | ||
91 | |||
92 | |||
93 | |||
94 | static void Wait(void) | ||
95 | { | ||
96 | int pid2, status; | ||
97 | |||
98 | do { | ||
99 | status = 0; | ||
100 | pid2 = (int) waitpid(gCCPID, &status, 0); | ||
101 | } while (((pid2 >= 0) && (! WIFEXITED(status))) || ((pid2 < 0) && (errno == EINTR))); | ||
102 | if (WIFEXITED(status)) | ||
103 | gExitStatus = WEXITSTATUS(status); | ||
104 | } /* Wait */ | ||
105 | |||
106 | |||
107 | |||
108 | static int SlurpProgress(int fd) | ||
109 | { | ||
110 | char s1[71]; | ||
111 | char *newbuf; | ||
112 | int nready; | ||
113 | size_t ntoread; | ||
114 | ssize_t nread; | ||
115 | struct timeval now, tnext, tleft; | ||
116 | fd_set ss; | ||
117 | fd_set ss2; | ||
118 | const char *trail = "/-\\|", *trailcp; | ||
119 | |||
120 | trailcp = trail; | ||
121 | snprintf(s1, sizeof(s1), "%s%s%s... ", gAction, gTarget[0] ? " " : "", gTarget); | ||
122 | printf("\r%-70s%-9s", s1, ""); | ||
123 | fflush(stdout); | ||
124 | |||
125 | gettimeofday(&now, NULL); | ||
126 | tnext = now; | ||
127 | tnext.tv_sec++; | ||
128 | tleft.tv_sec = 1; | ||
129 | tleft.tv_usec = 0; | ||
130 | FD_ZERO(&ss2); | ||
131 | FD_SET(fd, &ss2); | ||
132 | for(;;) { | ||
133 | if (gNBufUsed == (gNBufAllocated - 1)) { | ||
134 | if ((newbuf = (char *) realloc(gBuf, gNBufAllocated + TEXT_BLOCK_SIZE)) == NULL) { | ||
135 | perror("ccdv: realloc"); | ||
136 | return (-1); | ||
137 | } | ||
138 | gNBufAllocated += TEXT_BLOCK_SIZE; | ||
139 | gBuf = newbuf; | ||
140 | } | ||
141 | for (;;) { | ||
142 | ss = ss2; | ||
143 | nready = select(fd + 1, &ss, NULL, NULL, &tleft); | ||
144 | if (nready == 1) | ||
145 | break; | ||
146 | if (nready < 0) { | ||
147 | if (errno != EINTR) { | ||
148 | perror("ccdv: select"); | ||
149 | return (-1); | ||
150 | } | ||
151 | continue; | ||
152 | } | ||
153 | gettimeofday(&now, NULL); | ||
154 | if ((now.tv_sec > tnext.tv_sec) || ((now.tv_sec == tnext.tv_sec) && (now.tv_usec >= tnext.tv_usec))) { | ||
155 | tnext = now; | ||
156 | tnext.tv_sec++; | ||
157 | tleft.tv_sec = 1; | ||
158 | tleft.tv_usec = 0; | ||
159 | printf("\r%-71s%c%-7s", s1, *trailcp, ""); | ||
160 | fflush(stdout); | ||
161 | if (*++trailcp == '\0') | ||
162 | trailcp = trail; | ||
163 | } else { | ||
164 | TimeValSubtract(&tleft, &tnext, &now); | ||
165 | } | ||
166 | } | ||
167 | ntoread = (gNBufAllocated - gNBufUsed - 1); | ||
168 | nread = read(fd, gBuf + gNBufUsed, ntoread); | ||
169 | if (nread < 0) { | ||
170 | if (errno == EINTR) | ||
171 | continue; | ||
172 | perror("ccdv: read"); | ||
173 | return (-1); | ||
174 | } else if (nread == 0) { | ||
175 | break; | ||
176 | } | ||
177 | gNBufUsed += nread; | ||
178 | gBuf[gNBufUsed] = '\0'; | ||
179 | } | ||
180 | snprintf(s1, sizeof(s1), "%s%s%s: ", gAction, gTarget[0] ? " " : "", gTarget); | ||
181 | Wait(); | ||
182 | if (gExitStatus == 0) { | ||
183 | printf("\r%-70s", s1); | ||
184 | printf("[%s%s%s]", ((gNBufUsed - strlen(gArgsStr)) < 4) ? SETCOLOR_SUCCESS : SETCOLOR_WARNING, "OK", SETCOLOR_NORMAL); | ||
185 | printf("%-5s\n", " "); | ||
186 | } else { | ||
187 | printf("\r%-70s", s1); | ||
188 | printf("[%s%s%s]", SETCOLOR_FAILURE, "ERROR", SETCOLOR_NORMAL); | ||
189 | printf("%-2s\n", " "); | ||
190 | gDumpCmdArgs = 1; /* print cmd when there are errors */ | ||
191 | } | ||
192 | fflush(stdout); | ||
193 | return (0); | ||
194 | } /* SlurpProgress */ | ||
195 | |||
196 | |||
197 | |||
198 | static int SlurpAll(int fd) | ||
199 | { | ||
200 | char *newbuf; | ||
201 | size_t ntoread; | ||
202 | ssize_t nread; | ||
203 | |||
204 | printf("%s%s%s.\n", gAction, gTarget[0] ? " " : "", gTarget); | ||
205 | fflush(stdout); | ||
206 | |||
207 | for(;;) { | ||
208 | if (gNBufUsed == (gNBufAllocated - 1)) { | ||
209 | if ((newbuf = (char *) realloc(gBuf, gNBufAllocated + TEXT_BLOCK_SIZE)) == NULL) { | ||
210 | perror("ccdv: realloc"); | ||
211 | return (-1); | ||
212 | } | ||
213 | gNBufAllocated += TEXT_BLOCK_SIZE; | ||
214 | gBuf = newbuf; | ||
215 | } | ||
216 | ntoread = (gNBufAllocated - gNBufUsed - 1); | ||
217 | nread = read(fd, gBuf + gNBufUsed, ntoread); | ||
218 | if (nread < 0) { | ||
219 | if (errno == EINTR) | ||
220 | continue; | ||
221 | perror("ccdv: read"); | ||
222 | return (-1); | ||
223 | } else if (nread == 0) { | ||
224 | break; | ||
225 | } | ||
226 | gNBufUsed += nread; | ||
227 | gBuf[gNBufUsed] = '\0'; | ||
228 | } | ||
229 | Wait(); | ||
230 | gDumpCmdArgs = (gExitStatus != 0); /* print cmd when there are errors */ | ||
231 | return (0); | ||
232 | } /* SlurpAll */ | ||
233 | |||
234 | |||
235 | |||
236 | static const char *Basename(const char *path) | ||
237 | { | ||
238 | const char *cp; | ||
239 | cp = strrchr(path, '/'); | ||
240 | if (cp == NULL) | ||
241 | return (path); | ||
242 | return (cp + 1); | ||
243 | } /* Basename */ | ||
244 | |||
245 | |||
246 | |||
247 | static const char * Extension(const char *path) | ||
248 | { | ||
249 | const char *cp = path; | ||
250 | cp = strrchr(path, '.'); | ||
251 | if (cp == NULL) | ||
252 | return (""); | ||
253 | // printf("Extension='%s'\n", cp); | ||
254 | return (cp); | ||
255 | } /* Extension */ | ||
256 | |||
257 | |||
258 | |||
259 | static void Usage(void) | ||
260 | { | ||
261 | fprintf(stderr, "Usage: ccdv /path/to/cc CFLAGS...\n\n"); | ||
262 | fprintf(stderr, "I wrote this to reduce the deluge Make output to make finding actual problems\n"); | ||
263 | fprintf(stderr, "easier. It is intended to be invoked from Makefiles, like this. Instead of:\n\n"); | ||
264 | fprintf(stderr, "\t.c.o:\n"); | ||
265 | fprintf(stderr, "\t\t$(CC) $(CFLAGS) $(DEFS) $(CPPFLAGS) $< -c\n"); | ||
266 | fprintf(stderr, "\nRewrite your rule so it looks like:\n\n"); | ||
267 | fprintf(stderr, "\t.c.o:\n"); | ||
268 | fprintf(stderr, "\t\t@ccdv $(CC) $(CFLAGS) $(DEFS) $(CPPFLAGS) $< -c\n\n"); | ||
269 | fprintf(stderr, "ccdv 1.1.0 is Free under the GNU Public License. Enjoy!\n"); | ||
270 | fprintf(stderr, " -- Mike Gleason, NcFTP Software <http://www.ncftp.com>\n"); | ||
271 | exit(96); | ||
272 | } /* Usage */ | ||
273 | |||
274 | |||
275 | |||
276 | int main(int argc, char **argv) | ||
277 | { | ||
278 | int pipe1[2]; | ||
279 | int devnull; | ||
280 | char emerg[256]; | ||
281 | int fd; | ||
282 | int nread; | ||
283 | int i; | ||
284 | int cc = 0, pch = 0; | ||
285 | const char *quote; | ||
286 | |||
287 | if (argc < 2) | ||
288 | Usage(); | ||
289 | |||
290 | snprintf(gAction, sizeof(gAction), "Running %s", Basename(argv[1])); | ||
291 | memset(gArgsStr, 0, sizeof(gArgsStr)); | ||
292 | for (i = 1; i < argc; i++) { | ||
293 | // printf("argv[%d]='%s'\n", i, argv[i]); | ||
294 | quote = (strchr(argv[i], ' ') != NULL) ? "\"" : ""; | ||
295 | snprintf(gArgsStr + strlen(gArgsStr), sizeof(gArgsStr) - strlen(gArgsStr), "%s%s%s%s%s", (i == 1) ? "" : " ", quote, argv[i], quote, (i == (argc - 1)) ? "\n" : ""); | ||
296 | if ((strcmp(argv[i], "-o") == 0) && ((i + 1) < argc)) { | ||
297 | if (strcasecmp(Extension(argv[i + 1]), ".o") != 0) { | ||
298 | strcpy(gAction, "Linking"); | ||
299 | snprintf(gTarget, sizeof(gTarget), "%s", Basename(argv[i + 1])); | ||
300 | } | ||
301 | } else if (strchr("-+", (int) argv[i][0]) != NULL) { | ||
302 | continue; | ||
303 | } else if (strncasecmp(Extension(argv[i]), ".c", 2) == 0) { | ||
304 | cc++; | ||
305 | snprintf(gTarget, sizeof(gTarget), "%s", Basename(argv[i])); | ||
306 | // printf("gTarget='%s'\n", gTarget); | ||
307 | } else if ((strncasecmp(Extension(argv[i]), ".h", 2) == 0) && (cc == 0)) { | ||
308 | pch++; | ||
309 | snprintf(gTarget, sizeof(gTarget), "%s", Basename(argv[i])); | ||
310 | } else if ((i == 1) && (strcmp(Basename(argv[i]), "ar") == 0)) { | ||
311 | snprintf(gAr, sizeof(gAr), "%s", Basename(argv[i])); | ||
312 | } else if ((gArLibraryTarget[0] == '\0') && (strcasecmp(Extension(argv[i]), ".a") == 0)) { | ||
313 | snprintf(gArLibraryTarget, sizeof(gArLibraryTarget), "%s", Basename(argv[i])); | ||
314 | } | ||
315 | } | ||
316 | if ((gAr[0] != '\0') && (gArLibraryTarget[0] != '\0')) { | ||
317 | strcpy(gAction, "Creating library"); | ||
318 | snprintf(gTarget, sizeof(gTarget), "%s", gArLibraryTarget); | ||
319 | } else if (pch > 0) { | ||
320 | strcpy(gAction, "Precompiling"); | ||
321 | } else if (cc > 0) { | ||
322 | strcpy(gAction, "Compiling"); | ||
323 | } | ||
324 | |||
325 | if (pipe(pipe1) < 0) { | ||
326 | perror("ccdv: pipe"); | ||
327 | exit(97); | ||
328 | } | ||
329 | |||
330 | (void) close(0); | ||
331 | devnull = open("/dev/null", O_RDWR, 00666); | ||
332 | if ((devnull != 0) && (dup2(devnull, 0) == 0)) | ||
333 | close(devnull); | ||
334 | |||
335 | gCCPID = (int) fork(); | ||
336 | if (gCCPID < 0) { | ||
337 | (void) close(pipe1[0]); | ||
338 | (void) close(pipe1[1]); | ||
339 | perror("ccdv: fork"); | ||
340 | exit(98); | ||
341 | } else if (gCCPID == 0) { | ||
342 | /* Child */ | ||
343 | (void) close(pipe1[0]); /* close read end */ | ||
344 | if (pipe1[1] != 1) { /* use write end on stdout */ | ||
345 | (void) dup2(pipe1[1], 1); | ||
346 | (void) close(pipe1[1]); | ||
347 | } | ||
348 | (void) dup2(1, 2); /* use write end on stderr */ | ||
349 | execvp(argv[1], argv + 1); | ||
350 | perror(argv[1]); | ||
351 | exit(99); | ||
352 | } | ||
353 | |||
354 | /* parent */ | ||
355 | (void) close(pipe1[1]); /* close write end */ | ||
356 | fd = pipe1[0]; /* use read end */ | ||
357 | |||
358 | gColumns = (getenv("COLUMNS") != NULL) ? atoi(getenv("COLUMNS")) : 80; | ||
359 | gANSIEscapes = (getenv("TERM") != NULL) && (strstr(TERMS, getenv("TERM")) != NULL); | ||
360 | gBuf = (char *) malloc(TEXT_BLOCK_SIZE); | ||
361 | if (gBuf == NULL) | ||
362 | goto panic; | ||
363 | gNBufUsed = 0; | ||
364 | gNBufAllocated = TEXT_BLOCK_SIZE; | ||
365 | if (strlen(gArgsStr) < (gNBufAllocated - 1)) { | ||
366 | strcpy(gBuf, gArgsStr); | ||
367 | gNBufUsed = strlen(gArgsStr); | ||
368 | } | ||
369 | |||
370 | if (isatty(1)) { | ||
371 | if (SlurpProgress(fd) < 0) | ||
372 | goto panic; | ||
373 | } else { | ||
374 | if (SlurpAll(fd) < 0) | ||
375 | goto panic; | ||
376 | } | ||
377 | DumpFormattedOutput(); | ||
378 | exit(gExitStatus); | ||
379 | |||
380 | panic: | ||
381 | gDumpCmdArgs = 1; /* print cmd when there are errors */ | ||
382 | DumpFormattedOutput(); | ||
383 | while ((nread = read(fd, emerg, (size_t) sizeof(emerg))) > 0) | ||
384 | (void) write(2, emerg, (size_t) nread); | ||
385 | Wait(); | ||
386 | exit(gExitStatus); | ||
387 | } /* main */ | ||
diff --git a/tools/power/cpupower/debug/i386/Makefile b/tools/power/cpupower/debug/i386/Makefile new file mode 100644 index 00000000000..d08cc1ead9b --- /dev/null +++ b/tools/power/cpupower/debug/i386/Makefile | |||
@@ -0,0 +1,20 @@ | |||
1 | default: all | ||
2 | |||
3 | centrino-decode: centrino-decode.c | ||
4 | $(CC) $(CFLAGS) -o centrino-decode centrino-decode.c | ||
5 | |||
6 | dump_psb: dump_psb.c | ||
7 | $(CC) $(CFLAGS) -o dump_psb dump_psb.c | ||
8 | |||
9 | intel_gsic: intel_gsic.c | ||
10 | $(CC) $(CFLAGS) -o intel_gsic -llrmi intel_gsic.c | ||
11 | |||
12 | powernow-k8-decode: powernow-k8-decode.c | ||
13 | $(CC) $(CFLAGS) -o powernow-k8-decode powernow-k8-decode.c | ||
14 | |||
15 | all: centrino-decode dump_psb intel_gsic powernow-k8-decode | ||
16 | |||
17 | clean: | ||
18 | rm -rf centrino-decode dump_psb intel_gsic powernow-k8-decode | ||
19 | |||
20 | .PHONY: all default clean | ||
diff --git a/tools/power/cpupower/debug/i386/centrino-decode.c b/tools/power/cpupower/debug/i386/centrino-decode.c new file mode 100644 index 00000000000..7ef24cce492 --- /dev/null +++ b/tools/power/cpupower/debug/i386/centrino-decode.c | |||
@@ -0,0 +1,113 @@ | |||
1 | /* | ||
2 | * (C) 2003 - 2004 Dominik Brodowski <linux@dominikbrodowski.de> | ||
3 | * | ||
4 | * Licensed under the terms of the GNU GPL License version 2. | ||
5 | * | ||
6 | * Based on code found in | ||
7 | * linux/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c | ||
8 | * and originally developed by Jeremy Fitzhardinge. | ||
9 | * | ||
10 | * USAGE: simply run it to decode the current settings on CPU 0, | ||
11 | * or pass the CPU number as argument, or pass the MSR content | ||
12 | * as argument. | ||
13 | */ | ||
14 | |||
15 | #include <stdio.h> | ||
16 | #include <stdlib.h> | ||
17 | #include <stdint.h> | ||
18 | #include <unistd.h> | ||
19 | #include <errno.h> | ||
20 | #include <fcntl.h> | ||
21 | |||
22 | #include <sys/types.h> | ||
23 | #include <sys/stat.h> | ||
24 | |||
25 | #define MCPU 32 | ||
26 | |||
27 | #define MSR_IA32_PERF_STATUS 0x198 | ||
28 | |||
29 | static int rdmsr(unsigned int cpu, unsigned int msr, | ||
30 | unsigned int *lo, unsigned int *hi) | ||
31 | { | ||
32 | int fd; | ||
33 | char file[20]; | ||
34 | unsigned long long val; | ||
35 | int retval = -1; | ||
36 | |||
37 | *lo = *hi = 0; | ||
38 | |||
39 | if (cpu > MCPU) | ||
40 | goto err1; | ||
41 | |||
42 | sprintf(file, "/dev/cpu/%d/msr", cpu); | ||
43 | fd = open(file, O_RDONLY); | ||
44 | |||
45 | if (fd < 0) | ||
46 | goto err1; | ||
47 | |||
48 | if (lseek(fd, msr, SEEK_CUR) == -1) | ||
49 | goto err2; | ||
50 | |||
51 | if (read(fd, &val, 8) != 8) | ||
52 | goto err2; | ||
53 | |||
54 | *lo = (uint32_t )(val & 0xffffffffull); | ||
55 | *hi = (uint32_t )(val>>32 & 0xffffffffull); | ||
56 | |||
57 | retval = 0; | ||
58 | err2: | ||
59 | close(fd); | ||
60 | err1: | ||
61 | return retval; | ||
62 | } | ||
63 | |||
64 | static void decode (unsigned int msr) | ||
65 | { | ||
66 | unsigned int multiplier; | ||
67 | unsigned int mv; | ||
68 | |||
69 | multiplier = ((msr >> 8) & 0xFF); | ||
70 | |||
71 | mv = (((msr & 0xFF) * 16) + 700); | ||
72 | |||
73 | printf("0x%x means multiplier %d @ %d mV\n", msr, multiplier, mv); | ||
74 | } | ||
75 | |||
76 | static int decode_live(unsigned int cpu) | ||
77 | { | ||
78 | unsigned int lo, hi; | ||
79 | int err; | ||
80 | |||
81 | err = rdmsr(cpu, MSR_IA32_PERF_STATUS, &lo, &hi); | ||
82 | |||
83 | if (err) { | ||
84 | printf("can't get MSR_IA32_PERF_STATUS for cpu %d\n", cpu); | ||
85 | printf("Possible trouble: you don't run an Enhanced SpeedStep capable cpu\n"); | ||
86 | printf("or you are not root, or the msr driver is not present\n"); | ||
87 | return 1; | ||
88 | } | ||
89 | |||
90 | decode(lo); | ||
91 | |||
92 | return 0; | ||
93 | } | ||
94 | |||
95 | int main (int argc, char **argv) | ||
96 | { | ||
97 | unsigned int cpu, mode = 0; | ||
98 | |||
99 | if (argc < 2) | ||
100 | cpu = 0; | ||
101 | else { | ||
102 | cpu = strtoul(argv[1], NULL, 0); | ||
103 | if (cpu >= MCPU) | ||
104 | mode = 1; | ||
105 | } | ||
106 | |||
107 | if (mode) | ||
108 | decode(cpu); | ||
109 | else | ||
110 | decode_live(cpu); | ||
111 | |||
112 | return 0; | ||
113 | } | ||
diff --git a/tools/power/cpupower/debug/i386/dump_psb.c b/tools/power/cpupower/debug/i386/dump_psb.c new file mode 100644 index 00000000000..8d6a4751425 --- /dev/null +++ b/tools/power/cpupower/debug/i386/dump_psb.c | |||
@@ -0,0 +1,196 @@ | |||
1 | /* | ||
2 | * dump_psb. (c) 2004, Dave Jones, Red Hat Inc. | ||
3 | * Licensed under the GPL v2. | ||
4 | */ | ||
5 | |||
6 | #include <fcntl.h> | ||
7 | #include <stdio.h> | ||
8 | #include <stdlib.h> | ||
9 | #include <string.h> | ||
10 | #include <unistd.h> | ||
11 | |||
12 | #define _GNU_SOURCE | ||
13 | #include <getopt.h> | ||
14 | |||
15 | #include <sys/mman.h> | ||
16 | |||
17 | #define LEN (0x100000 - 0xc0000) | ||
18 | #define OFFSET (0xc0000) | ||
19 | |||
20 | #ifndef __packed | ||
21 | #define __packed __attribute((packed)) | ||
22 | #endif | ||
23 | |||
24 | static long relevant; | ||
25 | |||
26 | static const int fid_to_mult[32] = { | ||
27 | 110, 115, 120, 125, 50, 55, 60, 65, | ||
28 | 70, 75, 80, 85, 90, 95, 100, 105, | ||
29 | 30, 190, 40, 200, 130, 135, 140, 210, | ||
30 | 150, 225, 160, 165, 170, 180, -1, -1, | ||
31 | }; | ||
32 | |||
33 | static const int vid_to_voltage[32] = { | ||
34 | 2000, 1950, 1900, 1850, 1800, 1750, 1700, 1650, | ||
35 | 1600, 1550, 1500, 1450, 1400, 1350, 1300, 0, | ||
36 | 1275, 1250, 1225, 1200, 1175, 1150, 1125, 1100, | ||
37 | 1075, 1050, 1024, 1000, 975, 950, 925, 0, | ||
38 | }; | ||
39 | |||
40 | struct psb_header { | ||
41 | char signature[10]; | ||
42 | u_char version; | ||
43 | u_char flags; | ||
44 | u_short settlingtime; | ||
45 | u_char res1; | ||
46 | u_char numpst; | ||
47 | } __packed; | ||
48 | |||
49 | struct pst_header { | ||
50 | u_int32_t cpuid; | ||
51 | u_char fsb; | ||
52 | u_char maxfid; | ||
53 | u_char startvid; | ||
54 | u_char numpstates; | ||
55 | } __packed; | ||
56 | |||
57 | static u_int fsb; | ||
58 | static u_int sgtc; | ||
59 | |||
60 | static int | ||
61 | decode_pst(char *p, int npstates) | ||
62 | { | ||
63 | int i; | ||
64 | int freq, fid, vid; | ||
65 | |||
66 | for (i = 0; i < npstates; ++i) { | ||
67 | fid = *p++; | ||
68 | vid = *p++; | ||
69 | freq = 100 * fid_to_mult[fid] * fsb; | ||
70 | |||
71 | printf(" %2d %8dkHz FID %02x (%2d.%01d) VID %02x (%4dmV)\n", | ||
72 | i, | ||
73 | freq, | ||
74 | fid, fid_to_mult[fid]/10, fid_to_mult[fid]%10, | ||
75 | vid, vid_to_voltage[vid]); | ||
76 | } | ||
77 | |||
78 | return 0; | ||
79 | } | ||
80 | |||
81 | static | ||
82 | void decode_psb(char *p, int numpst) | ||
83 | { | ||
84 | int i; | ||
85 | struct psb_header *psb; | ||
86 | struct pst_header *pst; | ||
87 | |||
88 | psb = (struct psb_header*) p; | ||
89 | |||
90 | if (psb->version != 0x12) | ||
91 | return; | ||
92 | |||
93 | printf("PSB version: %hhx flags: %hhx settling time %hhuus res1 %hhx num pst %hhu\n", | ||
94 | psb->version, | ||
95 | psb->flags, | ||
96 | psb->settlingtime, | ||
97 | psb->res1, | ||
98 | psb->numpst); | ||
99 | sgtc = psb->settlingtime * 100; | ||
100 | |||
101 | if (sgtc < 10000) | ||
102 | sgtc = 10000; | ||
103 | |||
104 | p = ((char *) psb) + sizeof(struct psb_header); | ||
105 | |||
106 | if (numpst < 0) | ||
107 | numpst = psb->numpst; | ||
108 | else | ||
109 | printf("Overriding number of pst :%d\n", numpst); | ||
110 | |||
111 | for (i = 0; i < numpst; i++) { | ||
112 | pst = (struct pst_header*) p; | ||
113 | |||
114 | if (relevant != 0) { | ||
115 | if (relevant!= pst->cpuid) | ||
116 | goto next_one; | ||
117 | } | ||
118 | |||
119 | printf(" PST %d cpuid %.3x fsb %hhu mfid %hhx svid %hhx numberstates %hhu\n", | ||
120 | i+1, | ||
121 | pst->cpuid, | ||
122 | pst->fsb, | ||
123 | pst->maxfid, | ||
124 | pst->startvid, | ||
125 | pst->numpstates); | ||
126 | |||
127 | fsb = pst->fsb; | ||
128 | decode_pst(p + sizeof(struct pst_header), pst->numpstates); | ||
129 | |||
130 | next_one: | ||
131 | p += sizeof(struct pst_header) + 2*pst->numpstates; | ||
132 | } | ||
133 | |||
134 | } | ||
135 | |||
136 | static struct option info_opts[] = { | ||
137 | {.name = "numpst", .has_arg=no_argument, .flag=NULL, .val='n'}, | ||
138 | }; | ||
139 | |||
140 | void print_help(void) | ||
141 | { | ||
142 | printf ("Usage: dump_psb [options]\n"); | ||
143 | printf ("Options:\n"); | ||
144 | printf (" -n, --numpst Set number of PST tables to scan\n"); | ||
145 | printf (" -r, --relevant Only display PSTs relevant to cpuid N\n"); | ||
146 | } | ||
147 | |||
148 | int | ||
149 | main(int argc, char *argv[]) | ||
150 | { | ||
151 | int fd; | ||
152 | int numpst=-1; | ||
153 | int ret=0, cont=1; | ||
154 | char *mem = NULL; | ||
155 | char *p; | ||
156 | |||
157 | do { | ||
158 | ret = getopt_long(argc, argv, "hr:n:", info_opts, NULL); | ||
159 | switch (ret){ | ||
160 | case '?': | ||
161 | case 'h': | ||
162 | print_help(); | ||
163 | cont = 0; | ||
164 | break; | ||
165 | case 'r': | ||
166 | relevant = strtol(optarg, NULL, 16); | ||
167 | break; | ||
168 | case 'n': | ||
169 | numpst = strtol(optarg, NULL, 10); | ||
170 | break; | ||
171 | case -1: | ||
172 | cont = 0; | ||
173 | break; | ||
174 | } | ||
175 | |||
176 | } while(cont); | ||
177 | |||
178 | fd = open("/dev/mem", O_RDONLY); | ||
179 | if (fd < 0) { | ||
180 | printf ("Couldn't open /dev/mem. Are you root?\n"); | ||
181 | exit(1); | ||
182 | } | ||
183 | |||
184 | mem = mmap(mem, 0x100000 - 0xc0000, PROT_READ, MAP_SHARED, fd, 0xc0000); | ||
185 | close(fd); | ||
186 | |||
187 | for (p = mem; p - mem < LEN; p+=16) { | ||
188 | if (memcmp(p, "AMDK7PNOW!", 10) == 0) { | ||
189 | decode_psb(p, numpst); | ||
190 | break; | ||
191 | } | ||
192 | } | ||
193 | |||
194 | munmap(mem, LEN); | ||
195 | return 0; | ||
196 | } | ||
diff --git a/tools/power/cpupower/debug/i386/intel_gsic.c b/tools/power/cpupower/debug/i386/intel_gsic.c new file mode 100644 index 00000000000..53f5293c9c9 --- /dev/null +++ b/tools/power/cpupower/debug/i386/intel_gsic.c | |||
@@ -0,0 +1,78 @@ | |||
1 | /* | ||
2 | * (C) 2003 Bruno Ducrot | ||
3 | * (C) 2004 Dominik Brodowski <linux@dominikbrodowski.de> | ||
4 | * | ||
5 | * Licensed under the terms of the GNU GPL License version 2. | ||
6 | * | ||
7 | * Based on code found in | ||
8 | * linux/include/asm-i386/ist.h and linux/arch/i386/kernel/setup.c | ||
9 | * and originally developed by Andy Grover <andrew.grover@intel.com> | ||
10 | */ | ||
11 | |||
12 | #include <stdio.h> | ||
13 | #include <string.h> | ||
14 | #include <lrmi.h> | ||
15 | |||
16 | int main (void) | ||
17 | { | ||
18 | struct LRMI_regs r; | ||
19 | int retval; | ||
20 | |||
21 | if (!LRMI_init()) | ||
22 | return 0; | ||
23 | |||
24 | memset(&r, 0, sizeof(r)); | ||
25 | |||
26 | r.eax = 0x0000E980; | ||
27 | r.edx = 0x47534943; | ||
28 | |||
29 | retval = LRMI_int(0x15, &r); | ||
30 | |||
31 | if (!retval) { | ||
32 | printf("Failed!\n"); | ||
33 | return 0; | ||
34 | } | ||
35 | if (r.eax == 0x47534943) { | ||
36 | printf("BIOS supports GSIC call:\n"); | ||
37 | printf("\tsignature: %c%c%c%c\n", | ||
38 | (r.eax >> 24) & 0xff, | ||
39 | (r.eax >> 16) & 0xff, | ||
40 | (r.eax >> 8) & 0xff, | ||
41 | (r.eax) & 0xff); | ||
42 | printf("\tcommand port = 0x%.4x\n", | ||
43 | r.ebx & 0xffff); | ||
44 | printf("\tcommand = 0x%.4x\n", | ||
45 | (r.ebx >> 16) & 0xffff); | ||
46 | printf("\tevent port = 0x%.8x\n", r.ecx); | ||
47 | printf("\tflags = 0x%.8x\n", r.edx); | ||
48 | if (((r.ebx >> 16) & 0xffff) != 0x82) { | ||
49 | printf("non-default command value. If speedstep-smi " | ||
50 | "doesn't work out of the box,\nyou may want to " | ||
51 | "try out the default value by passing " | ||
52 | "smi_cmd=0x82 to the module\n ON YOUR OWN " | ||
53 | "RISK.\n"); | ||
54 | } | ||
55 | if ((r.ebx & 0xffff) != 0xb2) { | ||
56 | printf("non-default command port. If speedstep-smi " | ||
57 | "doesn't work out of the box,\nyou may want to " | ||
58 | "try out the default value by passing " | ||
59 | "smi_port=0x82 to the module\n ON YOUR OWN " | ||
60 | "RISK.\n"); | ||
61 | } | ||
62 | } else { | ||
63 | printf("BIOS DOES NOT support GSIC call. Dumping registers anyway:\n"); | ||
64 | printf("eax = 0x%.8x\n", r.eax); | ||
65 | printf("ebx = 0x%.8x\n", r.ebx); | ||
66 | printf("ecx = 0x%.8x\n", r.ecx); | ||
67 | printf("edx = 0x%.8x\n", r.edx); | ||
68 | printf("Note also that some BIOS do not support the initial " | ||
69 | "GSIC call, but the newer\nspeeedstep-smi driver may " | ||
70 | "work.\nFor this, you need to pass some arguments to " | ||
71 | "the speedstep-smi driver:\n"); | ||
72 | printf("\tsmi_cmd=0x?? smi_port=0x?? smi_sig=1\n"); | ||
73 | printf("\nUnfortunately, you have to know what exactly are " | ||
74 | "smi_cmd and smi_port, and this\nis system " | ||
75 | "dependant.\n"); | ||
76 | } | ||
77 | return 1; | ||
78 | } | ||
diff --git a/tools/power/cpupower/debug/i386/powernow-k8-decode.c b/tools/power/cpupower/debug/i386/powernow-k8-decode.c new file mode 100644 index 00000000000..638a6b3bfd9 --- /dev/null +++ b/tools/power/cpupower/debug/i386/powernow-k8-decode.c | |||
@@ -0,0 +1,96 @@ | |||
1 | /* | ||
2 | * (C) 2004 Bruno Ducrot <ducrot@poupinou.org> | ||
3 | * | ||
4 | * Licensed under the terms of the GNU GPL License version 2. | ||
5 | * | ||
6 | * Based on code found in | ||
7 | * linux/arch/i386/kernel/cpu/cpufreq/powernow-k8.c | ||
8 | * and originally developed by Paul Devriendt | ||
9 | */ | ||
10 | |||
11 | #include <stdio.h> | ||
12 | #include <stdlib.h> | ||
13 | #include <stdint.h> | ||
14 | #include <unistd.h> | ||
15 | #include <errno.h> | ||
16 | #include <fcntl.h> | ||
17 | |||
18 | #include <sys/types.h> | ||
19 | #include <sys/stat.h> | ||
20 | |||
21 | #define MCPU 32 | ||
22 | |||
23 | #define MSR_FIDVID_STATUS 0xc0010042 | ||
24 | |||
25 | #define MSR_S_HI_CURRENT_VID 0x0000001f | ||
26 | #define MSR_S_LO_CURRENT_FID 0x0000003f | ||
27 | |||
28 | static int get_fidvid(uint32_t cpu, uint32_t *fid, uint32_t *vid) | ||
29 | { | ||
30 | int err = 1; | ||
31 | uint64_t msr = 0; | ||
32 | int fd; | ||
33 | char file[20]; | ||
34 | |||
35 | if (cpu > MCPU) | ||
36 | goto out; | ||
37 | |||
38 | sprintf(file, "/dev/cpu/%d/msr", cpu); | ||
39 | |||
40 | fd = open(file, O_RDONLY); | ||
41 | if (fd < 0) | ||
42 | goto out; | ||
43 | lseek(fd, MSR_FIDVID_STATUS, SEEK_CUR); | ||
44 | if (read(fd, &msr, 8) != 8) | ||
45 | goto err1; | ||
46 | |||
47 | *fid = ((uint32_t )(msr & 0xffffffffull)) & MSR_S_LO_CURRENT_FID; | ||
48 | *vid = ((uint32_t )(msr>>32 & 0xffffffffull)) & MSR_S_HI_CURRENT_VID; | ||
49 | err = 0; | ||
50 | err1: | ||
51 | close(fd); | ||
52 | out: | ||
53 | return err; | ||
54 | } | ||
55 | |||
56 | |||
57 | /* Return a frequency in MHz, given an input fid */ | ||
58 | static uint32_t find_freq_from_fid(uint32_t fid) | ||
59 | { | ||
60 | return 800 + (fid * 100); | ||
61 | } | ||
62 | |||
63 | /* Return a voltage in miliVolts, given an input vid */ | ||
64 | static uint32_t find_millivolts_from_vid(uint32_t vid) | ||
65 | { | ||
66 | return 1550-vid*25; | ||
67 | } | ||
68 | |||
69 | int main (int argc, char *argv[]) | ||
70 | { | ||
71 | int err; | ||
72 | int cpu; | ||
73 | uint32_t fid, vid; | ||
74 | |||
75 | if (argc < 2) | ||
76 | cpu = 0; | ||
77 | else | ||
78 | cpu = strtoul(argv[1], NULL, 0); | ||
79 | |||
80 | err = get_fidvid(cpu, &fid, &vid); | ||
81 | |||
82 | if (err) { | ||
83 | printf("can't get fid, vid from MSR\n"); | ||
84 | printf("Possible trouble: you don't run a powernow-k8 capable cpu\n"); | ||
85 | printf("or you are not root, or the msr driver is not present\n"); | ||
86 | exit(1); | ||
87 | } | ||
88 | |||
89 | |||
90 | printf("cpu %d currently at %d MHz and %d mV\n", | ||
91 | cpu, | ||
92 | find_freq_from_fid(fid), | ||
93 | find_millivolts_from_vid(vid)); | ||
94 | |||
95 | return 0; | ||
96 | } | ||
diff --git a/tools/power/cpupower/debug/kernel/Makefile b/tools/power/cpupower/debug/kernel/Makefile new file mode 100644 index 00000000000..96b146fe6f8 --- /dev/null +++ b/tools/power/cpupower/debug/kernel/Makefile | |||
@@ -0,0 +1,23 @@ | |||
1 | obj-m := | ||
2 | |||
3 | KDIR := /lib/modules/$(shell uname -r)/build | ||
4 | PWD := $(shell pwd) | ||
5 | KMISC := /lib/modules/$(shell uname -r)/cpufrequtils/ | ||
6 | |||
7 | ifeq ("$(CONFIG_X86_TSC)", "y") | ||
8 | obj-m += cpufreq-test_tsc.o | ||
9 | endif | ||
10 | |||
11 | default: | ||
12 | $(MAKE) -C $(KDIR) M=$(PWD) | ||
13 | |||
14 | clean: | ||
15 | - rm -rf *.o *.ko .tmp-versions .*.cmd .*.mod.* *.mod.c | ||
16 | - rm -rf .tmp_versions* Module.symvers modules.order | ||
17 | |||
18 | install: default | ||
19 | install -d $(KMISC) | ||
20 | install -m 644 -c *.ko $(KMISC) | ||
21 | /sbin/depmod -a | ||
22 | |||
23 | all: default | ||
diff --git a/tools/power/cpupower/debug/kernel/cpufreq-test_tsc.c b/tools/power/cpupower/debug/kernel/cpufreq-test_tsc.c new file mode 100644 index 00000000000..66cace601e5 --- /dev/null +++ b/tools/power/cpupower/debug/kernel/cpufreq-test_tsc.c | |||
@@ -0,0 +1,113 @@ | |||
1 | /* | ||
2 | * test module to check whether the TSC-based delay routine continues | ||
3 | * to work properly after cpufreq transitions. Needs ACPI to work | ||
4 | * properly. | ||
5 | * | ||
6 | * Based partly on the Power Management Timer (PMTMR) code to be found | ||
7 | * in arch/i386/kernel/timers/timer_pm.c on recent 2.6. kernels, especially | ||
8 | * code written by John Stultz. The read_pmtmr function was copied verbatim | ||
9 | * from that file. | ||
10 | * | ||
11 | * (C) 2004 Dominik Brodowski | ||
12 | * | ||
13 | * To use: | ||
14 | * 1.) pass clock=tsc to the kernel on your bootloader | ||
15 | * 2.) modprobe this module (it'll fail) | ||
16 | * 3.) change CPU frequency | ||
17 | * 4.) modprobe this module again | ||
18 | * 5.) if the third value, "diff_pmtmr", changes between 2. and 4., the | ||
19 | * TSC-based delay routine on the Linux kernel does not correctly | ||
20 | * handle the cpufreq transition. Please report this to | ||
21 | * cpufreq@vger.kernel.org | ||
22 | */ | ||
23 | |||
24 | #include <linux/kernel.h> | ||
25 | #include <linux/module.h> | ||
26 | #include <linux/init.h> | ||
27 | #include <linux/delay.h> | ||
28 | |||
29 | #include <asm/io.h> | ||
30 | |||
31 | #include <acpi/acpi_bus.h> | ||
32 | #include <acpi/acpi_drivers.h> | ||
33 | |||
34 | static int pm_tmr_ioport = 0; | ||
35 | |||
36 | /*helper function to safely read acpi pm timesource*/ | ||
37 | static u32 read_pmtmr(void) | ||
38 | { | ||
39 | u32 v1=0,v2=0,v3=0; | ||
40 | /* It has been reported that because of various broken | ||
41 | * chipsets (ICH4, PIIX4 and PIIX4E) where the ACPI PM time | ||
42 | * source is not latched, so you must read it multiple | ||
43 | * times to insure a safe value is read. | ||
44 | */ | ||
45 | do { | ||
46 | v1 = inl(pm_tmr_ioport); | ||
47 | v2 = inl(pm_tmr_ioport); | ||
48 | v3 = inl(pm_tmr_ioport); | ||
49 | } while ((v1 > v2 && v1 < v3) || (v2 > v3 && v2 < v1) | ||
50 | || (v3 > v1 && v3 < v2)); | ||
51 | |||
52 | /* mask the output to 24 bits */ | ||
53 | return (v2 & 0xFFFFFF); | ||
54 | } | ||
55 | |||
56 | static int __init cpufreq_test_tsc(void) | ||
57 | { | ||
58 | u32 now, then, diff; | ||
59 | u64 now_tsc, then_tsc, diff_tsc; | ||
60 | int i; | ||
61 | |||
62 | /* the following code snipped is copied from arch/x86/kernel/acpi/boot.c | ||
63 | of Linux v2.6.25. */ | ||
64 | |||
65 | /* detect the location of the ACPI PM Timer */ | ||
66 | if (acpi_gbl_FADT.header.revision >= FADT2_REVISION_ID) { | ||
67 | /* FADT rev. 2 */ | ||
68 | if (acpi_gbl_FADT.xpm_timer_block.space_id != | ||
69 | ACPI_ADR_SPACE_SYSTEM_IO) | ||
70 | return 0; | ||
71 | |||
72 | pm_tmr_ioport = acpi_gbl_FADT.xpm_timer_block.address; | ||
73 | /* | ||
74 | * "X" fields are optional extensions to the original V1.0 | ||
75 | * fields, so we must selectively expand V1.0 fields if the | ||
76 | * corresponding X field is zero. | ||
77 | */ | ||
78 | if (!pm_tmr_ioport) | ||
79 | pm_tmr_ioport = acpi_gbl_FADT.pm_timer_block; | ||
80 | } else { | ||
81 | /* FADT rev. 1 */ | ||
82 | pm_tmr_ioport = acpi_gbl_FADT.pm_timer_block; | ||
83 | } | ||
84 | |||
85 | printk(KERN_DEBUG "start--> \n"); | ||
86 | then = read_pmtmr(); | ||
87 | rdtscll(then_tsc); | ||
88 | for (i=0;i<20;i++) { | ||
89 | mdelay(100); | ||
90 | now = read_pmtmr(); | ||
91 | rdtscll(now_tsc); | ||
92 | diff = (now - then) & 0xFFFFFF; | ||
93 | diff_tsc = now_tsc - then_tsc; | ||
94 | printk(KERN_DEBUG "t1: %08u t2: %08u diff_pmtmr: %08u diff_tsc: %016llu\n", then, now, diff, diff_tsc); | ||
95 | then = now; | ||
96 | then_tsc = now_tsc; | ||
97 | } | ||
98 | printk(KERN_DEBUG "<-- end \n"); | ||
99 | return -ENODEV; | ||
100 | } | ||
101 | |||
102 | static void __exit cpufreq_none(void) | ||
103 | { | ||
104 | return; | ||
105 | } | ||
106 | |||
107 | module_init(cpufreq_test_tsc) | ||
108 | module_exit(cpufreq_none) | ||
109 | |||
110 | |||
111 | MODULE_AUTHOR("Dominik Brodowski"); | ||
112 | MODULE_DESCRIPTION("Verify the TSC cpufreq notifier working correctly -- needs ACPI-enabled system"); | ||
113 | MODULE_LICENSE ("GPL"); | ||
diff --git a/tools/power/cpupower/debug/x86_64/Makefile b/tools/power/cpupower/debug/x86_64/Makefile new file mode 100644 index 00000000000..dbf13998462 --- /dev/null +++ b/tools/power/cpupower/debug/x86_64/Makefile | |||
@@ -0,0 +1,14 @@ | |||
1 | default: all | ||
2 | |||
3 | centrino-decode: centrino-decode.c | ||
4 | $(CC) $(CFLAGS) -o centrino-decode centrino-decode.c | ||
5 | |||
6 | powernow-k8-decode: powernow-k8-decode.c | ||
7 | $(CC) $(CFLAGS) -o powernow-k8-decode powernow-k8-decode.c | ||
8 | |||
9 | all: centrino-decode powernow-k8-decode | ||
10 | |||
11 | clean: | ||
12 | rm -rf centrino-decode powernow-k8-decode | ||
13 | |||
14 | .PHONY: all default clean | ||
diff --git a/tools/power/cpupower/debug/x86_64/centrino-decode.c b/tools/power/cpupower/debug/x86_64/centrino-decode.c new file mode 120000 index 00000000000..26fb3f1d8fc --- /dev/null +++ b/tools/power/cpupower/debug/x86_64/centrino-decode.c | |||
@@ -0,0 +1 @@ | |||
../i386/centrino-decode.c \ No newline at end of file | |||
diff --git a/tools/power/cpupower/debug/x86_64/powernow-k8-decode.c b/tools/power/cpupower/debug/x86_64/powernow-k8-decode.c new file mode 120000 index 00000000000..eb30c79cf9d --- /dev/null +++ b/tools/power/cpupower/debug/x86_64/powernow-k8-decode.c | |||
@@ -0,0 +1 @@ | |||
../i386/powernow-k8-decode.c \ No newline at end of file | |||
diff --git a/tools/power/cpupower/lib/cpufreq.c b/tools/power/cpupower/lib/cpufreq.c new file mode 100644 index 00000000000..ae7d8c57b44 --- /dev/null +++ b/tools/power/cpupower/lib/cpufreq.c | |||
@@ -0,0 +1,190 @@ | |||
1 | /* | ||
2 | * (C) 2004-2009 Dominik Brodowski <linux@dominikbrodowski.de> | ||
3 | * | ||
4 | * Licensed under the terms of the GNU GPL License version 2. | ||
5 | */ | ||
6 | |||
7 | |||
8 | #include <stdio.h> | ||
9 | #include <errno.h> | ||
10 | #include <stdlib.h> | ||
11 | #include <string.h> | ||
12 | |||
13 | #include "cpufreq.h" | ||
14 | #include "sysfs.h" | ||
15 | |||
16 | int cpufreq_cpu_exists(unsigned int cpu) | ||
17 | { | ||
18 | return sysfs_cpu_exists(cpu); | ||
19 | } | ||
20 | |||
21 | unsigned long cpufreq_get_freq_kernel(unsigned int cpu) | ||
22 | { | ||
23 | return sysfs_get_freq_kernel(cpu); | ||
24 | } | ||
25 | |||
26 | unsigned long cpufreq_get_freq_hardware(unsigned int cpu) | ||
27 | { | ||
28 | return sysfs_get_freq_hardware(cpu); | ||
29 | } | ||
30 | |||
31 | unsigned long cpufreq_get_transition_latency(unsigned int cpu) | ||
32 | { | ||
33 | return sysfs_get_freq_transition_latency(cpu); | ||
34 | } | ||
35 | |||
36 | int cpufreq_get_hardware_limits(unsigned int cpu, | ||
37 | unsigned long *min, | ||
38 | unsigned long *max) | ||
39 | { | ||
40 | if ((!min) || (!max)) | ||
41 | return -EINVAL; | ||
42 | return sysfs_get_freq_hardware_limits(cpu, min, max); | ||
43 | } | ||
44 | |||
45 | char * cpufreq_get_driver(unsigned int cpu) { | ||
46 | return sysfs_get_freq_driver(cpu); | ||
47 | } | ||
48 | |||
49 | void cpufreq_put_driver(char * ptr) { | ||
50 | if (!ptr) | ||
51 | return; | ||
52 | free(ptr); | ||
53 | } | ||
54 | |||
55 | struct cpufreq_policy * cpufreq_get_policy(unsigned int cpu) { | ||
56 | return sysfs_get_freq_policy(cpu); | ||
57 | } | ||
58 | |||
59 | void cpufreq_put_policy(struct cpufreq_policy *policy) { | ||
60 | if ((!policy) || (!policy->governor)) | ||
61 | return; | ||
62 | |||
63 | free(policy->governor); | ||
64 | policy->governor = NULL; | ||
65 | free(policy); | ||
66 | } | ||
67 | |||
68 | struct cpufreq_available_governors * cpufreq_get_available_governors(unsigned int cpu) { | ||
69 | return sysfs_get_freq_available_governors(cpu); | ||
70 | } | ||
71 | |||
72 | void cpufreq_put_available_governors(struct cpufreq_available_governors *any) { | ||
73 | struct cpufreq_available_governors *tmp, *next; | ||
74 | |||
75 | if (!any) | ||
76 | return; | ||
77 | |||
78 | tmp = any->first; | ||
79 | while (tmp) { | ||
80 | next = tmp->next; | ||
81 | if (tmp->governor) | ||
82 | free(tmp->governor); | ||
83 | free(tmp); | ||
84 | tmp = next; | ||
85 | } | ||
86 | } | ||
87 | |||
88 | |||
89 | struct cpufreq_available_frequencies * cpufreq_get_available_frequencies(unsigned int cpu) { | ||
90 | return sysfs_get_available_frequencies(cpu); | ||
91 | } | ||
92 | |||
93 | void cpufreq_put_available_frequencies(struct cpufreq_available_frequencies *any) { | ||
94 | struct cpufreq_available_frequencies *tmp, *next; | ||
95 | |||
96 | if (!any) | ||
97 | return; | ||
98 | |||
99 | tmp = any->first; | ||
100 | while (tmp) { | ||
101 | next = tmp->next; | ||
102 | free(tmp); | ||
103 | tmp = next; | ||
104 | } | ||
105 | } | ||
106 | |||
107 | |||
108 | struct cpufreq_affected_cpus * cpufreq_get_affected_cpus(unsigned int cpu) { | ||
109 | return sysfs_get_freq_affected_cpus(cpu); | ||
110 | } | ||
111 | |||
112 | void cpufreq_put_affected_cpus(struct cpufreq_affected_cpus *any) { | ||
113 | struct cpufreq_affected_cpus *tmp, *next; | ||
114 | |||
115 | if (!any) | ||
116 | return; | ||
117 | |||
118 | tmp = any->first; | ||
119 | while (tmp) { | ||
120 | next = tmp->next; | ||
121 | free(tmp); | ||
122 | tmp = next; | ||
123 | } | ||
124 | } | ||
125 | |||
126 | |||
127 | struct cpufreq_affected_cpus * cpufreq_get_related_cpus(unsigned int cpu) { | ||
128 | return sysfs_get_freq_related_cpus(cpu); | ||
129 | } | ||
130 | |||
131 | void cpufreq_put_related_cpus(struct cpufreq_affected_cpus *any) { | ||
132 | cpufreq_put_affected_cpus(any); | ||
133 | } | ||
134 | |||
135 | |||
136 | int cpufreq_set_policy(unsigned int cpu, struct cpufreq_policy *policy) { | ||
137 | if (!policy || !(policy->governor)) | ||
138 | return -EINVAL; | ||
139 | |||
140 | return sysfs_set_freq_policy(cpu, policy); | ||
141 | } | ||
142 | |||
143 | |||
144 | int cpufreq_modify_policy_min(unsigned int cpu, unsigned long min_freq) { | ||
145 | return sysfs_modify_freq_policy_min(cpu, min_freq); | ||
146 | } | ||
147 | |||
148 | |||
149 | int cpufreq_modify_policy_max(unsigned int cpu, unsigned long max_freq) { | ||
150 | return sysfs_modify_freq_policy_max(cpu, max_freq); | ||
151 | } | ||
152 | |||
153 | |||
154 | int cpufreq_modify_policy_governor(unsigned int cpu, char *governor) { | ||
155 | if ((!governor) || (strlen(governor) > 19)) | ||
156 | return -EINVAL; | ||
157 | |||
158 | return sysfs_modify_freq_policy_governor(cpu, governor); | ||
159 | } | ||
160 | |||
161 | int cpufreq_set_frequency(unsigned int cpu, unsigned long target_frequency) { | ||
162 | return sysfs_set_frequency(cpu, target_frequency); | ||
163 | } | ||
164 | |||
165 | struct cpufreq_stats * cpufreq_get_stats(unsigned int cpu, unsigned long long *total_time) { | ||
166 | struct cpufreq_stats *ret; | ||
167 | |||
168 | ret = sysfs_get_freq_stats(cpu, total_time); | ||
169 | return (ret); | ||
170 | } | ||
171 | |||
172 | void cpufreq_put_stats(struct cpufreq_stats *any) { | ||
173 | struct cpufreq_stats *tmp, *next; | ||
174 | |||
175 | if (!any) | ||
176 | return; | ||
177 | |||
178 | tmp = any->first; | ||
179 | while (tmp) { | ||
180 | next = tmp->next; | ||
181 | free(tmp); | ||
182 | tmp = next; | ||
183 | } | ||
184 | } | ||
185 | |||
186 | unsigned long cpufreq_get_transitions(unsigned int cpu) { | ||
187 | unsigned long ret = sysfs_get_freq_transitions(cpu); | ||
188 | |||
189 | return (ret); | ||
190 | } | ||
diff --git a/tools/power/cpupower/lib/cpufreq.h b/tools/power/cpupower/lib/cpufreq.h new file mode 100644 index 00000000000..03be906581b --- /dev/null +++ b/tools/power/cpupower/lib/cpufreq.h | |||
@@ -0,0 +1,215 @@ | |||
1 | /* | ||
2 | * cpufreq.h - definitions for libcpufreq | ||
3 | * | ||
4 | * Copyright (C) 2004-2009 Dominik Brodowski <linux@dominikbrodowski.de> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation, version 2 of the License. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
18 | */ | ||
19 | |||
20 | #ifndef _CPUFREQ_H | ||
21 | #define _CPUFREQ_H 1 | ||
22 | |||
23 | struct cpufreq_policy { | ||
24 | unsigned long min; | ||
25 | unsigned long max; | ||
26 | char *governor; | ||
27 | }; | ||
28 | |||
29 | struct cpufreq_available_governors { | ||
30 | char *governor; | ||
31 | struct cpufreq_available_governors *next; | ||
32 | struct cpufreq_available_governors *first; | ||
33 | }; | ||
34 | |||
35 | struct cpufreq_available_frequencies { | ||
36 | unsigned long frequency; | ||
37 | struct cpufreq_available_frequencies *next; | ||
38 | struct cpufreq_available_frequencies *first; | ||
39 | }; | ||
40 | |||
41 | |||
42 | struct cpufreq_affected_cpus { | ||
43 | unsigned int cpu; | ||
44 | struct cpufreq_affected_cpus *next; | ||
45 | struct cpufreq_affected_cpus *first; | ||
46 | }; | ||
47 | |||
48 | struct cpufreq_stats { | ||
49 | unsigned long frequency; | ||
50 | unsigned long long time_in_state; | ||
51 | struct cpufreq_stats *next; | ||
52 | struct cpufreq_stats *first; | ||
53 | }; | ||
54 | |||
55 | |||
56 | |||
57 | #ifdef __cplusplus | ||
58 | extern "C" { | ||
59 | #endif | ||
60 | |||
61 | /* | ||
62 | * returns 0 if the specified CPU is present (it doesn't say | ||
63 | * whether it is online!), and an error value if not. | ||
64 | */ | ||
65 | |||
66 | extern int cpufreq_cpu_exists(unsigned int cpu); | ||
67 | |||
68 | /* determine current CPU frequency | ||
69 | * - _kernel variant means kernel's opinion of CPU frequency | ||
70 | * - _hardware variant means actual hardware CPU frequency, | ||
71 | * which is only available to root. | ||
72 | * | ||
73 | * returns 0 on failure, else frequency in kHz. | ||
74 | */ | ||
75 | |||
76 | extern unsigned long cpufreq_get_freq_kernel(unsigned int cpu); | ||
77 | |||
78 | extern unsigned long cpufreq_get_freq_hardware(unsigned int cpu); | ||
79 | |||
80 | #define cpufreq_get(cpu) cpufreq_get_freq_kernel(cpu); | ||
81 | |||
82 | |||
83 | /* determine CPU transition latency | ||
84 | * | ||
85 | * returns 0 on failure, else transition latency in 10^(-9) s = nanoseconds | ||
86 | */ | ||
87 | extern unsigned long cpufreq_get_transition_latency(unsigned int cpu); | ||
88 | |||
89 | |||
90 | /* determine hardware CPU frequency limits | ||
91 | * | ||
92 | * These may be limited further by thermal, energy or other | ||
93 | * considerations by cpufreq policy notifiers in the kernel. | ||
94 | */ | ||
95 | |||
96 | extern int cpufreq_get_hardware_limits(unsigned int cpu, | ||
97 | unsigned long *min, | ||
98 | unsigned long *max); | ||
99 | |||
100 | |||
101 | /* determine CPUfreq driver used | ||
102 | * | ||
103 | * Remember to call cpufreq_put_driver when no longer needed | ||
104 | * to avoid memory leakage, please. | ||
105 | */ | ||
106 | |||
107 | extern char * cpufreq_get_driver(unsigned int cpu); | ||
108 | |||
109 | extern void cpufreq_put_driver(char * ptr); | ||
110 | |||
111 | |||
112 | /* determine CPUfreq policy currently used | ||
113 | * | ||
114 | * Remember to call cpufreq_put_policy when no longer needed | ||
115 | * to avoid memory leakage, please. | ||
116 | */ | ||
117 | |||
118 | |||
119 | extern struct cpufreq_policy * cpufreq_get_policy(unsigned int cpu); | ||
120 | |||
121 | extern void cpufreq_put_policy(struct cpufreq_policy *policy); | ||
122 | |||
123 | |||
124 | /* determine CPUfreq governors currently available | ||
125 | * | ||
126 | * may be modified by modprobe'ing or rmmod'ing other governors. Please | ||
127 | * free allocated memory by calling cpufreq_put_available_governors | ||
128 | * after use. | ||
129 | */ | ||
130 | |||
131 | |||
132 | extern struct cpufreq_available_governors * cpufreq_get_available_governors(unsigned int cpu); | ||
133 | |||
134 | extern void cpufreq_put_available_governors(struct cpufreq_available_governors *first); | ||
135 | |||
136 | |||
137 | /* determine CPU frequency states available | ||
138 | * | ||
139 | * only present on _some_ ->target() cpufreq drivers. For information purposes | ||
140 | * only. Please free allocated memory by calling cpufreq_put_available_frequencies | ||
141 | * after use. | ||
142 | */ | ||
143 | |||
144 | extern struct cpufreq_available_frequencies * cpufreq_get_available_frequencies(unsigned int cpu); | ||
145 | |||
146 | extern void cpufreq_put_available_frequencies(struct cpufreq_available_frequencies *first); | ||
147 | |||
148 | |||
149 | /* determine affected CPUs | ||
150 | * | ||
151 | * Remember to call cpufreq_put_affected_cpus when no longer needed | ||
152 | * to avoid memory leakage, please. | ||
153 | */ | ||
154 | |||
155 | extern struct cpufreq_affected_cpus * cpufreq_get_affected_cpus(unsigned int cpu); | ||
156 | |||
157 | extern void cpufreq_put_affected_cpus(struct cpufreq_affected_cpus *first); | ||
158 | |||
159 | |||
160 | /* determine related CPUs | ||
161 | * | ||
162 | * Remember to call cpufreq_put_related_cpus when no longer needed | ||
163 | * to avoid memory leakage, please. | ||
164 | */ | ||
165 | |||
166 | extern struct cpufreq_affected_cpus * cpufreq_get_related_cpus(unsigned int cpu); | ||
167 | |||
168 | extern void cpufreq_put_related_cpus(struct cpufreq_affected_cpus *first); | ||
169 | |||
170 | |||
171 | /* determine stats for cpufreq subsystem | ||
172 | * | ||
173 | * This is not available in all kernel versions or configurations. | ||
174 | */ | ||
175 | |||
176 | extern struct cpufreq_stats * cpufreq_get_stats(unsigned int cpu, unsigned long long *total_time); | ||
177 | |||
178 | extern void cpufreq_put_stats(struct cpufreq_stats *stats); | ||
179 | |||
180 | extern unsigned long cpufreq_get_transitions(unsigned int cpu); | ||
181 | |||
182 | |||
183 | /* set new cpufreq policy | ||
184 | * | ||
185 | * Tries to set the passed policy as new policy as close as possible, | ||
186 | * but results may differ depending e.g. on governors being available. | ||
187 | */ | ||
188 | |||
189 | extern int cpufreq_set_policy(unsigned int cpu, struct cpufreq_policy *policy); | ||
190 | |||
191 | |||
192 | /* modify a policy by only changing min/max freq or governor | ||
193 | * | ||
194 | * Does not check whether result is what was intended. | ||
195 | */ | ||
196 | |||
197 | extern int cpufreq_modify_policy_min(unsigned int cpu, unsigned long min_freq); | ||
198 | extern int cpufreq_modify_policy_max(unsigned int cpu, unsigned long max_freq); | ||
199 | extern int cpufreq_modify_policy_governor(unsigned int cpu, char *governor); | ||
200 | |||
201 | |||
202 | /* set a specific frequency | ||
203 | * | ||
204 | * Does only work if userspace governor can be used and no external | ||
205 | * interference (other calls to this function or to set/modify_policy) | ||
206 | * occurs. Also does not work on ->range() cpufreq drivers. | ||
207 | */ | ||
208 | |||
209 | extern int cpufreq_set_frequency(unsigned int cpu, unsigned long target_frequency); | ||
210 | |||
211 | #ifdef __cplusplus | ||
212 | } | ||
213 | #endif | ||
214 | |||
215 | #endif /* _CPUFREQ_H */ | ||
diff --git a/tools/power/cpupower/lib/sysfs.c b/tools/power/cpupower/lib/sysfs.c new file mode 100644 index 00000000000..c9b061fe87b --- /dev/null +++ b/tools/power/cpupower/lib/sysfs.c | |||
@@ -0,0 +1,671 @@ | |||
1 | /* | ||
2 | * (C) 2004-2009 Dominik Brodowski <linux@dominikbrodowski.de> | ||
3 | * | ||
4 | * Licensed under the terms of the GNU GPL License version 2. | ||
5 | */ | ||
6 | |||
7 | #include <stdio.h> | ||
8 | #include <errno.h> | ||
9 | #include <stdlib.h> | ||
10 | #include <string.h> | ||
11 | #include <limits.h> | ||
12 | #include <sys/types.h> | ||
13 | #include <sys/stat.h> | ||
14 | #include <fcntl.h> | ||
15 | #include <unistd.h> | ||
16 | |||
17 | #include "cpufreq.h" | ||
18 | |||
19 | #define PATH_TO_CPU "/sys/devices/system/cpu/" | ||
20 | #define MAX_LINE_LEN 255 | ||
21 | #define SYSFS_PATH_MAX 255 | ||
22 | |||
23 | |||
24 | static unsigned int sysfs_read_file(const char *path, char *buf, size_t buflen) | ||
25 | { | ||
26 | int fd; | ||
27 | size_t numread; | ||
28 | |||
29 | if ( ( fd = open(path, O_RDONLY) ) == -1 ) | ||
30 | return 0; | ||
31 | |||
32 | numread = read(fd, buf, buflen - 1); | ||
33 | if ( numread < 1 ) | ||
34 | { | ||
35 | close(fd); | ||
36 | return 0; | ||
37 | } | ||
38 | |||
39 | buf[numread] = '\0'; | ||
40 | close(fd); | ||
41 | |||
42 | return numread; | ||
43 | } | ||
44 | |||
45 | |||
46 | /* CPUFREQ sysfs access **************************************************/ | ||
47 | |||
48 | /* helper function to read file from /sys into given buffer */ | ||
49 | /* fname is a relative path under "cpuX/cpufreq" dir */ | ||
50 | static unsigned int sysfs_cpufreq_read_file(unsigned int cpu, const char *fname, | ||
51 | char *buf, size_t buflen) | ||
52 | { | ||
53 | char path[SYSFS_PATH_MAX]; | ||
54 | |||
55 | snprintf(path, sizeof(path), PATH_TO_CPU "cpu%u/cpufreq/%s", | ||
56 | cpu, fname); | ||
57 | return sysfs_read_file(path, buf, buflen); | ||
58 | } | ||
59 | |||
60 | /* helper function to write a new value to a /sys file */ | ||
61 | /* fname is a relative path under "cpuX/cpufreq" dir */ | ||
62 | static unsigned int sysfs_cpufreq_write_file(unsigned int cpu, | ||
63 | const char *fname, | ||
64 | const char *value, size_t len) | ||
65 | { | ||
66 | char path[SYSFS_PATH_MAX]; | ||
67 | int fd; | ||
68 | size_t numwrite; | ||
69 | |||
70 | snprintf(path, sizeof(path), PATH_TO_CPU "cpu%u/cpufreq/%s", | ||
71 | cpu, fname); | ||
72 | |||
73 | if ( ( fd = open(path, O_WRONLY) ) == -1 ) | ||
74 | return 0; | ||
75 | |||
76 | numwrite = write(fd, value, len); | ||
77 | if ( numwrite < 1 ) | ||
78 | { | ||
79 | close(fd); | ||
80 | return 0; | ||
81 | } | ||
82 | |||
83 | close(fd); | ||
84 | |||
85 | return numwrite; | ||
86 | } | ||
87 | |||
88 | /* read access to files which contain one numeric value */ | ||
89 | |||
90 | enum cpufreq_value { | ||
91 | CPUINFO_CUR_FREQ, | ||
92 | CPUINFO_MIN_FREQ, | ||
93 | CPUINFO_MAX_FREQ, | ||
94 | CPUINFO_LATENCY, | ||
95 | SCALING_CUR_FREQ, | ||
96 | SCALING_MIN_FREQ, | ||
97 | SCALING_MAX_FREQ, | ||
98 | STATS_NUM_TRANSITIONS, | ||
99 | MAX_CPUFREQ_VALUE_READ_FILES | ||
100 | }; | ||
101 | |||
102 | static const char *cpufreq_value_files[MAX_CPUFREQ_VALUE_READ_FILES] = { | ||
103 | [CPUINFO_CUR_FREQ] = "cpuinfo_cur_freq", | ||
104 | [CPUINFO_MIN_FREQ] = "cpuinfo_min_freq", | ||
105 | [CPUINFO_MAX_FREQ] = "cpuinfo_max_freq", | ||
106 | [CPUINFO_LATENCY] = "cpuinfo_transition_latency", | ||
107 | [SCALING_CUR_FREQ] = "scaling_cur_freq", | ||
108 | [SCALING_MIN_FREQ] = "scaling_min_freq", | ||
109 | [SCALING_MAX_FREQ] = "scaling_max_freq", | ||
110 | [STATS_NUM_TRANSITIONS] = "stats/total_trans" | ||
111 | }; | ||
112 | |||
113 | |||
114 | static unsigned long sysfs_cpufreq_get_one_value(unsigned int cpu, | ||
115 | enum cpufreq_value which) | ||
116 | { | ||
117 | unsigned long value; | ||
118 | unsigned int len; | ||
119 | char linebuf[MAX_LINE_LEN]; | ||
120 | char *endp; | ||
121 | |||
122 | if ( which >= MAX_CPUFREQ_VALUE_READ_FILES ) | ||
123 | return 0; | ||
124 | |||
125 | if ( ( len = sysfs_cpufreq_read_file(cpu, cpufreq_value_files[which], | ||
126 | linebuf, sizeof(linebuf))) == 0 ) | ||
127 | return 0; | ||
128 | |||
129 | value = strtoul(linebuf, &endp, 0); | ||
130 | |||
131 | if ( endp == linebuf || errno == ERANGE ) | ||
132 | return 0; | ||
133 | |||
134 | return value; | ||
135 | } | ||
136 | |||
137 | /* read access to files which contain one string */ | ||
138 | |||
139 | enum cpufreq_string { | ||
140 | SCALING_DRIVER, | ||
141 | SCALING_GOVERNOR, | ||
142 | MAX_CPUFREQ_STRING_FILES | ||
143 | }; | ||
144 | |||
145 | static const char *cpufreq_string_files[MAX_CPUFREQ_STRING_FILES] = { | ||
146 | [SCALING_DRIVER] = "scaling_driver", | ||
147 | [SCALING_GOVERNOR] = "scaling_governor", | ||
148 | }; | ||
149 | |||
150 | |||
151 | static char * sysfs_cpufreq_get_one_string(unsigned int cpu, | ||
152 | enum cpufreq_string which) | ||
153 | { | ||
154 | char linebuf[MAX_LINE_LEN]; | ||
155 | char *result; | ||
156 | unsigned int len; | ||
157 | |||
158 | if (which >= MAX_CPUFREQ_STRING_FILES) | ||
159 | return NULL; | ||
160 | |||
161 | if ( ( len = sysfs_cpufreq_read_file(cpu, cpufreq_string_files[which], | ||
162 | linebuf, sizeof(linebuf))) == 0 ) | ||
163 | return NULL; | ||
164 | |||
165 | if ( ( result = strdup(linebuf) ) == NULL ) | ||
166 | return NULL; | ||
167 | |||
168 | if (result[strlen(result) - 1] == '\n') | ||
169 | result[strlen(result) - 1] = '\0'; | ||
170 | |||
171 | return result; | ||
172 | } | ||
173 | |||
174 | /* write access */ | ||
175 | |||
176 | enum cpufreq_write { | ||
177 | WRITE_SCALING_MIN_FREQ, | ||
178 | WRITE_SCALING_MAX_FREQ, | ||
179 | WRITE_SCALING_GOVERNOR, | ||
180 | WRITE_SCALING_SET_SPEED, | ||
181 | MAX_CPUFREQ_WRITE_FILES | ||
182 | }; | ||
183 | |||
184 | static const char *cpufreq_write_files[MAX_CPUFREQ_WRITE_FILES] = { | ||
185 | [WRITE_SCALING_MIN_FREQ] = "scaling_min_freq", | ||
186 | [WRITE_SCALING_MAX_FREQ] = "scaling_max_freq", | ||
187 | [WRITE_SCALING_GOVERNOR] = "scaling_governor", | ||
188 | [WRITE_SCALING_SET_SPEED] = "scaling_setspeed", | ||
189 | }; | ||
190 | |||
191 | static int sysfs_cpufreq_write_one_value(unsigned int cpu, | ||
192 | enum cpufreq_write which, | ||
193 | const char *new_value, size_t len) | ||
194 | { | ||
195 | if (which >= MAX_CPUFREQ_WRITE_FILES) | ||
196 | return 0; | ||
197 | |||
198 | if ( sysfs_cpufreq_write_file(cpu, cpufreq_write_files[which], | ||
199 | new_value, len) != len ) | ||
200 | return -ENODEV; | ||
201 | |||
202 | return 0; | ||
203 | }; | ||
204 | |||
205 | unsigned long sysfs_get_freq_kernel(unsigned int cpu) | ||
206 | { | ||
207 | return sysfs_cpufreq_get_one_value(cpu, SCALING_CUR_FREQ); | ||
208 | } | ||
209 | |||
210 | unsigned long sysfs_get_freq_hardware(unsigned int cpu) | ||
211 | { | ||
212 | return sysfs_cpufreq_get_one_value(cpu, CPUINFO_CUR_FREQ); | ||
213 | } | ||
214 | |||
215 | unsigned long sysfs_get_freq_transition_latency(unsigned int cpu) | ||
216 | { | ||
217 | return sysfs_cpufreq_get_one_value(cpu, CPUINFO_LATENCY); | ||
218 | } | ||
219 | |||
220 | int sysfs_get_freq_hardware_limits(unsigned int cpu, | ||
221 | unsigned long *min, | ||
222 | unsigned long *max) | ||
223 | { | ||
224 | if ((!min) || (!max)) | ||
225 | return -EINVAL; | ||
226 | |||
227 | *min = sysfs_cpufreq_get_one_value(cpu, CPUINFO_MIN_FREQ); | ||
228 | if (!*min) | ||
229 | return -ENODEV; | ||
230 | |||
231 | *max = sysfs_cpufreq_get_one_value(cpu, CPUINFO_MAX_FREQ); | ||
232 | if (!*max) | ||
233 | return -ENODEV; | ||
234 | |||
235 | return 0; | ||
236 | } | ||
237 | |||
238 | char * sysfs_get_freq_driver(unsigned int cpu) { | ||
239 | return sysfs_cpufreq_get_one_string(cpu, SCALING_DRIVER); | ||
240 | } | ||
241 | |||
242 | struct cpufreq_policy * sysfs_get_freq_policy(unsigned int cpu) { | ||
243 | struct cpufreq_policy *policy; | ||
244 | |||
245 | policy = malloc(sizeof(struct cpufreq_policy)); | ||
246 | if (!policy) | ||
247 | return NULL; | ||
248 | |||
249 | policy->governor = sysfs_cpufreq_get_one_string(cpu, SCALING_GOVERNOR); | ||
250 | if (!policy->governor) { | ||
251 | free(policy); | ||
252 | return NULL; | ||
253 | } | ||
254 | policy->min = sysfs_cpufreq_get_one_value(cpu, SCALING_MIN_FREQ); | ||
255 | policy->max = sysfs_cpufreq_get_one_value(cpu, SCALING_MAX_FREQ); | ||
256 | if ((!policy->min) || (!policy->max)) { | ||
257 | free(policy->governor); | ||
258 | free(policy); | ||
259 | return NULL; | ||
260 | } | ||
261 | |||
262 | return policy; | ||
263 | } | ||
264 | |||
265 | struct cpufreq_available_governors * | ||
266 | sysfs_get_freq_available_governors(unsigned int cpu) { | ||
267 | struct cpufreq_available_governors *first = NULL; | ||
268 | struct cpufreq_available_governors *current = NULL; | ||
269 | char linebuf[MAX_LINE_LEN]; | ||
270 | unsigned int pos, i; | ||
271 | unsigned int len; | ||
272 | |||
273 | if ( ( len = sysfs_cpufreq_read_file(cpu, "scaling_available_governors", | ||
274 | linebuf, sizeof(linebuf))) == 0 ) | ||
275 | { | ||
276 | return NULL; | ||
277 | } | ||
278 | |||
279 | pos = 0; | ||
280 | for ( i = 0; i < len; i++ ) | ||
281 | { | ||
282 | if ( linebuf[i] == ' ' || linebuf[i] == '\n' ) | ||
283 | { | ||
284 | if ( i - pos < 2 ) | ||
285 | continue; | ||
286 | if ( current ) { | ||
287 | current->next = malloc(sizeof *current ); | ||
288 | if ( ! current->next ) | ||
289 | goto error_out; | ||
290 | current = current->next; | ||
291 | } else { | ||
292 | first = malloc( sizeof *first ); | ||
293 | if ( ! first ) | ||
294 | goto error_out; | ||
295 | current = first; | ||
296 | } | ||
297 | current->first = first; | ||
298 | current->next = NULL; | ||
299 | |||
300 | current->governor = malloc(i - pos + 1); | ||
301 | if ( ! current->governor ) | ||
302 | goto error_out; | ||
303 | |||
304 | memcpy( current->governor, linebuf + pos, i - pos); | ||
305 | current->governor[i - pos] = '\0'; | ||
306 | pos = i + 1; | ||
307 | } | ||
308 | } | ||
309 | |||
310 | return first; | ||
311 | |||
312 | error_out: | ||
313 | while ( first ) { | ||
314 | current = first->next; | ||
315 | if ( first->governor ) | ||
316 | free( first->governor ); | ||
317 | free( first ); | ||
318 | first = current; | ||
319 | } | ||
320 | return NULL; | ||
321 | } | ||
322 | |||
323 | |||
324 | struct cpufreq_available_frequencies * | ||
325 | sysfs_get_available_frequencies(unsigned int cpu) { | ||
326 | struct cpufreq_available_frequencies *first = NULL; | ||
327 | struct cpufreq_available_frequencies *current = NULL; | ||
328 | char one_value[SYSFS_PATH_MAX]; | ||
329 | char linebuf[MAX_LINE_LEN]; | ||
330 | unsigned int pos, i; | ||
331 | unsigned int len; | ||
332 | |||
333 | if ( ( len = sysfs_cpufreq_read_file(cpu, | ||
334 | "scaling_available_frequencies", | ||
335 | linebuf, sizeof(linebuf))) == 0 ) | ||
336 | { | ||
337 | return NULL; | ||
338 | } | ||
339 | |||
340 | pos = 0; | ||
341 | for ( i = 0; i < len; i++ ) | ||
342 | { | ||
343 | if ( linebuf[i] == ' ' || linebuf[i] == '\n' ) | ||
344 | { | ||
345 | if ( i - pos < 2 ) | ||
346 | continue; | ||
347 | if ( i - pos >= SYSFS_PATH_MAX ) | ||
348 | goto error_out; | ||
349 | if ( current ) { | ||
350 | current->next = malloc(sizeof *current ); | ||
351 | if ( ! current->next ) | ||
352 | goto error_out; | ||
353 | current = current->next; | ||
354 | } else { | ||
355 | first = malloc(sizeof *first ); | ||
356 | if ( ! first ) | ||
357 | goto error_out; | ||
358 | current = first; | ||
359 | } | ||
360 | current->first = first; | ||
361 | current->next = NULL; | ||
362 | |||
363 | memcpy(one_value, linebuf + pos, i - pos); | ||
364 | one_value[i - pos] = '\0'; | ||
365 | if ( sscanf(one_value, "%lu", ¤t->frequency) != 1 ) | ||
366 | goto error_out; | ||
367 | |||
368 | pos = i + 1; | ||
369 | } | ||
370 | } | ||
371 | |||
372 | return first; | ||
373 | |||
374 | error_out: | ||
375 | while ( first ) { | ||
376 | current = first->next; | ||
377 | free(first); | ||
378 | first = current; | ||
379 | } | ||
380 | return NULL; | ||
381 | } | ||
382 | |||
383 | static struct cpufreq_affected_cpus * sysfs_get_cpu_list(unsigned int cpu, | ||
384 | const char *file) { | ||
385 | struct cpufreq_affected_cpus *first = NULL; | ||
386 | struct cpufreq_affected_cpus *current = NULL; | ||
387 | char one_value[SYSFS_PATH_MAX]; | ||
388 | char linebuf[MAX_LINE_LEN]; | ||
389 | unsigned int pos, i; | ||
390 | unsigned int len; | ||
391 | |||
392 | if ( ( len = sysfs_cpufreq_read_file(cpu, file, linebuf, | ||
393 | sizeof(linebuf))) == 0 ) | ||
394 | { | ||
395 | return NULL; | ||
396 | } | ||
397 | |||
398 | pos = 0; | ||
399 | for ( i = 0; i < len; i++ ) | ||
400 | { | ||
401 | if ( i == len || linebuf[i] == ' ' || linebuf[i] == '\n' ) | ||
402 | { | ||
403 | if ( i - pos < 1 ) | ||
404 | continue; | ||
405 | if ( i - pos >= SYSFS_PATH_MAX ) | ||
406 | goto error_out; | ||
407 | if ( current ) { | ||
408 | current->next = malloc(sizeof *current); | ||
409 | if ( ! current->next ) | ||
410 | goto error_out; | ||
411 | current = current->next; | ||
412 | } else { | ||
413 | first = malloc(sizeof *first); | ||
414 | if ( ! first ) | ||
415 | goto error_out; | ||
416 | current = first; | ||
417 | } | ||
418 | current->first = first; | ||
419 | current->next = NULL; | ||
420 | |||
421 | memcpy(one_value, linebuf + pos, i - pos); | ||
422 | one_value[i - pos] = '\0'; | ||
423 | |||
424 | if ( sscanf(one_value, "%u", ¤t->cpu) != 1 ) | ||
425 | goto error_out; | ||
426 | |||
427 | pos = i + 1; | ||
428 | } | ||
429 | } | ||
430 | |||
431 | return first; | ||
432 | |||
433 | error_out: | ||
434 | while (first) { | ||
435 | current = first->next; | ||
436 | free(first); | ||
437 | first = current; | ||
438 | } | ||
439 | return NULL; | ||
440 | } | ||
441 | |||
442 | struct cpufreq_affected_cpus * sysfs_get_freq_affected_cpus(unsigned int cpu) { | ||
443 | return sysfs_get_cpu_list(cpu, "affected_cpus"); | ||
444 | } | ||
445 | |||
446 | struct cpufreq_affected_cpus * sysfs_get_freq_related_cpus(unsigned int cpu) { | ||
447 | return sysfs_get_cpu_list(cpu, "related_cpus"); | ||
448 | } | ||
449 | |||
450 | struct cpufreq_stats * sysfs_get_freq_stats(unsigned int cpu, unsigned long long *total_time) { | ||
451 | struct cpufreq_stats *first = NULL; | ||
452 | struct cpufreq_stats *current = NULL; | ||
453 | char one_value[SYSFS_PATH_MAX]; | ||
454 | char linebuf[MAX_LINE_LEN]; | ||
455 | unsigned int pos, i; | ||
456 | unsigned int len; | ||
457 | |||
458 | if ( ( len = sysfs_cpufreq_read_file(cpu, "stats/time_in_state", | ||
459 | linebuf, sizeof(linebuf))) == 0 ) | ||
460 | return NULL; | ||
461 | |||
462 | *total_time = 0; | ||
463 | pos = 0; | ||
464 | for ( i = 0; i < len; i++ ) | ||
465 | { | ||
466 | if ( i == strlen(linebuf) || linebuf[i] == '\n' ) | ||
467 | { | ||
468 | if ( i - pos < 2 ) | ||
469 | continue; | ||
470 | if ( (i - pos) >= SYSFS_PATH_MAX ) | ||
471 | goto error_out; | ||
472 | if ( current ) { | ||
473 | current->next = malloc(sizeof *current ); | ||
474 | if ( ! current->next ) | ||
475 | goto error_out; | ||
476 | current = current->next; | ||
477 | } else { | ||
478 | first = malloc(sizeof *first ); | ||
479 | if ( ! first ) | ||
480 | goto error_out; | ||
481 | current = first; | ||
482 | } | ||
483 | current->first = first; | ||
484 | current->next = NULL; | ||
485 | |||
486 | memcpy(one_value, linebuf + pos, i - pos); | ||
487 | one_value[i - pos] = '\0'; | ||
488 | if ( sscanf(one_value, "%lu %llu", ¤t->frequency, ¤t->time_in_state) != 2 ) | ||
489 | goto error_out; | ||
490 | |||
491 | *total_time = *total_time + current->time_in_state; | ||
492 | pos = i + 1; | ||
493 | } | ||
494 | } | ||
495 | |||
496 | return first; | ||
497 | |||
498 | error_out: | ||
499 | while ( first ) { | ||
500 | current = first->next; | ||
501 | free(first); | ||
502 | first = current; | ||
503 | } | ||
504 | return NULL; | ||
505 | } | ||
506 | |||
507 | unsigned long sysfs_get_freq_transitions(unsigned int cpu) | ||
508 | { | ||
509 | return sysfs_cpufreq_get_one_value(cpu, STATS_NUM_TRANSITIONS); | ||
510 | } | ||
511 | |||
512 | static int verify_gov(char *new_gov, char *passed_gov) | ||
513 | { | ||
514 | unsigned int i, j=0; | ||
515 | |||
516 | if (!passed_gov || (strlen(passed_gov) > 19)) | ||
517 | return -EINVAL; | ||
518 | |||
519 | strncpy(new_gov, passed_gov, 20); | ||
520 | for (i=0;i<20;i++) { | ||
521 | if (j) { | ||
522 | new_gov[i] = '\0'; | ||
523 | continue; | ||
524 | } | ||
525 | if ((new_gov[i] >= 'a') && (new_gov[i] <= 'z')) { | ||
526 | continue; | ||
527 | } | ||
528 | if ((new_gov[i] >= 'A') && (new_gov[i] <= 'Z')) { | ||
529 | continue; | ||
530 | } | ||
531 | if (new_gov[i] == '-') { | ||
532 | continue; | ||
533 | } | ||
534 | if (new_gov[i] == '_') { | ||
535 | continue; | ||
536 | } | ||
537 | if (new_gov[i] == '\0') { | ||
538 | j = 1; | ||
539 | continue; | ||
540 | } | ||
541 | return -EINVAL; | ||
542 | } | ||
543 | new_gov[19] = '\0'; | ||
544 | return 0; | ||
545 | } | ||
546 | |||
547 | int sysfs_modify_freq_policy_governor(unsigned int cpu, char *governor) | ||
548 | { | ||
549 | char new_gov[SYSFS_PATH_MAX]; | ||
550 | |||
551 | if (!governor) | ||
552 | return -EINVAL; | ||
553 | |||
554 | if (verify_gov(new_gov, governor)) | ||
555 | return -EINVAL; | ||
556 | |||
557 | return sysfs_cpufreq_write_one_value(cpu, WRITE_SCALING_GOVERNOR, | ||
558 | new_gov, strlen(new_gov)); | ||
559 | }; | ||
560 | |||
561 | int sysfs_modify_freq_policy_max(unsigned int cpu, unsigned long max_freq) | ||
562 | { | ||
563 | char value[SYSFS_PATH_MAX]; | ||
564 | |||
565 | snprintf(value, SYSFS_PATH_MAX, "%lu", max_freq); | ||
566 | |||
567 | return sysfs_cpufreq_write_one_value(cpu, WRITE_SCALING_MAX_FREQ, | ||
568 | value, strlen(value)); | ||
569 | }; | ||
570 | |||
571 | |||
572 | int sysfs_modify_freq_policy_min(unsigned int cpu, unsigned long min_freq) | ||
573 | { | ||
574 | char value[SYSFS_PATH_MAX]; | ||
575 | |||
576 | snprintf(value, SYSFS_PATH_MAX, "%lu", min_freq); | ||
577 | |||
578 | return sysfs_cpufreq_write_one_value(cpu, WRITE_SCALING_MIN_FREQ, | ||
579 | value, strlen(value)); | ||
580 | }; | ||
581 | |||
582 | |||
583 | int sysfs_set_freq_policy(unsigned int cpu, struct cpufreq_policy *policy) | ||
584 | { | ||
585 | char min[SYSFS_PATH_MAX]; | ||
586 | char max[SYSFS_PATH_MAX]; | ||
587 | char gov[SYSFS_PATH_MAX]; | ||
588 | int ret; | ||
589 | unsigned long old_min; | ||
590 | int write_max_first; | ||
591 | |||
592 | if (!policy || !(policy->governor)) | ||
593 | return -EINVAL; | ||
594 | |||
595 | if (policy->max < policy->min) | ||
596 | return -EINVAL; | ||
597 | |||
598 | if (verify_gov(gov, policy->governor)) | ||
599 | return -EINVAL; | ||
600 | |||
601 | snprintf(min, SYSFS_PATH_MAX, "%lu", policy->min); | ||
602 | snprintf(max, SYSFS_PATH_MAX, "%lu", policy->max); | ||
603 | |||
604 | old_min = sysfs_cpufreq_get_one_value(cpu, SCALING_MIN_FREQ); | ||
605 | write_max_first = (old_min && (policy->max < old_min) ? 0 : 1); | ||
606 | |||
607 | if (write_max_first) { | ||
608 | ret = sysfs_cpufreq_write_one_value(cpu, WRITE_SCALING_MAX_FREQ, | ||
609 | max, strlen(max)); | ||
610 | if (ret) | ||
611 | return ret; | ||
612 | } | ||
613 | |||
614 | ret = sysfs_cpufreq_write_one_value(cpu, WRITE_SCALING_MIN_FREQ, min, | ||
615 | strlen(min)); | ||
616 | if (ret) | ||
617 | return ret; | ||
618 | |||
619 | if (!write_max_first) { | ||
620 | ret = sysfs_cpufreq_write_one_value(cpu, WRITE_SCALING_MAX_FREQ, | ||
621 | max, strlen(max)); | ||
622 | if (ret) | ||
623 | return ret; | ||
624 | } | ||
625 | |||
626 | return sysfs_cpufreq_write_one_value(cpu, WRITE_SCALING_GOVERNOR, | ||
627 | gov, strlen(gov)); | ||
628 | } | ||
629 | |||
630 | int sysfs_set_frequency(unsigned int cpu, unsigned long target_frequency) { | ||
631 | struct cpufreq_policy *pol = sysfs_get_freq_policy(cpu); | ||
632 | char userspace_gov[] = "userspace"; | ||
633 | char freq[SYSFS_PATH_MAX]; | ||
634 | int ret; | ||
635 | |||
636 | if (!pol) | ||
637 | return -ENODEV; | ||
638 | |||
639 | if (strncmp(pol->governor, userspace_gov, 9) != 0) { | ||
640 | ret = sysfs_modify_freq_policy_governor(cpu, userspace_gov); | ||
641 | if (ret) { | ||
642 | cpufreq_put_policy(pol); | ||
643 | return (ret); | ||
644 | } | ||
645 | } | ||
646 | |||
647 | cpufreq_put_policy(pol); | ||
648 | |||
649 | snprintf(freq, SYSFS_PATH_MAX, "%lu", target_frequency); | ||
650 | |||
651 | return sysfs_cpufreq_write_one_value(cpu, WRITE_SCALING_SET_SPEED, | ||
652 | freq, strlen(freq)); | ||
653 | } | ||
654 | |||
655 | /* CPUFREQ sysfs access **************************************************/ | ||
656 | |||
657 | /* General sysfs access **************************************************/ | ||
658 | int sysfs_cpu_exists(unsigned int cpu) | ||
659 | { | ||
660 | char file[SYSFS_PATH_MAX]; | ||
661 | struct stat statbuf; | ||
662 | |||
663 | snprintf(file, SYSFS_PATH_MAX, PATH_TO_CPU "cpu%u/", cpu); | ||
664 | |||
665 | if ( stat(file, &statbuf) != 0 ) | ||
666 | return -ENOSYS; | ||
667 | |||
668 | return S_ISDIR(statbuf.st_mode) ? 0 : -ENOSYS; | ||
669 | } | ||
670 | |||
671 | /* General sysfs access **************************************************/ | ||
diff --git a/tools/power/cpupower/lib/sysfs.h b/tools/power/cpupower/lib/sysfs.h new file mode 100644 index 00000000000..c29e5575be8 --- /dev/null +++ b/tools/power/cpupower/lib/sysfs.h | |||
@@ -0,0 +1,21 @@ | |||
1 | /* General */ | ||
2 | extern unsigned int sysfs_cpu_exists(unsigned int cpu); | ||
3 | |||
4 | /* CPUfreq */ | ||
5 | extern unsigned long sysfs_get_freq_kernel(unsigned int cpu); | ||
6 | extern unsigned long sysfs_get_freq_hardware(unsigned int cpu); | ||
7 | extern unsigned long sysfs_get_freq_transition_latency(unsigned int cpu); | ||
8 | extern int sysfs_get_freq_hardware_limits(unsigned int cpu, unsigned long *min, unsigned long *max); | ||
9 | extern char * sysfs_get_freq_driver(unsigned int cpu); | ||
10 | extern struct cpufreq_policy * sysfs_get_freq_policy(unsigned int cpu); | ||
11 | extern struct cpufreq_available_governors * sysfs_get_freq_available_governors(unsigned int cpu); | ||
12 | extern struct cpufreq_available_frequencies * sysfs_get_available_frequencies(unsigned int cpu); | ||
13 | extern struct cpufreq_affected_cpus * sysfs_get_freq_affected_cpus(unsigned int cpu); | ||
14 | extern struct cpufreq_affected_cpus * sysfs_get_freq_related_cpus(unsigned int cpu); | ||
15 | extern struct cpufreq_stats * sysfs_get_freq_stats(unsigned int cpu, unsigned long long *total_time); | ||
16 | extern unsigned long sysfs_get_freq_transitions(unsigned int cpu); | ||
17 | extern int sysfs_set_freq_policy(unsigned int cpu, struct cpufreq_policy *policy); | ||
18 | extern int sysfs_modify_freq_policy_min(unsigned int cpu, unsigned long min_freq); | ||
19 | extern int sysfs_modify_freq_policy_max(unsigned int cpu, unsigned long max_freq); | ||
20 | extern int sysfs_modify_freq_policy_governor(unsigned int cpu, char *governor); | ||
21 | extern int sysfs_set_frequency(unsigned int cpu, unsigned long target_frequency); | ||
diff --git a/tools/power/cpupower/man/cpupower-frequency-info.1 b/tools/power/cpupower/man/cpupower-frequency-info.1 new file mode 100644 index 00000000000..3194811d58f --- /dev/null +++ b/tools/power/cpupower/man/cpupower-frequency-info.1 | |||
@@ -0,0 +1,76 @@ | |||
1 | .TH "cpufreq-info" "1" "0.1" "Mattia Dongili" "" | ||
2 | .SH "NAME" | ||
3 | .LP | ||
4 | cpufreq\-info \- Utility to retrieve cpufreq kernel information | ||
5 | .SH "SYNTAX" | ||
6 | .LP | ||
7 | cpufreq\-info [\fIoptions\fP] | ||
8 | .SH "DESCRIPTION" | ||
9 | .LP | ||
10 | A small tool which prints out cpufreq information helpful to developers and interested users. | ||
11 | .SH "OPTIONS" | ||
12 | .LP | ||
13 | .TP | ||
14 | \fB\-e\fR \fB\-\-debug\fR | ||
15 | Prints out debug information. | ||
16 | .TP | ||
17 | \fB\-f\fR \fB\-\-freq\fR | ||
18 | Get frequency the CPU currently runs at, according to the cpufreq core. | ||
19 | .TP | ||
20 | \fB\-w\fR \fB\-\-hwfreq\fR | ||
21 | Get frequency the CPU currently runs at, by reading it from hardware (only available to root). | ||
22 | .TP | ||
23 | \fB\-l\fR \fB\-\-hwlimits\fR | ||
24 | Determine the minimum and maximum CPU frequency allowed. | ||
25 | .TP | ||
26 | \fB\-d\fR \fB\-\-driver\fR | ||
27 | Determines the used cpufreq kernel driver. | ||
28 | .TP | ||
29 | \fB\-p\fR \fB\-\-policy\fR | ||
30 | Gets the currently used cpufreq policy. | ||
31 | .TP | ||
32 | \fB\-g\fR \fB\-\-governors\fR | ||
33 | Determines available cpufreq governors. | ||
34 | .TP | ||
35 | \fB\-a\fR \fB\-\-related\-cpus\fR | ||
36 | Determines which CPUs run at the same hardware frequency. | ||
37 | .TP | ||
38 | \fB\-a\fR \fB\-\-affected\-cpus\fR | ||
39 | Determines which CPUs need to have their frequency coordinated by software. | ||
40 | .TP | ||
41 | \fB\-s\fR \fB\-\-stats\fR | ||
42 | Shows cpufreq statistics if available. | ||
43 | .TP | ||
44 | \fB\-y\fR \fB\-\-latency\fR | ||
45 | Determines the maximum latency on CPU frequency changes. | ||
46 | .TP | ||
47 | \fB\-o\fR \fB\-\-proc\fR | ||
48 | Prints out information like provided by the /proc/cpufreq interface in 2.4. and early 2.6. kernels. | ||
49 | .TP | ||
50 | \fB\-m\fR \fB\-\-human\fR | ||
51 | human\-readable output for the \-f, \-w, \-s and \-y parameters. | ||
52 | .TP | ||
53 | \fB\-h\fR \fB\-\-help\fR | ||
54 | Prints out the help screen. | ||
55 | .SH "REMARKS" | ||
56 | .LP | ||
57 | By default only values of core zero are displayed. How to display settings of | ||
58 | other cores is described in the cpupower(1) manpage in the \-\-cpu option section. | ||
59 | .LP | ||
60 | You can't specify more than one of the output specific options \-o \-e \-a \-g \-p \-d \-l \-w \-f \-y. | ||
61 | .LP | ||
62 | You also can't specify the \-o option combined with the \-c option. | ||
63 | .SH "FILES" | ||
64 | .nf | ||
65 | \fI/sys/devices/system/cpu/cpu*/cpufreq/\fP | ||
66 | \fI/proc/cpufreq\fP (deprecated) | ||
67 | \fI/proc/sys/cpu/\fP (deprecated) | ||
68 | .fi | ||
69 | .SH "AUTHORS" | ||
70 | .nf | ||
71 | Dominik Brodowski <linux@brodo.de> \- author | ||
72 | Mattia Dongili<malattia@gmail.com> \- first autolibtoolization | ||
73 | .fi | ||
74 | .SH "SEE ALSO" | ||
75 | .LP | ||
76 | cpupower\-frequency\-set(1), cpupower(1) | ||
diff --git a/tools/power/cpupower/man/cpupower-frequency-set.1 b/tools/power/cpupower/man/cpupower-frequency-set.1 new file mode 100644 index 00000000000..26e3e13eee3 --- /dev/null +++ b/tools/power/cpupower/man/cpupower-frequency-set.1 | |||
@@ -0,0 +1,54 @@ | |||
1 | .TH "cpufreq-set" "1" "0.1" "Mattia Dongili" "" | ||
2 | .SH "NAME" | ||
3 | .LP | ||
4 | cpufreq\-set \- A small tool which allows to modify cpufreq settings. | ||
5 | .SH "SYNTAX" | ||
6 | .LP | ||
7 | cpufreq\-set [\fIoptions\fP] | ||
8 | .SH "DESCRIPTION" | ||
9 | .LP | ||
10 | cpufreq\-set allows you to modify cpufreq settings without having to type e.g. "/sys/devices/system/cpu/cpu0/cpufreq/scaling_set_speed" all the time. | ||
11 | .SH "OPTIONS" | ||
12 | .LP | ||
13 | .TP | ||
14 | \fB\-d\fR \fB\-\-min\fR <FREQ> | ||
15 | new minimum CPU frequency the governor may select. | ||
16 | .TP | ||
17 | \fB\-u\fR \fB\-\-max\fR <FREQ> | ||
18 | new maximum CPU frequency the governor may select. | ||
19 | .TP | ||
20 | \fB\-g\fR \fB\-\-governor\fR <GOV> | ||
21 | new cpufreq governor. | ||
22 | .TP | ||
23 | \fB\-f\fR \fB\-\-freq\fR <FREQ> | ||
24 | specific frequency to be set. Requires userspace governor to be available and loaded. | ||
25 | .TP | ||
26 | \fB\-r\fR \fB\-\-related\fR | ||
27 | modify all hardware-related CPUs at the same time | ||
28 | .TP | ||
29 | \fB\-h\fR \fB\-\-help\fR | ||
30 | Prints out the help screen. | ||
31 | .SH "REMARKS" | ||
32 | .LP | ||
33 | By default values are applied on all cores. How to modify single core | ||
34 | configurations is described in the cpupower(1) manpage in the \-\-cpu option section. | ||
35 | .LP | ||
36 | The \-f FREQ, \-\-freq FREQ parameter cannot be combined with any other parameter. | ||
37 | .LP | ||
38 | FREQuencies can be passed in Hz, kHz (default), MHz, GHz, or THz by postfixing the value with the wanted unit name, without any space (frequency in kHz =^ Hz * 0.001 =^ MHz * 1000 =^ GHz * 1000000). | ||
39 | .LP | ||
40 | On Linux kernels up to 2.6.29, the \-r or \-\-related parameter is ignored. | ||
41 | .SH "FILES" | ||
42 | .nf | ||
43 | \fI/sys/devices/system/cpu/cpu*/cpufreq/\fP | ||
44 | \fI/proc/cpufreq\fP (deprecated) | ||
45 | \fI/proc/sys/cpu/\fP (deprecated) | ||
46 | .fi | ||
47 | .SH "AUTHORS" | ||
48 | .nf | ||
49 | Dominik Brodowski <linux@brodo.de> \- author | ||
50 | Mattia Dongili<malattia@gmail.com> \- first autolibtoolization | ||
51 | .fi | ||
52 | .SH "SEE ALSO" | ||
53 | .LP | ||
54 | cpupower\-frequency\-info(1), cpupower(1) | ||
diff --git a/tools/power/cpupower/man/cpupower-info.1 b/tools/power/cpupower/man/cpupower-info.1 new file mode 100644 index 00000000000..58e21196f17 --- /dev/null +++ b/tools/power/cpupower/man/cpupower-info.1 | |||
@@ -0,0 +1,19 @@ | |||
1 | .TH CPUPOWER\-INFO "1" "22/02/2011" "" "cpupower Manual" | ||
2 | .SH NAME | ||
3 | cpupower\-info \- Shows processor power related kernel or hardware configurations | ||
4 | .SH SYNOPSIS | ||
5 | .ft B | ||
6 | .B cpupower info [ \-b ] [ \-s ] [ \-m ] | ||
7 | |||
8 | .SH DESCRIPTION | ||
9 | \fBcpupower info \fP shows kernel configurations or processor hardware | ||
10 | registers affecting processor power saving policies. | ||
11 | |||
12 | Some options are platform wide, some affect single cores. By default values | ||
13 | of core zero are displayed only. cpupower --cpu all cpuinfo will show the | ||
14 | settings of all cores, see cpupower(1) how to choose specific cores. | ||
15 | |||
16 | .SH "SEE ALSO" | ||
17 | Options are described in detail in: | ||
18 | |||
19 | cpupower(1), cpupower-set(1) | ||
diff --git a/tools/power/cpupower/man/cpupower-monitor.1 b/tools/power/cpupower/man/cpupower-monitor.1 new file mode 100644 index 00000000000..d5cfa265c3d --- /dev/null +++ b/tools/power/cpupower/man/cpupower-monitor.1 | |||
@@ -0,0 +1,179 @@ | |||
1 | .TH CPUPOWER\-MONITOR "1" "22/02/2011" "" "cpupower Manual" | ||
2 | .SH NAME | ||
3 | cpupower\-monitor \- Report processor frequency and idle statistics | ||
4 | .SH SYNOPSIS | ||
5 | .ft B | ||
6 | .B cpupower monitor | ||
7 | .RB "\-l" | ||
8 | |||
9 | .B cpupower monitor | ||
10 | .RB [ "\-m <mon1>," [ "<mon2>,..." ] ] | ||
11 | .RB [ "\-i seconds" ] | ||
12 | .br | ||
13 | .B cpupower monitor | ||
14 | .RB [ "\-m <mon1>," [ "<mon2>,..." ] ] | ||
15 | .RB command | ||
16 | .br | ||
17 | .SH DESCRIPTION | ||
18 | \fBcpupower-monitor \fP reports processor topology, frequency and idle power | ||
19 | state statistics. Either \fBcommand\fP is forked and | ||
20 | statistics are printed upon its completion, or statistics are printed periodically. | ||
21 | |||
22 | \fBcpupower-monitor \fP implements independent processor sleep state and | ||
23 | frequency counters. Some are retrieved from kernel statistics, some are | ||
24 | directly reading out hardware registers. Use \-l to get an overview which are | ||
25 | supported on your system. | ||
26 | |||
27 | .SH Options | ||
28 | .PP | ||
29 | \-l | ||
30 | .RS 4 | ||
31 | List available monitors on your system. Additional details about each monitor | ||
32 | are shown: | ||
33 | .RS 2 | ||
34 | .IP \(bu | ||
35 | The name in quotation marks which can be passed to the \-m parameter. | ||
36 | .IP \(bu | ||
37 | The number of different counters the monitor supports in brackets. | ||
38 | .IP \(bu | ||
39 | The amount of time in seconds the counters might overflow, due to | ||
40 | implementation constraints. | ||
41 | .IP \(bu | ||
42 | The name and a description of each counter and its processor hierarchy level | ||
43 | coverage in square brackets: | ||
44 | .RS 4 | ||
45 | .IP \(bu | ||
46 | [T] \-> Thread | ||
47 | .IP \(bu | ||
48 | [C] \-> Core | ||
49 | .IP \(bu | ||
50 | [P] \-> Processor Package (Socket) | ||
51 | .IP \(bu | ||
52 | [M] \-> Machine/Platform wide counter | ||
53 | .RE | ||
54 | .RE | ||
55 | .RE | ||
56 | .PP | ||
57 | \-m <mon1>,<mon2>,... | ||
58 | .RS 4 | ||
59 | Only display specific monitors. Use the monitor string(s) provided by \-l option. | ||
60 | .RE | ||
61 | .PP | ||
62 | \-i seconds | ||
63 | .RS 4 | ||
64 | Measure intervall. | ||
65 | .RE | ||
66 | .PP | ||
67 | command | ||
68 | .RS 4 | ||
69 | Measure idle and frequency characteristics of an arbitrary command/workload. | ||
70 | The executable \fBcommand\fP is forked and upon its exit, statistics gathered since it was | ||
71 | forked are displayed. | ||
72 | .RE | ||
73 | .PP | ||
74 | \-v | ||
75 | .RS 4 | ||
76 | Increase verbosity if the binary was compiled with the DEBUG option set. | ||
77 | .RE | ||
78 | |||
79 | .SH MONITOR DESCRIPTIONS | ||
80 | .SS "Idle_Stats" | ||
81 | Shows statistics of the cpuidle kernel subsystem. Values are retrieved from | ||
82 | /sys/devices/system/cpu/cpu*/cpuidle/state*/. | ||
83 | The kernel updates these values every time an idle state is entered or | ||
84 | left. Therefore there can be some inaccuracy when cores are in an idle | ||
85 | state for some time when the measure starts or ends. In worst case it can happen | ||
86 | that one core stayed in an idle state for the whole measure time and the idle | ||
87 | state usage time as exported by the kernel did not get updated. In this case | ||
88 | a state residency of 0 percent is shown while it was 100. | ||
89 | |||
90 | .SS "Mperf" | ||
91 | The name comes from the aperf/mperf (average and maximum) MSR registers used | ||
92 | which are available on recent X86 processors. It shows the average frequency | ||
93 | (including boost frequencies). | ||
94 | The fact that on all recent hardware the mperf timer stops ticking in any idle | ||
95 | state it is also used to show C0 (processor is active) and Cx (processor is in | ||
96 | any sleep state) times. These counters do not have the inaccuracy restrictions | ||
97 | the "Idle_Stats" counters may show. | ||
98 | May work poorly on Linux-2.6.20 through 2.6.29, as the \fBacpi-cpufreq \fP | ||
99 | kernel frequency driver periodically cleared aperf/mperf registers in those | ||
100 | kernels. | ||
101 | |||
102 | .SS "Nehalem" "SandyBridge" | ||
103 | Intel Core and Package sleep state counters. | ||
104 | Threads (hyperthreaded cores) may not be able to enter deeper core states if | ||
105 | its sibling is utilized. | ||
106 | Deepest package sleep states may in reality show up as machine/platform wide | ||
107 | sleep states and can only be entered if all cores are idle. Look up Intel | ||
108 | manuals (some are provided in the References section) for further details. | ||
109 | |||
110 | .SS "Ontario" "Liano" | ||
111 | AMD laptop and desktop processor (family 12h and 14h) sleep state counters. | ||
112 | The registers are accessed via PCI and therefore can still be read out while | ||
113 | cores have been offlined. | ||
114 | |||
115 | There is one special counter: NBP1 (North Bridge P1). | ||
116 | This one always returns 0 or 1, depending on whether the North Bridge P1 | ||
117 | power state got entered at least once during measure time. | ||
118 | Being able to enter NBP1 state also depends on graphics power management. | ||
119 | Therefore this counter can be used to verify whether the graphics' driver | ||
120 | power management is working as expected. | ||
121 | |||
122 | .SH EXAMPLES | ||
123 | |||
124 | cpupower monitor -l" may show: | ||
125 | .RS 4 | ||
126 | Monitor "Mperf" (3 states) \- Might overflow after 922000000 s | ||
127 | |||
128 | ... | ||
129 | |||
130 | Monitor "Idle_Stats" (3 states) \- Might overflow after 4294967295 s | ||
131 | |||
132 | ... | ||
133 | |||
134 | .RE | ||
135 | cpupower monitor \-m "Idle_Stats,Mperf" scp /tmp/test /nfs/tmp | ||
136 | |||
137 | Monitor the scp command, show both Mperf and Idle_Stats states counter | ||
138 | statistics, but in exchanged order. | ||
139 | |||
140 | |||
141 | |||
142 | .RE | ||
143 | Be careful that the typical command to fully utilize one CPU by doing: | ||
144 | |||
145 | cpupower monitor cat /dev/zero >/dev/null | ||
146 | |||
147 | Does not work as expected, because the measured output is redirected to | ||
148 | /dev/null. This could get workarounded by putting the line into an own, tiny | ||
149 | shell script. Hit CTRL\-c to terminate the command and get the measure output | ||
150 | displayed. | ||
151 | |||
152 | .SH REFERENCES | ||
153 | "BIOS and Kernel Developer’s Guide (BKDG) for AMD Family 14h Processors" | ||
154 | http://support.amd.com/us/Processor_TechDocs/43170.pdf | ||
155 | |||
156 | "Intel® Turbo Boost Technology | ||
157 | in Intel® Core™ Microarchitecture (Nehalem) Based Processors" | ||
158 | http://download.intel.com/design/processor/applnots/320354.pdf | ||
159 | |||
160 | "Intel® 64 and IA-32 Architectures Software Developer's Manual | ||
161 | Volume 3B: System Programming Guide" | ||
162 | http://www.intel.com/products/processor/manuals | ||
163 | |||
164 | .SH FILES | ||
165 | .ta | ||
166 | .nf | ||
167 | /dev/cpu/*/msr | ||
168 | /sys/devices/system/cpu/cpu*/cpuidle/state*/. | ||
169 | .fi | ||
170 | |||
171 | .SH "SEE ALSO" | ||
172 | powertop(8), msr(4), vmstat(8) | ||
173 | .PP | ||
174 | .SH AUTHORS | ||
175 | .nf | ||
176 | Written by Thomas Renninger <trenn@suse.de> | ||
177 | |||
178 | Nehalem, SandyBridge monitors and command passing | ||
179 | based on turbostat.8 from Len Brown <len.brown@intel.com> | ||
diff --git a/tools/power/cpupower/man/cpupower-set.1 b/tools/power/cpupower/man/cpupower-set.1 new file mode 100644 index 00000000000..c4954a9fe4e --- /dev/null +++ b/tools/power/cpupower/man/cpupower-set.1 | |||
@@ -0,0 +1,103 @@ | |||
1 | .TH CPUPOWER\-SET "1" "22/02/2011" "" "cpupower Manual" | ||
2 | .SH NAME | ||
3 | cpupower\-set \- Set processor power related kernel or hardware configurations | ||
4 | .SH SYNOPSIS | ||
5 | .ft B | ||
6 | .B cpupower set [ \-b VAL ] [ \-s VAL ] [ \-m VAL ] | ||
7 | |||
8 | |||
9 | .SH DESCRIPTION | ||
10 | \fBcpupower set \fP sets kernel configurations or directly accesses hardware | ||
11 | registers affecting processor power saving policies. | ||
12 | |||
13 | Some options are platform wide, some affect single cores. By default values | ||
14 | are applied on all cores. How to modify single core configurations is | ||
15 | described in the cpupower(1) manpage in the \-\-cpu option section. Whether an | ||
16 | option affects the whole system or can be applied to individual cores is | ||
17 | described in the Options sections. | ||
18 | |||
19 | Use \fBcpupower info \fP to read out current settings and whether they are | ||
20 | supported on the system at all. | ||
21 | |||
22 | .SH Options | ||
23 | .PP | ||
24 | \-\-perf-bias, \-b | ||
25 | .RS 4 | ||
26 | Sets a register on supported Intel processore which allows software to convey | ||
27 | its policy for the relative importance of performance versus energy savings to | ||
28 | the processor. | ||
29 | |||
30 | The range of valid numbers is 0-15, where 0 is maximum | ||
31 | performance and 15 is maximum energy efficiency. | ||
32 | |||
33 | The processor uses this information in model-specific ways | ||
34 | when it must select trade-offs between performance and | ||
35 | energy efficiency. | ||
36 | |||
37 | This policy hint does not supersede Processor Performance states | ||
38 | (P-states) or CPU Idle power states (C-states), but allows | ||
39 | software to have influence where it would otherwise be unable | ||
40 | to express a preference. | ||
41 | |||
42 | For example, this setting may tell the hardware how | ||
43 | aggressively or conservatively to control frequency | ||
44 | in the "turbo range" above the explicitly OS-controlled | ||
45 | P-state frequency range. It may also tell the hardware | ||
46 | how aggressively it should enter the OS requested C-states. | ||
47 | |||
48 | This option can be applied to individual cores only via the \-\-cpu option, | ||
49 | cpupower(1). | ||
50 | |||
51 | Setting the performance bias value on one CPU can modify the setting on | ||
52 | related CPUs as well (for example all CPUs on one socket), because of | ||
53 | hardware restrictions. | ||
54 | Use \fBcpupower -c all info -b\fP to verify. | ||
55 | |||
56 | This options needs the msr kernel driver (CONFIG_X86_MSR) loaded. | ||
57 | .RE | ||
58 | .PP | ||
59 | \-\-sched\-mc, \-m [ VAL ] | ||
60 | .RE | ||
61 | \-\-sched\-smt, \-s [ VAL ] | ||
62 | .RS 4 | ||
63 | \-\-sched\-mc utilizes cores in one processor package/socket first before | ||
64 | processes are scheduled to other processor packages/sockets. | ||
65 | |||
66 | \-\-sched\-smt utilizes thread siblings of one processor core first before | ||
67 | processes are scheduled to other cores. | ||
68 | |||
69 | The impact on power consumption and performance (positiv or negativ) heavily | ||
70 | depends on processor support for deep sleep states, frequency scaling and | ||
71 | frequency boost modes and their dependencies between other thread siblings | ||
72 | and processor cores. | ||
73 | |||
74 | Taken over from kernel documentation: | ||
75 | |||
76 | Adjust the kernel's multi-core scheduler support. | ||
77 | |||
78 | Possible values are: | ||
79 | .RS 2 | ||
80 | 0 - No power saving load balance (default value) | ||
81 | |||
82 | 1 - Fill one thread/core/package first for long running threads | ||
83 | |||
84 | 2 - Also bias task wakeups to semi-idle cpu package for power | ||
85 | savings | ||
86 | .RE | ||
87 | |||
88 | sched_mc_power_savings is dependent upon SCHED_MC, which is | ||
89 | itself architecture dependent. | ||
90 | |||
91 | sched_smt_power_savings is dependent upon SCHED_SMT, which | ||
92 | is itself architecture dependent. | ||
93 | |||
94 | The two files are independent of each other. It is possible | ||
95 | that one file may be present without the other. | ||
96 | |||
97 | .SH "SEE ALSO" | ||
98 | cpupower-info(1), cpupower-monitor(1), powertop(1) | ||
99 | .PP | ||
100 | .SH AUTHORS | ||
101 | .nf | ||
102 | \-\-perf\-bias parts written by Len Brown <len.brown@intel.com> | ||
103 | Thomas Renninger <trenn@suse.de> | ||
diff --git a/tools/power/cpupower/man/cpupower.1 b/tools/power/cpupower/man/cpupower.1 new file mode 100644 index 00000000000..78c20feab85 --- /dev/null +++ b/tools/power/cpupower/man/cpupower.1 | |||
@@ -0,0 +1,72 @@ | |||
1 | .TH CPUPOWER "1" "07/03/2011" "" "cpupower Manual" | ||
2 | .SH NAME | ||
3 | cpupower \- Shows and sets processor power related values | ||
4 | .SH SYNOPSIS | ||
5 | .ft B | ||
6 | .B cpupower [ \-c cpulist ] subcommand [ARGS] | ||
7 | |||
8 | .B cpupower \-v|\-\-version | ||
9 | |||
10 | .B cpupower \-h|\-\-help | ||
11 | |||
12 | .SH DESCRIPTION | ||
13 | \fBcpupower \fP is a collection of tools to examine and tune power saving | ||
14 | related features of your processor. | ||
15 | |||
16 | The manpages of the subcommands (cpupower\-<subcommand>(1)) provide detailed | ||
17 | descriptions of supported features. Run \fBcpupower help\fP to get an overview | ||
18 | of supported subcommands. | ||
19 | |||
20 | .SH Options | ||
21 | .PP | ||
22 | \-\-help, \-h | ||
23 | .RS 4 | ||
24 | Shows supported subcommands and general usage. | ||
25 | .RE | ||
26 | .PP | ||
27 | \-\-cpu cpulist, \-c cpulist | ||
28 | .RS 4 | ||
29 | Only show or set values for specific cores. | ||
30 | This option is not supported by all subcommands, details can be found in the | ||
31 | manpages of the subcommands. | ||
32 | |||
33 | Some subcommands access all cores (typically the *\-set commands), some only | ||
34 | the first core (typically the *\-info commands) by default. | ||
35 | |||
36 | The syntax for <cpulist> is based on how the kernel exports CPU bitmasks via | ||
37 | sysfs files. Some examples: | ||
38 | .RS 4 | ||
39 | .TP 16 | ||
40 | Input | ||
41 | Equivalent to | ||
42 | .TP | ||
43 | all | ||
44 | all cores | ||
45 | .TP | ||
46 | 0\-3 | ||
47 | 0,1,2,3 | ||
48 | .TP | ||
49 | 0\-7:2 | ||
50 | 0,2,4,6 | ||
51 | .TP | ||
52 | 1,3,5-7 | ||
53 | 1,3,5,6,7 | ||
54 | .TP | ||
55 | 0\-3:2,8\-15:4 | ||
56 | 0,2,8,12 | ||
57 | .RE | ||
58 | .RE | ||
59 | .PP | ||
60 | \-\-version, \-v | ||
61 | .RS 4 | ||
62 | Print the package name and version number. | ||
63 | |||
64 | .SH "SEE ALSO" | ||
65 | cpupower-set(1), cpupower-info(1), cpupower-idle(1), | ||
66 | cpupower-frequency-set(1), cpupower-frequency-info(1), cpupower-monitor(1), | ||
67 | powertop(1) | ||
68 | .PP | ||
69 | .SH AUTHORS | ||
70 | .nf | ||
71 | \-\-perf\-bias parts written by Len Brown <len.brown@intel.com> | ||
72 | Thomas Renninger <trenn@suse.de> | ||
diff --git a/tools/power/cpupower/po/cs.po b/tools/power/cpupower/po/cs.po new file mode 100644 index 00000000000..cb22c45c506 --- /dev/null +++ b/tools/power/cpupower/po/cs.po | |||
@@ -0,0 +1,944 @@ | |||
1 | # translation of cs.po to Czech | ||
2 | # Czech translation for cpufrequtils package | ||
3 | # Czech messages for cpufrequtils. | ||
4 | # Copyright (C) 2007 kavol | ||
5 | # This file is distributed under the same license as the cpufrequtils package. | ||
6 | # | ||
7 | # Karel Volný <kavol@seznam.cz>, 2007, 2008. | ||
8 | msgid "" | ||
9 | msgstr "" | ||
10 | "Project-Id-Version: cs\n" | ||
11 | "Report-Msgid-Bugs-To: \n" | ||
12 | "POT-Creation-Date: 2011-03-08 17:03+0100\n" | ||
13 | "PO-Revision-Date: 2008-06-11 16:26+0200\n" | ||
14 | "Last-Translator: Karel Volný <kavol@seznam.cz>\n" | ||
15 | "Language-Team: Czech <diskuze@lists.l10n.cz>\n" | ||
16 | "Language: cs\n" | ||
17 | "MIME-Version: 1.0\n" | ||
18 | "Content-Type: text/plain; charset=UTF-8\n" | ||
19 | "Content-Transfer-Encoding: 8bit\n" | ||
20 | "Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n" | ||
21 | "X-Generator: KBabel 1.11.4\n" | ||
22 | |||
23 | #: utils/idle_monitor/nhm_idle.c:36 | ||
24 | msgid "Processor Core C3" | ||
25 | msgstr "" | ||
26 | |||
27 | #: utils/idle_monitor/nhm_idle.c:43 | ||
28 | msgid "Processor Core C6" | ||
29 | msgstr "" | ||
30 | |||
31 | #: utils/idle_monitor/nhm_idle.c:51 | ||
32 | msgid "Processor Package C3" | ||
33 | msgstr "" | ||
34 | |||
35 | #: utils/idle_monitor/nhm_idle.c:58 utils/idle_monitor/amd_fam14h_idle.c:70 | ||
36 | msgid "Processor Package C6" | ||
37 | msgstr "" | ||
38 | |||
39 | #: utils/idle_monitor/snb_idle.c:33 | ||
40 | msgid "Processor Core C7" | ||
41 | msgstr "" | ||
42 | |||
43 | #: utils/idle_monitor/snb_idle.c:40 | ||
44 | msgid "Processor Package C2" | ||
45 | msgstr "" | ||
46 | |||
47 | #: utils/idle_monitor/snb_idle.c:47 | ||
48 | msgid "Processor Package C7" | ||
49 | msgstr "" | ||
50 | |||
51 | #: utils/idle_monitor/amd_fam14h_idle.c:56 | ||
52 | msgid "Package in sleep state (PC1 or deeper)" | ||
53 | msgstr "" | ||
54 | |||
55 | #: utils/idle_monitor/amd_fam14h_idle.c:63 | ||
56 | msgid "Processor Package C1" | ||
57 | msgstr "" | ||
58 | |||
59 | #: utils/idle_monitor/amd_fam14h_idle.c:77 | ||
60 | msgid "North Bridge P1 boolean counter (returns 0 or 1)" | ||
61 | msgstr "" | ||
62 | |||
63 | #: utils/idle_monitor/mperf_monitor.c:35 | ||
64 | msgid "Processor Core not idle" | ||
65 | msgstr "" | ||
66 | |||
67 | #: utils/idle_monitor/mperf_monitor.c:42 | ||
68 | msgid "Processor Core in an idle state" | ||
69 | msgstr "" | ||
70 | |||
71 | #: utils/idle_monitor/mperf_monitor.c:50 | ||
72 | msgid "Average Frequency (including boost) in MHz" | ||
73 | msgstr "" | ||
74 | |||
75 | #: utils/idle_monitor/cpupower-monitor.c:66 | ||
76 | #, c-format | ||
77 | msgid "" | ||
78 | "cpupower monitor: [-h] [ [-t] | [-l] | [-m <mon1>,[<mon2>] ] ] [-i " | ||
79 | "interval_sec | -c command ...]\n" | ||
80 | msgstr "" | ||
81 | |||
82 | #: utils/idle_monitor/cpupower-monitor.c:69 | ||
83 | #, c-format | ||
84 | msgid "" | ||
85 | "cpupower monitor: [-v] [-h] [ [-t] | [-l] | [-m <mon1>,[<mon2>] ] ] [-i " | ||
86 | "interval_sec | -c command ...]\n" | ||
87 | msgstr "" | ||
88 | |||
89 | #: utils/idle_monitor/cpupower-monitor.c:71 | ||
90 | #, c-format | ||
91 | msgid "\t -v: be more verbose\n" | ||
92 | msgstr "" | ||
93 | |||
94 | #: utils/idle_monitor/cpupower-monitor.c:73 | ||
95 | #, c-format | ||
96 | msgid "\t -h: print this help\n" | ||
97 | msgstr "" | ||
98 | |||
99 | #: utils/idle_monitor/cpupower-monitor.c:74 | ||
100 | #, c-format | ||
101 | msgid "\t -i: time intervall to measure for in seconds (default 1)\n" | ||
102 | msgstr "" | ||
103 | |||
104 | #: utils/idle_monitor/cpupower-monitor.c:75 | ||
105 | #, c-format | ||
106 | msgid "\t -t: show CPU topology/hierarchy\n" | ||
107 | msgstr "" | ||
108 | |||
109 | #: utils/idle_monitor/cpupower-monitor.c:76 | ||
110 | #, c-format | ||
111 | msgid "\t -l: list available CPU sleep monitors (for use with -m)\n" | ||
112 | msgstr "" | ||
113 | |||
114 | #: utils/idle_monitor/cpupower-monitor.c:77 | ||
115 | #, c-format | ||
116 | msgid "\t -m: show specific CPU sleep monitors only (in same order)\n" | ||
117 | msgstr "" | ||
118 | |||
119 | #: utils/idle_monitor/cpupower-monitor.c:79 | ||
120 | #, c-format | ||
121 | msgid "" | ||
122 | "only one of: -t, -l, -m are allowed\n" | ||
123 | "If none of them is passed," | ||
124 | msgstr "" | ||
125 | |||
126 | #: utils/idle_monitor/cpupower-monitor.c:80 | ||
127 | #, c-format | ||
128 | msgid " all supported monitors are shown\n" | ||
129 | msgstr "" | ||
130 | |||
131 | #: utils/idle_monitor/cpupower-monitor.c:197 | ||
132 | #, c-format | ||
133 | msgid "Monitor %s, Counter %s has no count function. Implementation error\n" | ||
134 | msgstr "" | ||
135 | |||
136 | #: utils/idle_monitor/cpupower-monitor.c:207 | ||
137 | #, c-format | ||
138 | msgid " *is offline\n" | ||
139 | msgstr "" | ||
140 | |||
141 | #: utils/idle_monitor/cpupower-monitor.c:236 | ||
142 | #, c-format | ||
143 | msgid "%s: max monitor name length (%d) exceeded\n" | ||
144 | msgstr "" | ||
145 | |||
146 | #: utils/idle_monitor/cpupower-monitor.c:250 | ||
147 | #, c-format | ||
148 | msgid "No matching monitor found in %s, try -l option\n" | ||
149 | msgstr "" | ||
150 | |||
151 | #: utils/idle_monitor/cpupower-monitor.c:266 | ||
152 | #, c-format | ||
153 | msgid "Monitor \"%s\" (%d states) - Might overflow after %u s\n" | ||
154 | msgstr "" | ||
155 | |||
156 | #: utils/idle_monitor/cpupower-monitor.c:319 | ||
157 | #, c-format | ||
158 | msgid "%s took %.5f seconds and exited with status %d\n" | ||
159 | msgstr "" | ||
160 | |||
161 | #: utils/idle_monitor/cpupower-monitor.c:406 | ||
162 | #, c-format | ||
163 | msgid "Cannot read number of available processors\n" | ||
164 | msgstr "" | ||
165 | |||
166 | #: utils/idle_monitor/cpupower-monitor.c:417 | ||
167 | #, c-format | ||
168 | msgid "Available monitor %s needs root access\n" | ||
169 | msgstr "" | ||
170 | |||
171 | #: utils/idle_monitor/cpupower-monitor.c:428 | ||
172 | #, c-format | ||
173 | msgid "No HW Cstate monitors found\n" | ||
174 | msgstr "" | ||
175 | |||
176 | #: utils/cpupower.c:78 | ||
177 | #, c-format | ||
178 | msgid "cpupower [ -c cpulist ] subcommand [ARGS]\n" | ||
179 | msgstr "" | ||
180 | |||
181 | #: utils/cpupower.c:79 | ||
182 | #, c-format | ||
183 | msgid "cpupower --version\n" | ||
184 | msgstr "" | ||
185 | |||
186 | #: utils/cpupower.c:80 | ||
187 | #, c-format | ||
188 | msgid "Supported subcommands are:\n" | ||
189 | msgstr "" | ||
190 | |||
191 | #: utils/cpupower.c:83 | ||
192 | #, c-format | ||
193 | msgid "" | ||
194 | "\n" | ||
195 | "Some subcommands can make use of the -c cpulist option.\n" | ||
196 | msgstr "" | ||
197 | |||
198 | #: utils/cpupower.c:84 | ||
199 | #, c-format | ||
200 | msgid "Look at the general cpupower manpage how to use it\n" | ||
201 | msgstr "" | ||
202 | |||
203 | #: utils/cpupower.c:85 | ||
204 | #, c-format | ||
205 | msgid "and read up the subcommand's manpage whether it is supported.\n" | ||
206 | msgstr "" | ||
207 | |||
208 | #: utils/cpupower.c:86 | ||
209 | #, c-format | ||
210 | msgid "" | ||
211 | "\n" | ||
212 | "Use cpupower help subcommand for getting help for above subcommands.\n" | ||
213 | msgstr "" | ||
214 | |||
215 | #: utils/cpupower.c:91 | ||
216 | #, c-format | ||
217 | msgid "Report errors and bugs to %s, please.\n" | ||
218 | msgstr "" | ||
219 | "Chyby v programu prosÃm hlaste na %s (anglicky).\n" | ||
220 | "Chyby v pÅ™ekladu prosÃm hlaste na kavol@seznam.cz (Äesky ;-)\n" | ||
221 | |||
222 | #: utils/cpupower.c:114 | ||
223 | #, c-format | ||
224 | msgid "Error parsing cpu list\n" | ||
225 | msgstr "" | ||
226 | |||
227 | #: utils/cpupower.c:172 | ||
228 | #, c-format | ||
229 | msgid "Subcommand %s needs root privileges\n" | ||
230 | msgstr "" | ||
231 | |||
232 | #: utils/cpufreq-info.c:31 | ||
233 | #, c-format | ||
234 | msgid "Couldn't count the number of CPUs (%s: %s), assuming 1\n" | ||
235 | msgstr "Nelze zjistit poÄet CPU (%s: %s), pÅ™edpokládá se 1.\n" | ||
236 | |||
237 | #: utils/cpufreq-info.c:63 | ||
238 | #, c-format | ||
239 | msgid "" | ||
240 | " minimum CPU frequency - maximum CPU frequency - governor\n" | ||
241 | msgstr "" | ||
242 | " minimálnà frekvence CPU - maximálnà frekvence CPU - regulátor\n" | ||
243 | |||
244 | #: utils/cpufreq-info.c:151 | ||
245 | #, c-format | ||
246 | msgid "Error while evaluating Boost Capabilities on CPU %d -- are you root?\n" | ||
247 | msgstr "" | ||
248 | |||
249 | #. P state changes via MSR are identified via cpuid 80000007 | ||
250 | #. on Intel and AMD, but we assume boost capable machines can do that | ||
251 | #. if (cpuid_eax(0x80000000) >= 0x80000007 | ||
252 | #. && (cpuid_edx(0x80000007) & (1 << 7))) | ||
253 | #. | ||
254 | #: utils/cpufreq-info.c:161 | ||
255 | #, c-format | ||
256 | msgid " boost state support: \n" | ||
257 | msgstr "" | ||
258 | |||
259 | #: utils/cpufreq-info.c:163 | ||
260 | #, c-format | ||
261 | msgid " Supported: %s\n" | ||
262 | msgstr "" | ||
263 | |||
264 | #: utils/cpufreq-info.c:163 utils/cpufreq-info.c:164 | ||
265 | msgid "yes" | ||
266 | msgstr "" | ||
267 | |||
268 | #: utils/cpufreq-info.c:163 utils/cpufreq-info.c:164 | ||
269 | msgid "no" | ||
270 | msgstr "" | ||
271 | |||
272 | #: utils/cpufreq-info.c:164 | ||
273 | #, fuzzy, c-format | ||
274 | msgid " Active: %s\n" | ||
275 | msgstr " ovladaÄ: %s\n" | ||
276 | |||
277 | #: utils/cpufreq-info.c:177 | ||
278 | #, c-format | ||
279 | msgid " Boost States: %d\n" | ||
280 | msgstr "" | ||
281 | |||
282 | #: utils/cpufreq-info.c:178 | ||
283 | #, c-format | ||
284 | msgid " Total States: %d\n" | ||
285 | msgstr "" | ||
286 | |||
287 | #: utils/cpufreq-info.c:181 | ||
288 | #, c-format | ||
289 | msgid " Pstate-Pb%d: %luMHz (boost state)\n" | ||
290 | msgstr "" | ||
291 | |||
292 | #: utils/cpufreq-info.c:184 | ||
293 | #, c-format | ||
294 | msgid " Pstate-P%d: %luMHz\n" | ||
295 | msgstr "" | ||
296 | |||
297 | #: utils/cpufreq-info.c:211 | ||
298 | #, c-format | ||
299 | msgid " no or unknown cpufreq driver is active on this CPU\n" | ||
300 | msgstr " pro tento CPU nenà aktivnà žádný známý ovladaÄ cpufreq\n" | ||
301 | |||
302 | #: utils/cpufreq-info.c:213 | ||
303 | #, c-format | ||
304 | msgid " driver: %s\n" | ||
305 | msgstr " ovladaÄ: %s\n" | ||
306 | |||
307 | #: utils/cpufreq-info.c:219 | ||
308 | #, fuzzy, c-format | ||
309 | msgid " CPUs which run at the same hardware frequency: " | ||
310 | msgstr " CPU, které musà měnit frekvenci zároveň: " | ||
311 | |||
312 | #: utils/cpufreq-info.c:230 | ||
313 | #, fuzzy, c-format | ||
314 | msgid " CPUs which need to have their frequency coordinated by software: " | ||
315 | msgstr " CPU, které musà měnit frekvenci zároveň: " | ||
316 | |||
317 | #: utils/cpufreq-info.c:241 | ||
318 | #, c-format | ||
319 | msgid " maximum transition latency: " | ||
320 | msgstr "" | ||
321 | |||
322 | #: utils/cpufreq-info.c:247 | ||
323 | #, c-format | ||
324 | msgid " hardware limits: " | ||
325 | msgstr " hardwarové meze: " | ||
326 | |||
327 | #: utils/cpufreq-info.c:256 | ||
328 | #, c-format | ||
329 | msgid " available frequency steps: " | ||
330 | msgstr " dostupné frekvence: " | ||
331 | |||
332 | #: utils/cpufreq-info.c:269 | ||
333 | #, c-format | ||
334 | msgid " available cpufreq governors: " | ||
335 | msgstr " dostupné regulátory: " | ||
336 | |||
337 | #: utils/cpufreq-info.c:280 | ||
338 | #, c-format | ||
339 | msgid " current policy: frequency should be within " | ||
340 | msgstr " souÄasná taktika: frekvence by mÄ›la být mezi " | ||
341 | |||
342 | #: utils/cpufreq-info.c:282 | ||
343 | #, c-format | ||
344 | msgid " and " | ||
345 | msgstr " a " | ||
346 | |||
347 | #: utils/cpufreq-info.c:286 | ||
348 | #, c-format | ||
349 | msgid "" | ||
350 | "The governor \"%s\" may decide which speed to use\n" | ||
351 | " within this range.\n" | ||
352 | msgstr "" | ||
353 | " Regulátor \"%s\" může rozhodnout jakou frekvenci použÃt\n" | ||
354 | " v tÄ›chto mezÃch.\n" | ||
355 | |||
356 | #: utils/cpufreq-info.c:293 | ||
357 | #, c-format | ||
358 | msgid " current CPU frequency is " | ||
359 | msgstr " souÄasná frekvence CPU je " | ||
360 | |||
361 | #: utils/cpufreq-info.c:296 | ||
362 | #, c-format | ||
363 | msgid " (asserted by call to hardware)" | ||
364 | msgstr " (zjiÅ¡tÄ›no hardwarovým volánÃm)" | ||
365 | |||
366 | #: utils/cpufreq-info.c:304 | ||
367 | #, c-format | ||
368 | msgid " cpufreq stats: " | ||
369 | msgstr " statistika cpufreq: " | ||
370 | |||
371 | #: utils/cpufreq-info.c:472 | ||
372 | #, fuzzy, c-format | ||
373 | msgid "Usage: cpupower freqinfo [options]\n" | ||
374 | msgstr "UžitÃ: cpufreq-info [pÅ™epÃnaÄe]\n" | ||
375 | |||
376 | #: utils/cpufreq-info.c:473 utils/cpufreq-set.c:26 utils/cpupower-set.c:23 | ||
377 | #: utils/cpupower-info.c:22 utils/cpuidle-info.c:148 | ||
378 | #, c-format | ||
379 | msgid "Options:\n" | ||
380 | msgstr "PÅ™epÃnaÄe:\n" | ||
381 | |||
382 | #: utils/cpufreq-info.c:474 | ||
383 | #, fuzzy, c-format | ||
384 | msgid " -e, --debug Prints out debug information [default]\n" | ||
385 | msgstr " -e, --debug VypÃÅ¡e ladicà informace\n" | ||
386 | |||
387 | #: utils/cpufreq-info.c:475 | ||
388 | #, c-format | ||
389 | msgid "" | ||
390 | " -f, --freq Get frequency the CPU currently runs at, according\n" | ||
391 | " to the cpufreq core *\n" | ||
392 | msgstr "" | ||
393 | " -f, --freq Zjistà aktuálnà frekvenci, na které CPU běžÃ\n" | ||
394 | " podle cpufreq *\n" | ||
395 | |||
396 | #: utils/cpufreq-info.c:477 | ||
397 | #, c-format | ||
398 | msgid "" | ||
399 | " -w, --hwfreq Get frequency the CPU currently runs at, by reading\n" | ||
400 | " it from hardware (only available to root) *\n" | ||
401 | msgstr "" | ||
402 | " -w, --hwfreq Zjistà aktuálnà frekvenci, na které CPU běžÃ\n" | ||
403 | " z hardware (dostupné jen uživateli root) *\n" | ||
404 | |||
405 | #: utils/cpufreq-info.c:479 | ||
406 | #, c-format | ||
407 | msgid "" | ||
408 | " -l, --hwlimits Determine the minimum and maximum CPU frequency " | ||
409 | "allowed *\n" | ||
410 | msgstr "" | ||
411 | " -l, --hwlimits Zjistà minimálnà a maximálnà dostupnou frekvenci CPU " | ||
412 | "*\n" | ||
413 | |||
414 | #: utils/cpufreq-info.c:480 | ||
415 | #, c-format | ||
416 | msgid " -d, --driver Determines the used cpufreq kernel driver *\n" | ||
417 | msgstr " -d, --driver Zjistà aktivnà ovladaÄ cpufreq *\n" | ||
418 | |||
419 | #: utils/cpufreq-info.c:481 | ||
420 | #, c-format | ||
421 | msgid " -p, --policy Gets the currently used cpufreq policy *\n" | ||
422 | msgstr " -p, --policy Zjistà aktuálnà taktiku cpufreq *\n" | ||
423 | |||
424 | #: utils/cpufreq-info.c:482 | ||
425 | #, c-format | ||
426 | msgid " -g, --governors Determines available cpufreq governors *\n" | ||
427 | msgstr " -g, --governors Zjistà dostupné regulátory cpufreq *\n" | ||
428 | |||
429 | #: utils/cpufreq-info.c:483 | ||
430 | #, fuzzy, c-format | ||
431 | msgid "" | ||
432 | " -r, --related-cpus Determines which CPUs run at the same hardware " | ||
433 | "frequency *\n" | ||
434 | msgstr "" | ||
435 | " -a, --affected-cpus ZjistÃ, které CPU musà mÄ›nit frekvenci zároveň *\n" | ||
436 | |||
437 | #: utils/cpufreq-info.c:484 | ||
438 | #, fuzzy, c-format | ||
439 | msgid "" | ||
440 | " -a, --affected-cpus Determines which CPUs need to have their frequency\n" | ||
441 | " coordinated by software *\n" | ||
442 | msgstr "" | ||
443 | " -a, --affected-cpus ZjistÃ, které CPU musà mÄ›nit frekvenci zároveň *\n" | ||
444 | |||
445 | #: utils/cpufreq-info.c:486 | ||
446 | #, c-format | ||
447 | msgid " -s, --stats Shows cpufreq statistics if available\n" | ||
448 | msgstr " -s, --stats Zobrazà statistiku cpufreq, je-li dostupná\n" | ||
449 | |||
450 | #: utils/cpufreq-info.c:487 | ||
451 | #, fuzzy, c-format | ||
452 | msgid "" | ||
453 | " -y, --latency Determines the maximum latency on CPU frequency " | ||
454 | "changes *\n" | ||
455 | msgstr "" | ||
456 | " -l, --hwlimits Zjistà minimálnà a maximálnà dostupnou frekvenci CPU " | ||
457 | "*\n" | ||
458 | |||
459 | #: utils/cpufreq-info.c:488 | ||
460 | #, c-format | ||
461 | msgid " -b, --boost Checks for turbo or boost modes *\n" | ||
462 | msgstr "" | ||
463 | |||
464 | #: utils/cpufreq-info.c:489 | ||
465 | #, c-format | ||
466 | msgid "" | ||
467 | " -o, --proc Prints out information like provided by the /proc/" | ||
468 | "cpufreq\n" | ||
469 | " interface in 2.4. and early 2.6. kernels\n" | ||
470 | msgstr "" | ||
471 | " -o, --proc VypÃÅ¡e informace ve formátu, jaký použÃvalo rozhranÃ\n" | ||
472 | " /proc/cpufreq v kernelech Å™ady 2.4 a Äasné 2.6\n" | ||
473 | |||
474 | #: utils/cpufreq-info.c:491 | ||
475 | #, fuzzy, c-format | ||
476 | msgid "" | ||
477 | " -m, --human human-readable output for the -f, -w, -s and -y " | ||
478 | "parameters\n" | ||
479 | msgstr "" | ||
480 | " -m, --human Výstup parametrů -f, -w a -s v „lidmi Äitelném“ " | ||
481 | "formátu\n" | ||
482 | |||
483 | #: utils/cpufreq-info.c:492 utils/cpuidle-info.c:152 | ||
484 | #, c-format | ||
485 | msgid " -h, --help Prints out this screen\n" | ||
486 | msgstr " -h, --help VypÃÅ¡e tuto nápovÄ›du\n" | ||
487 | |||
488 | #: utils/cpufreq-info.c:495 | ||
489 | #, c-format | ||
490 | msgid "" | ||
491 | "If no argument or only the -c, --cpu parameter is given, debug output about\n" | ||
492 | "cpufreq is printed which is useful e.g. for reporting bugs.\n" | ||
493 | msgstr "" | ||
494 | "NenÃ-li zadán žádný parametr nebo je-li zadán pouze pÅ™epÃnaÄ -c, --cpu, " | ||
495 | "jsou\n" | ||
496 | "vypsány ladicà informace, což může být užiteÄné napÅ™Ãklad pÅ™i hlášenà chyb.\n" | ||
497 | |||
498 | #: utils/cpufreq-info.c:497 | ||
499 | #, c-format | ||
500 | msgid "" | ||
501 | "For the arguments marked with *, omitting the -c or --cpu argument is\n" | ||
502 | "equivalent to setting it to zero\n" | ||
503 | msgstr "" | ||
504 | "NenÃ-li pÅ™i použità pÅ™epÃnaÄů oznaÄených * zadán parametr -c nebo --cpu,\n" | ||
505 | "předpokládá se jeho hodnota 0.\n" | ||
506 | |||
507 | #: utils/cpufreq-info.c:580 | ||
508 | #, c-format | ||
509 | msgid "" | ||
510 | "The argument passed to this tool can't be combined with passing a --cpu " | ||
511 | "argument\n" | ||
512 | msgstr "Zadaný parametr nemůže být použit zároveň s pÅ™epÃnaÄem -c nebo --cpu\n" | ||
513 | |||
514 | #: utils/cpufreq-info.c:596 | ||
515 | #, c-format | ||
516 | msgid "" | ||
517 | "You can't specify more than one --cpu parameter and/or\n" | ||
518 | "more than one output-specific argument\n" | ||
519 | msgstr "" | ||
520 | "Nelze zadat vÃce než jeden parametr -c nebo --cpu\n" | ||
521 | "anebo vÃce než jeden parametr urÄujÃcà výstup\n" | ||
522 | |||
523 | #: utils/cpufreq-info.c:600 utils/cpufreq-set.c:82 utils/cpupower-set.c:42 | ||
524 | #: utils/cpupower-info.c:42 utils/cpuidle-info.c:213 | ||
525 | #, c-format | ||
526 | msgid "invalid or unknown argument\n" | ||
527 | msgstr "neplatný nebo neznámý parametr\n" | ||
528 | |||
529 | #: utils/cpufreq-info.c:617 | ||
530 | #, c-format | ||
531 | msgid "couldn't analyze CPU %d as it doesn't seem to be present\n" | ||
532 | msgstr "nelze analyzovat CPU %d, vypadá to, že nenà pÅ™Ãtomen\n" | ||
533 | |||
534 | #: utils/cpufreq-info.c:620 utils/cpupower-info.c:142 | ||
535 | #, c-format | ||
536 | msgid "analyzing CPU %d:\n" | ||
537 | msgstr "analyzuji CPU %d:\n" | ||
538 | |||
539 | #: utils/cpufreq-set.c:25 | ||
540 | #, fuzzy, c-format | ||
541 | msgid "Usage: cpupower frequency-set [options]\n" | ||
542 | msgstr "UžitÃ: cpufreq-set [pÅ™epÃnaÄe]\n" | ||
543 | |||
544 | #: utils/cpufreq-set.c:27 | ||
545 | #, c-format | ||
546 | msgid "" | ||
547 | " -d FREQ, --min FREQ new minimum CPU frequency the governor may " | ||
548 | "select\n" | ||
549 | msgstr "" | ||
550 | " -d FREQ, --min FREQ Nová nejnižšà frekvence, kterou může regulátor " | ||
551 | "vybrat\n" | ||
552 | |||
553 | #: utils/cpufreq-set.c:28 | ||
554 | #, c-format | ||
555 | msgid "" | ||
556 | " -u FREQ, --max FREQ new maximum CPU frequency the governor may " | ||
557 | "select\n" | ||
558 | msgstr "" | ||
559 | " -u FREQ, --max FREQ Nová nejvyššà frekvence, kterou může regulátor " | ||
560 | "zvolit\n" | ||
561 | |||
562 | #: utils/cpufreq-set.c:29 | ||
563 | #, c-format | ||
564 | msgid " -g GOV, --governor GOV new cpufreq governor\n" | ||
565 | msgstr " -g GOV, --governors GOV Nový regulátor cpufreq\n" | ||
566 | |||
567 | #: utils/cpufreq-set.c:30 | ||
568 | #, c-format | ||
569 | msgid "" | ||
570 | " -f FREQ, --freq FREQ specific frequency to be set. Requires userspace\n" | ||
571 | " governor to be available and loaded\n" | ||
572 | msgstr "" | ||
573 | " -f FREQ, --freq FREQ Frekvence, která má být nastavena. Vyžaduje, aby " | ||
574 | "byl\n" | ||
575 | " v jádře nahrán regulátor ‚userspace‘.\n" | ||
576 | |||
577 | #: utils/cpufreq-set.c:32 | ||
578 | #, c-format | ||
579 | msgid " -r, --related Switches all hardware-related CPUs\n" | ||
580 | msgstr "" | ||
581 | |||
582 | #: utils/cpufreq-set.c:33 utils/cpupower-set.c:28 utils/cpupower-info.c:27 | ||
583 | #, fuzzy, c-format | ||
584 | msgid " -h, --help Prints out this screen\n" | ||
585 | msgstr " -h, --help VypÃÅ¡e tuto nápovÄ›du\n" | ||
586 | |||
587 | #: utils/cpufreq-set.c:35 | ||
588 | #, fuzzy, c-format | ||
589 | msgid "" | ||
590 | "Notes:\n" | ||
591 | "1. Omitting the -c or --cpu argument is equivalent to setting it to \"all\"\n" | ||
592 | msgstr "" | ||
593 | "NenÃ-li pÅ™i použità pÅ™epÃnaÄů oznaÄených * zadán parametr -c nebo --cpu,\n" | ||
594 | "předpokládá se jeho hodnota 0.\n" | ||
595 | |||
596 | #: utils/cpufreq-set.c:37 | ||
597 | #, fuzzy, c-format | ||
598 | msgid "" | ||
599 | "2. The -f FREQ, --freq FREQ parameter cannot be combined with any other " | ||
600 | "parameter\n" | ||
601 | " except the -c CPU, --cpu CPU parameter\n" | ||
602 | "3. FREQuencies can be passed in Hz, kHz (default), MHz, GHz, or THz\n" | ||
603 | " by postfixing the value with the wanted unit name, without any space\n" | ||
604 | " (FREQuency in kHz =^ Hz * 0.001 =^ MHz * 1000 =^ GHz * 1000000).\n" | ||
605 | msgstr "" | ||
606 | "Poznámky:\n" | ||
607 | "1. Vynechánà parametru -c nebo --cpu je ekvivalentnà jeho nastavenà na 0\n" | ||
608 | "2. PÅ™epÃnaÄ -f nebo --freq nemůže být použit zároveň s žádným jiným vyjma -" | ||
609 | "c\n" | ||
610 | " nebo --cpu\n" | ||
611 | "3. Frekvence (FREQ) mohou být zadány v Hz, kHz (výchozÃ), MHz, GHz nebo THz\n" | ||
612 | " pÅ™ipojenÃm názvu jednotky bez mezery mezi ÄÃslem a jednotkou\n" | ||
613 | " (FREQ v kHz =^ Hz * 0,001 = ^ MHz * 1000 =^ GHz * 1000000)\n" | ||
614 | |||
615 | #: utils/cpufreq-set.c:57 | ||
616 | #, c-format | ||
617 | msgid "" | ||
618 | "Error setting new values. Common errors:\n" | ||
619 | "- Do you have proper administration rights? (super-user?)\n" | ||
620 | "- Is the governor you requested available and modprobed?\n" | ||
621 | "- Trying to set an invalid policy?\n" | ||
622 | "- Trying to set a specific frequency, but userspace governor is not " | ||
623 | "available,\n" | ||
624 | " for example because of hardware which cannot be set to a specific " | ||
625 | "frequency\n" | ||
626 | " or because the userspace governor isn't loaded?\n" | ||
627 | msgstr "" | ||
628 | "Chyba při nastavovánà nových hodnot. Obvyklé problémy:\n" | ||
629 | "- Máte patÅ™iÄná administrátorská práva? (root?)\n" | ||
630 | "- Je požadovaný regulátor dostupný v jádře? (modprobe?)\n" | ||
631 | "- SnažÃte se nastavit neplatnou taktiku?\n" | ||
632 | "- SnažÃte se nastavit urÄitou frekvenci, ale nenà dostupný\n" | ||
633 | " regulátor ‚userspace‘, napÅ™Ãklad protože nenà nahrán v jádÅ™e,\n" | ||
634 | " nebo nelze na tomto hardware nastavit urÄitou frekvenci?\n" | ||
635 | |||
636 | #: utils/cpufreq-set.c:170 | ||
637 | #, c-format | ||
638 | msgid "wrong, unknown or unhandled CPU?\n" | ||
639 | msgstr "neznámý nebo nepodporovaný CPU?\n" | ||
640 | |||
641 | #: utils/cpufreq-set.c:302 | ||
642 | #, c-format | ||
643 | msgid "" | ||
644 | "the -f/--freq parameter cannot be combined with -d/--min, -u/--max or\n" | ||
645 | "-g/--governor parameters\n" | ||
646 | msgstr "" | ||
647 | "pÅ™epÃnaÄ -f/--freq nemůže být použit zároveň\n" | ||
648 | "s pÅ™epÃnaÄem -d/--min, -u/--max nebo -g/--governor\n" | ||
649 | |||
650 | #: utils/cpufreq-set.c:308 | ||
651 | #, c-format | ||
652 | msgid "" | ||
653 | "At least one parameter out of -f/--freq, -d/--min, -u/--max, and\n" | ||
654 | "-g/--governor must be passed\n" | ||
655 | msgstr "" | ||
656 | "Musà být zadán alespoň jeden pÅ™epÃnaÄ\n" | ||
657 | "-f/--freq, -d/--min, -u/--max nebo -g/--governor\n" | ||
658 | |||
659 | #: utils/cpufreq-set.c:347 | ||
660 | #, c-format | ||
661 | msgid "Setting cpu: %d\n" | ||
662 | msgstr "" | ||
663 | |||
664 | #: utils/cpupower-set.c:22 | ||
665 | #, c-format | ||
666 | msgid "Usage: cpupower set [ -b val ] [ -m val ] [ -s val ]\n" | ||
667 | msgstr "" | ||
668 | |||
669 | #: utils/cpupower-set.c:24 | ||
670 | #, c-format | ||
671 | msgid "" | ||
672 | " -b, --perf-bias [VAL] Sets CPU's power vs performance policy on some\n" | ||
673 | " Intel models [0-15], see manpage for details\n" | ||
674 | msgstr "" | ||
675 | |||
676 | #: utils/cpupower-set.c:26 | ||
677 | #, c-format | ||
678 | msgid "" | ||
679 | " -m, --sched-mc [VAL] Sets the kernel's multi core scheduler policy.\n" | ||
680 | msgstr "" | ||
681 | |||
682 | #: utils/cpupower-set.c:27 | ||
683 | #, c-format | ||
684 | msgid "" | ||
685 | " -s, --sched-smt [VAL] Sets the kernel's thread sibling scheduler " | ||
686 | "policy.\n" | ||
687 | msgstr "" | ||
688 | |||
689 | #: utils/cpupower-set.c:80 | ||
690 | #, c-format | ||
691 | msgid "--perf-bias param out of range [0-%d]\n" | ||
692 | msgstr "" | ||
693 | |||
694 | #: utils/cpupower-set.c:91 | ||
695 | #, c-format | ||
696 | msgid "--sched-mc param out of range [0-%d]\n" | ||
697 | msgstr "" | ||
698 | |||
699 | #: utils/cpupower-set.c:102 | ||
700 | #, c-format | ||
701 | msgid "--sched-smt param out of range [0-%d]\n" | ||
702 | msgstr "" | ||
703 | |||
704 | #: utils/cpupower-set.c:121 | ||
705 | #, c-format | ||
706 | msgid "Error setting sched-mc %s\n" | ||
707 | msgstr "" | ||
708 | |||
709 | #: utils/cpupower-set.c:127 | ||
710 | #, c-format | ||
711 | msgid "Error setting sched-smt %s\n" | ||
712 | msgstr "" | ||
713 | |||
714 | #: utils/cpupower-set.c:146 | ||
715 | #, c-format | ||
716 | msgid "Error setting perf-bias value on CPU %d\n" | ||
717 | msgstr "" | ||
718 | |||
719 | #: utils/cpupower-info.c:21 | ||
720 | #, c-format | ||
721 | msgid "Usage: cpupower info [ -b ] [ -m ] [ -s ]\n" | ||
722 | msgstr "" | ||
723 | |||
724 | #: utils/cpupower-info.c:23 | ||
725 | #, c-format | ||
726 | msgid "" | ||
727 | " -b, --perf-bias Gets CPU's power vs performance policy on some\n" | ||
728 | " Intel models [0-15], see manpage for details\n" | ||
729 | msgstr "" | ||
730 | |||
731 | #: utils/cpupower-info.c:25 | ||
732 | #, fuzzy, c-format | ||
733 | msgid " -m, --sched-mc Gets the kernel's multi core scheduler policy.\n" | ||
734 | msgstr " -p, --policy Zjistà aktuálnà taktiku cpufreq *\n" | ||
735 | |||
736 | #: utils/cpupower-info.c:26 | ||
737 | #, c-format | ||
738 | msgid "" | ||
739 | " -s, --sched-smt Gets the kernel's thread sibling scheduler policy.\n" | ||
740 | msgstr "" | ||
741 | |||
742 | #: utils/cpupower-info.c:28 | ||
743 | #, c-format | ||
744 | msgid "" | ||
745 | "\n" | ||
746 | "Passing no option will show all info, by default only on core 0\n" | ||
747 | msgstr "" | ||
748 | |||
749 | #: utils/cpupower-info.c:102 | ||
750 | #, c-format | ||
751 | msgid "System's multi core scheduler setting: " | ||
752 | msgstr "" | ||
753 | |||
754 | #. if sysfs file is missing it's: errno == ENOENT | ||
755 | #: utils/cpupower-info.c:105 utils/cpupower-info.c:114 | ||
756 | #, c-format | ||
757 | msgid "not supported\n" | ||
758 | msgstr "" | ||
759 | |||
760 | #: utils/cpupower-info.c:111 | ||
761 | #, c-format | ||
762 | msgid "System's thread sibling scheduler setting: " | ||
763 | msgstr "" | ||
764 | |||
765 | #: utils/cpupower-info.c:126 | ||
766 | #, c-format | ||
767 | msgid "Intel's performance bias setting needs root privileges\n" | ||
768 | msgstr "" | ||
769 | |||
770 | #: utils/cpupower-info.c:128 | ||
771 | #, c-format | ||
772 | msgid "System does not support Intel's performance bias setting\n" | ||
773 | msgstr "" | ||
774 | |||
775 | #: utils/cpupower-info.c:147 | ||
776 | #, c-format | ||
777 | msgid "Could not read perf-bias value\n" | ||
778 | msgstr "" | ||
779 | |||
780 | #: utils/cpupower-info.c:150 | ||
781 | #, c-format | ||
782 | msgid "perf-bias: %d\n" | ||
783 | msgstr "" | ||
784 | |||
785 | #: utils/cpuidle-info.c:28 | ||
786 | #, fuzzy, c-format | ||
787 | msgid "Analyzing CPU %d:\n" | ||
788 | msgstr "analyzuji CPU %d:\n" | ||
789 | |||
790 | #: utils/cpuidle-info.c:32 | ||
791 | #, c-format | ||
792 | msgid "CPU %u: No idle states\n" | ||
793 | msgstr "" | ||
794 | |||
795 | #: utils/cpuidle-info.c:36 | ||
796 | #, c-format | ||
797 | msgid "CPU %u: Can't read idle state info\n" | ||
798 | msgstr "" | ||
799 | |||
800 | #: utils/cpuidle-info.c:41 | ||
801 | #, c-format | ||
802 | msgid "Could not determine max idle state %u\n" | ||
803 | msgstr "" | ||
804 | |||
805 | #: utils/cpuidle-info.c:46 | ||
806 | #, c-format | ||
807 | msgid "Number of idle states: %d\n" | ||
808 | msgstr "" | ||
809 | |||
810 | #: utils/cpuidle-info.c:48 | ||
811 | #, fuzzy, c-format | ||
812 | msgid "Available idle states:" | ||
813 | msgstr " dostupné frekvence: " | ||
814 | |||
815 | #: utils/cpuidle-info.c:71 | ||
816 | #, c-format | ||
817 | msgid "Flags/Description: %s\n" | ||
818 | msgstr "" | ||
819 | |||
820 | #: utils/cpuidle-info.c:74 | ||
821 | #, c-format | ||
822 | msgid "Latency: %lu\n" | ||
823 | msgstr "" | ||
824 | |||
825 | #: utils/cpuidle-info.c:76 | ||
826 | #, c-format | ||
827 | msgid "Usage: %lu\n" | ||
828 | msgstr "" | ||
829 | |||
830 | #: utils/cpuidle-info.c:78 | ||
831 | #, c-format | ||
832 | msgid "Duration: %llu\n" | ||
833 | msgstr "" | ||
834 | |||
835 | #: utils/cpuidle-info.c:90 | ||
836 | #, c-format | ||
837 | msgid "Could not determine cpuidle driver\n" | ||
838 | msgstr "" | ||
839 | |||
840 | #: utils/cpuidle-info.c:94 | ||
841 | #, fuzzy, c-format | ||
842 | msgid "CPUidle driver: %s\n" | ||
843 | msgstr " ovladaÄ: %s\n" | ||
844 | |||
845 | #: utils/cpuidle-info.c:99 | ||
846 | #, c-format | ||
847 | msgid "Could not determine cpuidle governor\n" | ||
848 | msgstr "" | ||
849 | |||
850 | #: utils/cpuidle-info.c:103 | ||
851 | #, c-format | ||
852 | msgid "CPUidle governor: %s\n" | ||
853 | msgstr "" | ||
854 | |||
855 | #: utils/cpuidle-info.c:122 | ||
856 | #, c-format | ||
857 | msgid "CPU %u: Can't read C-state info\n" | ||
858 | msgstr "" | ||
859 | |||
860 | #. printf("Cstates: %d\n", cstates); | ||
861 | #: utils/cpuidle-info.c:127 | ||
862 | #, c-format | ||
863 | msgid "active state: C0\n" | ||
864 | msgstr "" | ||
865 | |||
866 | #: utils/cpuidle-info.c:128 | ||
867 | #, c-format | ||
868 | msgid "max_cstate: C%u\n" | ||
869 | msgstr "" | ||
870 | |||
871 | #: utils/cpuidle-info.c:129 | ||
872 | #, c-format | ||
873 | msgid "maximum allowed latency: %lu usec\n" | ||
874 | msgstr "" | ||
875 | |||
876 | #: utils/cpuidle-info.c:130 | ||
877 | #, c-format | ||
878 | msgid "states:\t\n" | ||
879 | msgstr "" | ||
880 | |||
881 | #: utils/cpuidle-info.c:132 | ||
882 | #, c-format | ||
883 | msgid " C%d: type[C%d] " | ||
884 | msgstr "" | ||
885 | |||
886 | #: utils/cpuidle-info.c:134 | ||
887 | #, c-format | ||
888 | msgid "promotion[--] demotion[--] " | ||
889 | msgstr "" | ||
890 | |||
891 | #: utils/cpuidle-info.c:135 | ||
892 | #, c-format | ||
893 | msgid "latency[%03lu] " | ||
894 | msgstr "" | ||
895 | |||
896 | #: utils/cpuidle-info.c:137 | ||
897 | #, c-format | ||
898 | msgid "usage[%08lu] " | ||
899 | msgstr "" | ||
900 | |||
901 | #: utils/cpuidle-info.c:139 | ||
902 | #, c-format | ||
903 | msgid "duration[%020Lu] \n" | ||
904 | msgstr "" | ||
905 | |||
906 | #: utils/cpuidle-info.c:147 | ||
907 | #, fuzzy, c-format | ||
908 | msgid "Usage: cpupower idleinfo [options]\n" | ||
909 | msgstr "UžitÃ: cpufreq-info [pÅ™epÃnaÄe]\n" | ||
910 | |||
911 | #: utils/cpuidle-info.c:149 | ||
912 | #, fuzzy, c-format | ||
913 | msgid " -s, --silent Only show general C-state information\n" | ||
914 | msgstr " -e, --debug VypÃÅ¡e ladicà informace\n" | ||
915 | |||
916 | #: utils/cpuidle-info.c:150 | ||
917 | #, fuzzy, c-format | ||
918 | msgid "" | ||
919 | " -o, --proc Prints out information like provided by the /proc/" | ||
920 | "acpi/processor/*/power\n" | ||
921 | " interface in older kernels\n" | ||
922 | msgstr "" | ||
923 | " -o, --proc VypÃÅ¡e informace ve formátu, jaký použÃvalo rozhranÃ\n" | ||
924 | " /proc/cpufreq v kernelech Å™ady 2.4 a Äasné 2.6\n" | ||
925 | |||
926 | #: utils/cpuidle-info.c:209 | ||
927 | #, fuzzy, c-format | ||
928 | msgid "You can't specify more than one output-specific argument\n" | ||
929 | msgstr "" | ||
930 | "Nelze zadat vÃce než jeden parametr -c nebo --cpu\n" | ||
931 | "anebo vÃce než jeden parametr urÄujÃcà výstup\n" | ||
932 | |||
933 | #~ msgid "" | ||
934 | #~ " -c CPU, --cpu CPU CPU number which information shall be determined " | ||
935 | #~ "about\n" | ||
936 | #~ msgstr "" | ||
937 | #~ " -c CPU, --cpu CPU ÄŒÃslo CPU, o kterém se majà zjistit informace\n" | ||
938 | |||
939 | #~ msgid "" | ||
940 | #~ " -c CPU, --cpu CPU number of CPU where cpufreq settings shall be " | ||
941 | #~ "modified\n" | ||
942 | #~ msgstr "" | ||
943 | #~ " -c CPU, --cpu CPU ÄŒÃslo CPU pro který se má provést nastavenà " | ||
944 | #~ "cpufreq\n" | ||
diff --git a/tools/power/cpupower/po/de.po b/tools/power/cpupower/po/de.po new file mode 100644 index 00000000000..78c09e51663 --- /dev/null +++ b/tools/power/cpupower/po/de.po | |||
@@ -0,0 +1,961 @@ | |||
1 | # German translations for cpufrequtils package | ||
2 | # German messages for cpufrequtils. | ||
3 | # Copyright (C) 2004-2009 Dominik Brodowski <linux@dominikbrodowski.net> | ||
4 | # This file is distributed under the same license as the cpufrequtils package. | ||
5 | # | ||
6 | msgid "" | ||
7 | msgstr "" | ||
8 | "Project-Id-Version: cpufrequtils 006\n" | ||
9 | "Report-Msgid-Bugs-To: \n" | ||
10 | "POT-Creation-Date: 2011-03-08 17:03+0100\n" | ||
11 | "PO-Revision-Date: 2009-08-08 17:18+0100\n" | ||
12 | "Last-Translator: <linux@dominikbrodowski.net>\n" | ||
13 | "Language-Team: NONE\n" | ||
14 | "Language: \n" | ||
15 | "MIME-Version: 1.0\n" | ||
16 | "Content-Type: text/plain; charset=ISO-8859-1\n" | ||
17 | "Content-Transfer-Encoding: 8bit\n" | ||
18 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" | ||
19 | |||
20 | #: utils/idle_monitor/nhm_idle.c:36 | ||
21 | msgid "Processor Core C3" | ||
22 | msgstr "" | ||
23 | |||
24 | #: utils/idle_monitor/nhm_idle.c:43 | ||
25 | msgid "Processor Core C6" | ||
26 | msgstr "" | ||
27 | |||
28 | #: utils/idle_monitor/nhm_idle.c:51 | ||
29 | msgid "Processor Package C3" | ||
30 | msgstr "" | ||
31 | |||
32 | #: utils/idle_monitor/nhm_idle.c:58 utils/idle_monitor/amd_fam14h_idle.c:70 | ||
33 | msgid "Processor Package C6" | ||
34 | msgstr "" | ||
35 | |||
36 | #: utils/idle_monitor/snb_idle.c:33 | ||
37 | msgid "Processor Core C7" | ||
38 | msgstr "" | ||
39 | |||
40 | #: utils/idle_monitor/snb_idle.c:40 | ||
41 | msgid "Processor Package C2" | ||
42 | msgstr "" | ||
43 | |||
44 | #: utils/idle_monitor/snb_idle.c:47 | ||
45 | msgid "Processor Package C7" | ||
46 | msgstr "" | ||
47 | |||
48 | #: utils/idle_monitor/amd_fam14h_idle.c:56 | ||
49 | msgid "Package in sleep state (PC1 or deeper)" | ||
50 | msgstr "" | ||
51 | |||
52 | #: utils/idle_monitor/amd_fam14h_idle.c:63 | ||
53 | msgid "Processor Package C1" | ||
54 | msgstr "" | ||
55 | |||
56 | #: utils/idle_monitor/amd_fam14h_idle.c:77 | ||
57 | msgid "North Bridge P1 boolean counter (returns 0 or 1)" | ||
58 | msgstr "" | ||
59 | |||
60 | #: utils/idle_monitor/mperf_monitor.c:35 | ||
61 | msgid "Processor Core not idle" | ||
62 | msgstr "" | ||
63 | |||
64 | #: utils/idle_monitor/mperf_monitor.c:42 | ||
65 | msgid "Processor Core in an idle state" | ||
66 | msgstr "" | ||
67 | |||
68 | #: utils/idle_monitor/mperf_monitor.c:50 | ||
69 | msgid "Average Frequency (including boost) in MHz" | ||
70 | msgstr "" | ||
71 | |||
72 | #: utils/idle_monitor/cpupower-monitor.c:66 | ||
73 | #, c-format | ||
74 | msgid "" | ||
75 | "cpupower monitor: [-h] [ [-t] | [-l] | [-m <mon1>,[<mon2>] ] ] [-i " | ||
76 | "interval_sec | -c command ...]\n" | ||
77 | msgstr "" | ||
78 | |||
79 | #: utils/idle_monitor/cpupower-monitor.c:69 | ||
80 | #, c-format | ||
81 | msgid "" | ||
82 | "cpupower monitor: [-v] [-h] [ [-t] | [-l] | [-m <mon1>,[<mon2>] ] ] [-i " | ||
83 | "interval_sec | -c command ...]\n" | ||
84 | msgstr "" | ||
85 | |||
86 | #: utils/idle_monitor/cpupower-monitor.c:71 | ||
87 | #, c-format | ||
88 | msgid "\t -v: be more verbose\n" | ||
89 | msgstr "" | ||
90 | |||
91 | #: utils/idle_monitor/cpupower-monitor.c:73 | ||
92 | #, c-format | ||
93 | msgid "\t -h: print this help\n" | ||
94 | msgstr "" | ||
95 | |||
96 | #: utils/idle_monitor/cpupower-monitor.c:74 | ||
97 | #, c-format | ||
98 | msgid "\t -i: time intervall to measure for in seconds (default 1)\n" | ||
99 | msgstr "" | ||
100 | |||
101 | #: utils/idle_monitor/cpupower-monitor.c:75 | ||
102 | #, c-format | ||
103 | msgid "\t -t: show CPU topology/hierarchy\n" | ||
104 | msgstr "" | ||
105 | |||
106 | #: utils/idle_monitor/cpupower-monitor.c:76 | ||
107 | #, c-format | ||
108 | msgid "\t -l: list available CPU sleep monitors (for use with -m)\n" | ||
109 | msgstr "" | ||
110 | |||
111 | #: utils/idle_monitor/cpupower-monitor.c:77 | ||
112 | #, c-format | ||
113 | msgid "\t -m: show specific CPU sleep monitors only (in same order)\n" | ||
114 | msgstr "" | ||
115 | |||
116 | #: utils/idle_monitor/cpupower-monitor.c:79 | ||
117 | #, c-format | ||
118 | msgid "" | ||
119 | "only one of: -t, -l, -m are allowed\n" | ||
120 | "If none of them is passed," | ||
121 | msgstr "" | ||
122 | |||
123 | #: utils/idle_monitor/cpupower-monitor.c:80 | ||
124 | #, c-format | ||
125 | msgid " all supported monitors are shown\n" | ||
126 | msgstr "" | ||
127 | |||
128 | #: utils/idle_monitor/cpupower-monitor.c:197 | ||
129 | #, c-format | ||
130 | msgid "Monitor %s, Counter %s has no count function. Implementation error\n" | ||
131 | msgstr "" | ||
132 | |||
133 | #: utils/idle_monitor/cpupower-monitor.c:207 | ||
134 | #, c-format | ||
135 | msgid " *is offline\n" | ||
136 | msgstr "" | ||
137 | |||
138 | #: utils/idle_monitor/cpupower-monitor.c:236 | ||
139 | #, c-format | ||
140 | msgid "%s: max monitor name length (%d) exceeded\n" | ||
141 | msgstr "" | ||
142 | |||
143 | #: utils/idle_monitor/cpupower-monitor.c:250 | ||
144 | #, c-format | ||
145 | msgid "No matching monitor found in %s, try -l option\n" | ||
146 | msgstr "" | ||
147 | |||
148 | #: utils/idle_monitor/cpupower-monitor.c:266 | ||
149 | #, c-format | ||
150 | msgid "Monitor \"%s\" (%d states) - Might overflow after %u s\n" | ||
151 | msgstr "" | ||
152 | |||
153 | #: utils/idle_monitor/cpupower-monitor.c:319 | ||
154 | #, c-format | ||
155 | msgid "%s took %.5f seconds and exited with status %d\n" | ||
156 | msgstr "" | ||
157 | |||
158 | #: utils/idle_monitor/cpupower-monitor.c:406 | ||
159 | #, c-format | ||
160 | msgid "Cannot read number of available processors\n" | ||
161 | msgstr "" | ||
162 | |||
163 | #: utils/idle_monitor/cpupower-monitor.c:417 | ||
164 | #, c-format | ||
165 | msgid "Available monitor %s needs root access\n" | ||
166 | msgstr "" | ||
167 | |||
168 | #: utils/idle_monitor/cpupower-monitor.c:428 | ||
169 | #, c-format | ||
170 | msgid "No HW Cstate monitors found\n" | ||
171 | msgstr "" | ||
172 | |||
173 | #: utils/cpupower.c:78 | ||
174 | #, c-format | ||
175 | msgid "cpupower [ -c cpulist ] subcommand [ARGS]\n" | ||
176 | msgstr "" | ||
177 | |||
178 | #: utils/cpupower.c:79 | ||
179 | #, c-format | ||
180 | msgid "cpupower --version\n" | ||
181 | msgstr "" | ||
182 | |||
183 | #: utils/cpupower.c:80 | ||
184 | #, c-format | ||
185 | msgid "Supported subcommands are:\n" | ||
186 | msgstr "" | ||
187 | |||
188 | #: utils/cpupower.c:83 | ||
189 | #, c-format | ||
190 | msgid "" | ||
191 | "\n" | ||
192 | "Some subcommands can make use of the -c cpulist option.\n" | ||
193 | msgstr "" | ||
194 | |||
195 | #: utils/cpupower.c:84 | ||
196 | #, c-format | ||
197 | msgid "Look at the general cpupower manpage how to use it\n" | ||
198 | msgstr "" | ||
199 | |||
200 | #: utils/cpupower.c:85 | ||
201 | #, c-format | ||
202 | msgid "and read up the subcommand's manpage whether it is supported.\n" | ||
203 | msgstr "" | ||
204 | |||
205 | #: utils/cpupower.c:86 | ||
206 | #, c-format | ||
207 | msgid "" | ||
208 | "\n" | ||
209 | "Use cpupower help subcommand for getting help for above subcommands.\n" | ||
210 | msgstr "" | ||
211 | |||
212 | #: utils/cpupower.c:91 | ||
213 | #, c-format | ||
214 | msgid "Report errors and bugs to %s, please.\n" | ||
215 | msgstr "Bitte melden Sie Fehler an %s.\n" | ||
216 | |||
217 | #: utils/cpupower.c:114 | ||
218 | #, c-format | ||
219 | msgid "Error parsing cpu list\n" | ||
220 | msgstr "" | ||
221 | |||
222 | #: utils/cpupower.c:172 | ||
223 | #, c-format | ||
224 | msgid "Subcommand %s needs root privileges\n" | ||
225 | msgstr "" | ||
226 | |||
227 | #: utils/cpufreq-info.c:31 | ||
228 | #, c-format | ||
229 | msgid "Couldn't count the number of CPUs (%s: %s), assuming 1\n" | ||
230 | msgstr "" | ||
231 | "Konnte nicht die Anzahl der CPUs herausfinden (%s : %s), nehme daher 1 an.\n" | ||
232 | |||
233 | #: utils/cpufreq-info.c:63 | ||
234 | #, c-format | ||
235 | msgid "" | ||
236 | " minimum CPU frequency - maximum CPU frequency - governor\n" | ||
237 | msgstr "" | ||
238 | " minimale CPU-Taktfreq. - maximale CPU-Taktfreq. - Regler \n" | ||
239 | |||
240 | #: utils/cpufreq-info.c:151 | ||
241 | #, c-format | ||
242 | msgid "Error while evaluating Boost Capabilities on CPU %d -- are you root?\n" | ||
243 | msgstr "" | ||
244 | |||
245 | #. P state changes via MSR are identified via cpuid 80000007 | ||
246 | #. on Intel and AMD, but we assume boost capable machines can do that | ||
247 | #. if (cpuid_eax(0x80000000) >= 0x80000007 | ||
248 | #. && (cpuid_edx(0x80000007) & (1 << 7))) | ||
249 | #. | ||
250 | #: utils/cpufreq-info.c:161 | ||
251 | #, c-format | ||
252 | msgid " boost state support: \n" | ||
253 | msgstr "" | ||
254 | |||
255 | #: utils/cpufreq-info.c:163 | ||
256 | #, c-format | ||
257 | msgid " Supported: %s\n" | ||
258 | msgstr "" | ||
259 | |||
260 | #: utils/cpufreq-info.c:163 utils/cpufreq-info.c:164 | ||
261 | msgid "yes" | ||
262 | msgstr "" | ||
263 | |||
264 | #: utils/cpufreq-info.c:163 utils/cpufreq-info.c:164 | ||
265 | msgid "no" | ||
266 | msgstr "" | ||
267 | |||
268 | #: utils/cpufreq-info.c:164 | ||
269 | #, fuzzy, c-format | ||
270 | msgid " Active: %s\n" | ||
271 | msgstr " Treiber: %s\n" | ||
272 | |||
273 | #: utils/cpufreq-info.c:177 | ||
274 | #, c-format | ||
275 | msgid " Boost States: %d\n" | ||
276 | msgstr "" | ||
277 | |||
278 | #: utils/cpufreq-info.c:178 | ||
279 | #, c-format | ||
280 | msgid " Total States: %d\n" | ||
281 | msgstr "" | ||
282 | |||
283 | #: utils/cpufreq-info.c:181 | ||
284 | #, c-format | ||
285 | msgid " Pstate-Pb%d: %luMHz (boost state)\n" | ||
286 | msgstr "" | ||
287 | |||
288 | #: utils/cpufreq-info.c:184 | ||
289 | #, c-format | ||
290 | msgid " Pstate-P%d: %luMHz\n" | ||
291 | msgstr "" | ||
292 | |||
293 | #: utils/cpufreq-info.c:211 | ||
294 | #, c-format | ||
295 | msgid " no or unknown cpufreq driver is active on this CPU\n" | ||
296 | msgstr " kein oder nicht bestimmbarer cpufreq-Treiber aktiv\n" | ||
297 | |||
298 | #: utils/cpufreq-info.c:213 | ||
299 | #, c-format | ||
300 | msgid " driver: %s\n" | ||
301 | msgstr " Treiber: %s\n" | ||
302 | |||
303 | #: utils/cpufreq-info.c:219 | ||
304 | #, c-format | ||
305 | msgid " CPUs which run at the same hardware frequency: " | ||
306 | msgstr " Folgende CPUs laufen mit der gleichen Hardware-Taktfrequenz: " | ||
307 | |||
308 | #: utils/cpufreq-info.c:230 | ||
309 | #, c-format | ||
310 | msgid " CPUs which need to have their frequency coordinated by software: " | ||
311 | msgstr " Die Taktfrequenz folgender CPUs werden per Software koordiniert: " | ||
312 | |||
313 | #: utils/cpufreq-info.c:241 | ||
314 | #, c-format | ||
315 | msgid " maximum transition latency: " | ||
316 | msgstr " Maximale Dauer eines Taktfrequenzwechsels: " | ||
317 | |||
318 | #: utils/cpufreq-info.c:247 | ||
319 | #, c-format | ||
320 | msgid " hardware limits: " | ||
321 | msgstr " Hardwarebedingte Grenzen der Taktfrequenz: " | ||
322 | |||
323 | #: utils/cpufreq-info.c:256 | ||
324 | #, c-format | ||
325 | msgid " available frequency steps: " | ||
326 | msgstr " mögliche Taktfrequenzen: " | ||
327 | |||
328 | #: utils/cpufreq-info.c:269 | ||
329 | #, c-format | ||
330 | msgid " available cpufreq governors: " | ||
331 | msgstr " mögliche Regler: " | ||
332 | |||
333 | #: utils/cpufreq-info.c:280 | ||
334 | #, c-format | ||
335 | msgid " current policy: frequency should be within " | ||
336 | msgstr " momentane Taktik: die Frequenz soll innerhalb " | ||
337 | |||
338 | #: utils/cpufreq-info.c:282 | ||
339 | #, c-format | ||
340 | msgid " and " | ||
341 | msgstr " und " | ||
342 | |||
343 | #: utils/cpufreq-info.c:286 | ||
344 | #, c-format | ||
345 | msgid "" | ||
346 | "The governor \"%s\" may decide which speed to use\n" | ||
347 | " within this range.\n" | ||
348 | msgstr "" | ||
349 | " liegen. Der Regler \"%s\" kann frei entscheiden,\n" | ||
350 | " welche Taktfrequenz innerhalb dieser Grenze verwendet " | ||
351 | "wird.\n" | ||
352 | |||
353 | #: utils/cpufreq-info.c:293 | ||
354 | #, c-format | ||
355 | msgid " current CPU frequency is " | ||
356 | msgstr " momentane Taktfrequenz ist " | ||
357 | |||
358 | #: utils/cpufreq-info.c:296 | ||
359 | #, c-format | ||
360 | msgid " (asserted by call to hardware)" | ||
361 | msgstr " (verifiziert durch Nachfrage bei der Hardware)" | ||
362 | |||
363 | #: utils/cpufreq-info.c:304 | ||
364 | #, c-format | ||
365 | msgid " cpufreq stats: " | ||
366 | msgstr " Statistik:" | ||
367 | |||
368 | #: utils/cpufreq-info.c:472 | ||
369 | #, fuzzy, c-format | ||
370 | msgid "Usage: cpupower freqinfo [options]\n" | ||
371 | msgstr "Aufruf: cpufreq-info [Optionen]\n" | ||
372 | |||
373 | #: utils/cpufreq-info.c:473 utils/cpufreq-set.c:26 utils/cpupower-set.c:23 | ||
374 | #: utils/cpupower-info.c:22 utils/cpuidle-info.c:148 | ||
375 | #, c-format | ||
376 | msgid "Options:\n" | ||
377 | msgstr "Optionen:\n" | ||
378 | |||
379 | #: utils/cpufreq-info.c:474 | ||
380 | #, fuzzy, c-format | ||
381 | msgid " -e, --debug Prints out debug information [default]\n" | ||
382 | msgstr "" | ||
383 | " -e, --debug Erzeugt detaillierte Informationen, hilfreich\n" | ||
384 | " zum Aufspüren von Fehlern\n" | ||
385 | |||
386 | #: utils/cpufreq-info.c:475 | ||
387 | #, c-format | ||
388 | msgid "" | ||
389 | " -f, --freq Get frequency the CPU currently runs at, according\n" | ||
390 | " to the cpufreq core *\n" | ||
391 | msgstr "" | ||
392 | " -f, --freq Findet die momentane CPU-Taktfrquenz heraus (nach\n" | ||
393 | " Meinung des Betriebssystems) *\n" | ||
394 | |||
395 | #: utils/cpufreq-info.c:477 | ||
396 | #, c-format | ||
397 | msgid "" | ||
398 | " -w, --hwfreq Get frequency the CPU currently runs at, by reading\n" | ||
399 | " it from hardware (only available to root) *\n" | ||
400 | msgstr "" | ||
401 | " -w, --hwfreq Findet die momentane CPU-Taktfrequenz heraus\n" | ||
402 | " (verifiziert durch Nachfrage bei der Hardware)\n" | ||
403 | " [nur der Administrator kann dies tun] *\n" | ||
404 | |||
405 | #: utils/cpufreq-info.c:479 | ||
406 | #, c-format | ||
407 | msgid "" | ||
408 | " -l, --hwlimits Determine the minimum and maximum CPU frequency " | ||
409 | "allowed *\n" | ||
410 | msgstr "" | ||
411 | " -l, --hwlimits Findet die minimale und maximale Taktfrequenz heraus " | ||
412 | "*\n" | ||
413 | |||
414 | #: utils/cpufreq-info.c:480 | ||
415 | #, c-format | ||
416 | msgid " -d, --driver Determines the used cpufreq kernel driver *\n" | ||
417 | msgstr " -d, --driver Findet den momentanen Treiber heraus *\n" | ||
418 | |||
419 | #: utils/cpufreq-info.c:481 | ||
420 | #, c-format | ||
421 | msgid " -p, --policy Gets the currently used cpufreq policy *\n" | ||
422 | msgstr " -p, --policy Findet die momentane Taktik heraus *\n" | ||
423 | |||
424 | #: utils/cpufreq-info.c:482 | ||
425 | #, c-format | ||
426 | msgid " -g, --governors Determines available cpufreq governors *\n" | ||
427 | msgstr " -g, --governors Erzeugt eine Liste mit verfügbaren Reglern *\n" | ||
428 | |||
429 | #: utils/cpufreq-info.c:483 | ||
430 | #, c-format | ||
431 | msgid "" | ||
432 | " -r, --related-cpus Determines which CPUs run at the same hardware " | ||
433 | "frequency *\n" | ||
434 | msgstr "" | ||
435 | " -r, --related-cpus Findet heraus, welche CPUs mit derselben " | ||
436 | "physikalischen\n" | ||
437 | " Taktfrequenz laufen *\n" | ||
438 | |||
439 | #: utils/cpufreq-info.c:484 | ||
440 | #, c-format | ||
441 | msgid "" | ||
442 | " -a, --affected-cpus Determines which CPUs need to have their frequency\n" | ||
443 | " coordinated by software *\n" | ||
444 | msgstr "" | ||
445 | " -a, --affected-cpus Findet heraus, von welchen CPUs die Taktfrequenz " | ||
446 | "durch\n" | ||
447 | " Software koordiniert werden muss *\n" | ||
448 | |||
449 | #: utils/cpufreq-info.c:486 | ||
450 | #, c-format | ||
451 | msgid " -s, --stats Shows cpufreq statistics if available\n" | ||
452 | msgstr "" | ||
453 | " -s, --stats Zeigt, sofern möglich, Statistiken über cpufreq an.\n" | ||
454 | |||
455 | #: utils/cpufreq-info.c:487 | ||
456 | #, c-format | ||
457 | msgid "" | ||
458 | " -y, --latency Determines the maximum latency on CPU frequency " | ||
459 | "changes *\n" | ||
460 | msgstr "" | ||
461 | " -y, --latency Findet die maximale Dauer eines Taktfrequenzwechsels " | ||
462 | "heraus *\n" | ||
463 | |||
464 | #: utils/cpufreq-info.c:488 | ||
465 | #, c-format | ||
466 | msgid " -b, --boost Checks for turbo or boost modes *\n" | ||
467 | msgstr "" | ||
468 | |||
469 | #: utils/cpufreq-info.c:489 | ||
470 | #, c-format | ||
471 | msgid "" | ||
472 | " -o, --proc Prints out information like provided by the /proc/" | ||
473 | "cpufreq\n" | ||
474 | " interface in 2.4. and early 2.6. kernels\n" | ||
475 | msgstr "" | ||
476 | " -o, --proc Erzeugt Informationen in einem ähnlichem Format zu " | ||
477 | "dem\n" | ||
478 | " der /proc/cpufreq-Datei in 2.4. und frühen 2.6.\n" | ||
479 | " Kernel-Versionen\n" | ||
480 | |||
481 | #: utils/cpufreq-info.c:491 | ||
482 | #, c-format | ||
483 | msgid "" | ||
484 | " -m, --human human-readable output for the -f, -w, -s and -y " | ||
485 | "parameters\n" | ||
486 | msgstr "" | ||
487 | " -m, --human Formatiert Taktfrequenz- und Zeitdauerangaben in " | ||
488 | "besser\n" | ||
489 | " lesbarer Form (MHz, GHz; us, ms)\n" | ||
490 | |||
491 | #: utils/cpufreq-info.c:492 utils/cpuidle-info.c:152 | ||
492 | #, c-format | ||
493 | msgid " -h, --help Prints out this screen\n" | ||
494 | msgstr " -h, --help Gibt diese Kurzübersicht aus\n" | ||
495 | |||
496 | #: utils/cpufreq-info.c:495 | ||
497 | #, c-format | ||
498 | msgid "" | ||
499 | "If no argument or only the -c, --cpu parameter is given, debug output about\n" | ||
500 | "cpufreq is printed which is useful e.g. for reporting bugs.\n" | ||
501 | msgstr "" | ||
502 | "Sofern kein anderer Parameter als '-c, --cpu' angegeben wird, liefert " | ||
503 | "dieses\n" | ||
504 | "Programm Informationen, die z.B. zum Berichten von Fehlern nützlich sind.\n" | ||
505 | |||
506 | #: utils/cpufreq-info.c:497 | ||
507 | #, c-format | ||
508 | msgid "" | ||
509 | "For the arguments marked with *, omitting the -c or --cpu argument is\n" | ||
510 | "equivalent to setting it to zero\n" | ||
511 | msgstr "" | ||
512 | "Bei den mit * markierten Parametern wird '--cpu 0' angenommen, soweit nicht\n" | ||
513 | "mittels -c oder --cpu etwas anderes angegeben wird\n" | ||
514 | |||
515 | #: utils/cpufreq-info.c:580 | ||
516 | #, c-format | ||
517 | msgid "" | ||
518 | "The argument passed to this tool can't be combined with passing a --cpu " | ||
519 | "argument\n" | ||
520 | msgstr "Diese Option kann nicht mit der --cpu-Option kombiniert werden\n" | ||
521 | |||
522 | #: utils/cpufreq-info.c:596 | ||
523 | #, c-format | ||
524 | msgid "" | ||
525 | "You can't specify more than one --cpu parameter and/or\n" | ||
526 | "more than one output-specific argument\n" | ||
527 | msgstr "" | ||
528 | "Man kann nicht mehr als einen --cpu-Parameter und/oder mehr als einen\n" | ||
529 | "informationsspezifischen Parameter gleichzeitig angeben\n" | ||
530 | |||
531 | #: utils/cpufreq-info.c:600 utils/cpufreq-set.c:82 utils/cpupower-set.c:42 | ||
532 | #: utils/cpupower-info.c:42 utils/cpuidle-info.c:213 | ||
533 | #, c-format | ||
534 | msgid "invalid or unknown argument\n" | ||
535 | msgstr "unbekannter oder falscher Parameter\n" | ||
536 | |||
537 | #: utils/cpufreq-info.c:617 | ||
538 | #, c-format | ||
539 | msgid "couldn't analyze CPU %d as it doesn't seem to be present\n" | ||
540 | msgstr "" | ||
541 | "Konnte nicht die CPU %d analysieren, da sie (scheinbar?) nicht existiert.\n" | ||
542 | |||
543 | #: utils/cpufreq-info.c:620 utils/cpupower-info.c:142 | ||
544 | #, c-format | ||
545 | msgid "analyzing CPU %d:\n" | ||
546 | msgstr "analysiere CPU %d:\n" | ||
547 | |||
548 | #: utils/cpufreq-set.c:25 | ||
549 | #, fuzzy, c-format | ||
550 | msgid "Usage: cpupower frequency-set [options]\n" | ||
551 | msgstr "Aufruf: cpufreq-set [Optionen]\n" | ||
552 | |||
553 | #: utils/cpufreq-set.c:27 | ||
554 | #, c-format | ||
555 | msgid "" | ||
556 | " -d FREQ, --min FREQ new minimum CPU frequency the governor may " | ||
557 | "select\n" | ||
558 | msgstr "" | ||
559 | " -d FREQ, --min FREQ neue minimale Taktfrequenz, die der Regler\n" | ||
560 | " auswählen darf\n" | ||
561 | |||
562 | #: utils/cpufreq-set.c:28 | ||
563 | #, c-format | ||
564 | msgid "" | ||
565 | " -u FREQ, --max FREQ new maximum CPU frequency the governor may " | ||
566 | "select\n" | ||
567 | msgstr "" | ||
568 | " -u FREQ, --max FREQ neue maximale Taktfrequenz, die der Regler\n" | ||
569 | " auswählen darf\n" | ||
570 | |||
571 | #: utils/cpufreq-set.c:29 | ||
572 | #, c-format | ||
573 | msgid " -g GOV, --governor GOV new cpufreq governor\n" | ||
574 | msgstr " -g GOV, --governors GOV wechsle zu Regler GOV\n" | ||
575 | |||
576 | #: utils/cpufreq-set.c:30 | ||
577 | #, c-format | ||
578 | msgid "" | ||
579 | " -f FREQ, --freq FREQ specific frequency to be set. Requires userspace\n" | ||
580 | " governor to be available and loaded\n" | ||
581 | msgstr "" | ||
582 | " -f FREQ, --freq FREQ setze exakte Taktfrequenz. Benötigt den Regler\n" | ||
583 | " 'userspace'.\n" | ||
584 | |||
585 | #: utils/cpufreq-set.c:32 | ||
586 | #, c-format | ||
587 | msgid " -r, --related Switches all hardware-related CPUs\n" | ||
588 | msgstr "" | ||
589 | " -r, --related Setze Werte für alle CPUs, deren Taktfrequenz\n" | ||
590 | " hardwarebedingt identisch ist.\n" | ||
591 | |||
592 | #: utils/cpufreq-set.c:33 utils/cpupower-set.c:28 utils/cpupower-info.c:27 | ||
593 | #, c-format | ||
594 | msgid " -h, --help Prints out this screen\n" | ||
595 | msgstr " -h, --help Gibt diese Kurzübersicht aus\n" | ||
596 | |||
597 | #: utils/cpufreq-set.c:35 | ||
598 | #, fuzzy, c-format | ||
599 | msgid "" | ||
600 | "Notes:\n" | ||
601 | "1. Omitting the -c or --cpu argument is equivalent to setting it to \"all\"\n" | ||
602 | msgstr "" | ||
603 | "Bei den mit * markierten Parametern wird '--cpu 0' angenommen, soweit nicht\n" | ||
604 | "mittels -c oder --cpu etwas anderes angegeben wird\n" | ||
605 | |||
606 | #: utils/cpufreq-set.c:37 | ||
607 | #, fuzzy, c-format | ||
608 | msgid "" | ||
609 | "2. The -f FREQ, --freq FREQ parameter cannot be combined with any other " | ||
610 | "parameter\n" | ||
611 | " except the -c CPU, --cpu CPU parameter\n" | ||
612 | "3. FREQuencies can be passed in Hz, kHz (default), MHz, GHz, or THz\n" | ||
613 | " by postfixing the value with the wanted unit name, without any space\n" | ||
614 | " (FREQuency in kHz =^ Hz * 0.001 =^ MHz * 1000 =^ GHz * 1000000).\n" | ||
615 | msgstr "" | ||
616 | "Hinweise:\n" | ||
617 | "1. Sofern kein -c oder --cpu-Parameter angegeben ist, wird '--cpu 0'\n" | ||
618 | " angenommen\n" | ||
619 | "2. Der Parameter -f bzw. --freq kann mit keinem anderen als dem Parameter\n" | ||
620 | " -c bzw. --cpu kombiniert werden\n" | ||
621 | "3. FREQuenzen können in Hz, kHz (Standard), MHz, GHz oder THz eingegeben\n" | ||
622 | " werden, indem der Wert und unmittelbar anschließend (ohne Leerzeichen!)\n" | ||
623 | " die Einheit angegeben werden. (Bsp: 1GHz )\n" | ||
624 | " (FREQuenz in kHz =^ MHz * 1000 =^ GHz * 1000000).\n" | ||
625 | |||
626 | #: utils/cpufreq-set.c:57 | ||
627 | #, c-format | ||
628 | msgid "" | ||
629 | "Error setting new values. Common errors:\n" | ||
630 | "- Do you have proper administration rights? (super-user?)\n" | ||
631 | "- Is the governor you requested available and modprobed?\n" | ||
632 | "- Trying to set an invalid policy?\n" | ||
633 | "- Trying to set a specific frequency, but userspace governor is not " | ||
634 | "available,\n" | ||
635 | " for example because of hardware which cannot be set to a specific " | ||
636 | "frequency\n" | ||
637 | " or because the userspace governor isn't loaded?\n" | ||
638 | msgstr "" | ||
639 | "Beim Einstellen ist ein Fehler aufgetreten. Typische Fehlerquellen sind:\n" | ||
640 | "- nicht ausreichende Rechte (Administrator)\n" | ||
641 | "- der Regler ist nicht verfügbar bzw. nicht geladen\n" | ||
642 | "- die angegebene Taktik ist inkorrekt\n" | ||
643 | "- eine spezifische Frequenz wurde angegeben, aber der Regler 'userspace'\n" | ||
644 | " kann entweder hardwarebedingt nicht genutzt werden oder ist nicht geladen\n" | ||
645 | |||
646 | #: utils/cpufreq-set.c:170 | ||
647 | #, c-format | ||
648 | msgid "wrong, unknown or unhandled CPU?\n" | ||
649 | msgstr "unbekannte oder nicht regelbare CPU\n" | ||
650 | |||
651 | #: utils/cpufreq-set.c:302 | ||
652 | #, c-format | ||
653 | msgid "" | ||
654 | "the -f/--freq parameter cannot be combined with -d/--min, -u/--max or\n" | ||
655 | "-g/--governor parameters\n" | ||
656 | msgstr "" | ||
657 | "Der -f bzw. --freq-Parameter kann nicht mit den Parametern -d/--min, -u/--" | ||
658 | "max\n" | ||
659 | "oder -g/--governor kombiniert werden\n" | ||
660 | |||
661 | #: utils/cpufreq-set.c:308 | ||
662 | #, c-format | ||
663 | msgid "" | ||
664 | "At least one parameter out of -f/--freq, -d/--min, -u/--max, and\n" | ||
665 | "-g/--governor must be passed\n" | ||
666 | msgstr "" | ||
667 | "Es muss mindestens ein Parameter aus -f/--freq, -d/--min, -u/--max oder\n" | ||
668 | "-g/--governor angegeben werden.\n" | ||
669 | |||
670 | #: utils/cpufreq-set.c:347 | ||
671 | #, c-format | ||
672 | msgid "Setting cpu: %d\n" | ||
673 | msgstr "" | ||
674 | |||
675 | #: utils/cpupower-set.c:22 | ||
676 | #, c-format | ||
677 | msgid "Usage: cpupower set [ -b val ] [ -m val ] [ -s val ]\n" | ||
678 | msgstr "" | ||
679 | |||
680 | #: utils/cpupower-set.c:24 | ||
681 | #, c-format | ||
682 | msgid "" | ||
683 | " -b, --perf-bias [VAL] Sets CPU's power vs performance policy on some\n" | ||
684 | " Intel models [0-15], see manpage for details\n" | ||
685 | msgstr "" | ||
686 | |||
687 | #: utils/cpupower-set.c:26 | ||
688 | #, c-format | ||
689 | msgid "" | ||
690 | " -m, --sched-mc [VAL] Sets the kernel's multi core scheduler policy.\n" | ||
691 | msgstr "" | ||
692 | |||
693 | #: utils/cpupower-set.c:27 | ||
694 | #, c-format | ||
695 | msgid "" | ||
696 | " -s, --sched-smt [VAL] Sets the kernel's thread sibling scheduler " | ||
697 | "policy.\n" | ||
698 | msgstr "" | ||
699 | |||
700 | #: utils/cpupower-set.c:80 | ||
701 | #, c-format | ||
702 | msgid "--perf-bias param out of range [0-%d]\n" | ||
703 | msgstr "" | ||
704 | |||
705 | #: utils/cpupower-set.c:91 | ||
706 | #, c-format | ||
707 | msgid "--sched-mc param out of range [0-%d]\n" | ||
708 | msgstr "" | ||
709 | |||
710 | #: utils/cpupower-set.c:102 | ||
711 | #, c-format | ||
712 | msgid "--sched-smt param out of range [0-%d]\n" | ||
713 | msgstr "" | ||
714 | |||
715 | #: utils/cpupower-set.c:121 | ||
716 | #, c-format | ||
717 | msgid "Error setting sched-mc %s\n" | ||
718 | msgstr "" | ||
719 | |||
720 | #: utils/cpupower-set.c:127 | ||
721 | #, c-format | ||
722 | msgid "Error setting sched-smt %s\n" | ||
723 | msgstr "" | ||
724 | |||
725 | #: utils/cpupower-set.c:146 | ||
726 | #, c-format | ||
727 | msgid "Error setting perf-bias value on CPU %d\n" | ||
728 | msgstr "" | ||
729 | |||
730 | #: utils/cpupower-info.c:21 | ||
731 | #, c-format | ||
732 | msgid "Usage: cpupower info [ -b ] [ -m ] [ -s ]\n" | ||
733 | msgstr "" | ||
734 | |||
735 | #: utils/cpupower-info.c:23 | ||
736 | #, c-format | ||
737 | msgid "" | ||
738 | " -b, --perf-bias Gets CPU's power vs performance policy on some\n" | ||
739 | " Intel models [0-15], see manpage for details\n" | ||
740 | msgstr "" | ||
741 | |||
742 | #: utils/cpupower-info.c:25 | ||
743 | #, fuzzy, c-format | ||
744 | msgid " -m, --sched-mc Gets the kernel's multi core scheduler policy.\n" | ||
745 | msgstr " -p, --policy Findet die momentane Taktik heraus *\n" | ||
746 | |||
747 | #: utils/cpupower-info.c:26 | ||
748 | #, c-format | ||
749 | msgid "" | ||
750 | " -s, --sched-smt Gets the kernel's thread sibling scheduler policy.\n" | ||
751 | msgstr "" | ||
752 | |||
753 | #: utils/cpupower-info.c:28 | ||
754 | #, c-format | ||
755 | msgid "" | ||
756 | "\n" | ||
757 | "Passing no option will show all info, by default only on core 0\n" | ||
758 | msgstr "" | ||
759 | |||
760 | #: utils/cpupower-info.c:102 | ||
761 | #, c-format | ||
762 | msgid "System's multi core scheduler setting: " | ||
763 | msgstr "" | ||
764 | |||
765 | #. if sysfs file is missing it's: errno == ENOENT | ||
766 | #: utils/cpupower-info.c:105 utils/cpupower-info.c:114 | ||
767 | #, c-format | ||
768 | msgid "not supported\n" | ||
769 | msgstr "" | ||
770 | |||
771 | #: utils/cpupower-info.c:111 | ||
772 | #, c-format | ||
773 | msgid "System's thread sibling scheduler setting: " | ||
774 | msgstr "" | ||
775 | |||
776 | #: utils/cpupower-info.c:126 | ||
777 | #, c-format | ||
778 | msgid "Intel's performance bias setting needs root privileges\n" | ||
779 | msgstr "" | ||
780 | |||
781 | #: utils/cpupower-info.c:128 | ||
782 | #, c-format | ||
783 | msgid "System does not support Intel's performance bias setting\n" | ||
784 | msgstr "" | ||
785 | |||
786 | #: utils/cpupower-info.c:147 | ||
787 | #, c-format | ||
788 | msgid "Could not read perf-bias value\n" | ||
789 | msgstr "" | ||
790 | |||
791 | #: utils/cpupower-info.c:150 | ||
792 | #, c-format | ||
793 | msgid "perf-bias: %d\n" | ||
794 | msgstr "" | ||
795 | |||
796 | #: utils/cpuidle-info.c:28 | ||
797 | #, fuzzy, c-format | ||
798 | msgid "Analyzing CPU %d:\n" | ||
799 | msgstr "analysiere CPU %d:\n" | ||
800 | |||
801 | #: utils/cpuidle-info.c:32 | ||
802 | #, c-format | ||
803 | msgid "CPU %u: No idle states\n" | ||
804 | msgstr "" | ||
805 | |||
806 | #: utils/cpuidle-info.c:36 | ||
807 | #, c-format | ||
808 | msgid "CPU %u: Can't read idle state info\n" | ||
809 | msgstr "" | ||
810 | |||
811 | #: utils/cpuidle-info.c:41 | ||
812 | #, c-format | ||
813 | msgid "Could not determine max idle state %u\n" | ||
814 | msgstr "" | ||
815 | |||
816 | #: utils/cpuidle-info.c:46 | ||
817 | #, c-format | ||
818 | msgid "Number of idle states: %d\n" | ||
819 | msgstr "" | ||
820 | |||
821 | #: utils/cpuidle-info.c:48 | ||
822 | #, fuzzy, c-format | ||
823 | msgid "Available idle states:" | ||
824 | msgstr " mögliche Taktfrequenzen: " | ||
825 | |||
826 | #: utils/cpuidle-info.c:71 | ||
827 | #, c-format | ||
828 | msgid "Flags/Description: %s\n" | ||
829 | msgstr "" | ||
830 | |||
831 | #: utils/cpuidle-info.c:74 | ||
832 | #, c-format | ||
833 | msgid "Latency: %lu\n" | ||
834 | msgstr "" | ||
835 | |||
836 | #: utils/cpuidle-info.c:76 | ||
837 | #, c-format | ||
838 | msgid "Usage: %lu\n" | ||
839 | msgstr "" | ||
840 | |||
841 | #: utils/cpuidle-info.c:78 | ||
842 | #, c-format | ||
843 | msgid "Duration: %llu\n" | ||
844 | msgstr "" | ||
845 | |||
846 | #: utils/cpuidle-info.c:90 | ||
847 | #, c-format | ||
848 | msgid "Could not determine cpuidle driver\n" | ||
849 | msgstr "" | ||
850 | |||
851 | #: utils/cpuidle-info.c:94 | ||
852 | #, fuzzy, c-format | ||
853 | msgid "CPUidle driver: %s\n" | ||
854 | msgstr " Treiber: %s\n" | ||
855 | |||
856 | #: utils/cpuidle-info.c:99 | ||
857 | #, c-format | ||
858 | msgid "Could not determine cpuidle governor\n" | ||
859 | msgstr "" | ||
860 | |||
861 | #: utils/cpuidle-info.c:103 | ||
862 | #, c-format | ||
863 | msgid "CPUidle governor: %s\n" | ||
864 | msgstr "" | ||
865 | |||
866 | #: utils/cpuidle-info.c:122 | ||
867 | #, c-format | ||
868 | msgid "CPU %u: Can't read C-state info\n" | ||
869 | msgstr "" | ||
870 | |||
871 | #. printf("Cstates: %d\n", cstates); | ||
872 | #: utils/cpuidle-info.c:127 | ||
873 | #, c-format | ||
874 | msgid "active state: C0\n" | ||
875 | msgstr "" | ||
876 | |||
877 | #: utils/cpuidle-info.c:128 | ||
878 | #, c-format | ||
879 | msgid "max_cstate: C%u\n" | ||
880 | msgstr "" | ||
881 | |||
882 | #: utils/cpuidle-info.c:129 | ||
883 | #, fuzzy, c-format | ||
884 | msgid "maximum allowed latency: %lu usec\n" | ||
885 | msgstr " Maximale Dauer eines Taktfrequenzwechsels: " | ||
886 | |||
887 | #: utils/cpuidle-info.c:130 | ||
888 | #, c-format | ||
889 | msgid "states:\t\n" | ||
890 | msgstr "" | ||
891 | |||
892 | #: utils/cpuidle-info.c:132 | ||
893 | #, c-format | ||
894 | msgid " C%d: type[C%d] " | ||
895 | msgstr "" | ||
896 | |||
897 | #: utils/cpuidle-info.c:134 | ||
898 | #, c-format | ||
899 | msgid "promotion[--] demotion[--] " | ||
900 | msgstr "" | ||
901 | |||
902 | #: utils/cpuidle-info.c:135 | ||
903 | #, c-format | ||
904 | msgid "latency[%03lu] " | ||
905 | msgstr "" | ||
906 | |||
907 | #: utils/cpuidle-info.c:137 | ||
908 | #, c-format | ||
909 | msgid "usage[%08lu] " | ||
910 | msgstr "" | ||
911 | |||
912 | #: utils/cpuidle-info.c:139 | ||
913 | #, c-format | ||
914 | msgid "duration[%020Lu] \n" | ||
915 | msgstr "" | ||
916 | |||
917 | #: utils/cpuidle-info.c:147 | ||
918 | #, fuzzy, c-format | ||
919 | msgid "Usage: cpupower idleinfo [options]\n" | ||
920 | msgstr "Aufruf: cpufreq-info [Optionen]\n" | ||
921 | |||
922 | #: utils/cpuidle-info.c:149 | ||
923 | #, fuzzy, c-format | ||
924 | msgid " -s, --silent Only show general C-state information\n" | ||
925 | msgstr "" | ||
926 | " -e, --debug Erzeugt detaillierte Informationen, hilfreich\n" | ||
927 | " zum Aufspüren von Fehlern\n" | ||
928 | |||
929 | #: utils/cpuidle-info.c:150 | ||
930 | #, fuzzy, c-format | ||
931 | msgid "" | ||
932 | " -o, --proc Prints out information like provided by the /proc/" | ||
933 | "acpi/processor/*/power\n" | ||
934 | " interface in older kernels\n" | ||
935 | msgstr "" | ||
936 | " -o, --proc Erzeugt Informationen in einem ähnlichem Format zu " | ||
937 | "dem\n" | ||
938 | " der /proc/cpufreq-Datei in 2.4. und frühen 2.6.\n" | ||
939 | " Kernel-Versionen\n" | ||
940 | |||
941 | #: utils/cpuidle-info.c:209 | ||
942 | #, fuzzy, c-format | ||
943 | msgid "You can't specify more than one output-specific argument\n" | ||
944 | msgstr "" | ||
945 | "Man kann nicht mehr als einen --cpu-Parameter und/oder mehr als einen\n" | ||
946 | "informationsspezifischen Parameter gleichzeitig angeben\n" | ||
947 | |||
948 | #~ msgid "" | ||
949 | #~ " -c CPU, --cpu CPU CPU number which information shall be determined " | ||
950 | #~ "about\n" | ||
951 | #~ msgstr "" | ||
952 | #~ " -c CPU, --cpu CPU Nummer der CPU, über die Informationen " | ||
953 | #~ "herausgefunden werden sollen\n" | ||
954 | |||
955 | #~ msgid "" | ||
956 | #~ " -c CPU, --cpu CPU number of CPU where cpufreq settings shall be " | ||
957 | #~ "modified\n" | ||
958 | #~ msgstr "" | ||
959 | #~ " -c CPU, --cpu CPU Nummer der CPU, deren Taktfrequenz-" | ||
960 | #~ "Einstellung\n" | ||
961 | #~ " werden soll\n" | ||
diff --git a/tools/power/cpupower/po/fr.po b/tools/power/cpupower/po/fr.po new file mode 100644 index 00000000000..245ad20a9bf --- /dev/null +++ b/tools/power/cpupower/po/fr.po | |||
@@ -0,0 +1,947 @@ | |||
1 | # French translations for cpufrequtils package | ||
2 | # Copyright (C) 2004 THE PACKAGE'S COPYRIGHT HOLDER | ||
3 | # This file is distributed under the same license as the cpufrequtils package. | ||
4 | # Ducrot Bruno <ducrot@poupinou.org>, 2004. | ||
5 | # | ||
6 | #, fuzzy | ||
7 | msgid "" | ||
8 | msgstr "" | ||
9 | "Project-Id-Version: cpufrequtils 0.1-pre2\n" | ||
10 | "Report-Msgid-Bugs-To: \n" | ||
11 | "POT-Creation-Date: 2011-03-08 17:03+0100\n" | ||
12 | "PO-Revision-Date: 2004-11-17 15:53+1000\n" | ||
13 | "Last-Translator: Bruno Ducrot <ducrot@poupinou.org>\n" | ||
14 | "Language-Team: NONE\n" | ||
15 | "Language: \n" | ||
16 | "MIME-Version: 1.0\n" | ||
17 | "Content-Type: text/plain; charset=ISO-8859-1\n" | ||
18 | "Content-Transfer-Encoding: 8bit\n" | ||
19 | |||
20 | #: utils/idle_monitor/nhm_idle.c:36 | ||
21 | msgid "Processor Core C3" | ||
22 | msgstr "" | ||
23 | |||
24 | #: utils/idle_monitor/nhm_idle.c:43 | ||
25 | msgid "Processor Core C6" | ||
26 | msgstr "" | ||
27 | |||
28 | #: utils/idle_monitor/nhm_idle.c:51 | ||
29 | msgid "Processor Package C3" | ||
30 | msgstr "" | ||
31 | |||
32 | #: utils/idle_monitor/nhm_idle.c:58 utils/idle_monitor/amd_fam14h_idle.c:70 | ||
33 | msgid "Processor Package C6" | ||
34 | msgstr "" | ||
35 | |||
36 | #: utils/idle_monitor/snb_idle.c:33 | ||
37 | msgid "Processor Core C7" | ||
38 | msgstr "" | ||
39 | |||
40 | #: utils/idle_monitor/snb_idle.c:40 | ||
41 | msgid "Processor Package C2" | ||
42 | msgstr "" | ||
43 | |||
44 | #: utils/idle_monitor/snb_idle.c:47 | ||
45 | msgid "Processor Package C7" | ||
46 | msgstr "" | ||
47 | |||
48 | #: utils/idle_monitor/amd_fam14h_idle.c:56 | ||
49 | msgid "Package in sleep state (PC1 or deeper)" | ||
50 | msgstr "" | ||
51 | |||
52 | #: utils/idle_monitor/amd_fam14h_idle.c:63 | ||
53 | msgid "Processor Package C1" | ||
54 | msgstr "" | ||
55 | |||
56 | #: utils/idle_monitor/amd_fam14h_idle.c:77 | ||
57 | msgid "North Bridge P1 boolean counter (returns 0 or 1)" | ||
58 | msgstr "" | ||
59 | |||
60 | #: utils/idle_monitor/mperf_monitor.c:35 | ||
61 | msgid "Processor Core not idle" | ||
62 | msgstr "" | ||
63 | |||
64 | #: utils/idle_monitor/mperf_monitor.c:42 | ||
65 | msgid "Processor Core in an idle state" | ||
66 | msgstr "" | ||
67 | |||
68 | #: utils/idle_monitor/mperf_monitor.c:50 | ||
69 | msgid "Average Frequency (including boost) in MHz" | ||
70 | msgstr "" | ||
71 | |||
72 | #: utils/idle_monitor/cpupower-monitor.c:66 | ||
73 | #, c-format | ||
74 | msgid "" | ||
75 | "cpupower monitor: [-h] [ [-t] | [-l] | [-m <mon1>,[<mon2>] ] ] [-i " | ||
76 | "interval_sec | -c command ...]\n" | ||
77 | msgstr "" | ||
78 | |||
79 | #: utils/idle_monitor/cpupower-monitor.c:69 | ||
80 | #, c-format | ||
81 | msgid "" | ||
82 | "cpupower monitor: [-v] [-h] [ [-t] | [-l] | [-m <mon1>,[<mon2>] ] ] [-i " | ||
83 | "interval_sec | -c command ...]\n" | ||
84 | msgstr "" | ||
85 | |||
86 | #: utils/idle_monitor/cpupower-monitor.c:71 | ||
87 | #, c-format | ||
88 | msgid "\t -v: be more verbose\n" | ||
89 | msgstr "" | ||
90 | |||
91 | #: utils/idle_monitor/cpupower-monitor.c:73 | ||
92 | #, c-format | ||
93 | msgid "\t -h: print this help\n" | ||
94 | msgstr "" | ||
95 | |||
96 | #: utils/idle_monitor/cpupower-monitor.c:74 | ||
97 | #, c-format | ||
98 | msgid "\t -i: time intervall to measure for in seconds (default 1)\n" | ||
99 | msgstr "" | ||
100 | |||
101 | #: utils/idle_monitor/cpupower-monitor.c:75 | ||
102 | #, c-format | ||
103 | msgid "\t -t: show CPU topology/hierarchy\n" | ||
104 | msgstr "" | ||
105 | |||
106 | #: utils/idle_monitor/cpupower-monitor.c:76 | ||
107 | #, c-format | ||
108 | msgid "\t -l: list available CPU sleep monitors (for use with -m)\n" | ||
109 | msgstr "" | ||
110 | |||
111 | #: utils/idle_monitor/cpupower-monitor.c:77 | ||
112 | #, c-format | ||
113 | msgid "\t -m: show specific CPU sleep monitors only (in same order)\n" | ||
114 | msgstr "" | ||
115 | |||
116 | #: utils/idle_monitor/cpupower-monitor.c:79 | ||
117 | #, c-format | ||
118 | msgid "" | ||
119 | "only one of: -t, -l, -m are allowed\n" | ||
120 | "If none of them is passed," | ||
121 | msgstr "" | ||
122 | |||
123 | #: utils/idle_monitor/cpupower-monitor.c:80 | ||
124 | #, c-format | ||
125 | msgid " all supported monitors are shown\n" | ||
126 | msgstr "" | ||
127 | |||
128 | #: utils/idle_monitor/cpupower-monitor.c:197 | ||
129 | #, c-format | ||
130 | msgid "Monitor %s, Counter %s has no count function. Implementation error\n" | ||
131 | msgstr "" | ||
132 | |||
133 | #: utils/idle_monitor/cpupower-monitor.c:207 | ||
134 | #, c-format | ||
135 | msgid " *is offline\n" | ||
136 | msgstr "" | ||
137 | |||
138 | #: utils/idle_monitor/cpupower-monitor.c:236 | ||
139 | #, c-format | ||
140 | msgid "%s: max monitor name length (%d) exceeded\n" | ||
141 | msgstr "" | ||
142 | |||
143 | #: utils/idle_monitor/cpupower-monitor.c:250 | ||
144 | #, c-format | ||
145 | msgid "No matching monitor found in %s, try -l option\n" | ||
146 | msgstr "" | ||
147 | |||
148 | #: utils/idle_monitor/cpupower-monitor.c:266 | ||
149 | #, c-format | ||
150 | msgid "Monitor \"%s\" (%d states) - Might overflow after %u s\n" | ||
151 | msgstr "" | ||
152 | |||
153 | #: utils/idle_monitor/cpupower-monitor.c:319 | ||
154 | #, c-format | ||
155 | msgid "%s took %.5f seconds and exited with status %d\n" | ||
156 | msgstr "" | ||
157 | |||
158 | #: utils/idle_monitor/cpupower-monitor.c:406 | ||
159 | #, c-format | ||
160 | msgid "Cannot read number of available processors\n" | ||
161 | msgstr "" | ||
162 | |||
163 | #: utils/idle_monitor/cpupower-monitor.c:417 | ||
164 | #, c-format | ||
165 | msgid "Available monitor %s needs root access\n" | ||
166 | msgstr "" | ||
167 | |||
168 | #: utils/idle_monitor/cpupower-monitor.c:428 | ||
169 | #, c-format | ||
170 | msgid "No HW Cstate monitors found\n" | ||
171 | msgstr "" | ||
172 | |||
173 | #: utils/cpupower.c:78 | ||
174 | #, c-format | ||
175 | msgid "cpupower [ -c cpulist ] subcommand [ARGS]\n" | ||
176 | msgstr "" | ||
177 | |||
178 | #: utils/cpupower.c:79 | ||
179 | #, c-format | ||
180 | msgid "cpupower --version\n" | ||
181 | msgstr "" | ||
182 | |||
183 | #: utils/cpupower.c:80 | ||
184 | #, c-format | ||
185 | msgid "Supported subcommands are:\n" | ||
186 | msgstr "" | ||
187 | |||
188 | #: utils/cpupower.c:83 | ||
189 | #, c-format | ||
190 | msgid "" | ||
191 | "\n" | ||
192 | "Some subcommands can make use of the -c cpulist option.\n" | ||
193 | msgstr "" | ||
194 | |||
195 | #: utils/cpupower.c:84 | ||
196 | #, c-format | ||
197 | msgid "Look at the general cpupower manpage how to use it\n" | ||
198 | msgstr "" | ||
199 | |||
200 | #: utils/cpupower.c:85 | ||
201 | #, c-format | ||
202 | msgid "and read up the subcommand's manpage whether it is supported.\n" | ||
203 | msgstr "" | ||
204 | |||
205 | #: utils/cpupower.c:86 | ||
206 | #, c-format | ||
207 | msgid "" | ||
208 | "\n" | ||
209 | "Use cpupower help subcommand for getting help for above subcommands.\n" | ||
210 | msgstr "" | ||
211 | |||
212 | #: utils/cpupower.c:91 | ||
213 | #, c-format | ||
214 | msgid "Report errors and bugs to %s, please.\n" | ||
215 | msgstr "Veuillez rapportez les erreurs et les bogues à %s, s'il vous plait.\n" | ||
216 | |||
217 | #: utils/cpupower.c:114 | ||
218 | #, c-format | ||
219 | msgid "Error parsing cpu list\n" | ||
220 | msgstr "" | ||
221 | |||
222 | #: utils/cpupower.c:172 | ||
223 | #, c-format | ||
224 | msgid "Subcommand %s needs root privileges\n" | ||
225 | msgstr "" | ||
226 | |||
227 | #: utils/cpufreq-info.c:31 | ||
228 | #, c-format | ||
229 | msgid "Couldn't count the number of CPUs (%s: %s), assuming 1\n" | ||
230 | msgstr "Détermination du nombre de CPUs (%s : %s) impossible. Assume 1\n" | ||
231 | |||
232 | #: utils/cpufreq-info.c:63 | ||
233 | #, c-format | ||
234 | msgid "" | ||
235 | " minimum CPU frequency - maximum CPU frequency - governor\n" | ||
236 | msgstr "" | ||
237 | " Fréquence CPU minimale - Fréquence CPU maximale - régulateur\n" | ||
238 | |||
239 | #: utils/cpufreq-info.c:151 | ||
240 | #, c-format | ||
241 | msgid "Error while evaluating Boost Capabilities on CPU %d -- are you root?\n" | ||
242 | msgstr "" | ||
243 | |||
244 | #. P state changes via MSR are identified via cpuid 80000007 | ||
245 | #. on Intel and AMD, but we assume boost capable machines can do that | ||
246 | #. if (cpuid_eax(0x80000000) >= 0x80000007 | ||
247 | #. && (cpuid_edx(0x80000007) & (1 << 7))) | ||
248 | #. | ||
249 | #: utils/cpufreq-info.c:161 | ||
250 | #, c-format | ||
251 | msgid " boost state support: \n" | ||
252 | msgstr "" | ||
253 | |||
254 | #: utils/cpufreq-info.c:163 | ||
255 | #, c-format | ||
256 | msgid " Supported: %s\n" | ||
257 | msgstr "" | ||
258 | |||
259 | #: utils/cpufreq-info.c:163 utils/cpufreq-info.c:164 | ||
260 | msgid "yes" | ||
261 | msgstr "" | ||
262 | |||
263 | #: utils/cpufreq-info.c:163 utils/cpufreq-info.c:164 | ||
264 | msgid "no" | ||
265 | msgstr "" | ||
266 | |||
267 | #: utils/cpufreq-info.c:164 | ||
268 | #, fuzzy, c-format | ||
269 | msgid " Active: %s\n" | ||
270 | msgstr " pilote : %s\n" | ||
271 | |||
272 | #: utils/cpufreq-info.c:177 | ||
273 | #, c-format | ||
274 | msgid " Boost States: %d\n" | ||
275 | msgstr "" | ||
276 | |||
277 | #: utils/cpufreq-info.c:178 | ||
278 | #, c-format | ||
279 | msgid " Total States: %d\n" | ||
280 | msgstr "" | ||
281 | |||
282 | #: utils/cpufreq-info.c:181 | ||
283 | #, c-format | ||
284 | msgid " Pstate-Pb%d: %luMHz (boost state)\n" | ||
285 | msgstr "" | ||
286 | |||
287 | #: utils/cpufreq-info.c:184 | ||
288 | #, c-format | ||
289 | msgid " Pstate-P%d: %luMHz\n" | ||
290 | msgstr "" | ||
291 | |||
292 | #: utils/cpufreq-info.c:211 | ||
293 | #, c-format | ||
294 | msgid " no or unknown cpufreq driver is active on this CPU\n" | ||
295 | msgstr " pas de pilotes cpufreq reconnu pour ce CPU\n" | ||
296 | |||
297 | #: utils/cpufreq-info.c:213 | ||
298 | #, c-format | ||
299 | msgid " driver: %s\n" | ||
300 | msgstr " pilote : %s\n" | ||
301 | |||
302 | #: utils/cpufreq-info.c:219 | ||
303 | #, fuzzy, c-format | ||
304 | msgid " CPUs which run at the same hardware frequency: " | ||
305 | msgstr " CPUs qui doivent changer de fréquences en même temps : " | ||
306 | |||
307 | #: utils/cpufreq-info.c:230 | ||
308 | #, fuzzy, c-format | ||
309 | msgid " CPUs which need to have their frequency coordinated by software: " | ||
310 | msgstr " CPUs qui doivent changer de fréquences en même temps : " | ||
311 | |||
312 | #: utils/cpufreq-info.c:241 | ||
313 | #, c-format | ||
314 | msgid " maximum transition latency: " | ||
315 | msgstr "" | ||
316 | |||
317 | #: utils/cpufreq-info.c:247 | ||
318 | #, c-format | ||
319 | msgid " hardware limits: " | ||
320 | msgstr " limitation matérielle : " | ||
321 | |||
322 | #: utils/cpufreq-info.c:256 | ||
323 | #, c-format | ||
324 | msgid " available frequency steps: " | ||
325 | msgstr " plage de fréquence : " | ||
326 | |||
327 | #: utils/cpufreq-info.c:269 | ||
328 | #, c-format | ||
329 | msgid " available cpufreq governors: " | ||
330 | msgstr " régulateurs disponibles : " | ||
331 | |||
332 | #: utils/cpufreq-info.c:280 | ||
333 | #, c-format | ||
334 | msgid " current policy: frequency should be within " | ||
335 | msgstr " tactique actuelle : la fréquence doit être comprise entre " | ||
336 | |||
337 | #: utils/cpufreq-info.c:282 | ||
338 | #, c-format | ||
339 | msgid " and " | ||
340 | msgstr " et " | ||
341 | |||
342 | #: utils/cpufreq-info.c:286 | ||
343 | #, c-format | ||
344 | msgid "" | ||
345 | "The governor \"%s\" may decide which speed to use\n" | ||
346 | " within this range.\n" | ||
347 | msgstr "" | ||
348 | "Le régulateur \"%s\" est libre de choisir la vitesse\n" | ||
349 | " dans cette plage de fréquences.\n" | ||
350 | |||
351 | #: utils/cpufreq-info.c:293 | ||
352 | #, c-format | ||
353 | msgid " current CPU frequency is " | ||
354 | msgstr " la fréquence actuelle de ce CPU est " | ||
355 | |||
356 | #: utils/cpufreq-info.c:296 | ||
357 | #, c-format | ||
358 | msgid " (asserted by call to hardware)" | ||
359 | msgstr " (vérifié par un appel direct du matériel)" | ||
360 | |||
361 | #: utils/cpufreq-info.c:304 | ||
362 | #, c-format | ||
363 | msgid " cpufreq stats: " | ||
364 | msgstr " des statistique concernant cpufreq:" | ||
365 | |||
366 | #: utils/cpufreq-info.c:472 | ||
367 | #, fuzzy, c-format | ||
368 | msgid "Usage: cpupower freqinfo [options]\n" | ||
369 | msgstr "Usage : cpufreq-info [options]\n" | ||
370 | |||
371 | #: utils/cpufreq-info.c:473 utils/cpufreq-set.c:26 utils/cpupower-set.c:23 | ||
372 | #: utils/cpupower-info.c:22 utils/cpuidle-info.c:148 | ||
373 | #, c-format | ||
374 | msgid "Options:\n" | ||
375 | msgstr "Options :\n" | ||
376 | |||
377 | #: utils/cpufreq-info.c:474 | ||
378 | #, fuzzy, c-format | ||
379 | msgid " -e, --debug Prints out debug information [default]\n" | ||
380 | msgstr " -e, --debug Afficher les informations de déboguage\n" | ||
381 | |||
382 | #: utils/cpufreq-info.c:475 | ||
383 | #, c-format | ||
384 | msgid "" | ||
385 | " -f, --freq Get frequency the CPU currently runs at, according\n" | ||
386 | " to the cpufreq core *\n" | ||
387 | msgstr "" | ||
388 | " -f, --freq Obtenir la fréquence actuelle du CPU selon le point\n" | ||
389 | " de vue du coeur du système de cpufreq *\n" | ||
390 | |||
391 | #: utils/cpufreq-info.c:477 | ||
392 | #, c-format | ||
393 | msgid "" | ||
394 | " -w, --hwfreq Get frequency the CPU currently runs at, by reading\n" | ||
395 | " it from hardware (only available to root) *\n" | ||
396 | msgstr "" | ||
397 | " -w, --hwfreq Obtenir la fréquence actuelle du CPU directement par\n" | ||
398 | " le matériel (doit être root) *\n" | ||
399 | |||
400 | #: utils/cpufreq-info.c:479 | ||
401 | #, c-format | ||
402 | msgid "" | ||
403 | " -l, --hwlimits Determine the minimum and maximum CPU frequency " | ||
404 | "allowed *\n" | ||
405 | msgstr "" | ||
406 | " -l, --hwlimits Affiche les fréquences minimales et maximales du CPU " | ||
407 | "*\n" | ||
408 | |||
409 | #: utils/cpufreq-info.c:480 | ||
410 | #, c-format | ||
411 | msgid " -d, --driver Determines the used cpufreq kernel driver *\n" | ||
412 | msgstr " -d, --driver Affiche le pilote cpufreq utilisé *\n" | ||
413 | |||
414 | #: utils/cpufreq-info.c:481 | ||
415 | #, c-format | ||
416 | msgid " -p, --policy Gets the currently used cpufreq policy *\n" | ||
417 | msgstr " -p, --policy Affiche la tactique actuelle de cpufreq *\n" | ||
418 | |||
419 | #: utils/cpufreq-info.c:482 | ||
420 | #, c-format | ||
421 | msgid " -g, --governors Determines available cpufreq governors *\n" | ||
422 | msgstr "" | ||
423 | " -g, --governors Affiche les régulateurs disponibles de cpufreq *\n" | ||
424 | |||
425 | #: utils/cpufreq-info.c:483 | ||
426 | #, fuzzy, c-format | ||
427 | msgid "" | ||
428 | " -r, --related-cpus Determines which CPUs run at the same hardware " | ||
429 | "frequency *\n" | ||
430 | msgstr "" | ||
431 | " -a, --affected-cpus Affiche quels sont les CPUs qui doivent changer de\n" | ||
432 | " fréquences en même temps *\n" | ||
433 | |||
434 | #: utils/cpufreq-info.c:484 | ||
435 | #, fuzzy, c-format | ||
436 | msgid "" | ||
437 | " -a, --affected-cpus Determines which CPUs need to have their frequency\n" | ||
438 | " coordinated by software *\n" | ||
439 | msgstr "" | ||
440 | " -a, --affected-cpus Affiche quels sont les CPUs qui doivent changer de\n" | ||
441 | " fréquences en même temps *\n" | ||
442 | |||
443 | #: utils/cpufreq-info.c:486 | ||
444 | #, c-format | ||
445 | msgid " -s, --stats Shows cpufreq statistics if available\n" | ||
446 | msgstr "" | ||
447 | " -s, --stats Indique des statistiques concernant cpufreq, si\n" | ||
448 | " disponibles\n" | ||
449 | |||
450 | #: utils/cpufreq-info.c:487 | ||
451 | #, fuzzy, c-format | ||
452 | msgid "" | ||
453 | " -y, --latency Determines the maximum latency on CPU frequency " | ||
454 | "changes *\n" | ||
455 | msgstr "" | ||
456 | " -l, --hwlimits Affiche les fréquences minimales et maximales du CPU " | ||
457 | "*\n" | ||
458 | |||
459 | #: utils/cpufreq-info.c:488 | ||
460 | #, c-format | ||
461 | msgid " -b, --boost Checks for turbo or boost modes *\n" | ||
462 | msgstr "" | ||
463 | |||
464 | #: utils/cpufreq-info.c:489 | ||
465 | #, c-format | ||
466 | msgid "" | ||
467 | " -o, --proc Prints out information like provided by the /proc/" | ||
468 | "cpufreq\n" | ||
469 | " interface in 2.4. and early 2.6. kernels\n" | ||
470 | msgstr "" | ||
471 | " -o, --proc Affiche les informations en utilisant l'interface\n" | ||
472 | " fournie par /proc/cpufreq, présente dans les " | ||
473 | "versions\n" | ||
474 | " 2.4 et les anciennes versions 2.6 du noyau\n" | ||
475 | |||
476 | #: utils/cpufreq-info.c:491 | ||
477 | #, fuzzy, c-format | ||
478 | msgid "" | ||
479 | " -m, --human human-readable output for the -f, -w, -s and -y " | ||
480 | "parameters\n" | ||
481 | msgstr "" | ||
482 | " -m, --human affiche dans un format lisible pour un humain\n" | ||
483 | " pour les options -f, -w et -s (MHz, GHz)\n" | ||
484 | |||
485 | #: utils/cpufreq-info.c:492 utils/cpuidle-info.c:152 | ||
486 | #, c-format | ||
487 | msgid " -h, --help Prints out this screen\n" | ||
488 | msgstr " -h, --help affiche l'aide-mémoire\n" | ||
489 | |||
490 | #: utils/cpufreq-info.c:495 | ||
491 | #, c-format | ||
492 | msgid "" | ||
493 | "If no argument or only the -c, --cpu parameter is given, debug output about\n" | ||
494 | "cpufreq is printed which is useful e.g. for reporting bugs.\n" | ||
495 | msgstr "" | ||
496 | "Par défaut, les informations de déboguage seront affichées si aucun\n" | ||
497 | "argument, ou bien si seulement l'argument -c (--cpu) est donné, afin de\n" | ||
498 | "faciliter les rapports de bogues par exemple\n" | ||
499 | |||
500 | #: utils/cpufreq-info.c:497 | ||
501 | #, c-format | ||
502 | msgid "" | ||
503 | "For the arguments marked with *, omitting the -c or --cpu argument is\n" | ||
504 | "equivalent to setting it to zero\n" | ||
505 | msgstr "Les arguments avec un * utiliseront le CPU 0 si -c (--cpu) est omis\n" | ||
506 | |||
507 | #: utils/cpufreq-info.c:580 | ||
508 | #, c-format | ||
509 | msgid "" | ||
510 | "The argument passed to this tool can't be combined with passing a --cpu " | ||
511 | "argument\n" | ||
512 | msgstr "Cette option est incompatible avec --cpu\n" | ||
513 | |||
514 | #: utils/cpufreq-info.c:596 | ||
515 | #, c-format | ||
516 | msgid "" | ||
517 | "You can't specify more than one --cpu parameter and/or\n" | ||
518 | "more than one output-specific argument\n" | ||
519 | msgstr "" | ||
520 | "On ne peut indiquer plus d'un paramètre --cpu, tout comme l'on ne peut\n" | ||
521 | "spécifier plus d'un argument de formatage\n" | ||
522 | |||
523 | #: utils/cpufreq-info.c:600 utils/cpufreq-set.c:82 utils/cpupower-set.c:42 | ||
524 | #: utils/cpupower-info.c:42 utils/cpuidle-info.c:213 | ||
525 | #, c-format | ||
526 | msgid "invalid or unknown argument\n" | ||
527 | msgstr "option invalide\n" | ||
528 | |||
529 | #: utils/cpufreq-info.c:617 | ||
530 | #, c-format | ||
531 | msgid "couldn't analyze CPU %d as it doesn't seem to be present\n" | ||
532 | msgstr "analyse du CPU %d impossible puisqu'il ne semble pas être présent\n" | ||
533 | |||
534 | #: utils/cpufreq-info.c:620 utils/cpupower-info.c:142 | ||
535 | #, c-format | ||
536 | msgid "analyzing CPU %d:\n" | ||
537 | msgstr "analyse du CPU %d :\n" | ||
538 | |||
539 | #: utils/cpufreq-set.c:25 | ||
540 | #, fuzzy, c-format | ||
541 | msgid "Usage: cpupower frequency-set [options]\n" | ||
542 | msgstr "Usage : cpufreq-set [options]\n" | ||
543 | |||
544 | #: utils/cpufreq-set.c:27 | ||
545 | #, c-format | ||
546 | msgid "" | ||
547 | " -d FREQ, --min FREQ new minimum CPU frequency the governor may " | ||
548 | "select\n" | ||
549 | msgstr "" | ||
550 | " -d FREQ, --min FREQ nouvelle fréquence minimale du CPU à utiliser\n" | ||
551 | " par le régulateur\n" | ||
552 | |||
553 | #: utils/cpufreq-set.c:28 | ||
554 | #, c-format | ||
555 | msgid "" | ||
556 | " -u FREQ, --max FREQ new maximum CPU frequency the governor may " | ||
557 | "select\n" | ||
558 | msgstr "" | ||
559 | " -u FREQ, --max FREQ nouvelle fréquence maximale du CPU à utiliser\n" | ||
560 | " par le régulateur\n" | ||
561 | |||
562 | #: utils/cpufreq-set.c:29 | ||
563 | #, c-format | ||
564 | msgid " -g GOV, --governor GOV new cpufreq governor\n" | ||
565 | msgstr " -g GOV, --governor GOV active le régulateur GOV\n" | ||
566 | |||
567 | #: utils/cpufreq-set.c:30 | ||
568 | #, c-format | ||
569 | msgid "" | ||
570 | " -f FREQ, --freq FREQ specific frequency to be set. Requires userspace\n" | ||
571 | " governor to be available and loaded\n" | ||
572 | msgstr "" | ||
573 | " -f FREQ, --freq FREQ fixe la fréquence du processeur à FREQ. Il faut\n" | ||
574 | " que le régulateur « userspace » soit disponible \n" | ||
575 | " et activé.\n" | ||
576 | |||
577 | #: utils/cpufreq-set.c:32 | ||
578 | #, c-format | ||
579 | msgid " -r, --related Switches all hardware-related CPUs\n" | ||
580 | msgstr "" | ||
581 | |||
582 | #: utils/cpufreq-set.c:33 utils/cpupower-set.c:28 utils/cpupower-info.c:27 | ||
583 | #, fuzzy, c-format | ||
584 | msgid " -h, --help Prints out this screen\n" | ||
585 | msgstr " -h, --help affiche l'aide-mémoire\n" | ||
586 | |||
587 | #: utils/cpufreq-set.c:35 | ||
588 | #, fuzzy, c-format | ||
589 | msgid "" | ||
590 | "Notes:\n" | ||
591 | "1. Omitting the -c or --cpu argument is equivalent to setting it to \"all\"\n" | ||
592 | msgstr "Les arguments avec un * utiliseront le CPU 0 si -c (--cpu) est omis\n" | ||
593 | |||
594 | #: utils/cpufreq-set.c:37 | ||
595 | #, fuzzy, c-format | ||
596 | msgid "" | ||
597 | "2. The -f FREQ, --freq FREQ parameter cannot be combined with any other " | ||
598 | "parameter\n" | ||
599 | " except the -c CPU, --cpu CPU parameter\n" | ||
600 | "3. FREQuencies can be passed in Hz, kHz (default), MHz, GHz, or THz\n" | ||
601 | " by postfixing the value with the wanted unit name, without any space\n" | ||
602 | " (FREQuency in kHz =^ Hz * 0.001 =^ MHz * 1000 =^ GHz * 1000000).\n" | ||
603 | msgstr "" | ||
604 | "Remarque :\n" | ||
605 | "1. Le CPU numéro 0 sera utilisé par défaut si -c (ou --cpu) est omis ;\n" | ||
606 | "2. l'argument -f FREQ (ou --freq FREQ) ne peut être utilisé qu'avec --cpu ;\n" | ||
607 | "3. on pourra préciser l'unité des fréquences en postfixant sans aucune " | ||
608 | "espace\n" | ||
609 | " les valeurs par hz, kHz (par défaut), MHz, GHz ou THz\n" | ||
610 | " (kHz =^ Hz * 0.001 =^ MHz * 1000 =^ GHz * 1000000).\n" | ||
611 | |||
612 | #: utils/cpufreq-set.c:57 | ||
613 | #, c-format | ||
614 | msgid "" | ||
615 | "Error setting new values. Common errors:\n" | ||
616 | "- Do you have proper administration rights? (super-user?)\n" | ||
617 | "- Is the governor you requested available and modprobed?\n" | ||
618 | "- Trying to set an invalid policy?\n" | ||
619 | "- Trying to set a specific frequency, but userspace governor is not " | ||
620 | "available,\n" | ||
621 | " for example because of hardware which cannot be set to a specific " | ||
622 | "frequency\n" | ||
623 | " or because the userspace governor isn't loaded?\n" | ||
624 | msgstr "" | ||
625 | "En ajustant les nouveaux paramètres, une erreur est apparue. Les sources\n" | ||
626 | "d'erreur typique sont :\n" | ||
627 | "- droit d'administration insuffisant (êtes-vous root ?) ;\n" | ||
628 | "- le régulateur choisi n'est pas disponible, ou bien n'est pas disponible " | ||
629 | "en\n" | ||
630 | " tant que module noyau ;\n" | ||
631 | "- la tactique n'est pas disponible ;\n" | ||
632 | "- vous voulez utiliser l'option -f/--freq, mais le régulateur « userspace »\n" | ||
633 | " n'est pas disponible, par exemple parce que le matériel ne le supporte\n" | ||
634 | " pas, ou bien n'est tout simplement pas chargé.\n" | ||
635 | |||
636 | #: utils/cpufreq-set.c:170 | ||
637 | #, c-format | ||
638 | msgid "wrong, unknown or unhandled CPU?\n" | ||
639 | msgstr "CPU inconnu ou non supporté ?\n" | ||
640 | |||
641 | #: utils/cpufreq-set.c:302 | ||
642 | #, c-format | ||
643 | msgid "" | ||
644 | "the -f/--freq parameter cannot be combined with -d/--min, -u/--max or\n" | ||
645 | "-g/--governor parameters\n" | ||
646 | msgstr "" | ||
647 | "l'option -f/--freq est incompatible avec les options -d/--min, -u/--max et\n" | ||
648 | "-g/--governor\n" | ||
649 | |||
650 | #: utils/cpufreq-set.c:308 | ||
651 | #, c-format | ||
652 | msgid "" | ||
653 | "At least one parameter out of -f/--freq, -d/--min, -u/--max, and\n" | ||
654 | "-g/--governor must be passed\n" | ||
655 | msgstr "" | ||
656 | "L'un de ces paramètres est obligatoire : -f/--freq, -d/--min, -u/--max et\n" | ||
657 | "-g/--governor\n" | ||
658 | |||
659 | #: utils/cpufreq-set.c:347 | ||
660 | #, c-format | ||
661 | msgid "Setting cpu: %d\n" | ||
662 | msgstr "" | ||
663 | |||
664 | #: utils/cpupower-set.c:22 | ||
665 | #, c-format | ||
666 | msgid "Usage: cpupower set [ -b val ] [ -m val ] [ -s val ]\n" | ||
667 | msgstr "" | ||
668 | |||
669 | #: utils/cpupower-set.c:24 | ||
670 | #, c-format | ||
671 | msgid "" | ||
672 | " -b, --perf-bias [VAL] Sets CPU's power vs performance policy on some\n" | ||
673 | " Intel models [0-15], see manpage for details\n" | ||
674 | msgstr "" | ||
675 | |||
676 | #: utils/cpupower-set.c:26 | ||
677 | #, c-format | ||
678 | msgid "" | ||
679 | " -m, --sched-mc [VAL] Sets the kernel's multi core scheduler policy.\n" | ||
680 | msgstr "" | ||
681 | |||
682 | #: utils/cpupower-set.c:27 | ||
683 | #, c-format | ||
684 | msgid "" | ||
685 | " -s, --sched-smt [VAL] Sets the kernel's thread sibling scheduler " | ||
686 | "policy.\n" | ||
687 | msgstr "" | ||
688 | |||
689 | #: utils/cpupower-set.c:80 | ||
690 | #, c-format | ||
691 | msgid "--perf-bias param out of range [0-%d]\n" | ||
692 | msgstr "" | ||
693 | |||
694 | #: utils/cpupower-set.c:91 | ||
695 | #, c-format | ||
696 | msgid "--sched-mc param out of range [0-%d]\n" | ||
697 | msgstr "" | ||
698 | |||
699 | #: utils/cpupower-set.c:102 | ||
700 | #, c-format | ||
701 | msgid "--sched-smt param out of range [0-%d]\n" | ||
702 | msgstr "" | ||
703 | |||
704 | #: utils/cpupower-set.c:121 | ||
705 | #, c-format | ||
706 | msgid "Error setting sched-mc %s\n" | ||
707 | msgstr "" | ||
708 | |||
709 | #: utils/cpupower-set.c:127 | ||
710 | #, c-format | ||
711 | msgid "Error setting sched-smt %s\n" | ||
712 | msgstr "" | ||
713 | |||
714 | #: utils/cpupower-set.c:146 | ||
715 | #, c-format | ||
716 | msgid "Error setting perf-bias value on CPU %d\n" | ||
717 | msgstr "" | ||
718 | |||
719 | #: utils/cpupower-info.c:21 | ||
720 | #, c-format | ||
721 | msgid "Usage: cpupower info [ -b ] [ -m ] [ -s ]\n" | ||
722 | msgstr "" | ||
723 | |||
724 | #: utils/cpupower-info.c:23 | ||
725 | #, c-format | ||
726 | msgid "" | ||
727 | " -b, --perf-bias Gets CPU's power vs performance policy on some\n" | ||
728 | " Intel models [0-15], see manpage for details\n" | ||
729 | msgstr "" | ||
730 | |||
731 | #: utils/cpupower-info.c:25 | ||
732 | #, fuzzy, c-format | ||
733 | msgid " -m, --sched-mc Gets the kernel's multi core scheduler policy.\n" | ||
734 | msgstr " -p, --policy Affiche la tactique actuelle de cpufreq *\n" | ||
735 | |||
736 | #: utils/cpupower-info.c:26 | ||
737 | #, c-format | ||
738 | msgid "" | ||
739 | " -s, --sched-smt Gets the kernel's thread sibling scheduler policy.\n" | ||
740 | msgstr "" | ||
741 | |||
742 | #: utils/cpupower-info.c:28 | ||
743 | #, c-format | ||
744 | msgid "" | ||
745 | "\n" | ||
746 | "Passing no option will show all info, by default only on core 0\n" | ||
747 | msgstr "" | ||
748 | |||
749 | #: utils/cpupower-info.c:102 | ||
750 | #, c-format | ||
751 | msgid "System's multi core scheduler setting: " | ||
752 | msgstr "" | ||
753 | |||
754 | #. if sysfs file is missing it's: errno == ENOENT | ||
755 | #: utils/cpupower-info.c:105 utils/cpupower-info.c:114 | ||
756 | #, c-format | ||
757 | msgid "not supported\n" | ||
758 | msgstr "" | ||
759 | |||
760 | #: utils/cpupower-info.c:111 | ||
761 | #, c-format | ||
762 | msgid "System's thread sibling scheduler setting: " | ||
763 | msgstr "" | ||
764 | |||
765 | #: utils/cpupower-info.c:126 | ||
766 | #, c-format | ||
767 | msgid "Intel's performance bias setting needs root privileges\n" | ||
768 | msgstr "" | ||
769 | |||
770 | #: utils/cpupower-info.c:128 | ||
771 | #, c-format | ||
772 | msgid "System does not support Intel's performance bias setting\n" | ||
773 | msgstr "" | ||
774 | |||
775 | #: utils/cpupower-info.c:147 | ||
776 | #, c-format | ||
777 | msgid "Could not read perf-bias value\n" | ||
778 | msgstr "" | ||
779 | |||
780 | #: utils/cpupower-info.c:150 | ||
781 | #, c-format | ||
782 | msgid "perf-bias: %d\n" | ||
783 | msgstr "" | ||
784 | |||
785 | #: utils/cpuidle-info.c:28 | ||
786 | #, fuzzy, c-format | ||
787 | msgid "Analyzing CPU %d:\n" | ||
788 | msgstr "analyse du CPU %d :\n" | ||
789 | |||
790 | #: utils/cpuidle-info.c:32 | ||
791 | #, c-format | ||
792 | msgid "CPU %u: No idle states\n" | ||
793 | msgstr "" | ||
794 | |||
795 | #: utils/cpuidle-info.c:36 | ||
796 | #, c-format | ||
797 | msgid "CPU %u: Can't read idle state info\n" | ||
798 | msgstr "" | ||
799 | |||
800 | #: utils/cpuidle-info.c:41 | ||
801 | #, c-format | ||
802 | msgid "Could not determine max idle state %u\n" | ||
803 | msgstr "" | ||
804 | |||
805 | #: utils/cpuidle-info.c:46 | ||
806 | #, c-format | ||
807 | msgid "Number of idle states: %d\n" | ||
808 | msgstr "" | ||
809 | |||
810 | #: utils/cpuidle-info.c:48 | ||
811 | #, fuzzy, c-format | ||
812 | msgid "Available idle states:" | ||
813 | msgstr " plage de fréquence : " | ||
814 | |||
815 | #: utils/cpuidle-info.c:71 | ||
816 | #, c-format | ||
817 | msgid "Flags/Description: %s\n" | ||
818 | msgstr "" | ||
819 | |||
820 | #: utils/cpuidle-info.c:74 | ||
821 | #, c-format | ||
822 | msgid "Latency: %lu\n" | ||
823 | msgstr "" | ||
824 | |||
825 | #: utils/cpuidle-info.c:76 | ||
826 | #, c-format | ||
827 | msgid "Usage: %lu\n" | ||
828 | msgstr "" | ||
829 | |||
830 | #: utils/cpuidle-info.c:78 | ||
831 | #, c-format | ||
832 | msgid "Duration: %llu\n" | ||
833 | msgstr "" | ||
834 | |||
835 | #: utils/cpuidle-info.c:90 | ||
836 | #, c-format | ||
837 | msgid "Could not determine cpuidle driver\n" | ||
838 | msgstr "" | ||
839 | |||
840 | #: utils/cpuidle-info.c:94 | ||
841 | #, fuzzy, c-format | ||
842 | msgid "CPUidle driver: %s\n" | ||
843 | msgstr " pilote : %s\n" | ||
844 | |||
845 | #: utils/cpuidle-info.c:99 | ||
846 | #, c-format | ||
847 | msgid "Could not determine cpuidle governor\n" | ||
848 | msgstr "" | ||
849 | |||
850 | #: utils/cpuidle-info.c:103 | ||
851 | #, c-format | ||
852 | msgid "CPUidle governor: %s\n" | ||
853 | msgstr "" | ||
854 | |||
855 | #: utils/cpuidle-info.c:122 | ||
856 | #, c-format | ||
857 | msgid "CPU %u: Can't read C-state info\n" | ||
858 | msgstr "" | ||
859 | |||
860 | #. printf("Cstates: %d\n", cstates); | ||
861 | #: utils/cpuidle-info.c:127 | ||
862 | #, c-format | ||
863 | msgid "active state: C0\n" | ||
864 | msgstr "" | ||
865 | |||
866 | #: utils/cpuidle-info.c:128 | ||
867 | #, c-format | ||
868 | msgid "max_cstate: C%u\n" | ||
869 | msgstr "" | ||
870 | |||
871 | #: utils/cpuidle-info.c:129 | ||
872 | #, c-format | ||
873 | msgid "maximum allowed latency: %lu usec\n" | ||
874 | msgstr "" | ||
875 | |||
876 | #: utils/cpuidle-info.c:130 | ||
877 | #, c-format | ||
878 | msgid "states:\t\n" | ||
879 | msgstr "" | ||
880 | |||
881 | #: utils/cpuidle-info.c:132 | ||
882 | #, c-format | ||
883 | msgid " C%d: type[C%d] " | ||
884 | msgstr "" | ||
885 | |||
886 | #: utils/cpuidle-info.c:134 | ||
887 | #, c-format | ||
888 | msgid "promotion[--] demotion[--] " | ||
889 | msgstr "" | ||
890 | |||
891 | #: utils/cpuidle-info.c:135 | ||
892 | #, c-format | ||
893 | msgid "latency[%03lu] " | ||
894 | msgstr "" | ||
895 | |||
896 | #: utils/cpuidle-info.c:137 | ||
897 | #, c-format | ||
898 | msgid "usage[%08lu] " | ||
899 | msgstr "" | ||
900 | |||
901 | #: utils/cpuidle-info.c:139 | ||
902 | #, c-format | ||
903 | msgid "duration[%020Lu] \n" | ||
904 | msgstr "" | ||
905 | |||
906 | #: utils/cpuidle-info.c:147 | ||
907 | #, fuzzy, c-format | ||
908 | msgid "Usage: cpupower idleinfo [options]\n" | ||
909 | msgstr "Usage : cpufreq-info [options]\n" | ||
910 | |||
911 | #: utils/cpuidle-info.c:149 | ||
912 | #, fuzzy, c-format | ||
913 | msgid " -s, --silent Only show general C-state information\n" | ||
914 | msgstr " -e, --debug Afficher les informations de déboguage\n" | ||
915 | |||
916 | #: utils/cpuidle-info.c:150 | ||
917 | #, fuzzy, c-format | ||
918 | msgid "" | ||
919 | " -o, --proc Prints out information like provided by the /proc/" | ||
920 | "acpi/processor/*/power\n" | ||
921 | " interface in older kernels\n" | ||
922 | msgstr "" | ||
923 | " -o, --proc Affiche les informations en utilisant l'interface\n" | ||
924 | " fournie par /proc/cpufreq, présente dans les " | ||
925 | "versions\n" | ||
926 | " 2.4 et les anciennes versions 2.6 du noyau\n" | ||
927 | |||
928 | #: utils/cpuidle-info.c:209 | ||
929 | #, fuzzy, c-format | ||
930 | msgid "You can't specify more than one output-specific argument\n" | ||
931 | msgstr "" | ||
932 | "On ne peut indiquer plus d'un paramètre --cpu, tout comme l'on ne peut\n" | ||
933 | "spécifier plus d'un argument de formatage\n" | ||
934 | |||
935 | #~ msgid "" | ||
936 | #~ " -c CPU, --cpu CPU CPU number which information shall be determined " | ||
937 | #~ "about\n" | ||
938 | #~ msgstr "" | ||
939 | #~ " -c CPU, --cpu CPU Numéro du CPU pour lequel l'information sera " | ||
940 | #~ "affichée\n" | ||
941 | |||
942 | #~ msgid "" | ||
943 | #~ " -c CPU, --cpu CPU number of CPU where cpufreq settings shall be " | ||
944 | #~ "modified\n" | ||
945 | #~ msgstr "" | ||
946 | #~ " -c CPU, --cpu CPU numéro du CPU à prendre en compte pour les\n" | ||
947 | #~ " changements\n" | ||
diff --git a/tools/power/cpupower/po/it.po b/tools/power/cpupower/po/it.po new file mode 100644 index 00000000000..f80c4ddb9bd --- /dev/null +++ b/tools/power/cpupower/po/it.po | |||
@@ -0,0 +1,961 @@ | |||
1 | # Italian translations for cpufrequtils package | ||
2 | # Copyright (C) 2004-2009 | ||
3 | # This file is distributed under the same license as the cpufrequtils package. | ||
4 | # Mattia Dongili <malattia@gmail.com>. | ||
5 | # | ||
6 | # | ||
7 | msgid "" | ||
8 | msgstr "" | ||
9 | "Project-Id-Version: cpufrequtils 0.3\n" | ||
10 | "Report-Msgid-Bugs-To: \n" | ||
11 | "POT-Creation-Date: 2011-03-08 17:03+0100\n" | ||
12 | "PO-Revision-Date: 2009-08-15 12:00+0900\n" | ||
13 | "Last-Translator: Mattia Dongili <malattia@gmail.com>\n" | ||
14 | "Language-Team: NONE\n" | ||
15 | "Language: \n" | ||
16 | "MIME-Version: 1.0\n" | ||
17 | "Content-Type: text/plain; charset=UTF-8\n" | ||
18 | "Content-Transfer-Encoding: 8bit\n" | ||
19 | |||
20 | #: utils/idle_monitor/nhm_idle.c:36 | ||
21 | msgid "Processor Core C3" | ||
22 | msgstr "" | ||
23 | |||
24 | #: utils/idle_monitor/nhm_idle.c:43 | ||
25 | msgid "Processor Core C6" | ||
26 | msgstr "" | ||
27 | |||
28 | #: utils/idle_monitor/nhm_idle.c:51 | ||
29 | msgid "Processor Package C3" | ||
30 | msgstr "" | ||
31 | |||
32 | #: utils/idle_monitor/nhm_idle.c:58 utils/idle_monitor/amd_fam14h_idle.c:70 | ||
33 | msgid "Processor Package C6" | ||
34 | msgstr "" | ||
35 | |||
36 | #: utils/idle_monitor/snb_idle.c:33 | ||
37 | msgid "Processor Core C7" | ||
38 | msgstr "" | ||
39 | |||
40 | #: utils/idle_monitor/snb_idle.c:40 | ||
41 | msgid "Processor Package C2" | ||
42 | msgstr "" | ||
43 | |||
44 | #: utils/idle_monitor/snb_idle.c:47 | ||
45 | msgid "Processor Package C7" | ||
46 | msgstr "" | ||
47 | |||
48 | #: utils/idle_monitor/amd_fam14h_idle.c:56 | ||
49 | msgid "Package in sleep state (PC1 or deeper)" | ||
50 | msgstr "" | ||
51 | |||
52 | #: utils/idle_monitor/amd_fam14h_idle.c:63 | ||
53 | msgid "Processor Package C1" | ||
54 | msgstr "" | ||
55 | |||
56 | #: utils/idle_monitor/amd_fam14h_idle.c:77 | ||
57 | msgid "North Bridge P1 boolean counter (returns 0 or 1)" | ||
58 | msgstr "" | ||
59 | |||
60 | #: utils/idle_monitor/mperf_monitor.c:35 | ||
61 | msgid "Processor Core not idle" | ||
62 | msgstr "" | ||
63 | |||
64 | #: utils/idle_monitor/mperf_monitor.c:42 | ||
65 | msgid "Processor Core in an idle state" | ||
66 | msgstr "" | ||
67 | |||
68 | #: utils/idle_monitor/mperf_monitor.c:50 | ||
69 | msgid "Average Frequency (including boost) in MHz" | ||
70 | msgstr "" | ||
71 | |||
72 | #: utils/idle_monitor/cpupower-monitor.c:66 | ||
73 | #, c-format | ||
74 | msgid "" | ||
75 | "cpupower monitor: [-h] [ [-t] | [-l] | [-m <mon1>,[<mon2>] ] ] [-i " | ||
76 | "interval_sec | -c command ...]\n" | ||
77 | msgstr "" | ||
78 | |||
79 | #: utils/idle_monitor/cpupower-monitor.c:69 | ||
80 | #, c-format | ||
81 | msgid "" | ||
82 | "cpupower monitor: [-v] [-h] [ [-t] | [-l] | [-m <mon1>,[<mon2>] ] ] [-i " | ||
83 | "interval_sec | -c command ...]\n" | ||
84 | msgstr "" | ||
85 | |||
86 | #: utils/idle_monitor/cpupower-monitor.c:71 | ||
87 | #, c-format | ||
88 | msgid "\t -v: be more verbose\n" | ||
89 | msgstr "" | ||
90 | |||
91 | #: utils/idle_monitor/cpupower-monitor.c:73 | ||
92 | #, c-format | ||
93 | msgid "\t -h: print this help\n" | ||
94 | msgstr "" | ||
95 | |||
96 | #: utils/idle_monitor/cpupower-monitor.c:74 | ||
97 | #, c-format | ||
98 | msgid "\t -i: time intervall to measure for in seconds (default 1)\n" | ||
99 | msgstr "" | ||
100 | |||
101 | #: utils/idle_monitor/cpupower-monitor.c:75 | ||
102 | #, c-format | ||
103 | msgid "\t -t: show CPU topology/hierarchy\n" | ||
104 | msgstr "" | ||
105 | |||
106 | #: utils/idle_monitor/cpupower-monitor.c:76 | ||
107 | #, c-format | ||
108 | msgid "\t -l: list available CPU sleep monitors (for use with -m)\n" | ||
109 | msgstr "" | ||
110 | |||
111 | #: utils/idle_monitor/cpupower-monitor.c:77 | ||
112 | #, c-format | ||
113 | msgid "\t -m: show specific CPU sleep monitors only (in same order)\n" | ||
114 | msgstr "" | ||
115 | |||
116 | #: utils/idle_monitor/cpupower-monitor.c:79 | ||
117 | #, c-format | ||
118 | msgid "" | ||
119 | "only one of: -t, -l, -m are allowed\n" | ||
120 | "If none of them is passed," | ||
121 | msgstr "" | ||
122 | |||
123 | #: utils/idle_monitor/cpupower-monitor.c:80 | ||
124 | #, c-format | ||
125 | msgid " all supported monitors are shown\n" | ||
126 | msgstr "" | ||
127 | |||
128 | #: utils/idle_monitor/cpupower-monitor.c:197 | ||
129 | #, c-format | ||
130 | msgid "Monitor %s, Counter %s has no count function. Implementation error\n" | ||
131 | msgstr "" | ||
132 | |||
133 | #: utils/idle_monitor/cpupower-monitor.c:207 | ||
134 | #, c-format | ||
135 | msgid " *is offline\n" | ||
136 | msgstr "" | ||
137 | |||
138 | #: utils/idle_monitor/cpupower-monitor.c:236 | ||
139 | #, c-format | ||
140 | msgid "%s: max monitor name length (%d) exceeded\n" | ||
141 | msgstr "" | ||
142 | |||
143 | #: utils/idle_monitor/cpupower-monitor.c:250 | ||
144 | #, c-format | ||
145 | msgid "No matching monitor found in %s, try -l option\n" | ||
146 | msgstr "" | ||
147 | |||
148 | #: utils/idle_monitor/cpupower-monitor.c:266 | ||
149 | #, c-format | ||
150 | msgid "Monitor \"%s\" (%d states) - Might overflow after %u s\n" | ||
151 | msgstr "" | ||
152 | |||
153 | #: utils/idle_monitor/cpupower-monitor.c:319 | ||
154 | #, c-format | ||
155 | msgid "%s took %.5f seconds and exited with status %d\n" | ||
156 | msgstr "" | ||
157 | |||
158 | #: utils/idle_monitor/cpupower-monitor.c:406 | ||
159 | #, c-format | ||
160 | msgid "Cannot read number of available processors\n" | ||
161 | msgstr "" | ||
162 | |||
163 | #: utils/idle_monitor/cpupower-monitor.c:417 | ||
164 | #, c-format | ||
165 | msgid "Available monitor %s needs root access\n" | ||
166 | msgstr "" | ||
167 | |||
168 | #: utils/idle_monitor/cpupower-monitor.c:428 | ||
169 | #, c-format | ||
170 | msgid "No HW Cstate monitors found\n" | ||
171 | msgstr "" | ||
172 | |||
173 | #: utils/cpupower.c:78 | ||
174 | #, c-format | ||
175 | msgid "cpupower [ -c cpulist ] subcommand [ARGS]\n" | ||
176 | msgstr "" | ||
177 | |||
178 | #: utils/cpupower.c:79 | ||
179 | #, c-format | ||
180 | msgid "cpupower --version\n" | ||
181 | msgstr "" | ||
182 | |||
183 | #: utils/cpupower.c:80 | ||
184 | #, c-format | ||
185 | msgid "Supported subcommands are:\n" | ||
186 | msgstr "" | ||
187 | |||
188 | #: utils/cpupower.c:83 | ||
189 | #, c-format | ||
190 | msgid "" | ||
191 | "\n" | ||
192 | "Some subcommands can make use of the -c cpulist option.\n" | ||
193 | msgstr "" | ||
194 | |||
195 | #: utils/cpupower.c:84 | ||
196 | #, c-format | ||
197 | msgid "Look at the general cpupower manpage how to use it\n" | ||
198 | msgstr "" | ||
199 | |||
200 | #: utils/cpupower.c:85 | ||
201 | #, c-format | ||
202 | msgid "and read up the subcommand's manpage whether it is supported.\n" | ||
203 | msgstr "" | ||
204 | |||
205 | #: utils/cpupower.c:86 | ||
206 | #, c-format | ||
207 | msgid "" | ||
208 | "\n" | ||
209 | "Use cpupower help subcommand for getting help for above subcommands.\n" | ||
210 | msgstr "" | ||
211 | |||
212 | #: utils/cpupower.c:91 | ||
213 | #, c-format | ||
214 | msgid "Report errors and bugs to %s, please.\n" | ||
215 | msgstr "Per favore, comunicare errori e malfunzionamenti a %s.\n" | ||
216 | |||
217 | #: utils/cpupower.c:114 | ||
218 | #, c-format | ||
219 | msgid "Error parsing cpu list\n" | ||
220 | msgstr "" | ||
221 | |||
222 | #: utils/cpupower.c:172 | ||
223 | #, c-format | ||
224 | msgid "Subcommand %s needs root privileges\n" | ||
225 | msgstr "" | ||
226 | |||
227 | #: utils/cpufreq-info.c:31 | ||
228 | #, c-format | ||
229 | msgid "Couldn't count the number of CPUs (%s: %s), assuming 1\n" | ||
230 | msgstr "Impossibile determinare il numero di CPU (%s: %s), assumo sia 1\n" | ||
231 | |||
232 | #: utils/cpufreq-info.c:63 | ||
233 | #, c-format | ||
234 | msgid "" | ||
235 | " minimum CPU frequency - maximum CPU frequency - governor\n" | ||
236 | msgstr "" | ||
237 | " frequenza minima CPU - frequenza massima CPU - gestore\n" | ||
238 | |||
239 | #: utils/cpufreq-info.c:151 | ||
240 | #, c-format | ||
241 | msgid "Error while evaluating Boost Capabilities on CPU %d -- are you root?\n" | ||
242 | msgstr "" | ||
243 | |||
244 | #. P state changes via MSR are identified via cpuid 80000007 | ||
245 | #. on Intel and AMD, but we assume boost capable machines can do that | ||
246 | #. if (cpuid_eax(0x80000000) >= 0x80000007 | ||
247 | #. && (cpuid_edx(0x80000007) & (1 << 7))) | ||
248 | #. | ||
249 | #: utils/cpufreq-info.c:161 | ||
250 | #, c-format | ||
251 | msgid " boost state support: \n" | ||
252 | msgstr "" | ||
253 | |||
254 | #: utils/cpufreq-info.c:163 | ||
255 | #, c-format | ||
256 | msgid " Supported: %s\n" | ||
257 | msgstr "" | ||
258 | |||
259 | #: utils/cpufreq-info.c:163 utils/cpufreq-info.c:164 | ||
260 | msgid "yes" | ||
261 | msgstr "" | ||
262 | |||
263 | #: utils/cpufreq-info.c:163 utils/cpufreq-info.c:164 | ||
264 | msgid "no" | ||
265 | msgstr "" | ||
266 | |||
267 | #: utils/cpufreq-info.c:164 | ||
268 | #, fuzzy, c-format | ||
269 | msgid " Active: %s\n" | ||
270 | msgstr " modulo %s\n" | ||
271 | |||
272 | #: utils/cpufreq-info.c:177 | ||
273 | #, c-format | ||
274 | msgid " Boost States: %d\n" | ||
275 | msgstr "" | ||
276 | |||
277 | #: utils/cpufreq-info.c:178 | ||
278 | #, c-format | ||
279 | msgid " Total States: %d\n" | ||
280 | msgstr "" | ||
281 | |||
282 | #: utils/cpufreq-info.c:181 | ||
283 | #, c-format | ||
284 | msgid " Pstate-Pb%d: %luMHz (boost state)\n" | ||
285 | msgstr "" | ||
286 | |||
287 | #: utils/cpufreq-info.c:184 | ||
288 | #, c-format | ||
289 | msgid " Pstate-P%d: %luMHz\n" | ||
290 | msgstr "" | ||
291 | |||
292 | #: utils/cpufreq-info.c:211 | ||
293 | #, c-format | ||
294 | msgid " no or unknown cpufreq driver is active on this CPU\n" | ||
295 | msgstr " nessun modulo o modulo cpufreq sconosciuto per questa CPU\n" | ||
296 | |||
297 | #: utils/cpufreq-info.c:213 | ||
298 | #, c-format | ||
299 | msgid " driver: %s\n" | ||
300 | msgstr " modulo %s\n" | ||
301 | |||
302 | #: utils/cpufreq-info.c:219 | ||
303 | #, c-format | ||
304 | msgid " CPUs which run at the same hardware frequency: " | ||
305 | msgstr " CPU che operano alla stessa frequenza hardware: " | ||
306 | |||
307 | #: utils/cpufreq-info.c:230 | ||
308 | #, c-format | ||
309 | msgid " CPUs which need to have their frequency coordinated by software: " | ||
310 | msgstr " CPU che è necessario siano coordinate dal software: " | ||
311 | |||
312 | #: utils/cpufreq-info.c:241 | ||
313 | #, c-format | ||
314 | msgid " maximum transition latency: " | ||
315 | msgstr " latenza massima durante la transizione: " | ||
316 | |||
317 | #: utils/cpufreq-info.c:247 | ||
318 | #, c-format | ||
319 | msgid " hardware limits: " | ||
320 | msgstr " limiti hardware: " | ||
321 | |||
322 | #: utils/cpufreq-info.c:256 | ||
323 | #, c-format | ||
324 | msgid " available frequency steps: " | ||
325 | msgstr " frequenze disponibili: " | ||
326 | |||
327 | #: utils/cpufreq-info.c:269 | ||
328 | #, c-format | ||
329 | msgid " available cpufreq governors: " | ||
330 | msgstr " gestori disponibili: " | ||
331 | |||
332 | #: utils/cpufreq-info.c:280 | ||
333 | #, c-format | ||
334 | msgid " current policy: frequency should be within " | ||
335 | msgstr " gestore attuale: la frequenza deve mantenersi tra " | ||
336 | |||
337 | #: utils/cpufreq-info.c:282 | ||
338 | #, c-format | ||
339 | msgid " and " | ||
340 | msgstr " e " | ||
341 | |||
342 | #: utils/cpufreq-info.c:286 | ||
343 | #, c-format | ||
344 | msgid "" | ||
345 | "The governor \"%s\" may decide which speed to use\n" | ||
346 | " within this range.\n" | ||
347 | msgstr "" | ||
348 | " Il gestore \"%s\" può decidere quale velocità usare\n" | ||
349 | " in questo intervallo.\n" | ||
350 | |||
351 | #: utils/cpufreq-info.c:293 | ||
352 | #, c-format | ||
353 | msgid " current CPU frequency is " | ||
354 | msgstr " la frequenza attuale della CPU è " | ||
355 | |||
356 | #: utils/cpufreq-info.c:296 | ||
357 | #, c-format | ||
358 | msgid " (asserted by call to hardware)" | ||
359 | msgstr " (ottenuta da una chiamata diretta all'hardware)" | ||
360 | |||
361 | #: utils/cpufreq-info.c:304 | ||
362 | #, c-format | ||
363 | msgid " cpufreq stats: " | ||
364 | msgstr " statistiche cpufreq:" | ||
365 | |||
366 | #: utils/cpufreq-info.c:472 | ||
367 | #, fuzzy, c-format | ||
368 | msgid "Usage: cpupower freqinfo [options]\n" | ||
369 | msgstr "Uso: cpufreq-info [opzioni]\n" | ||
370 | |||
371 | #: utils/cpufreq-info.c:473 utils/cpufreq-set.c:26 utils/cpupower-set.c:23 | ||
372 | #: utils/cpupower-info.c:22 utils/cpuidle-info.c:148 | ||
373 | #, c-format | ||
374 | msgid "Options:\n" | ||
375 | msgstr "Opzioni:\n" | ||
376 | |||
377 | #: utils/cpufreq-info.c:474 | ||
378 | #, fuzzy, c-format | ||
379 | msgid " -e, --debug Prints out debug information [default]\n" | ||
380 | msgstr " -e, --debug Mostra informazioni di debug\n" | ||
381 | |||
382 | #: utils/cpufreq-info.c:475 | ||
383 | #, c-format | ||
384 | msgid "" | ||
385 | " -f, --freq Get frequency the CPU currently runs at, according\n" | ||
386 | " to the cpufreq core *\n" | ||
387 | msgstr "" | ||
388 | " -f, --freq Mostra la frequenza attuale della CPU secondo\n" | ||
389 | " il modulo cpufreq *\n" | ||
390 | |||
391 | #: utils/cpufreq-info.c:477 | ||
392 | #, c-format | ||
393 | msgid "" | ||
394 | " -w, --hwfreq Get frequency the CPU currently runs at, by reading\n" | ||
395 | " it from hardware (only available to root) *\n" | ||
396 | msgstr "" | ||
397 | " -w, --hwfreq Mostra la frequenza attuale della CPU leggendola\n" | ||
398 | " dall'hardware (disponibile solo per l'utente root) *\n" | ||
399 | |||
400 | #: utils/cpufreq-info.c:479 | ||
401 | #, c-format | ||
402 | msgid "" | ||
403 | " -l, --hwlimits Determine the minimum and maximum CPU frequency " | ||
404 | "allowed *\n" | ||
405 | msgstr "" | ||
406 | " -l, --hwlimits Determina le frequenze minima e massima possibili per " | ||
407 | "la CPU *\n" | ||
408 | |||
409 | #: utils/cpufreq-info.c:480 | ||
410 | #, c-format | ||
411 | msgid " -d, --driver Determines the used cpufreq kernel driver *\n" | ||
412 | msgstr "" | ||
413 | " -d, --driver Determina il modulo cpufreq del kernel in uso *\n" | ||
414 | |||
415 | #: utils/cpufreq-info.c:481 | ||
416 | #, c-format | ||
417 | msgid " -p, --policy Gets the currently used cpufreq policy *\n" | ||
418 | msgstr "" | ||
419 | " -p, --policy Mostra il gestore cpufreq attualmente in uso *\n" | ||
420 | |||
421 | #: utils/cpufreq-info.c:482 | ||
422 | #, c-format | ||
423 | msgid " -g, --governors Determines available cpufreq governors *\n" | ||
424 | msgstr " -g, --governors Determina i gestori cpufreq disponibili *\n" | ||
425 | |||
426 | #: utils/cpufreq-info.c:483 | ||
427 | #, c-format | ||
428 | msgid "" | ||
429 | " -r, --related-cpus Determines which CPUs run at the same hardware " | ||
430 | "frequency *\n" | ||
431 | msgstr "" | ||
432 | " -r, --related-cpus Determina quali CPU operano alla stessa frequenza *\n" | ||
433 | |||
434 | #: utils/cpufreq-info.c:484 | ||
435 | #, c-format | ||
436 | msgid "" | ||
437 | " -a, --affected-cpus Determines which CPUs need to have their frequency\n" | ||
438 | " coordinated by software *\n" | ||
439 | msgstr "" | ||
440 | " -a, --affected-cpus Determina quali CPU devono avere la frequenza\n" | ||
441 | " coordinata dal software *\n" | ||
442 | |||
443 | #: utils/cpufreq-info.c:486 | ||
444 | #, c-format | ||
445 | msgid " -s, --stats Shows cpufreq statistics if available\n" | ||
446 | msgstr " -s, --stats Mostra le statistiche se disponibili\n" | ||
447 | |||
448 | #: utils/cpufreq-info.c:487 | ||
449 | #, c-format | ||
450 | msgid "" | ||
451 | " -y, --latency Determines the maximum latency on CPU frequency " | ||
452 | "changes *\n" | ||
453 | msgstr "" | ||
454 | " -y, --latency Determina la latenza massima durante i cambi di " | ||
455 | "frequenza *\n" | ||
456 | |||
457 | #: utils/cpufreq-info.c:488 | ||
458 | #, c-format | ||
459 | msgid " -b, --boost Checks for turbo or boost modes *\n" | ||
460 | msgstr "" | ||
461 | |||
462 | #: utils/cpufreq-info.c:489 | ||
463 | #, c-format | ||
464 | msgid "" | ||
465 | " -o, --proc Prints out information like provided by the /proc/" | ||
466 | "cpufreq\n" | ||
467 | " interface in 2.4. and early 2.6. kernels\n" | ||
468 | msgstr "" | ||
469 | " -o, --proc Stampa le informazioni come se provenissero dalla\n" | ||
470 | " interfaccia cpufreq /proc/ presente nei kernel\n" | ||
471 | " 2.4 ed i primi 2.6\n" | ||
472 | |||
473 | #: utils/cpufreq-info.c:491 | ||
474 | #, c-format | ||
475 | msgid "" | ||
476 | " -m, --human human-readable output for the -f, -w, -s and -y " | ||
477 | "parameters\n" | ||
478 | msgstr "" | ||
479 | " -m, --human formatta l'output delle opzioni -f, -w, -s e -y in " | ||
480 | "maniera\n" | ||
481 | " leggibile da un essere umano\n" | ||
482 | |||
483 | #: utils/cpufreq-info.c:492 utils/cpuidle-info.c:152 | ||
484 | #, c-format | ||
485 | msgid " -h, --help Prints out this screen\n" | ||
486 | msgstr " -h, --help Stampa questa schermata\n" | ||
487 | |||
488 | #: utils/cpufreq-info.c:495 | ||
489 | #, c-format | ||
490 | msgid "" | ||
491 | "If no argument or only the -c, --cpu parameter is given, debug output about\n" | ||
492 | "cpufreq is printed which is useful e.g. for reporting bugs.\n" | ||
493 | msgstr "" | ||
494 | "Se non viene specificata nessuna opzione o viene specificata solo l'opzione -" | ||
495 | "c, --cpu,\n" | ||
496 | "le informazioni di debug per cpufreq saranno utili ad esempio a riportare i " | ||
497 | "bug.\n" | ||
498 | |||
499 | #: utils/cpufreq-info.c:497 | ||
500 | #, c-format | ||
501 | msgid "" | ||
502 | "For the arguments marked with *, omitting the -c or --cpu argument is\n" | ||
503 | "equivalent to setting it to zero\n" | ||
504 | msgstr "" | ||
505 | "Per le opzioni segnalate con *, omettere l'opzione -c o --cpu è come " | ||
506 | "specificarla\n" | ||
507 | "con il valore 0\n" | ||
508 | |||
509 | #: utils/cpufreq-info.c:580 | ||
510 | #, c-format | ||
511 | msgid "" | ||
512 | "The argument passed to this tool can't be combined with passing a --cpu " | ||
513 | "argument\n" | ||
514 | msgstr "" | ||
515 | "L'opzione specificata a questo programma non può essere combinata con --cpu\n" | ||
516 | |||
517 | #: utils/cpufreq-info.c:596 | ||
518 | #, c-format | ||
519 | msgid "" | ||
520 | "You can't specify more than one --cpu parameter and/or\n" | ||
521 | "more than one output-specific argument\n" | ||
522 | msgstr "" | ||
523 | "Non è possibile specificare più di una volta l'opzione --cpu e/o\n" | ||
524 | "specificare più di un parametro di output specifico\n" | ||
525 | |||
526 | #: utils/cpufreq-info.c:600 utils/cpufreq-set.c:82 utils/cpupower-set.c:42 | ||
527 | #: utils/cpupower-info.c:42 utils/cpuidle-info.c:213 | ||
528 | #, c-format | ||
529 | msgid "invalid or unknown argument\n" | ||
530 | msgstr "opzione sconosciuta o non valida\n" | ||
531 | |||
532 | #: utils/cpufreq-info.c:617 | ||
533 | #, c-format | ||
534 | msgid "couldn't analyze CPU %d as it doesn't seem to be present\n" | ||
535 | msgstr "impossibile analizzare la CPU %d poiché non sembra essere presente\n" | ||
536 | |||
537 | #: utils/cpufreq-info.c:620 utils/cpupower-info.c:142 | ||
538 | #, c-format | ||
539 | msgid "analyzing CPU %d:\n" | ||
540 | msgstr "analisi della CPU %d:\n" | ||
541 | |||
542 | #: utils/cpufreq-set.c:25 | ||
543 | #, fuzzy, c-format | ||
544 | msgid "Usage: cpupower frequency-set [options]\n" | ||
545 | msgstr "Uso: cpufreq-set [opzioni]\n" | ||
546 | |||
547 | #: utils/cpufreq-set.c:27 | ||
548 | #, c-format | ||
549 | msgid "" | ||
550 | " -d FREQ, --min FREQ new minimum CPU frequency the governor may " | ||
551 | "select\n" | ||
552 | msgstr "" | ||
553 | " -d FREQ, --min FREQ la nuova frequenza minima che il gestore cpufreq " | ||
554 | "può scegliere\n" | ||
555 | |||
556 | #: utils/cpufreq-set.c:28 | ||
557 | #, c-format | ||
558 | msgid "" | ||
559 | " -u FREQ, --max FREQ new maximum CPU frequency the governor may " | ||
560 | "select\n" | ||
561 | msgstr "" | ||
562 | " -u FREQ, --max FREQ la nuova frequenza massima che il gestore cpufreq " | ||
563 | "può scegliere\n" | ||
564 | |||
565 | #: utils/cpufreq-set.c:29 | ||
566 | #, c-format | ||
567 | msgid " -g GOV, --governor GOV new cpufreq governor\n" | ||
568 | msgstr " -g GOV, --governor GOV nuovo gestore cpufreq\n" | ||
569 | |||
570 | #: utils/cpufreq-set.c:30 | ||
571 | #, c-format | ||
572 | msgid "" | ||
573 | " -f FREQ, --freq FREQ specific frequency to be set. Requires userspace\n" | ||
574 | " governor to be available and loaded\n" | ||
575 | msgstr "" | ||
576 | " -f FREQ, --freq FREQ specifica la frequenza a cui impostare la CPU.\n" | ||
577 | " È necessario che il gestore userspace sia " | ||
578 | "disponibile e caricato\n" | ||
579 | |||
580 | #: utils/cpufreq-set.c:32 | ||
581 | #, c-format | ||
582 | msgid " -r, --related Switches all hardware-related CPUs\n" | ||
583 | msgstr "" | ||
584 | " -r, --related Modifica tutte le CPU coordinate dall'hardware\n" | ||
585 | |||
586 | #: utils/cpufreq-set.c:33 utils/cpupower-set.c:28 utils/cpupower-info.c:27 | ||
587 | #, c-format | ||
588 | msgid " -h, --help Prints out this screen\n" | ||
589 | msgstr " -h, --help Stampa questa schermata\n" | ||
590 | |||
591 | #: utils/cpufreq-set.c:35 | ||
592 | #, fuzzy, c-format | ||
593 | msgid "" | ||
594 | "Notes:\n" | ||
595 | "1. Omitting the -c or --cpu argument is equivalent to setting it to \"all\"\n" | ||
596 | msgstr "" | ||
597 | "Per le opzioni segnalate con *, omettere l'opzione -c o --cpu è come " | ||
598 | "specificarla\n" | ||
599 | "con il valore 0\n" | ||
600 | |||
601 | #: utils/cpufreq-set.c:37 | ||
602 | #, fuzzy, c-format | ||
603 | msgid "" | ||
604 | "2. The -f FREQ, --freq FREQ parameter cannot be combined with any other " | ||
605 | "parameter\n" | ||
606 | " except the -c CPU, --cpu CPU parameter\n" | ||
607 | "3. FREQuencies can be passed in Hz, kHz (default), MHz, GHz, or THz\n" | ||
608 | " by postfixing the value with the wanted unit name, without any space\n" | ||
609 | " (FREQuency in kHz =^ Hz * 0.001 =^ MHz * 1000 =^ GHz * 1000000).\n" | ||
610 | msgstr "" | ||
611 | "Note:\n" | ||
612 | "1. Omettere l'opzione -c o --cpu è equivalente a impostarlo a 0\n" | ||
613 | "2. l'opzione -f FREQ, --freq FREQ non può essere specificata con altre " | ||
614 | "opzioni\n" | ||
615 | " ad eccezione dell'opzione -c CPU o --cpu CPU\n" | ||
616 | "3. le FREQuenze possono essere specuficate in Hz, kHz (default), MHz, GHz, " | ||
617 | "or THz\n" | ||
618 | " postponendo l'unità di misura al valore senza nessuno spazio fra loro\n" | ||
619 | " (FREQuenza in kHz =^ Hz * 0.001 =^ MHz * 1000 =^ GHz * 1000000).\n" | ||
620 | |||
621 | #: utils/cpufreq-set.c:57 | ||
622 | #, c-format | ||
623 | msgid "" | ||
624 | "Error setting new values. Common errors:\n" | ||
625 | "- Do you have proper administration rights? (super-user?)\n" | ||
626 | "- Is the governor you requested available and modprobed?\n" | ||
627 | "- Trying to set an invalid policy?\n" | ||
628 | "- Trying to set a specific frequency, but userspace governor is not " | ||
629 | "available,\n" | ||
630 | " for example because of hardware which cannot be set to a specific " | ||
631 | "frequency\n" | ||
632 | " or because the userspace governor isn't loaded?\n" | ||
633 | msgstr "" | ||
634 | "Si sono verificati degli errori impostando i nuovi valori.\n" | ||
635 | "Alcuni errori comuni possono essere:\n" | ||
636 | "- Hai i necessari diritti di amministrazione? (super-user?)\n" | ||
637 | "- Il gestore che hai richiesto è disponibile e caricato?\n" | ||
638 | "- Stai provando ad impostare una politica di gestione non valida?\n" | ||
639 | "- Stai provando a impostare una specifica frequenza ma il gestore\n" | ||
640 | " userspace non è disponibile, per esempio a causa dell'hardware\n" | ||
641 | " che non supporta frequenze fisse o a causa del fatto che\n" | ||
642 | " il gestore userspace non è caricato?\n" | ||
643 | |||
644 | #: utils/cpufreq-set.c:170 | ||
645 | #, c-format | ||
646 | msgid "wrong, unknown or unhandled CPU?\n" | ||
647 | msgstr "CPU errata, sconosciuta o non gestita?\n" | ||
648 | |||
649 | #: utils/cpufreq-set.c:302 | ||
650 | #, c-format | ||
651 | msgid "" | ||
652 | "the -f/--freq parameter cannot be combined with -d/--min, -u/--max or\n" | ||
653 | "-g/--governor parameters\n" | ||
654 | msgstr "" | ||
655 | "l'opzione -f/--freq non può venire combinata con i parametri\n" | ||
656 | " -d/--min, -u/--max o -g/--governor\n" | ||
657 | |||
658 | #: utils/cpufreq-set.c:308 | ||
659 | #, c-format | ||
660 | msgid "" | ||
661 | "At least one parameter out of -f/--freq, -d/--min, -u/--max, and\n" | ||
662 | "-g/--governor must be passed\n" | ||
663 | msgstr "" | ||
664 | "Almeno una delle opzioni -f/--freq, -d/--min, -u/--max, e -g/--governor\n" | ||
665 | "deve essere specificata\n" | ||
666 | |||
667 | #: utils/cpufreq-set.c:347 | ||
668 | #, c-format | ||
669 | msgid "Setting cpu: %d\n" | ||
670 | msgstr "" | ||
671 | |||
672 | #: utils/cpupower-set.c:22 | ||
673 | #, c-format | ||
674 | msgid "Usage: cpupower set [ -b val ] [ -m val ] [ -s val ]\n" | ||
675 | msgstr "" | ||
676 | |||
677 | #: utils/cpupower-set.c:24 | ||
678 | #, c-format | ||
679 | msgid "" | ||
680 | " -b, --perf-bias [VAL] Sets CPU's power vs performance policy on some\n" | ||
681 | " Intel models [0-15], see manpage for details\n" | ||
682 | msgstr "" | ||
683 | |||
684 | #: utils/cpupower-set.c:26 | ||
685 | #, c-format | ||
686 | msgid "" | ||
687 | " -m, --sched-mc [VAL] Sets the kernel's multi core scheduler policy.\n" | ||
688 | msgstr "" | ||
689 | |||
690 | #: utils/cpupower-set.c:27 | ||
691 | #, c-format | ||
692 | msgid "" | ||
693 | " -s, --sched-smt [VAL] Sets the kernel's thread sibling scheduler " | ||
694 | "policy.\n" | ||
695 | msgstr "" | ||
696 | |||
697 | #: utils/cpupower-set.c:80 | ||
698 | #, c-format | ||
699 | msgid "--perf-bias param out of range [0-%d]\n" | ||
700 | msgstr "" | ||
701 | |||
702 | #: utils/cpupower-set.c:91 | ||
703 | #, c-format | ||
704 | msgid "--sched-mc param out of range [0-%d]\n" | ||
705 | msgstr "" | ||
706 | |||
707 | #: utils/cpupower-set.c:102 | ||
708 | #, c-format | ||
709 | msgid "--sched-smt param out of range [0-%d]\n" | ||
710 | msgstr "" | ||
711 | |||
712 | #: utils/cpupower-set.c:121 | ||
713 | #, c-format | ||
714 | msgid "Error setting sched-mc %s\n" | ||
715 | msgstr "" | ||
716 | |||
717 | #: utils/cpupower-set.c:127 | ||
718 | #, c-format | ||
719 | msgid "Error setting sched-smt %s\n" | ||
720 | msgstr "" | ||
721 | |||
722 | #: utils/cpupower-set.c:146 | ||
723 | #, c-format | ||
724 | msgid "Error setting perf-bias value on CPU %d\n" | ||
725 | msgstr "" | ||
726 | |||
727 | #: utils/cpupower-info.c:21 | ||
728 | #, c-format | ||
729 | msgid "Usage: cpupower info [ -b ] [ -m ] [ -s ]\n" | ||
730 | msgstr "" | ||
731 | |||
732 | #: utils/cpupower-info.c:23 | ||
733 | #, c-format | ||
734 | msgid "" | ||
735 | " -b, --perf-bias Gets CPU's power vs performance policy on some\n" | ||
736 | " Intel models [0-15], see manpage for details\n" | ||
737 | msgstr "" | ||
738 | |||
739 | #: utils/cpupower-info.c:25 | ||
740 | #, fuzzy, c-format | ||
741 | msgid " -m, --sched-mc Gets the kernel's multi core scheduler policy.\n" | ||
742 | msgstr "" | ||
743 | " -p, --policy Mostra il gestore cpufreq attualmente in uso *\n" | ||
744 | |||
745 | #: utils/cpupower-info.c:26 | ||
746 | #, c-format | ||
747 | msgid "" | ||
748 | " -s, --sched-smt Gets the kernel's thread sibling scheduler policy.\n" | ||
749 | msgstr "" | ||
750 | |||
751 | #: utils/cpupower-info.c:28 | ||
752 | #, c-format | ||
753 | msgid "" | ||
754 | "\n" | ||
755 | "Passing no option will show all info, by default only on core 0\n" | ||
756 | msgstr "" | ||
757 | |||
758 | #: utils/cpupower-info.c:102 | ||
759 | #, c-format | ||
760 | msgid "System's multi core scheduler setting: " | ||
761 | msgstr "" | ||
762 | |||
763 | #. if sysfs file is missing it's: errno == ENOENT | ||
764 | #: utils/cpupower-info.c:105 utils/cpupower-info.c:114 | ||
765 | #, c-format | ||
766 | msgid "not supported\n" | ||
767 | msgstr "" | ||
768 | |||
769 | #: utils/cpupower-info.c:111 | ||
770 | #, c-format | ||
771 | msgid "System's thread sibling scheduler setting: " | ||
772 | msgstr "" | ||
773 | |||
774 | #: utils/cpupower-info.c:126 | ||
775 | #, c-format | ||
776 | msgid "Intel's performance bias setting needs root privileges\n" | ||
777 | msgstr "" | ||
778 | |||
779 | #: utils/cpupower-info.c:128 | ||
780 | #, c-format | ||
781 | msgid "System does not support Intel's performance bias setting\n" | ||
782 | msgstr "" | ||
783 | |||
784 | #: utils/cpupower-info.c:147 | ||
785 | #, c-format | ||
786 | msgid "Could not read perf-bias value\n" | ||
787 | msgstr "" | ||
788 | |||
789 | #: utils/cpupower-info.c:150 | ||
790 | #, c-format | ||
791 | msgid "perf-bias: %d\n" | ||
792 | msgstr "" | ||
793 | |||
794 | #: utils/cpuidle-info.c:28 | ||
795 | #, fuzzy, c-format | ||
796 | msgid "Analyzing CPU %d:\n" | ||
797 | msgstr "analisi della CPU %d:\n" | ||
798 | |||
799 | #: utils/cpuidle-info.c:32 | ||
800 | #, c-format | ||
801 | msgid "CPU %u: No idle states\n" | ||
802 | msgstr "" | ||
803 | |||
804 | #: utils/cpuidle-info.c:36 | ||
805 | #, c-format | ||
806 | msgid "CPU %u: Can't read idle state info\n" | ||
807 | msgstr "" | ||
808 | |||
809 | #: utils/cpuidle-info.c:41 | ||
810 | #, c-format | ||
811 | msgid "Could not determine max idle state %u\n" | ||
812 | msgstr "" | ||
813 | |||
814 | #: utils/cpuidle-info.c:46 | ||
815 | #, c-format | ||
816 | msgid "Number of idle states: %d\n" | ||
817 | msgstr "" | ||
818 | |||
819 | #: utils/cpuidle-info.c:48 | ||
820 | #, fuzzy, c-format | ||
821 | msgid "Available idle states:" | ||
822 | msgstr " frequenze disponibili: " | ||
823 | |||
824 | #: utils/cpuidle-info.c:71 | ||
825 | #, c-format | ||
826 | msgid "Flags/Description: %s\n" | ||
827 | msgstr "" | ||
828 | |||
829 | #: utils/cpuidle-info.c:74 | ||
830 | #, c-format | ||
831 | msgid "Latency: %lu\n" | ||
832 | msgstr "" | ||
833 | |||
834 | #: utils/cpuidle-info.c:76 | ||
835 | #, c-format | ||
836 | msgid "Usage: %lu\n" | ||
837 | msgstr "" | ||
838 | |||
839 | #: utils/cpuidle-info.c:78 | ||
840 | #, c-format | ||
841 | msgid "Duration: %llu\n" | ||
842 | msgstr "" | ||
843 | |||
844 | #: utils/cpuidle-info.c:90 | ||
845 | #, c-format | ||
846 | msgid "Could not determine cpuidle driver\n" | ||
847 | msgstr "" | ||
848 | |||
849 | #: utils/cpuidle-info.c:94 | ||
850 | #, fuzzy, c-format | ||
851 | msgid "CPUidle driver: %s\n" | ||
852 | msgstr " modulo %s\n" | ||
853 | |||
854 | #: utils/cpuidle-info.c:99 | ||
855 | #, c-format | ||
856 | msgid "Could not determine cpuidle governor\n" | ||
857 | msgstr "" | ||
858 | |||
859 | #: utils/cpuidle-info.c:103 | ||
860 | #, c-format | ||
861 | msgid "CPUidle governor: %s\n" | ||
862 | msgstr "" | ||
863 | |||
864 | #: utils/cpuidle-info.c:122 | ||
865 | #, c-format | ||
866 | msgid "CPU %u: Can't read C-state info\n" | ||
867 | msgstr "" | ||
868 | |||
869 | #. printf("Cstates: %d\n", cstates); | ||
870 | #: utils/cpuidle-info.c:127 | ||
871 | #, c-format | ||
872 | msgid "active state: C0\n" | ||
873 | msgstr "" | ||
874 | |||
875 | #: utils/cpuidle-info.c:128 | ||
876 | #, c-format | ||
877 | msgid "max_cstate: C%u\n" | ||
878 | msgstr "" | ||
879 | |||
880 | #: utils/cpuidle-info.c:129 | ||
881 | #, fuzzy, c-format | ||
882 | msgid "maximum allowed latency: %lu usec\n" | ||
883 | msgstr " latenza massima durante la transizione: " | ||
884 | |||
885 | #: utils/cpuidle-info.c:130 | ||
886 | #, c-format | ||
887 | msgid "states:\t\n" | ||
888 | msgstr "" | ||
889 | |||
890 | #: utils/cpuidle-info.c:132 | ||
891 | #, c-format | ||
892 | msgid " C%d: type[C%d] " | ||
893 | msgstr "" | ||
894 | |||
895 | #: utils/cpuidle-info.c:134 | ||
896 | #, c-format | ||
897 | msgid "promotion[--] demotion[--] " | ||
898 | msgstr "" | ||
899 | |||
900 | #: utils/cpuidle-info.c:135 | ||
901 | #, c-format | ||
902 | msgid "latency[%03lu] " | ||
903 | msgstr "" | ||
904 | |||
905 | #: utils/cpuidle-info.c:137 | ||
906 | #, c-format | ||
907 | msgid "usage[%08lu] " | ||
908 | msgstr "" | ||
909 | |||
910 | #: utils/cpuidle-info.c:139 | ||
911 | #, c-format | ||
912 | msgid "duration[%020Lu] \n" | ||
913 | msgstr "" | ||
914 | |||
915 | #: utils/cpuidle-info.c:147 | ||
916 | #, fuzzy, c-format | ||
917 | msgid "Usage: cpupower idleinfo [options]\n" | ||
918 | msgstr "Uso: cpufreq-info [opzioni]\n" | ||
919 | |||
920 | #: utils/cpuidle-info.c:149 | ||
921 | #, fuzzy, c-format | ||
922 | msgid " -s, --silent Only show general C-state information\n" | ||
923 | msgstr " -e, --debug Mostra informazioni di debug\n" | ||
924 | |||
925 | #: utils/cpuidle-info.c:150 | ||
926 | #, fuzzy, c-format | ||
927 | msgid "" | ||
928 | " -o, --proc Prints out information like provided by the /proc/" | ||
929 | "acpi/processor/*/power\n" | ||
930 | " interface in older kernels\n" | ||
931 | msgstr "" | ||
932 | " -o, --proc Stampa le informazioni come se provenissero dalla\n" | ||
933 | " interfaccia cpufreq /proc/ presente nei kernel\n" | ||
934 | " 2.4 ed i primi 2.6\n" | ||
935 | |||
936 | #: utils/cpuidle-info.c:209 | ||
937 | #, fuzzy, c-format | ||
938 | msgid "You can't specify more than one output-specific argument\n" | ||
939 | msgstr "" | ||
940 | "Non è possibile specificare più di una volta l'opzione --cpu e/o\n" | ||
941 | "specificare più di un parametro di output specifico\n" | ||
942 | |||
943 | #~ msgid "" | ||
944 | #~ " -c CPU, --cpu CPU CPU number which information shall be determined " | ||
945 | #~ "about\n" | ||
946 | #~ msgstr "" | ||
947 | #~ " -c CPU, --cpu CPU Numero di CPU per la quale ottenere le " | ||
948 | #~ "informazioni\n" | ||
949 | |||
950 | #~ msgid "" | ||
951 | #~ " -c CPU, --cpu CPU number of CPU where cpufreq settings shall be " | ||
952 | #~ "modified\n" | ||
953 | #~ msgstr "" | ||
954 | #~ " -c CPU, --cpu CPU numero di CPU per la quale modificare le " | ||
955 | #~ "impostazioni\n" | ||
956 | |||
957 | #, fuzzy | ||
958 | #~ msgid " CPUs which coordinate software frequency requirements: " | ||
959 | #~ msgstr "" | ||
960 | #~ " CPU per le quali e` necessario cambiare la frequenza " | ||
961 | #~ "contemporaneamente: " | ||
diff --git a/tools/power/cpupower/po/pt.po b/tools/power/cpupower/po/pt.po new file mode 100644 index 00000000000..990f5267ffe --- /dev/null +++ b/tools/power/cpupower/po/pt.po | |||
@@ -0,0 +1,957 @@ | |||
1 | # Brazilian Portuguese translations for cpufrequtils package | ||
2 | # Copyright (C) 2008 THE cpufrequtils'S COPYRIGHT HOLDER | ||
3 | # This file is distributed under the same license as the cpufrequtils package. | ||
4 | # Claudio Eduardo <claudioeddy@gmail.com>, 2009. | ||
5 | # | ||
6 | # | ||
7 | msgid "" | ||
8 | msgstr "" | ||
9 | "Project-Id-Version: cpufrequtils 004\n" | ||
10 | "Report-Msgid-Bugs-To: \n" | ||
11 | "POT-Creation-Date: 2011-03-08 17:03+0100\n" | ||
12 | "PO-Revision-Date: 2008-06-14 22:16-0400\n" | ||
13 | "Last-Translator: Claudio Eduardo <claudioeddy@gmail.com>\n" | ||
14 | "MIME-Version: 1.0\n" | ||
15 | "Content-Type: text/plain; charset=UTF-8\n" | ||
16 | "Content-Transfer-Encoding: 8bit\n" | ||
17 | |||
18 | #: utils/idle_monitor/nhm_idle.c:36 | ||
19 | msgid "Processor Core C3" | ||
20 | msgstr "" | ||
21 | |||
22 | #: utils/idle_monitor/nhm_idle.c:43 | ||
23 | msgid "Processor Core C6" | ||
24 | msgstr "" | ||
25 | |||
26 | #: utils/idle_monitor/nhm_idle.c:51 | ||
27 | msgid "Processor Package C3" | ||
28 | msgstr "" | ||
29 | |||
30 | #: utils/idle_monitor/nhm_idle.c:58 utils/idle_monitor/amd_fam14h_idle.c:70 | ||
31 | msgid "Processor Package C6" | ||
32 | msgstr "" | ||
33 | |||
34 | #: utils/idle_monitor/snb_idle.c:33 | ||
35 | msgid "Processor Core C7" | ||
36 | msgstr "" | ||
37 | |||
38 | #: utils/idle_monitor/snb_idle.c:40 | ||
39 | msgid "Processor Package C2" | ||
40 | msgstr "" | ||
41 | |||
42 | #: utils/idle_monitor/snb_idle.c:47 | ||
43 | msgid "Processor Package C7" | ||
44 | msgstr "" | ||
45 | |||
46 | #: utils/idle_monitor/amd_fam14h_idle.c:56 | ||
47 | msgid "Package in sleep state (PC1 or deeper)" | ||
48 | msgstr "" | ||
49 | |||
50 | #: utils/idle_monitor/amd_fam14h_idle.c:63 | ||
51 | msgid "Processor Package C1" | ||
52 | msgstr "" | ||
53 | |||
54 | #: utils/idle_monitor/amd_fam14h_idle.c:77 | ||
55 | msgid "North Bridge P1 boolean counter (returns 0 or 1)" | ||
56 | msgstr "" | ||
57 | |||
58 | #: utils/idle_monitor/mperf_monitor.c:35 | ||
59 | msgid "Processor Core not idle" | ||
60 | msgstr "" | ||
61 | |||
62 | #: utils/idle_monitor/mperf_monitor.c:42 | ||
63 | msgid "Processor Core in an idle state" | ||
64 | msgstr "" | ||
65 | |||
66 | #: utils/idle_monitor/mperf_monitor.c:50 | ||
67 | msgid "Average Frequency (including boost) in MHz" | ||
68 | msgstr "" | ||
69 | |||
70 | #: utils/idle_monitor/cpupower-monitor.c:66 | ||
71 | #, c-format | ||
72 | msgid "" | ||
73 | "cpupower monitor: [-h] [ [-t] | [-l] | [-m <mon1>,[<mon2>] ] ] [-i " | ||
74 | "interval_sec | -c command ...]\n" | ||
75 | msgstr "" | ||
76 | |||
77 | #: utils/idle_monitor/cpupower-monitor.c:69 | ||
78 | #, c-format | ||
79 | msgid "" | ||
80 | "cpupower monitor: [-v] [-h] [ [-t] | [-l] | [-m <mon1>,[<mon2>] ] ] [-i " | ||
81 | "interval_sec | -c command ...]\n" | ||
82 | msgstr "" | ||
83 | |||
84 | #: utils/idle_monitor/cpupower-monitor.c:71 | ||
85 | #, c-format | ||
86 | msgid "\t -v: be more verbose\n" | ||
87 | msgstr "" | ||
88 | |||
89 | #: utils/idle_monitor/cpupower-monitor.c:73 | ||
90 | #, c-format | ||
91 | msgid "\t -h: print this help\n" | ||
92 | msgstr "" | ||
93 | |||
94 | #: utils/idle_monitor/cpupower-monitor.c:74 | ||
95 | #, c-format | ||
96 | msgid "\t -i: time intervall to measure for in seconds (default 1)\n" | ||
97 | msgstr "" | ||
98 | |||
99 | #: utils/idle_monitor/cpupower-monitor.c:75 | ||
100 | #, c-format | ||
101 | msgid "\t -t: show CPU topology/hierarchy\n" | ||
102 | msgstr "" | ||
103 | |||
104 | #: utils/idle_monitor/cpupower-monitor.c:76 | ||
105 | #, c-format | ||
106 | msgid "\t -l: list available CPU sleep monitors (for use with -m)\n" | ||
107 | msgstr "" | ||
108 | |||
109 | #: utils/idle_monitor/cpupower-monitor.c:77 | ||
110 | #, c-format | ||
111 | msgid "\t -m: show specific CPU sleep monitors only (in same order)\n" | ||
112 | msgstr "" | ||
113 | |||
114 | #: utils/idle_monitor/cpupower-monitor.c:79 | ||
115 | #, c-format | ||
116 | msgid "" | ||
117 | "only one of: -t, -l, -m are allowed\n" | ||
118 | "If none of them is passed," | ||
119 | msgstr "" | ||
120 | |||
121 | #: utils/idle_monitor/cpupower-monitor.c:80 | ||
122 | #, c-format | ||
123 | msgid " all supported monitors are shown\n" | ||
124 | msgstr "" | ||
125 | |||
126 | #: utils/idle_monitor/cpupower-monitor.c:197 | ||
127 | #, c-format | ||
128 | msgid "Monitor %s, Counter %s has no count function. Implementation error\n" | ||
129 | msgstr "" | ||
130 | |||
131 | #: utils/idle_monitor/cpupower-monitor.c:207 | ||
132 | #, c-format | ||
133 | msgid " *is offline\n" | ||
134 | msgstr "" | ||
135 | |||
136 | #: utils/idle_monitor/cpupower-monitor.c:236 | ||
137 | #, c-format | ||
138 | msgid "%s: max monitor name length (%d) exceeded\n" | ||
139 | msgstr "" | ||
140 | |||
141 | #: utils/idle_monitor/cpupower-monitor.c:250 | ||
142 | #, c-format | ||
143 | msgid "No matching monitor found in %s, try -l option\n" | ||
144 | msgstr "" | ||
145 | |||
146 | #: utils/idle_monitor/cpupower-monitor.c:266 | ||
147 | #, c-format | ||
148 | msgid "Monitor \"%s\" (%d states) - Might overflow after %u s\n" | ||
149 | msgstr "" | ||
150 | |||
151 | #: utils/idle_monitor/cpupower-monitor.c:319 | ||
152 | #, c-format | ||
153 | msgid "%s took %.5f seconds and exited with status %d\n" | ||
154 | msgstr "" | ||
155 | |||
156 | #: utils/idle_monitor/cpupower-monitor.c:406 | ||
157 | #, c-format | ||
158 | msgid "Cannot read number of available processors\n" | ||
159 | msgstr "" | ||
160 | |||
161 | #: utils/idle_monitor/cpupower-monitor.c:417 | ||
162 | #, c-format | ||
163 | msgid "Available monitor %s needs root access\n" | ||
164 | msgstr "" | ||
165 | |||
166 | #: utils/idle_monitor/cpupower-monitor.c:428 | ||
167 | #, c-format | ||
168 | msgid "No HW Cstate monitors found\n" | ||
169 | msgstr "" | ||
170 | |||
171 | #: utils/cpupower.c:78 | ||
172 | #, c-format | ||
173 | msgid "cpupower [ -c cpulist ] subcommand [ARGS]\n" | ||
174 | msgstr "" | ||
175 | |||
176 | #: utils/cpupower.c:79 | ||
177 | #, c-format | ||
178 | msgid "cpupower --version\n" | ||
179 | msgstr "" | ||
180 | |||
181 | #: utils/cpupower.c:80 | ||
182 | #, c-format | ||
183 | msgid "Supported subcommands are:\n" | ||
184 | msgstr "" | ||
185 | |||
186 | #: utils/cpupower.c:83 | ||
187 | #, c-format | ||
188 | msgid "" | ||
189 | "\n" | ||
190 | "Some subcommands can make use of the -c cpulist option.\n" | ||
191 | msgstr "" | ||
192 | |||
193 | #: utils/cpupower.c:84 | ||
194 | #, c-format | ||
195 | msgid "Look at the general cpupower manpage how to use it\n" | ||
196 | msgstr "" | ||
197 | |||
198 | #: utils/cpupower.c:85 | ||
199 | #, c-format | ||
200 | msgid "and read up the subcommand's manpage whether it is supported.\n" | ||
201 | msgstr "" | ||
202 | |||
203 | #: utils/cpupower.c:86 | ||
204 | #, c-format | ||
205 | msgid "" | ||
206 | "\n" | ||
207 | "Use cpupower help subcommand for getting help for above subcommands.\n" | ||
208 | msgstr "" | ||
209 | |||
210 | #: utils/cpupower.c:91 | ||
211 | #, c-format | ||
212 | msgid "Report errors and bugs to %s, please.\n" | ||
213 | msgstr "Reporte erros e bugs para %s, por favor.\n" | ||
214 | |||
215 | #: utils/cpupower.c:114 | ||
216 | #, c-format | ||
217 | msgid "Error parsing cpu list\n" | ||
218 | msgstr "" | ||
219 | |||
220 | #: utils/cpupower.c:172 | ||
221 | #, c-format | ||
222 | msgid "Subcommand %s needs root privileges\n" | ||
223 | msgstr "" | ||
224 | |||
225 | #: utils/cpufreq-info.c:31 | ||
226 | #, c-format | ||
227 | msgid "Couldn't count the number of CPUs (%s: %s), assuming 1\n" | ||
228 | msgstr "Não foi possÃvel contar o número de CPUs (%s: %s), assumindo 1\n" | ||
229 | |||
230 | #: utils/cpufreq-info.c:63 | ||
231 | #, c-format | ||
232 | msgid "" | ||
233 | " minimum CPU frequency - maximum CPU frequency - governor\n" | ||
234 | msgstr "" | ||
235 | " frequência mÃnina do CPU - frequência máxima do CPU - " | ||
236 | "regulador\n" | ||
237 | |||
238 | #: utils/cpufreq-info.c:151 | ||
239 | #, c-format | ||
240 | msgid "Error while evaluating Boost Capabilities on CPU %d -- are you root?\n" | ||
241 | msgstr "" | ||
242 | |||
243 | #. P state changes via MSR are identified via cpuid 80000007 | ||
244 | #. on Intel and AMD, but we assume boost capable machines can do that | ||
245 | #. if (cpuid_eax(0x80000000) >= 0x80000007 | ||
246 | #. && (cpuid_edx(0x80000007) & (1 << 7))) | ||
247 | #. | ||
248 | #: utils/cpufreq-info.c:161 | ||
249 | #, c-format | ||
250 | msgid " boost state support: \n" | ||
251 | msgstr "" | ||
252 | |||
253 | #: utils/cpufreq-info.c:163 | ||
254 | #, c-format | ||
255 | msgid " Supported: %s\n" | ||
256 | msgstr "" | ||
257 | |||
258 | #: utils/cpufreq-info.c:163 utils/cpufreq-info.c:164 | ||
259 | msgid "yes" | ||
260 | msgstr "" | ||
261 | |||
262 | #: utils/cpufreq-info.c:163 utils/cpufreq-info.c:164 | ||
263 | msgid "no" | ||
264 | msgstr "" | ||
265 | |||
266 | #: utils/cpufreq-info.c:164 | ||
267 | #, fuzzy, c-format | ||
268 | msgid " Active: %s\n" | ||
269 | msgstr " driver: %s\n" | ||
270 | |||
271 | #: utils/cpufreq-info.c:177 | ||
272 | #, c-format | ||
273 | msgid " Boost States: %d\n" | ||
274 | msgstr "" | ||
275 | |||
276 | #: utils/cpufreq-info.c:178 | ||
277 | #, c-format | ||
278 | msgid " Total States: %d\n" | ||
279 | msgstr "" | ||
280 | |||
281 | #: utils/cpufreq-info.c:181 | ||
282 | #, c-format | ||
283 | msgid " Pstate-Pb%d: %luMHz (boost state)\n" | ||
284 | msgstr "" | ||
285 | |||
286 | #: utils/cpufreq-info.c:184 | ||
287 | #, c-format | ||
288 | msgid " Pstate-P%d: %luMHz\n" | ||
289 | msgstr "" | ||
290 | |||
291 | #: utils/cpufreq-info.c:211 | ||
292 | #, c-format | ||
293 | msgid " no or unknown cpufreq driver is active on this CPU\n" | ||
294 | msgstr " nenhum ou driver do cpufreq deconhecido está ativo nesse CPU\n" | ||
295 | |||
296 | #: utils/cpufreq-info.c:213 | ||
297 | #, c-format | ||
298 | msgid " driver: %s\n" | ||
299 | msgstr " driver: %s\n" | ||
300 | |||
301 | #: utils/cpufreq-info.c:219 | ||
302 | #, c-format | ||
303 | msgid " CPUs which run at the same hardware frequency: " | ||
304 | msgstr " CPUs que rodam na mesma frequência de hardware: " | ||
305 | |||
306 | #: utils/cpufreq-info.c:230 | ||
307 | #, c-format | ||
308 | msgid " CPUs which need to have their frequency coordinated by software: " | ||
309 | msgstr " CPUs que precisam ter suas frequências coordenadas por software: " | ||
310 | |||
311 | #: utils/cpufreq-info.c:241 | ||
312 | #, c-format | ||
313 | msgid " maximum transition latency: " | ||
314 | msgstr " maior latência de transição: " | ||
315 | |||
316 | #: utils/cpufreq-info.c:247 | ||
317 | #, c-format | ||
318 | msgid " hardware limits: " | ||
319 | msgstr " limites do hardware: " | ||
320 | |||
321 | #: utils/cpufreq-info.c:256 | ||
322 | #, c-format | ||
323 | msgid " available frequency steps: " | ||
324 | msgstr " nÃveis de frequência disponÃveis: " | ||
325 | |||
326 | #: utils/cpufreq-info.c:269 | ||
327 | #, c-format | ||
328 | msgid " available cpufreq governors: " | ||
329 | msgstr " reguladores do cpufreq disponÃveis: " | ||
330 | |||
331 | #: utils/cpufreq-info.c:280 | ||
332 | #, c-format | ||
333 | msgid " current policy: frequency should be within " | ||
334 | msgstr " polÃtica de frequência atual deve estar entre " | ||
335 | |||
336 | #: utils/cpufreq-info.c:282 | ||
337 | #, c-format | ||
338 | msgid " and " | ||
339 | msgstr " e " | ||
340 | |||
341 | #: utils/cpufreq-info.c:286 | ||
342 | #, c-format | ||
343 | msgid "" | ||
344 | "The governor \"%s\" may decide which speed to use\n" | ||
345 | " within this range.\n" | ||
346 | msgstr "" | ||
347 | "O regulador \"%s\" deve decidir qual velocidade usar\n" | ||
348 | " dentro desse limite.\n" | ||
349 | |||
350 | #: utils/cpufreq-info.c:293 | ||
351 | #, c-format | ||
352 | msgid " current CPU frequency is " | ||
353 | msgstr " frequência atual do CPU é " | ||
354 | |||
355 | #: utils/cpufreq-info.c:296 | ||
356 | #, c-format | ||
357 | msgid " (asserted by call to hardware)" | ||
358 | msgstr " (declarado por chamada ao hardware)" | ||
359 | |||
360 | #: utils/cpufreq-info.c:304 | ||
361 | #, c-format | ||
362 | msgid " cpufreq stats: " | ||
363 | msgstr " status do cpufreq: " | ||
364 | |||
365 | #: utils/cpufreq-info.c:472 | ||
366 | #, fuzzy, c-format | ||
367 | msgid "Usage: cpupower freqinfo [options]\n" | ||
368 | msgstr "Uso: cpufreq-info [opções]\n" | ||
369 | |||
370 | #: utils/cpufreq-info.c:473 utils/cpufreq-set.c:26 utils/cpupower-set.c:23 | ||
371 | #: utils/cpupower-info.c:22 utils/cpuidle-info.c:148 | ||
372 | #, c-format | ||
373 | msgid "Options:\n" | ||
374 | msgstr "Opções:\n" | ||
375 | |||
376 | #: utils/cpufreq-info.c:474 | ||
377 | #, fuzzy, c-format | ||
378 | msgid " -e, --debug Prints out debug information [default]\n" | ||
379 | msgstr " -e, --debug Mostra informação de debug\n" | ||
380 | |||
381 | #: utils/cpufreq-info.c:475 | ||
382 | #, c-format | ||
383 | msgid "" | ||
384 | " -f, --freq Get frequency the CPU currently runs at, according\n" | ||
385 | " to the cpufreq core *\n" | ||
386 | msgstr "" | ||
387 | " -f, --freq Obtem a frequência na qual o CPU roda no momento, de " | ||
388 | "acordo\n" | ||
389 | " com o núcleo do cpufreq *\n" | ||
390 | |||
391 | #: utils/cpufreq-info.c:477 | ||
392 | #, c-format | ||
393 | msgid "" | ||
394 | " -w, --hwfreq Get frequency the CPU currently runs at, by reading\n" | ||
395 | " it from hardware (only available to root) *\n" | ||
396 | msgstr "" | ||
397 | " -w, --hwfreq Obtem a frequência na qual o CPU está operando no " | ||
398 | "momento,\n" | ||
399 | " através de leitura no hardware (disponÃvel somente " | ||
400 | "para root) *\n" | ||
401 | |||
402 | #: utils/cpufreq-info.c:479 | ||
403 | #, c-format | ||
404 | msgid "" | ||
405 | " -l, --hwlimits Determine the minimum and maximum CPU frequency " | ||
406 | "allowed *\n" | ||
407 | msgstr "" | ||
408 | " -l, --hwlimits Determina a frequência mÃnima e máxima do CPU " | ||
409 | "permitida *\n" | ||
410 | |||
411 | #: utils/cpufreq-info.c:480 | ||
412 | #, c-format | ||
413 | msgid " -d, --driver Determines the used cpufreq kernel driver *\n" | ||
414 | msgstr "" | ||
415 | " -d, --driver Determina o driver do kernel do cpufreq usado *\n" | ||
416 | |||
417 | #: utils/cpufreq-info.c:481 | ||
418 | #, c-format | ||
419 | msgid " -p, --policy Gets the currently used cpufreq policy *\n" | ||
420 | msgstr "" | ||
421 | "--p, --policy Obtem a polÃtica do cpufreq em uso no momento *\n" | ||
422 | |||
423 | #: utils/cpufreq-info.c:482 | ||
424 | #, c-format | ||
425 | msgid " -g, --governors Determines available cpufreq governors *\n" | ||
426 | msgstr "" | ||
427 | " -g, --governors Determina reguladores do cpufreq disponÃveis *\n" | ||
428 | |||
429 | #: utils/cpufreq-info.c:483 | ||
430 | #, c-format | ||
431 | msgid "" | ||
432 | " -r, --related-cpus Determines which CPUs run at the same hardware " | ||
433 | "frequency *\n" | ||
434 | msgstr "" | ||
435 | " -r, --related-cpus Determina quais CPUs rodam na mesma frequência de " | ||
436 | "hardware *\n" | ||
437 | |||
438 | #: utils/cpufreq-info.c:484 | ||
439 | #, c-format | ||
440 | msgid "" | ||
441 | " -a, --affected-cpus Determines which CPUs need to have their frequency\n" | ||
442 | " coordinated by software *\n" | ||
443 | msgstr "" | ||
444 | " -a, --affected-cpus Determina quais CPUs precisam ter suas frequências\n" | ||
445 | " coordenadas por software *\n" | ||
446 | |||
447 | #: utils/cpufreq-info.c:486 | ||
448 | #, c-format | ||
449 | msgid " -s, --stats Shows cpufreq statistics if available\n" | ||
450 | msgstr " -s, --stats Mostra estatÃsticas do cpufreq se disponÃveis\n" | ||
451 | |||
452 | #: utils/cpufreq-info.c:487 | ||
453 | #, c-format | ||
454 | msgid "" | ||
455 | " -y, --latency Determines the maximum latency on CPU frequency " | ||
456 | "changes *\n" | ||
457 | msgstr "" | ||
458 | " -y, --latency Determina a latência máxima nas trocas de frequência " | ||
459 | "do CPU *\n" | ||
460 | |||
461 | #: utils/cpufreq-info.c:488 | ||
462 | #, c-format | ||
463 | msgid " -b, --boost Checks for turbo or boost modes *\n" | ||
464 | msgstr "" | ||
465 | |||
466 | #: utils/cpufreq-info.c:489 | ||
467 | #, c-format | ||
468 | msgid "" | ||
469 | " -o, --proc Prints out information like provided by the /proc/" | ||
470 | "cpufreq\n" | ||
471 | " interface in 2.4. and early 2.6. kernels\n" | ||
472 | msgstr "" | ||
473 | " -o, --proc Mostra informação do tipo provida pela interface /" | ||
474 | "proc/cpufreq\n" | ||
475 | " em kernels 2.4. e mais recentes 2.6\n" | ||
476 | |||
477 | #: utils/cpufreq-info.c:491 | ||
478 | #, c-format | ||
479 | msgid "" | ||
480 | " -m, --human human-readable output for the -f, -w, -s and -y " | ||
481 | "parameters\n" | ||
482 | msgstr "" | ||
483 | " -m, --human saÃda legÃvel para humanos para os parâmetros -f, -w, " | ||
484 | "-s e -y\n" | ||
485 | |||
486 | #: utils/cpufreq-info.c:492 utils/cpuidle-info.c:152 | ||
487 | #, c-format | ||
488 | msgid " -h, --help Prints out this screen\n" | ||
489 | msgstr " -h, --help Imprime essa tela\n" | ||
490 | |||
491 | #: utils/cpufreq-info.c:495 | ||
492 | #, c-format | ||
493 | msgid "" | ||
494 | "If no argument or only the -c, --cpu parameter is given, debug output about\n" | ||
495 | "cpufreq is printed which is useful e.g. for reporting bugs.\n" | ||
496 | msgstr "" | ||
497 | "Se nenhum argumento ou somente o parâmetro -c, --cpu é dado, informação de " | ||
498 | "debug sobre\n" | ||
499 | "o cpufreq é mostrada, o que é útil por exemplo para reportar bugs.\n" | ||
500 | |||
501 | #: utils/cpufreq-info.c:497 | ||
502 | #, c-format | ||
503 | msgid "" | ||
504 | "For the arguments marked with *, omitting the -c or --cpu argument is\n" | ||
505 | "equivalent to setting it to zero\n" | ||
506 | msgstr "" | ||
507 | "Para os argumentos marcados com *, omitir o argumento -c ou --cpu é\n" | ||
508 | "equivalente a setá-lo como zero\n" | ||
509 | |||
510 | #: utils/cpufreq-info.c:580 | ||
511 | #, c-format | ||
512 | msgid "" | ||
513 | "The argument passed to this tool can't be combined with passing a --cpu " | ||
514 | "argument\n" | ||
515 | msgstr "" | ||
516 | "O argumento usado pra essa ferramenta não pode ser combinado com um " | ||
517 | "argumento --cpu\n" | ||
518 | |||
519 | #: utils/cpufreq-info.c:596 | ||
520 | #, c-format | ||
521 | msgid "" | ||
522 | "You can't specify more than one --cpu parameter and/or\n" | ||
523 | "more than one output-specific argument\n" | ||
524 | msgstr "" | ||
525 | "Você não pode especificar mais do que um parâmetro --cpu e/ou\n" | ||
526 | "mais do que um argumento de saÃda especÃfico\n" | ||
527 | |||
528 | #: utils/cpufreq-info.c:600 utils/cpufreq-set.c:82 utils/cpupower-set.c:42 | ||
529 | #: utils/cpupower-info.c:42 utils/cpuidle-info.c:213 | ||
530 | #, c-format | ||
531 | msgid "invalid or unknown argument\n" | ||
532 | msgstr "argumento inválido ou desconhecido\n" | ||
533 | |||
534 | #: utils/cpufreq-info.c:617 | ||
535 | #, c-format | ||
536 | msgid "couldn't analyze CPU %d as it doesn't seem to be present\n" | ||
537 | msgstr "" | ||
538 | "não foi possÃvel analisar o CPU % já que o mesmo parece não estar presente\n" | ||
539 | |||
540 | #: utils/cpufreq-info.c:620 utils/cpupower-info.c:142 | ||
541 | #, c-format | ||
542 | msgid "analyzing CPU %d:\n" | ||
543 | msgstr "analisando o CPU %d:\n" | ||
544 | |||
545 | #: utils/cpufreq-set.c:25 | ||
546 | #, fuzzy, c-format | ||
547 | msgid "Usage: cpupower frequency-set [options]\n" | ||
548 | msgstr "Uso: cpufreq-set [opções]\n" | ||
549 | |||
550 | #: utils/cpufreq-set.c:27 | ||
551 | #, c-format | ||
552 | msgid "" | ||
553 | " -d FREQ, --min FREQ new minimum CPU frequency the governor may " | ||
554 | "select\n" | ||
555 | msgstr "" | ||
556 | " -d FREQ, --min FREQ nova frequência mÃnima do CPU que o regulador " | ||
557 | "deve selecionar\n" | ||
558 | |||
559 | #: utils/cpufreq-set.c:28 | ||
560 | #, c-format | ||
561 | msgid "" | ||
562 | " -u FREQ, --max FREQ new maximum CPU frequency the governor may " | ||
563 | "select\n" | ||
564 | msgstr "" | ||
565 | " -u FREQ, --max FREQ nova frequência máxima do CPU que o regulador " | ||
566 | "deve escolher\n" | ||
567 | |||
568 | #: utils/cpufreq-set.c:29 | ||
569 | #, c-format | ||
570 | msgid " -g GOV, --governor GOV new cpufreq governor\n" | ||
571 | msgstr " -g GOV, --governor GOV novo regulador do cpufreq\n" | ||
572 | |||
573 | #: utils/cpufreq-set.c:30 | ||
574 | #, c-format | ||
575 | msgid "" | ||
576 | " -f FREQ, --freq FREQ specific frequency to be set. Requires userspace\n" | ||
577 | " governor to be available and loaded\n" | ||
578 | msgstr "" | ||
579 | " -f FREQ, --freq FREQ frequência especÃfica para ser setada. Necessita " | ||
580 | "que o regulador em\n" | ||
581 | " nÃvel de usuário esteja disponÃvel e carregado\n" | ||
582 | |||
583 | #: utils/cpufreq-set.c:32 | ||
584 | #, c-format | ||
585 | msgid " -r, --related Switches all hardware-related CPUs\n" | ||
586 | msgstr "" | ||
587 | " -r, --related Modifica todos os CPUs relacionados ao hardware\n" | ||
588 | |||
589 | #: utils/cpufreq-set.c:33 utils/cpupower-set.c:28 utils/cpupower-info.c:27 | ||
590 | #, c-format | ||
591 | msgid " -h, --help Prints out this screen\n" | ||
592 | msgstr " -h, --help Mostra essa tela\n" | ||
593 | |||
594 | #: utils/cpufreq-set.c:35 | ||
595 | #, fuzzy, c-format | ||
596 | msgid "" | ||
597 | "Notes:\n" | ||
598 | "1. Omitting the -c or --cpu argument is equivalent to setting it to \"all\"\n" | ||
599 | msgstr "" | ||
600 | "Para os argumentos marcados com *, omitir o argumento -c ou --cpu é\n" | ||
601 | "equivalente a setá-lo como zero\n" | ||
602 | |||
603 | #: utils/cpufreq-set.c:37 | ||
604 | #, fuzzy, c-format | ||
605 | msgid "" | ||
606 | "2. The -f FREQ, --freq FREQ parameter cannot be combined with any other " | ||
607 | "parameter\n" | ||
608 | " except the -c CPU, --cpu CPU parameter\n" | ||
609 | "3. FREQuencies can be passed in Hz, kHz (default), MHz, GHz, or THz\n" | ||
610 | " by postfixing the value with the wanted unit name, without any space\n" | ||
611 | " (FREQuency in kHz =^ Hz * 0.001 =^ MHz * 1000 =^ GHz * 1000000).\n" | ||
612 | msgstr "" | ||
613 | "Notas:\n" | ||
614 | "1. Omitir o argumento -c or --cpu é equivalente a setá-lo como zero\n" | ||
615 | "2. O parâmetro -f FREQ, --freq FREQ não pode ser combinado com qualquer " | ||
616 | "outro parâmetro\n" | ||
617 | " exceto com o parâmetro -c CPU, --cpu CPU\n" | ||
618 | "3. FREQuências podem ser usadas em Hz, kHz (padrão), MHz, GHz, o THz\n" | ||
619 | " colocando o nome desejado da unidade após o valor, sem qualquer espaço\n" | ||
620 | " (FREQuência em kHz =^ Hz * 0.001 =^ MHz * 1000 =^ GHz * 1000000).\n" | ||
621 | |||
622 | #: utils/cpufreq-set.c:57 | ||
623 | #, c-format | ||
624 | msgid "" | ||
625 | "Error setting new values. Common errors:\n" | ||
626 | "- Do you have proper administration rights? (super-user?)\n" | ||
627 | "- Is the governor you requested available and modprobed?\n" | ||
628 | "- Trying to set an invalid policy?\n" | ||
629 | "- Trying to set a specific frequency, but userspace governor is not " | ||
630 | "available,\n" | ||
631 | " for example because of hardware which cannot be set to a specific " | ||
632 | "frequency\n" | ||
633 | " or because the userspace governor isn't loaded?\n" | ||
634 | msgstr "" | ||
635 | "Erro ao setar novos valores. Erros comuns:\n" | ||
636 | "- Você tem direitos administrativos necessários? (super-usuário?)\n" | ||
637 | "- O regulador que você requesitou está disponÃvel e foi \"modprobed\"?\n" | ||
638 | "- Tentando setar uma polÃtica inválida?\n" | ||
639 | "- Tentando setar uma frequência especÃfica, mas o regulador em nÃvel de " | ||
640 | "usuário não está disponÃvel,\n" | ||
641 | " por exemplo devido ao hardware que não pode ser setado pra uma frequência " | ||
642 | "especÃfica\n" | ||
643 | " ou porque o regulador em nÃvel de usuário não foi carregado?\n" | ||
644 | |||
645 | #: utils/cpufreq-set.c:170 | ||
646 | #, c-format | ||
647 | msgid "wrong, unknown or unhandled CPU?\n" | ||
648 | msgstr "CPU errado, desconhecido ou inesperado?\n" | ||
649 | |||
650 | #: utils/cpufreq-set.c:302 | ||
651 | #, c-format | ||
652 | msgid "" | ||
653 | "the -f/--freq parameter cannot be combined with -d/--min, -u/--max or\n" | ||
654 | "-g/--governor parameters\n" | ||
655 | msgstr "" | ||
656 | "o parâmetro -f/--freq não pode ser combinado com os parâmetros -d/--min, -" | ||
657 | "u/--max ou\n" | ||
658 | "-g/--governor\n" | ||
659 | |||
660 | #: utils/cpufreq-set.c:308 | ||
661 | #, c-format | ||
662 | msgid "" | ||
663 | "At least one parameter out of -f/--freq, -d/--min, -u/--max, and\n" | ||
664 | "-g/--governor must be passed\n" | ||
665 | msgstr "" | ||
666 | "Pelo menos um parâmetro entre -f/--freq, -d/--min, -u/--max, e\n" | ||
667 | "-g/--governor deve ser usado\n" | ||
668 | |||
669 | #: utils/cpufreq-set.c:347 | ||
670 | #, c-format | ||
671 | msgid "Setting cpu: %d\n" | ||
672 | msgstr "" | ||
673 | |||
674 | #: utils/cpupower-set.c:22 | ||
675 | #, c-format | ||
676 | msgid "Usage: cpupower set [ -b val ] [ -m val ] [ -s val ]\n" | ||
677 | msgstr "" | ||
678 | |||
679 | #: utils/cpupower-set.c:24 | ||
680 | #, c-format | ||
681 | msgid "" | ||
682 | " -b, --perf-bias [VAL] Sets CPU's power vs performance policy on some\n" | ||
683 | " Intel models [0-15], see manpage for details\n" | ||
684 | msgstr "" | ||
685 | |||
686 | #: utils/cpupower-set.c:26 | ||
687 | #, c-format | ||
688 | msgid "" | ||
689 | " -m, --sched-mc [VAL] Sets the kernel's multi core scheduler policy.\n" | ||
690 | msgstr "" | ||
691 | |||
692 | #: utils/cpupower-set.c:27 | ||
693 | #, c-format | ||
694 | msgid "" | ||
695 | " -s, --sched-smt [VAL] Sets the kernel's thread sibling scheduler " | ||
696 | "policy.\n" | ||
697 | msgstr "" | ||
698 | |||
699 | #: utils/cpupower-set.c:80 | ||
700 | #, c-format | ||
701 | msgid "--perf-bias param out of range [0-%d]\n" | ||
702 | msgstr "" | ||
703 | |||
704 | #: utils/cpupower-set.c:91 | ||
705 | #, c-format | ||
706 | msgid "--sched-mc param out of range [0-%d]\n" | ||
707 | msgstr "" | ||
708 | |||
709 | #: utils/cpupower-set.c:102 | ||
710 | #, c-format | ||
711 | msgid "--sched-smt param out of range [0-%d]\n" | ||
712 | msgstr "" | ||
713 | |||
714 | #: utils/cpupower-set.c:121 | ||
715 | #, c-format | ||
716 | msgid "Error setting sched-mc %s\n" | ||
717 | msgstr "" | ||
718 | |||
719 | #: utils/cpupower-set.c:127 | ||
720 | #, c-format | ||
721 | msgid "Error setting sched-smt %s\n" | ||
722 | msgstr "" | ||
723 | |||
724 | #: utils/cpupower-set.c:146 | ||
725 | #, c-format | ||
726 | msgid "Error setting perf-bias value on CPU %d\n" | ||
727 | msgstr "" | ||
728 | |||
729 | #: utils/cpupower-info.c:21 | ||
730 | #, c-format | ||
731 | msgid "Usage: cpupower info [ -b ] [ -m ] [ -s ]\n" | ||
732 | msgstr "" | ||
733 | |||
734 | #: utils/cpupower-info.c:23 | ||
735 | #, c-format | ||
736 | msgid "" | ||
737 | " -b, --perf-bias Gets CPU's power vs performance policy on some\n" | ||
738 | " Intel models [0-15], see manpage for details\n" | ||
739 | msgstr "" | ||
740 | |||
741 | #: utils/cpupower-info.c:25 | ||
742 | #, fuzzy, c-format | ||
743 | msgid " -m, --sched-mc Gets the kernel's multi core scheduler policy.\n" | ||
744 | msgstr "" | ||
745 | "--p, --policy Obtem a polÃtica do cpufreq em uso no momento *\n" | ||
746 | |||
747 | #: utils/cpupower-info.c:26 | ||
748 | #, c-format | ||
749 | msgid "" | ||
750 | " -s, --sched-smt Gets the kernel's thread sibling scheduler policy.\n" | ||
751 | msgstr "" | ||
752 | |||
753 | #: utils/cpupower-info.c:28 | ||
754 | #, c-format | ||
755 | msgid "" | ||
756 | "\n" | ||
757 | "Passing no option will show all info, by default only on core 0\n" | ||
758 | msgstr "" | ||
759 | |||
760 | #: utils/cpupower-info.c:102 | ||
761 | #, c-format | ||
762 | msgid "System's multi core scheduler setting: " | ||
763 | msgstr "" | ||
764 | |||
765 | #. if sysfs file is missing it's: errno == ENOENT | ||
766 | #: utils/cpupower-info.c:105 utils/cpupower-info.c:114 | ||
767 | #, c-format | ||
768 | msgid "not supported\n" | ||
769 | msgstr "" | ||
770 | |||
771 | #: utils/cpupower-info.c:111 | ||
772 | #, c-format | ||
773 | msgid "System's thread sibling scheduler setting: " | ||
774 | msgstr "" | ||
775 | |||
776 | #: utils/cpupower-info.c:126 | ||
777 | #, c-format | ||
778 | msgid "Intel's performance bias setting needs root privileges\n" | ||
779 | msgstr "" | ||
780 | |||
781 | #: utils/cpupower-info.c:128 | ||
782 | #, c-format | ||
783 | msgid "System does not support Intel's performance bias setting\n" | ||
784 | msgstr "" | ||
785 | |||
786 | #: utils/cpupower-info.c:147 | ||
787 | #, c-format | ||
788 | msgid "Could not read perf-bias value\n" | ||
789 | msgstr "" | ||
790 | |||
791 | #: utils/cpupower-info.c:150 | ||
792 | #, c-format | ||
793 | msgid "perf-bias: %d\n" | ||
794 | msgstr "" | ||
795 | |||
796 | #: utils/cpuidle-info.c:28 | ||
797 | #, fuzzy, c-format | ||
798 | msgid "Analyzing CPU %d:\n" | ||
799 | msgstr "analisando o CPU %d:\n" | ||
800 | |||
801 | #: utils/cpuidle-info.c:32 | ||
802 | #, c-format | ||
803 | msgid "CPU %u: No idle states\n" | ||
804 | msgstr "" | ||
805 | |||
806 | #: utils/cpuidle-info.c:36 | ||
807 | #, c-format | ||
808 | msgid "CPU %u: Can't read idle state info\n" | ||
809 | msgstr "" | ||
810 | |||
811 | #: utils/cpuidle-info.c:41 | ||
812 | #, c-format | ||
813 | msgid "Could not determine max idle state %u\n" | ||
814 | msgstr "" | ||
815 | |||
816 | #: utils/cpuidle-info.c:46 | ||
817 | #, c-format | ||
818 | msgid "Number of idle states: %d\n" | ||
819 | msgstr "" | ||
820 | |||
821 | #: utils/cpuidle-info.c:48 | ||
822 | #, fuzzy, c-format | ||
823 | msgid "Available idle states:" | ||
824 | msgstr " nÃveis de frequência disponÃveis: " | ||
825 | |||
826 | #: utils/cpuidle-info.c:71 | ||
827 | #, c-format | ||
828 | msgid "Flags/Description: %s\n" | ||
829 | msgstr "" | ||
830 | |||
831 | #: utils/cpuidle-info.c:74 | ||
832 | #, c-format | ||
833 | msgid "Latency: %lu\n" | ||
834 | msgstr "" | ||
835 | |||
836 | #: utils/cpuidle-info.c:76 | ||
837 | #, c-format | ||
838 | msgid "Usage: %lu\n" | ||
839 | msgstr "" | ||
840 | |||
841 | #: utils/cpuidle-info.c:78 | ||
842 | #, c-format | ||
843 | msgid "Duration: %llu\n" | ||
844 | msgstr "" | ||
845 | |||
846 | #: utils/cpuidle-info.c:90 | ||
847 | #, c-format | ||
848 | msgid "Could not determine cpuidle driver\n" | ||
849 | msgstr "" | ||
850 | |||
851 | #: utils/cpuidle-info.c:94 | ||
852 | #, fuzzy, c-format | ||
853 | msgid "CPUidle driver: %s\n" | ||
854 | msgstr " driver: %s\n" | ||
855 | |||
856 | #: utils/cpuidle-info.c:99 | ||
857 | #, c-format | ||
858 | msgid "Could not determine cpuidle governor\n" | ||
859 | msgstr "" | ||
860 | |||
861 | #: utils/cpuidle-info.c:103 | ||
862 | #, c-format | ||
863 | msgid "CPUidle governor: %s\n" | ||
864 | msgstr "" | ||
865 | |||
866 | #: utils/cpuidle-info.c:122 | ||
867 | #, c-format | ||
868 | msgid "CPU %u: Can't read C-state info\n" | ||
869 | msgstr "" | ||
870 | |||
871 | #. printf("Cstates: %d\n", cstates); | ||
872 | #: utils/cpuidle-info.c:127 | ||
873 | #, c-format | ||
874 | msgid "active state: C0\n" | ||
875 | msgstr "" | ||
876 | |||
877 | #: utils/cpuidle-info.c:128 | ||
878 | #, c-format | ||
879 | msgid "max_cstate: C%u\n" | ||
880 | msgstr "" | ||
881 | |||
882 | #: utils/cpuidle-info.c:129 | ||
883 | #, fuzzy, c-format | ||
884 | msgid "maximum allowed latency: %lu usec\n" | ||
885 | msgstr " maior latência de transição: " | ||
886 | |||
887 | #: utils/cpuidle-info.c:130 | ||
888 | #, c-format | ||
889 | msgid "states:\t\n" | ||
890 | msgstr "" | ||
891 | |||
892 | #: utils/cpuidle-info.c:132 | ||
893 | #, c-format | ||
894 | msgid " C%d: type[C%d] " | ||
895 | msgstr "" | ||
896 | |||
897 | #: utils/cpuidle-info.c:134 | ||
898 | #, c-format | ||
899 | msgid "promotion[--] demotion[--] " | ||
900 | msgstr "" | ||
901 | |||
902 | #: utils/cpuidle-info.c:135 | ||
903 | #, c-format | ||
904 | msgid "latency[%03lu] " | ||
905 | msgstr "" | ||
906 | |||
907 | #: utils/cpuidle-info.c:137 | ||
908 | #, c-format | ||
909 | msgid "usage[%08lu] " | ||
910 | msgstr "" | ||
911 | |||
912 | #: utils/cpuidle-info.c:139 | ||
913 | #, c-format | ||
914 | msgid "duration[%020Lu] \n" | ||
915 | msgstr "" | ||
916 | |||
917 | #: utils/cpuidle-info.c:147 | ||
918 | #, fuzzy, c-format | ||
919 | msgid "Usage: cpupower idleinfo [options]\n" | ||
920 | msgstr "Uso: cpufreq-info [opções]\n" | ||
921 | |||
922 | #: utils/cpuidle-info.c:149 | ||
923 | #, fuzzy, c-format | ||
924 | msgid " -s, --silent Only show general C-state information\n" | ||
925 | msgstr " -e, --debug Mostra informação de debug\n" | ||
926 | |||
927 | #: utils/cpuidle-info.c:150 | ||
928 | #, fuzzy, c-format | ||
929 | msgid "" | ||
930 | " -o, --proc Prints out information like provided by the /proc/" | ||
931 | "acpi/processor/*/power\n" | ||
932 | " interface in older kernels\n" | ||
933 | msgstr "" | ||
934 | " -o, --proc Mostra informação do tipo provida pela interface /" | ||
935 | "proc/cpufreq\n" | ||
936 | " em kernels 2.4. e mais recentes 2.6\n" | ||
937 | |||
938 | #: utils/cpuidle-info.c:209 | ||
939 | #, fuzzy, c-format | ||
940 | msgid "You can't specify more than one output-specific argument\n" | ||
941 | msgstr "" | ||
942 | "Você não pode especificar mais do que um parâmetro --cpu e/ou\n" | ||
943 | "mais do que um argumento de saÃda especÃfico\n" | ||
944 | |||
945 | #~ msgid "" | ||
946 | #~ " -c CPU, --cpu CPU CPU number which information shall be determined " | ||
947 | #~ "about\n" | ||
948 | #~ msgstr "" | ||
949 | #~ " -c CPU, --cpu CPU número do CPU sobre o qual as inforções devem ser " | ||
950 | #~ "determinadas\n" | ||
951 | |||
952 | #~ msgid "" | ||
953 | #~ " -c CPU, --cpu CPU number of CPU where cpufreq settings shall be " | ||
954 | #~ "modified\n" | ||
955 | #~ msgstr "" | ||
956 | #~ " -c CPU, --cpu CPU número do CPU onde as configurações do cpufreq " | ||
957 | #~ "vão ser modificadas\n" | ||
diff --git a/tools/power/cpupower/utils/builtin.h b/tools/power/cpupower/utils/builtin.h new file mode 100644 index 00000000000..c870ffba521 --- /dev/null +++ b/tools/power/cpupower/utils/builtin.h | |||
@@ -0,0 +1,18 @@ | |||
1 | #ifndef BUILTIN_H | ||
2 | #define BUILTIN_H | ||
3 | |||
4 | extern int cmd_set(int argc, const char **argv); | ||
5 | extern int cmd_info(int argc, const char **argv); | ||
6 | extern int cmd_freq_set(int argc, const char **argv); | ||
7 | extern int cmd_freq_info(int argc, const char **argv); | ||
8 | extern int cmd_idle_info(int argc, const char **argv); | ||
9 | extern int cmd_monitor(int argc, const char **argv); | ||
10 | |||
11 | extern void set_help(void); | ||
12 | extern void info_help(void); | ||
13 | extern void freq_set_help(void); | ||
14 | extern void freq_info_help(void); | ||
15 | extern void idle_info_help(void); | ||
16 | extern void monitor_help(void); | ||
17 | |||
18 | #endif | ||
diff --git a/tools/power/cpupower/utils/cpufreq-info.c b/tools/power/cpupower/utils/cpufreq-info.c new file mode 100644 index 00000000000..eaa8be06edf --- /dev/null +++ b/tools/power/cpupower/utils/cpufreq-info.c | |||
@@ -0,0 +1,665 @@ | |||
1 | /* | ||
2 | * (C) 2004-2009 Dominik Brodowski <linux@dominikbrodowski.de> | ||
3 | * | ||
4 | * Licensed under the terms of the GNU GPL License version 2. | ||
5 | */ | ||
6 | |||
7 | |||
8 | #include <unistd.h> | ||
9 | #include <stdio.h> | ||
10 | #include <errno.h> | ||
11 | #include <stdlib.h> | ||
12 | #include <string.h> | ||
13 | |||
14 | #include <getopt.h> | ||
15 | |||
16 | #include "cpufreq.h" | ||
17 | #include "helpers/helpers.h" | ||
18 | #include "helpers/bitmask.h" | ||
19 | |||
20 | #define LINE_LEN 10 | ||
21 | |||
22 | static unsigned int count_cpus(void) | ||
23 | { | ||
24 | FILE *fp; | ||
25 | char value[LINE_LEN]; | ||
26 | unsigned int ret = 0; | ||
27 | unsigned int cpunr = 0; | ||
28 | |||
29 | fp = fopen("/proc/stat", "r"); | ||
30 | if(!fp) { | ||
31 | printf(_("Couldn't count the number of CPUs (%s: %s), assuming 1\n"), "/proc/stat", strerror(errno)); | ||
32 | return 1; | ||
33 | } | ||
34 | |||
35 | while (!feof(fp)) { | ||
36 | if (!fgets(value, LINE_LEN, fp)) | ||
37 | continue; | ||
38 | value[LINE_LEN - 1] = '\0'; | ||
39 | if (strlen(value) < (LINE_LEN - 2)) | ||
40 | continue; | ||
41 | if (strstr(value, "cpu ")) | ||
42 | continue; | ||
43 | if (sscanf(value, "cpu%d ", &cpunr) != 1) | ||
44 | continue; | ||
45 | if (cpunr > ret) | ||
46 | ret = cpunr; | ||
47 | } | ||
48 | fclose(fp); | ||
49 | |||
50 | /* cpu count starts from 0, on error return 1 (UP) */ | ||
51 | return (ret+1); | ||
52 | } | ||
53 | |||
54 | |||
55 | static void proc_cpufreq_output(void) | ||
56 | { | ||
57 | unsigned int cpu, nr_cpus; | ||
58 | struct cpufreq_policy *policy; | ||
59 | unsigned int min_pctg = 0; | ||
60 | unsigned int max_pctg = 0; | ||
61 | unsigned long min, max; | ||
62 | |||
63 | printf(_(" minimum CPU frequency - maximum CPU frequency - governor\n")); | ||
64 | |||
65 | nr_cpus = count_cpus(); | ||
66 | for (cpu=0; cpu < nr_cpus; cpu++) { | ||
67 | policy = cpufreq_get_policy(cpu); | ||
68 | if (!policy) | ||
69 | continue; | ||
70 | |||
71 | if (cpufreq_get_hardware_limits(cpu, &min, &max)) { | ||
72 | max = 0; | ||
73 | } else { | ||
74 | min_pctg = (policy->min * 100) / max; | ||
75 | max_pctg = (policy->max * 100) / max; | ||
76 | } | ||
77 | printf("CPU%3d %9lu kHz (%3d %%) - %9lu kHz (%3d %%) - %s\n", | ||
78 | cpu , policy->min, max ? min_pctg : 0, policy->max, max ? max_pctg : 0, policy->governor); | ||
79 | |||
80 | cpufreq_put_policy(policy); | ||
81 | } | ||
82 | } | ||
83 | |||
84 | static void print_speed(unsigned long speed) | ||
85 | { | ||
86 | unsigned long tmp; | ||
87 | |||
88 | if (speed > 1000000) { | ||
89 | tmp = speed % 10000; | ||
90 | if (tmp >= 5000) | ||
91 | speed += 10000; | ||
92 | printf ("%u.%02u GHz", ((unsigned int) speed/1000000), | ||
93 | ((unsigned int) (speed%1000000)/10000)); | ||
94 | } else if (speed > 100000) { | ||
95 | tmp = speed % 1000; | ||
96 | if (tmp >= 500) | ||
97 | speed += 1000; | ||
98 | printf ("%u MHz", ((unsigned int) speed / 1000)); | ||
99 | } else if (speed > 1000) { | ||
100 | tmp = speed % 100; | ||
101 | if (tmp >= 50) | ||
102 | speed += 100; | ||
103 | printf ("%u.%01u MHz", ((unsigned int) speed/1000), | ||
104 | ((unsigned int) (speed%1000)/100)); | ||
105 | } else | ||
106 | printf ("%lu kHz", speed); | ||
107 | |||
108 | return; | ||
109 | } | ||
110 | |||
111 | static void print_duration(unsigned long duration) | ||
112 | { | ||
113 | unsigned long tmp; | ||
114 | |||
115 | if (duration > 1000000) { | ||
116 | tmp = duration % 10000; | ||
117 | if (tmp >= 5000) | ||
118 | duration += 10000; | ||
119 | printf ("%u.%02u ms", ((unsigned int) duration/1000000), | ||
120 | ((unsigned int) (duration%1000000)/10000)); | ||
121 | } else if (duration > 100000) { | ||
122 | tmp = duration % 1000; | ||
123 | if (tmp >= 500) | ||
124 | duration += 1000; | ||
125 | printf ("%u us", ((unsigned int) duration / 1000)); | ||
126 | } else if (duration > 1000) { | ||
127 | tmp = duration % 100; | ||
128 | if (tmp >= 50) | ||
129 | duration += 100; | ||
130 | printf ("%u.%01u us", ((unsigned int) duration/1000), | ||
131 | ((unsigned int) (duration%1000)/100)); | ||
132 | } else | ||
133 | printf ("%lu ns", duration); | ||
134 | |||
135 | return; | ||
136 | } | ||
137 | |||
138 | /* --boost / -b */ | ||
139 | |||
140 | static int get_boost_mode(unsigned int cpu) { | ||
141 | int support, active, b_states = 0, ret, pstate_no, i; | ||
142 | /* ToDo: Make this more global */ | ||
143 | unsigned long pstates[MAX_HW_PSTATES] = {0,}; | ||
144 | |||
145 | if (cpupower_cpu_info.vendor != X86_VENDOR_AMD && | ||
146 | cpupower_cpu_info.vendor != X86_VENDOR_INTEL) | ||
147 | return 0; | ||
148 | |||
149 | ret = cpufreq_has_boost_support(cpu, &support, &active, &b_states); | ||
150 | if (ret) { | ||
151 | printf(_("Error while evaluating Boost Capabilities" | ||
152 | " on CPU %d -- are you root?\n"), cpu); | ||
153 | return ret; | ||
154 | } | ||
155 | /* P state changes via MSR are identified via cpuid 80000007 | ||
156 | on Intel and AMD, but we assume boost capable machines can do that | ||
157 | if (cpuid_eax(0x80000000) >= 0x80000007 | ||
158 | && (cpuid_edx(0x80000007) & (1 << 7))) | ||
159 | */ | ||
160 | |||
161 | printf(_(" boost state support: \n")); | ||
162 | |||
163 | printf(_(" Supported: %s\n"), support ? _("yes") : _("no")); | ||
164 | printf(_(" Active: %s\n"), active ? _("yes") : _("no")); | ||
165 | |||
166 | /* ToDo: Only works for AMD for now... */ | ||
167 | |||
168 | if (cpupower_cpu_info.vendor == X86_VENDOR_AMD && | ||
169 | cpupower_cpu_info.family >= 0x10) { | ||
170 | ret = decode_pstates(cpu, cpupower_cpu_info.family, b_states, | ||
171 | pstates, &pstate_no); | ||
172 | if (ret) | ||
173 | return ret; | ||
174 | } else | ||
175 | return 0; | ||
176 | |||
177 | printf(_(" Boost States: %d\n"), b_states); | ||
178 | printf(_(" Total States: %d\n"), pstate_no); | ||
179 | for (i = 0; i < pstate_no; i++) { | ||
180 | if (i < b_states) | ||
181 | printf(_(" Pstate-Pb%d: %luMHz (boost state)\n"), | ||
182 | i, pstates[i]); | ||
183 | else | ||
184 | printf(_(" Pstate-P%d: %luMHz\n"), | ||
185 | i - b_states, pstates[i]); | ||
186 | } | ||
187 | return 0; | ||
188 | } | ||
189 | |||
190 | static void debug_output_one(unsigned int cpu) | ||
191 | { | ||
192 | char *driver; | ||
193 | struct cpufreq_affected_cpus *cpus; | ||
194 | struct cpufreq_available_frequencies *freqs; | ||
195 | unsigned long min, max, freq_kernel, freq_hardware; | ||
196 | unsigned long total_trans, latency; | ||
197 | unsigned long long total_time; | ||
198 | struct cpufreq_policy *policy; | ||
199 | struct cpufreq_available_governors * governors; | ||
200 | struct cpufreq_stats *stats; | ||
201 | |||
202 | if (cpufreq_cpu_exists(cpu)) { | ||
203 | return; | ||
204 | } | ||
205 | |||
206 | freq_kernel = cpufreq_get_freq_kernel(cpu); | ||
207 | freq_hardware = cpufreq_get_freq_hardware(cpu); | ||
208 | |||
209 | driver = cpufreq_get_driver(cpu); | ||
210 | if (!driver) { | ||
211 | printf(_(" no or unknown cpufreq driver is active on this CPU\n")); | ||
212 | } else { | ||
213 | printf(_(" driver: %s\n"), driver); | ||
214 | cpufreq_put_driver(driver); | ||
215 | } | ||
216 | |||
217 | cpus = cpufreq_get_related_cpus(cpu); | ||
218 | if (cpus) { | ||
219 | printf(_(" CPUs which run at the same hardware frequency: ")); | ||
220 | while (cpus->next) { | ||
221 | printf("%d ", cpus->cpu); | ||
222 | cpus = cpus->next; | ||
223 | } | ||
224 | printf("%d\n", cpus->cpu); | ||
225 | cpufreq_put_related_cpus(cpus); | ||
226 | } | ||
227 | |||
228 | cpus = cpufreq_get_affected_cpus(cpu); | ||
229 | if (cpus) { | ||
230 | printf(_(" CPUs which need to have their frequency coordinated by software: ")); | ||
231 | while (cpus->next) { | ||
232 | printf("%d ", cpus->cpu); | ||
233 | cpus = cpus->next; | ||
234 | } | ||
235 | printf("%d\n", cpus->cpu); | ||
236 | cpufreq_put_affected_cpus(cpus); | ||
237 | } | ||
238 | |||
239 | latency = cpufreq_get_transition_latency(cpu); | ||
240 | if (latency) { | ||
241 | printf(_(" maximum transition latency: ")); | ||
242 | print_duration(latency); | ||
243 | printf(".\n"); | ||
244 | } | ||
245 | |||
246 | if (!(cpufreq_get_hardware_limits(cpu, &min, &max))) { | ||
247 | printf(_(" hardware limits: ")); | ||
248 | print_speed(min); | ||
249 | printf(" - "); | ||
250 | print_speed(max); | ||
251 | printf("\n"); | ||
252 | } | ||
253 | |||
254 | freqs = cpufreq_get_available_frequencies(cpu); | ||
255 | if (freqs) { | ||
256 | printf(_(" available frequency steps: ")); | ||
257 | while (freqs->next) { | ||
258 | print_speed(freqs->frequency); | ||
259 | printf(", "); | ||
260 | freqs = freqs->next; | ||
261 | } | ||
262 | print_speed(freqs->frequency); | ||
263 | printf("\n"); | ||
264 | cpufreq_put_available_frequencies(freqs); | ||
265 | } | ||
266 | |||
267 | governors = cpufreq_get_available_governors(cpu); | ||
268 | if (governors) { | ||
269 | printf(_(" available cpufreq governors: ")); | ||
270 | while (governors->next) { | ||
271 | printf("%s, ", governors->governor); | ||
272 | governors = governors->next; | ||
273 | } | ||
274 | printf("%s\n", governors->governor); | ||
275 | cpufreq_put_available_governors(governors); | ||
276 | } | ||
277 | |||
278 | policy = cpufreq_get_policy(cpu); | ||
279 | if (policy) { | ||
280 | printf(_(" current policy: frequency should be within ")); | ||
281 | print_speed(policy->min); | ||
282 | printf(_(" and ")); | ||
283 | print_speed(policy->max); | ||
284 | |||
285 | printf(".\n "); | ||
286 | printf(_("The governor \"%s\" may" | ||
287 | " decide which speed to use\n within this range.\n"), | ||
288 | policy->governor); | ||
289 | cpufreq_put_policy(policy); | ||
290 | } | ||
291 | |||
292 | if (freq_kernel || freq_hardware) { | ||
293 | printf(_(" current CPU frequency is ")); | ||
294 | if (freq_hardware) { | ||
295 | print_speed(freq_hardware); | ||
296 | printf(_(" (asserted by call to hardware)")); | ||
297 | } | ||
298 | else | ||
299 | print_speed(freq_kernel); | ||
300 | printf(".\n"); | ||
301 | } | ||
302 | stats = cpufreq_get_stats(cpu, &total_time); | ||
303 | if (stats) { | ||
304 | printf(_(" cpufreq stats: ")); | ||
305 | while (stats) { | ||
306 | print_speed(stats->frequency); | ||
307 | printf(":%.2f%%", (100.0 * stats->time_in_state) / total_time); | ||
308 | stats = stats->next; | ||
309 | if (stats) | ||
310 | printf(", "); | ||
311 | } | ||
312 | cpufreq_put_stats(stats); | ||
313 | total_trans = cpufreq_get_transitions(cpu); | ||
314 | if (total_trans) | ||
315 | printf(" (%lu)\n", total_trans); | ||
316 | else | ||
317 | printf("\n"); | ||
318 | } | ||
319 | get_boost_mode(cpu); | ||
320 | |||
321 | } | ||
322 | |||
323 | /* --freq / -f */ | ||
324 | |||
325 | static int get_freq_kernel(unsigned int cpu, unsigned int human) { | ||
326 | unsigned long freq = cpufreq_get_freq_kernel(cpu); | ||
327 | if (!freq) | ||
328 | return -EINVAL; | ||
329 | if (human) { | ||
330 | print_speed(freq); | ||
331 | printf("\n"); | ||
332 | } else | ||
333 | printf("%lu\n", freq); | ||
334 | return 0; | ||
335 | } | ||
336 | |||
337 | |||
338 | /* --hwfreq / -w */ | ||
339 | |||
340 | static int get_freq_hardware(unsigned int cpu, unsigned int human) { | ||
341 | unsigned long freq = cpufreq_get_freq_hardware(cpu); | ||
342 | if (!freq) | ||
343 | return -EINVAL; | ||
344 | if (human) { | ||
345 | print_speed(freq); | ||
346 | printf("\n"); | ||
347 | } else | ||
348 | printf("%lu\n", freq); | ||
349 | return 0; | ||
350 | } | ||
351 | |||
352 | /* --hwlimits / -l */ | ||
353 | |||
354 | static int get_hardware_limits(unsigned int cpu) { | ||
355 | unsigned long min, max; | ||
356 | if (cpufreq_get_hardware_limits(cpu, &min, &max)) | ||
357 | return -EINVAL; | ||
358 | printf("%lu %lu\n", min, max); | ||
359 | return 0; | ||
360 | } | ||
361 | |||
362 | /* --driver / -d */ | ||
363 | |||
364 | static int get_driver(unsigned int cpu) { | ||
365 | char *driver = cpufreq_get_driver(cpu); | ||
366 | if (!driver) | ||
367 | return -EINVAL; | ||
368 | printf("%s\n", driver); | ||
369 | cpufreq_put_driver(driver); | ||
370 | return 0; | ||
371 | } | ||
372 | |||
373 | /* --policy / -p */ | ||
374 | |||
375 | static int get_policy(unsigned int cpu) { | ||
376 | struct cpufreq_policy *policy = cpufreq_get_policy(cpu); | ||
377 | if (!policy) | ||
378 | return -EINVAL; | ||
379 | printf("%lu %lu %s\n", policy->min, policy->max, policy->governor); | ||
380 | cpufreq_put_policy(policy); | ||
381 | return 0; | ||
382 | } | ||
383 | |||
384 | /* --governors / -g */ | ||
385 | |||
386 | static int get_available_governors(unsigned int cpu) { | ||
387 | struct cpufreq_available_governors *governors = cpufreq_get_available_governors(cpu); | ||
388 | if (!governors) | ||
389 | return -EINVAL; | ||
390 | |||
391 | while (governors->next) { | ||
392 | printf("%s ", governors->governor); | ||
393 | governors = governors->next; | ||
394 | } | ||
395 | printf("%s\n", governors->governor); | ||
396 | cpufreq_put_available_governors(governors); | ||
397 | return 0; | ||
398 | } | ||
399 | |||
400 | |||
401 | /* --affected-cpus / -a */ | ||
402 | |||
403 | static int get_affected_cpus(unsigned int cpu) { | ||
404 | struct cpufreq_affected_cpus *cpus = cpufreq_get_affected_cpus(cpu); | ||
405 | if (!cpus) | ||
406 | return -EINVAL; | ||
407 | |||
408 | while (cpus->next) { | ||
409 | printf("%d ", cpus->cpu); | ||
410 | cpus = cpus->next; | ||
411 | } | ||
412 | printf("%d\n", cpus->cpu); | ||
413 | cpufreq_put_affected_cpus(cpus); | ||
414 | return 0; | ||
415 | } | ||
416 | |||
417 | /* --related-cpus / -r */ | ||
418 | |||
419 | static int get_related_cpus(unsigned int cpu) { | ||
420 | struct cpufreq_affected_cpus *cpus = cpufreq_get_related_cpus(cpu); | ||
421 | if (!cpus) | ||
422 | return -EINVAL; | ||
423 | |||
424 | while (cpus->next) { | ||
425 | printf("%d ", cpus->cpu); | ||
426 | cpus = cpus->next; | ||
427 | } | ||
428 | printf("%d\n", cpus->cpu); | ||
429 | cpufreq_put_related_cpus(cpus); | ||
430 | return 0; | ||
431 | } | ||
432 | |||
433 | /* --stats / -s */ | ||
434 | |||
435 | static int get_freq_stats(unsigned int cpu, unsigned int human) { | ||
436 | unsigned long total_trans = cpufreq_get_transitions(cpu); | ||
437 | unsigned long long total_time; | ||
438 | struct cpufreq_stats *stats = cpufreq_get_stats(cpu, &total_time); | ||
439 | while (stats) { | ||
440 | if (human) { | ||
441 | print_speed(stats->frequency); | ||
442 | printf(":%.2f%%", (100.0 * stats->time_in_state) / total_time); | ||
443 | } | ||
444 | else | ||
445 | printf("%lu:%llu", stats->frequency, stats->time_in_state); | ||
446 | stats = stats->next; | ||
447 | if (stats) | ||
448 | printf(", "); | ||
449 | } | ||
450 | cpufreq_put_stats(stats); | ||
451 | if (total_trans) | ||
452 | printf(" (%lu)\n", total_trans); | ||
453 | return 0; | ||
454 | } | ||
455 | |||
456 | /* --latency / -y */ | ||
457 | |||
458 | static int get_latency(unsigned int cpu, unsigned int human) { | ||
459 | unsigned long latency = cpufreq_get_transition_latency(cpu); | ||
460 | if (!latency) | ||
461 | return -EINVAL; | ||
462 | |||
463 | if (human) { | ||
464 | print_duration(latency); | ||
465 | printf("\n"); | ||
466 | } else | ||
467 | printf("%lu\n", latency); | ||
468 | return 0; | ||
469 | } | ||
470 | |||
471 | void freq_info_help(void) { | ||
472 | printf(_("Usage: cpupower freqinfo [options]\n")); | ||
473 | printf(_("Options:\n")); | ||
474 | printf(_(" -e, --debug Prints out debug information [default]\n")); | ||
475 | printf(_(" -f, --freq Get frequency the CPU currently runs at, according\n" | ||
476 | " to the cpufreq core *\n")); | ||
477 | printf(_(" -w, --hwfreq Get frequency the CPU currently runs at, by reading\n" | ||
478 | " it from hardware (only available to root) *\n")); | ||
479 | printf(_(" -l, --hwlimits Determine the minimum and maximum CPU frequency allowed *\n")); | ||
480 | printf(_(" -d, --driver Determines the used cpufreq kernel driver *\n")); | ||
481 | printf(_(" -p, --policy Gets the currently used cpufreq policy *\n")); | ||
482 | printf(_(" -g, --governors Determines available cpufreq governors *\n")); | ||
483 | printf(_(" -r, --related-cpus Determines which CPUs run at the same hardware frequency *\n")); | ||
484 | printf(_(" -a, --affected-cpus Determines which CPUs need to have their frequency\n" | ||
485 | " coordinated by software *\n")); | ||
486 | printf(_(" -s, --stats Shows cpufreq statistics if available\n")); | ||
487 | printf(_(" -y, --latency Determines the maximum latency on CPU frequency changes *\n")); | ||
488 | printf(_(" -b, --boost Checks for turbo or boost modes *\n")); | ||
489 | printf(_(" -o, --proc Prints out information like provided by the /proc/cpufreq\n" | ||
490 | " interface in 2.4. and early 2.6. kernels\n")); | ||
491 | printf(_(" -m, --human human-readable output for the -f, -w, -s and -y parameters\n")); | ||
492 | printf(_(" -h, --help Prints out this screen\n")); | ||
493 | |||
494 | printf("\n"); | ||
495 | printf(_("If no argument is given, full output about\n" | ||
496 | "cpufreq is printed which is useful e.g. for reporting bugs.\n\n")); | ||
497 | printf(_("By default info of CPU 0 is shown which can be overridden \n" | ||
498 | "with the cpupower --cpu main command option.\n")); | ||
499 | } | ||
500 | |||
501 | static struct option info_opts[] = { | ||
502 | { .name="debug", .has_arg=no_argument, .flag=NULL, .val='e'}, | ||
503 | { .name="boost", .has_arg=no_argument, .flag=NULL, .val='b'}, | ||
504 | { .name="freq", .has_arg=no_argument, .flag=NULL, .val='f'}, | ||
505 | { .name="hwfreq", .has_arg=no_argument, .flag=NULL, .val='w'}, | ||
506 | { .name="hwlimits", .has_arg=no_argument, .flag=NULL, .val='l'}, | ||
507 | { .name="driver", .has_arg=no_argument, .flag=NULL, .val='d'}, | ||
508 | { .name="policy", .has_arg=no_argument, .flag=NULL, .val='p'}, | ||
509 | { .name="governors", .has_arg=no_argument, .flag=NULL, .val='g'}, | ||
510 | { .name="related-cpus", .has_arg=no_argument, .flag=NULL, .val='r'}, | ||
511 | { .name="affected-cpus",.has_arg=no_argument, .flag=NULL, .val='a'}, | ||
512 | { .name="stats", .has_arg=no_argument, .flag=NULL, .val='s'}, | ||
513 | { .name="latency", .has_arg=no_argument, .flag=NULL, .val='y'}, | ||
514 | { .name="proc", .has_arg=no_argument, .flag=NULL, .val='o'}, | ||
515 | { .name="human", .has_arg=no_argument, .flag=NULL, .val='m'}, | ||
516 | { .name="help", .has_arg=no_argument, .flag=NULL, .val='h'}, | ||
517 | { }, | ||
518 | }; | ||
519 | |||
520 | int cmd_freq_info(int argc, char **argv) | ||
521 | { | ||
522 | extern char *optarg; | ||
523 | extern int optind, opterr, optopt; | ||
524 | int ret = 0, cont = 1; | ||
525 | unsigned int cpu = 0; | ||
526 | unsigned int human = 0; | ||
527 | int output_param = 0; | ||
528 | |||
529 | do { | ||
530 | ret = getopt_long(argc, argv, "hoefwldpgrasmyb", info_opts, NULL); | ||
531 | switch (ret) { | ||
532 | case '?': | ||
533 | output_param = '?'; | ||
534 | cont = 0; | ||
535 | break; | ||
536 | case 'h': | ||
537 | output_param = 'h'; | ||
538 | cont = 0; | ||
539 | break; | ||
540 | case -1: | ||
541 | cont = 0; | ||
542 | break; | ||
543 | case 'b': | ||
544 | case 'o': | ||
545 | case 'a': | ||
546 | case 'r': | ||
547 | case 'g': | ||
548 | case 'p': | ||
549 | case 'd': | ||
550 | case 'l': | ||
551 | case 'w': | ||
552 | case 'f': | ||
553 | case 'e': | ||
554 | case 's': | ||
555 | case 'y': | ||
556 | if (output_param) { | ||
557 | output_param = -1; | ||
558 | cont = 0; | ||
559 | break; | ||
560 | } | ||
561 | output_param = ret; | ||
562 | break; | ||
563 | case 'm': | ||
564 | if (human) { | ||
565 | output_param = -1; | ||
566 | cont = 0; | ||
567 | break; | ||
568 | } | ||
569 | human = 1; | ||
570 | break; | ||
571 | default: | ||
572 | fprintf(stderr, "invalid or unknown argument\n"); | ||
573 | return EXIT_FAILURE; | ||
574 | } | ||
575 | } while(cont); | ||
576 | |||
577 | switch (output_param) { | ||
578 | case 'o': | ||
579 | if (!bitmask_isallclear(cpus_chosen)) { | ||
580 | printf(_("The argument passed to this tool can't be " | ||
581 | "combined with passing a --cpu argument\n")); | ||
582 | return -EINVAL; | ||
583 | } | ||
584 | break; | ||
585 | case 0: | ||
586 | output_param = 'e'; | ||
587 | } | ||
588 | |||
589 | ret = 0; | ||
590 | |||
591 | /* Default is: show output of CPU 0 only */ | ||
592 | if (bitmask_isallclear(cpus_chosen)) | ||
593 | bitmask_setbit(cpus_chosen, 0); | ||
594 | |||
595 | switch (output_param) { | ||
596 | case -1: | ||
597 | printf(_("You can't specify more than one --cpu parameter and/or\n" | ||
598 | "more than one output-specific argument\n")); | ||
599 | return -EINVAL; | ||
600 | case '?': | ||
601 | printf(_("invalid or unknown argument\n")); | ||
602 | freq_info_help(); | ||
603 | return -EINVAL; | ||
604 | case 'h': | ||
605 | freq_info_help(); | ||
606 | return EXIT_SUCCESS; | ||
607 | case 'o': | ||
608 | proc_cpufreq_output(); | ||
609 | return EXIT_SUCCESS; | ||
610 | } | ||
611 | |||
612 | for (cpu = bitmask_first(cpus_chosen); | ||
613 | cpu <= bitmask_last(cpus_chosen); cpu++) { | ||
614 | |||
615 | if (!bitmask_isbitset(cpus_chosen, cpu)) | ||
616 | continue; | ||
617 | if (cpufreq_cpu_exists(cpu)) { | ||
618 | printf(_("couldn't analyze CPU %d as it doesn't seem to be present\n"), cpu); | ||
619 | continue; | ||
620 | } | ||
621 | printf(_("analyzing CPU %d:\n"), cpu); | ||
622 | |||
623 | switch (output_param) { | ||
624 | case 'b': | ||
625 | get_boost_mode(cpu); | ||
626 | break; | ||
627 | case 'e': | ||
628 | debug_output_one(cpu); | ||
629 | break; | ||
630 | case 'a': | ||
631 | ret = get_affected_cpus(cpu); | ||
632 | break; | ||
633 | case 'r': | ||
634 | ret = get_related_cpus(cpu); | ||
635 | break; | ||
636 | case 'g': | ||
637 | ret = get_available_governors(cpu); | ||
638 | break; | ||
639 | case 'p': | ||
640 | ret = get_policy(cpu); | ||
641 | break; | ||
642 | case 'd': | ||
643 | ret = get_driver(cpu); | ||
644 | break; | ||
645 | case 'l': | ||
646 | ret = get_hardware_limits(cpu); | ||
647 | break; | ||
648 | case 'w': | ||
649 | ret = get_freq_hardware(cpu, human); | ||
650 | break; | ||
651 | case 'f': | ||
652 | ret = get_freq_kernel(cpu, human); | ||
653 | break; | ||
654 | case 's': | ||
655 | ret = get_freq_stats(cpu, human); | ||
656 | break; | ||
657 | case 'y': | ||
658 | ret = get_latency(cpu, human); | ||
659 | break; | ||
660 | } | ||
661 | if (ret) | ||
662 | return (ret); | ||
663 | } | ||
664 | return ret; | ||
665 | } | ||
diff --git a/tools/power/cpupower/utils/cpufreq-set.c b/tools/power/cpupower/utils/cpufreq-set.c new file mode 100644 index 00000000000..d415b6b52a0 --- /dev/null +++ b/tools/power/cpupower/utils/cpufreq-set.c | |||
@@ -0,0 +1,357 @@ | |||
1 | /* | ||
2 | * (C) 2004-2009 Dominik Brodowski <linux@dominikbrodowski.de> | ||
3 | * | ||
4 | * Licensed under the terms of the GNU GPL License version 2. | ||
5 | */ | ||
6 | |||
7 | |||
8 | #include <unistd.h> | ||
9 | #include <stdio.h> | ||
10 | #include <errno.h> | ||
11 | #include <stdlib.h> | ||
12 | #include <limits.h> | ||
13 | #include <string.h> | ||
14 | #include <ctype.h> | ||
15 | |||
16 | #include <getopt.h> | ||
17 | |||
18 | #include "cpufreq.h" | ||
19 | #include "helpers/helpers.h" | ||
20 | |||
21 | #define NORM_FREQ_LEN 32 | ||
22 | |||
23 | void freq_set_help(void) | ||
24 | { | ||
25 | printf(_("Usage: cpupower frequency-set [options]\n")); | ||
26 | printf(_("Options:\n")); | ||
27 | printf(_(" -d FREQ, --min FREQ new minimum CPU frequency the governor may select\n")); | ||
28 | printf(_(" -u FREQ, --max FREQ new maximum CPU frequency the governor may select\n")); | ||
29 | printf(_(" -g GOV, --governor GOV new cpufreq governor\n")); | ||
30 | printf(_(" -f FREQ, --freq FREQ specific frequency to be set. Requires userspace\n" | ||
31 | " governor to be available and loaded\n")); | ||
32 | printf(_(" -r, --related Switches all hardware-related CPUs\n")); | ||
33 | printf(_(" -h, --help Prints out this screen\n")); | ||
34 | printf("\n"); | ||
35 | printf(_("Notes:\n" | ||
36 | "1. Omitting the -c or --cpu argument is equivalent to setting it to \"all\"\n")); | ||
37 | printf(_("2. The -f FREQ, --freq FREQ parameter cannot be combined with any other parameter\n" | ||
38 | " except the -c CPU, --cpu CPU parameter\n" | ||
39 | "3. FREQuencies can be passed in Hz, kHz (default), MHz, GHz, or THz\n" | ||
40 | " by postfixing the value with the wanted unit name, without any space\n" | ||
41 | " (FREQuency in kHz =^ Hz * 0.001 =^ MHz * 1000 =^ GHz * 1000000).\n")); | ||
42 | |||
43 | } | ||
44 | |||
45 | static struct option set_opts[] = { | ||
46 | { .name="min", .has_arg=required_argument, .flag=NULL, .val='d'}, | ||
47 | { .name="max", .has_arg=required_argument, .flag=NULL, .val='u'}, | ||
48 | { .name="governor", .has_arg=required_argument, .flag=NULL, .val='g'}, | ||
49 | { .name="freq", .has_arg=required_argument, .flag=NULL, .val='f'}, | ||
50 | { .name="help", .has_arg=no_argument, .flag=NULL, .val='h'}, | ||
51 | { .name="related", .has_arg=no_argument, .flag=NULL, .val='r'}, | ||
52 | { }, | ||
53 | }; | ||
54 | |||
55 | static void print_error(void) | ||
56 | { | ||
57 | printf(_("Error setting new values. Common errors:\n" | ||
58 | "- Do you have proper administration rights? (super-user?)\n" | ||
59 | "- Is the governor you requested available and modprobed?\n" | ||
60 | "- Trying to set an invalid policy?\n" | ||
61 | "- Trying to set a specific frequency, but userspace governor is not available,\n" | ||
62 | " for example because of hardware which cannot be set to a specific frequency\n" | ||
63 | " or because the userspace governor isn't loaded?\n")); | ||
64 | }; | ||
65 | |||
66 | struct freq_units { | ||
67 | char* str_unit; | ||
68 | int power_of_ten; | ||
69 | }; | ||
70 | |||
71 | const struct freq_units def_units[] = { | ||
72 | {"hz", -3}, | ||
73 | {"khz", 0}, /* default */ | ||
74 | {"mhz", 3}, | ||
75 | {"ghz", 6}, | ||
76 | {"thz", 9}, | ||
77 | {NULL, 0} | ||
78 | }; | ||
79 | |||
80 | static void print_unknown_arg(void) | ||
81 | { | ||
82 | printf(_("invalid or unknown argument\n")); | ||
83 | freq_set_help(); | ||
84 | } | ||
85 | |||
86 | static unsigned long string_to_frequency(const char *str) | ||
87 | { | ||
88 | char normalized[NORM_FREQ_LEN]; | ||
89 | const struct freq_units *unit; | ||
90 | const char *scan; | ||
91 | char *end; | ||
92 | unsigned long freq; | ||
93 | int power = 0, match_count = 0, i, cp, pad; | ||
94 | |||
95 | while (*str == '0') | ||
96 | str++; | ||
97 | |||
98 | for (scan = str; isdigit(*scan) || *scan == '.'; scan++) { | ||
99 | if (*scan == '.' && match_count == 0) | ||
100 | match_count = 1; | ||
101 | else if (*scan == '.' && match_count == 1) | ||
102 | return 0; | ||
103 | } | ||
104 | |||
105 | if (*scan) { | ||
106 | match_count = 0; | ||
107 | for (unit = def_units; unit->str_unit; unit++) { | ||
108 | for (i = 0; | ||
109 | scan[i] && tolower(scan[i]) == unit->str_unit[i]; | ||
110 | ++i) | ||
111 | continue; | ||
112 | if (scan[i]) | ||
113 | continue; | ||
114 | match_count++; | ||
115 | power = unit->power_of_ten; | ||
116 | } | ||
117 | if (match_count != 1) | ||
118 | return 0; | ||
119 | } | ||
120 | |||
121 | /* count the number of digits to be copied */ | ||
122 | for (cp = 0; isdigit(str[cp]); cp++) | ||
123 | continue; | ||
124 | |||
125 | if (str[cp] == '.') { | ||
126 | while (power > -1 && isdigit(str[cp+1])) | ||
127 | cp++, power--; | ||
128 | } | ||
129 | if (power >= -1) /* not enough => pad */ | ||
130 | pad = power + 1; | ||
131 | else /* to much => strip */ | ||
132 | pad = 0, cp += power + 1; | ||
133 | /* check bounds */ | ||
134 | if (cp <= 0 || cp + pad > NORM_FREQ_LEN - 1) | ||
135 | return 0; | ||
136 | |||
137 | /* copy digits */ | ||
138 | for (i = 0; i < cp; i++, str++) { | ||
139 | if (*str == '.') | ||
140 | str++; | ||
141 | normalized[i] = *str; | ||
142 | } | ||
143 | /* and pad */ | ||
144 | for (; i < cp + pad; i++) | ||
145 | normalized[i] = '0'; | ||
146 | |||
147 | /* round up, down ? */ | ||
148 | match_count = (normalized[i-1] >= '5'); | ||
149 | /* and drop the decimal part */ | ||
150 | normalized[i-1] = 0; /* cp > 0 && pad >= 0 ==> i > 0 */ | ||
151 | |||
152 | /* final conversion (and applying rounding) */ | ||
153 | errno = 0; | ||
154 | freq = strtoul(normalized, &end, 10); | ||
155 | if (errno) | ||
156 | return 0; | ||
157 | else { | ||
158 | if (match_count && freq != ULONG_MAX) | ||
159 | freq++; | ||
160 | return freq; | ||
161 | } | ||
162 | } | ||
163 | |||
164 | static int do_new_policy(unsigned int cpu, struct cpufreq_policy *new_pol) | ||
165 | { | ||
166 | struct cpufreq_policy *cur_pol = cpufreq_get_policy(cpu); | ||
167 | int ret; | ||
168 | |||
169 | if (!cur_pol) { | ||
170 | printf(_("wrong, unknown or unhandled CPU?\n")); | ||
171 | return -EINVAL; | ||
172 | } | ||
173 | |||
174 | if (!new_pol->min) | ||
175 | new_pol->min = cur_pol->min; | ||
176 | |||
177 | if (!new_pol->max) | ||
178 | new_pol->max = cur_pol->max; | ||
179 | |||
180 | if (!new_pol->governor) | ||
181 | new_pol->governor = cur_pol->governor; | ||
182 | |||
183 | ret = cpufreq_set_policy(cpu, new_pol); | ||
184 | |||
185 | cpufreq_put_policy(cur_pol); | ||
186 | |||
187 | return ret; | ||
188 | } | ||
189 | |||
190 | |||
191 | static int do_one_cpu(unsigned int cpu, struct cpufreq_policy *new_pol, | ||
192 | unsigned long freq, unsigned int pc) | ||
193 | { | ||
194 | switch (pc) { | ||
195 | case 0: | ||
196 | return cpufreq_set_frequency(cpu, freq); | ||
197 | |||
198 | case 1: | ||
199 | /* if only one value of a policy is to be changed, we can | ||
200 | * use a "fast path". | ||
201 | */ | ||
202 | if (new_pol->min) | ||
203 | return cpufreq_modify_policy_min(cpu, new_pol->min); | ||
204 | else if (new_pol->max) | ||
205 | return cpufreq_modify_policy_max(cpu, new_pol->max); | ||
206 | else if (new_pol->governor) | ||
207 | return cpufreq_modify_policy_governor(cpu, new_pol->governor); | ||
208 | |||
209 | default: | ||
210 | /* slow path */ | ||
211 | return do_new_policy(cpu, new_pol); | ||
212 | } | ||
213 | } | ||
214 | |||
215 | int cmd_freq_set(int argc, char **argv) | ||
216 | { | ||
217 | extern char *optarg; | ||
218 | extern int optind, opterr, optopt; | ||
219 | int ret = 0, cont = 1; | ||
220 | int double_parm = 0, related = 0, policychange = 0; | ||
221 | unsigned long freq = 0; | ||
222 | char gov[20]; | ||
223 | unsigned int cpu; | ||
224 | |||
225 | struct cpufreq_policy new_pol = { | ||
226 | .min = 0, | ||
227 | .max = 0, | ||
228 | .governor = NULL, | ||
229 | }; | ||
230 | |||
231 | /* parameter parsing */ | ||
232 | do { | ||
233 | ret = getopt_long(argc, argv, "d:u:g:f:hr", set_opts, NULL); | ||
234 | switch (ret) { | ||
235 | case '?': | ||
236 | print_unknown_arg(); | ||
237 | return -EINVAL; | ||
238 | case 'h': | ||
239 | freq_set_help(); | ||
240 | return 0; | ||
241 | case -1: | ||
242 | cont = 0; | ||
243 | break; | ||
244 | case 'r': | ||
245 | if (related) | ||
246 | double_parm++; | ||
247 | related++; | ||
248 | break; | ||
249 | case 'd': | ||
250 | if (new_pol.min) | ||
251 | double_parm++; | ||
252 | policychange++; | ||
253 | new_pol.min = string_to_frequency(optarg); | ||
254 | if (new_pol.min == 0) { | ||
255 | print_unknown_arg(); | ||
256 | return -EINVAL; | ||
257 | } | ||
258 | break; | ||
259 | case 'u': | ||
260 | if (new_pol.max) | ||
261 | double_parm++; | ||
262 | policychange++; | ||
263 | new_pol.max = string_to_frequency(optarg); | ||
264 | if (new_pol.max == 0) { | ||
265 | print_unknown_arg(); | ||
266 | return -EINVAL; | ||
267 | } | ||
268 | break; | ||
269 | case 'f': | ||
270 | if (freq) | ||
271 | double_parm++; | ||
272 | freq = string_to_frequency(optarg); | ||
273 | if (freq == 0) { | ||
274 | print_unknown_arg(); | ||
275 | return -EINVAL; | ||
276 | } | ||
277 | break; | ||
278 | case 'g': | ||
279 | if (new_pol.governor) | ||
280 | double_parm++; | ||
281 | policychange++; | ||
282 | if ((strlen(optarg) < 3) || (strlen(optarg) > 18)) { | ||
283 | print_unknown_arg(); | ||
284 | return -EINVAL; | ||
285 | } | ||
286 | if ((sscanf(optarg, "%s", gov)) != 1) { | ||
287 | print_unknown_arg(); | ||
288 | return -EINVAL; | ||
289 | } | ||
290 | new_pol.governor = gov; | ||
291 | break; | ||
292 | } | ||
293 | } while(cont); | ||
294 | |||
295 | /* parameter checking */ | ||
296 | if (double_parm) { | ||
297 | printf("the same parameter was passed more than once\n"); | ||
298 | return -EINVAL; | ||
299 | } | ||
300 | |||
301 | if (freq && policychange) { | ||
302 | printf(_("the -f/--freq parameter cannot be combined with -d/--min, -u/--max or\n" | ||
303 | "-g/--governor parameters\n")); | ||
304 | return -EINVAL; | ||
305 | } | ||
306 | |||
307 | if (!freq && !policychange) { | ||
308 | printf(_("At least one parameter out of -f/--freq, -d/--min, -u/--max, and\n" | ||
309 | "-g/--governor must be passed\n")); | ||
310 | return -EINVAL; | ||
311 | } | ||
312 | |||
313 | /* Default is: set all CPUs */ | ||
314 | if (bitmask_isallclear(cpus_chosen)) | ||
315 | bitmask_setall(cpus_chosen); | ||
316 | |||
317 | /* Also set frequency settings for related CPUs if -r is passed */ | ||
318 | if (related) { | ||
319 | for (cpu = bitmask_first(cpus_chosen); | ||
320 | cpu <= bitmask_last(cpus_chosen); cpu++) { | ||
321 | struct cpufreq_affected_cpus *cpus; | ||
322 | |||
323 | if (!bitmask_isbitset(cpus_chosen, cpu) || | ||
324 | cpufreq_cpu_exists(cpu)) | ||
325 | continue; | ||
326 | |||
327 | cpus = cpufreq_get_related_cpus(cpu); | ||
328 | if (!cpus) | ||
329 | break; | ||
330 | while (cpus->next) { | ||
331 | bitmask_setbit(cpus_chosen, cpus->cpu); | ||
332 | cpus = cpus->next; | ||
333 | } | ||
334 | cpufreq_put_related_cpus(cpus); | ||
335 | } | ||
336 | } | ||
337 | |||
338 | |||
339 | /* loop over CPUs */ | ||
340 | for (cpu = bitmask_first(cpus_chosen); | ||
341 | cpu <= bitmask_last(cpus_chosen); cpu++) { | ||
342 | |||
343 | if (!bitmask_isbitset(cpus_chosen, cpu) || | ||
344 | cpufreq_cpu_exists(cpu)) | ||
345 | continue; | ||
346 | |||
347 | printf(_("Setting cpu: %d\n"), cpu); | ||
348 | ret = do_one_cpu(cpu, &new_pol, freq, policychange); | ||
349 | if (ret) | ||
350 | break; | ||
351 | } | ||
352 | |||
353 | if (ret) | ||
354 | print_error(); | ||
355 | |||
356 | return ret; | ||
357 | } | ||
diff --git a/tools/power/cpupower/utils/cpuidle-info.c b/tools/power/cpupower/utils/cpuidle-info.c new file mode 100644 index 00000000000..635468224e7 --- /dev/null +++ b/tools/power/cpupower/utils/cpuidle-info.c | |||
@@ -0,0 +1,245 @@ | |||
1 | /* | ||
2 | * (C) 2004-2009 Dominik Brodowski <linux@dominikbrodowski.de> | ||
3 | * (C) 2010 Thomas Renninger <trenn@suse.de> | ||
4 | * | ||
5 | * Licensed under the terms of the GNU GPL License version 2. | ||
6 | */ | ||
7 | |||
8 | |||
9 | #include <unistd.h> | ||
10 | #include <stdio.h> | ||
11 | #include <errno.h> | ||
12 | #include <stdlib.h> | ||
13 | #include <string.h> | ||
14 | #include <getopt.h> | ||
15 | #include <cpufreq.h> | ||
16 | |||
17 | #include "helpers/helpers.h" | ||
18 | #include "helpers/sysfs.h" | ||
19 | #include "helpers/bitmask.h" | ||
20 | |||
21 | #define LINE_LEN 10 | ||
22 | |||
23 | static void cpuidle_cpu_output(unsigned int cpu, int verbose) | ||
24 | { | ||
25 | int idlestates, idlestate; | ||
26 | char *tmp; | ||
27 | |||
28 | printf(_ ("Analyzing CPU %d:\n"), cpu); | ||
29 | |||
30 | idlestates = sysfs_get_idlestate_count(cpu); | ||
31 | if (idlestates == 0) { | ||
32 | printf(_("CPU %u: No idle states\n"), cpu); | ||
33 | return; | ||
34 | } | ||
35 | else if (idlestates <= 0) { | ||
36 | printf(_("CPU %u: Can't read idle state info\n"), cpu); | ||
37 | return; | ||
38 | } | ||
39 | tmp = sysfs_get_idlestate_name(cpu, idlestates - 1); | ||
40 | if (!tmp) { | ||
41 | printf(_("Could not determine max idle state %u\n"), | ||
42 | idlestates - 1); | ||
43 | return; | ||
44 | } | ||
45 | |||
46 | printf(_("Number of idle states: %d\n"), idlestates); | ||
47 | |||
48 | printf(_("Available idle states:")); | ||
49 | for (idlestate = 1; idlestate < idlestates; idlestate++) { | ||
50 | tmp = sysfs_get_idlestate_name(cpu, idlestate); | ||
51 | if (!tmp) | ||
52 | continue; | ||
53 | printf(" %s", tmp); | ||
54 | free(tmp); | ||
55 | } | ||
56 | printf("\n"); | ||
57 | |||
58 | if (!verbose) | ||
59 | return; | ||
60 | |||
61 | for (idlestate = 1; idlestate < idlestates; idlestate++) { | ||
62 | tmp = sysfs_get_idlestate_name(cpu, idlestate); | ||
63 | if (!tmp) | ||
64 | continue; | ||
65 | printf("%s:\n", tmp); | ||
66 | free(tmp); | ||
67 | |||
68 | tmp = sysfs_get_idlestate_desc(cpu, idlestate); | ||
69 | if (!tmp) | ||
70 | continue; | ||
71 | printf(_("Flags/Description: %s\n"), tmp); | ||
72 | free(tmp); | ||
73 | |||
74 | printf(_("Latency: %lu\n"), | ||
75 | sysfs_get_idlestate_latency(cpu, idlestate)); | ||
76 | printf(_("Usage: %lu\n"), | ||
77 | sysfs_get_idlestate_usage(cpu, idlestate)); | ||
78 | printf(_("Duration: %llu\n"), | ||
79 | sysfs_get_idlestate_time(cpu, idlestate)); | ||
80 | } | ||
81 | printf("\n"); | ||
82 | } | ||
83 | |||
84 | static void cpuidle_general_output(void) | ||
85 | { | ||
86 | char *tmp; | ||
87 | |||
88 | tmp = sysfs_get_cpuidle_driver(); | ||
89 | if (!tmp) { | ||
90 | printf(_("Could not determine cpuidle driver\n")); | ||
91 | return; | ||
92 | } | ||
93 | |||
94 | printf(_("CPUidle driver: %s\n"), tmp); | ||
95 | free (tmp); | ||
96 | |||
97 | tmp = sysfs_get_cpuidle_governor(); | ||
98 | if (!tmp) { | ||
99 | printf(_("Could not determine cpuidle governor\n")); | ||
100 | return; | ||
101 | } | ||
102 | |||
103 | printf(_("CPUidle governor: %s\n"), tmp); | ||
104 | free (tmp); | ||
105 | } | ||
106 | |||
107 | static void proc_cpuidle_cpu_output(unsigned int cpu) | ||
108 | { | ||
109 | long max_allowed_cstate = 2000000000; | ||
110 | int cstates, cstate; | ||
111 | |||
112 | cstates = sysfs_get_idlestate_count(cpu); | ||
113 | if (cstates == 0) { | ||
114 | /* | ||
115 | * Go on and print same useless info as you'd see with | ||
116 | * cat /proc/acpi/processor/../power | ||
117 | * printf(_("CPU %u: No C-states available\n"), cpu); | ||
118 | * return; | ||
119 | */ | ||
120 | } | ||
121 | else if (cstates <= 0) { | ||
122 | printf(_("CPU %u: Can't read C-state info\n"), cpu); | ||
123 | return; | ||
124 | } | ||
125 | /* printf("Cstates: %d\n", cstates); */ | ||
126 | |||
127 | printf(_("active state: C0\n")); | ||
128 | printf(_("max_cstate: C%u\n"), cstates-1); | ||
129 | printf(_("maximum allowed latency: %lu usec\n"), max_allowed_cstate); | ||
130 | printf(_("states:\t\n")); | ||
131 | for (cstate = 1; cstate < cstates; cstate++) { | ||
132 | printf(_(" C%d: " | ||
133 | "type[C%d] "), cstate, cstate); | ||
134 | printf(_("promotion[--] demotion[--] ")); | ||
135 | printf(_("latency[%03lu] "), | ||
136 | sysfs_get_idlestate_latency(cpu, cstate)); | ||
137 | printf(_("usage[%08lu] "), | ||
138 | sysfs_get_idlestate_usage(cpu, cstate)); | ||
139 | printf(_("duration[%020Lu] \n"), | ||
140 | sysfs_get_idlestate_time(cpu, cstate)); | ||
141 | } | ||
142 | } | ||
143 | |||
144 | /* --freq / -f */ | ||
145 | |||
146 | void idle_info_help(void) { | ||
147 | printf(_ ("Usage: cpupower idleinfo [options]\n")); | ||
148 | printf(_ ("Options:\n")); | ||
149 | printf(_ (" -s, --silent Only show general C-state information\n")); | ||
150 | printf(_ (" -o, --proc Prints out information like provided by the /proc/acpi/processor/*/power\n" | ||
151 | " interface in older kernels\n")); | ||
152 | printf(_ (" -h, --help Prints out this screen\n")); | ||
153 | |||
154 | printf("\n"); | ||
155 | } | ||
156 | |||
157 | static struct option info_opts[] = { | ||
158 | { .name="silent", .has_arg=no_argument, .flag=NULL, .val='s'}, | ||
159 | { .name="proc", .has_arg=no_argument, .flag=NULL, .val='o'}, | ||
160 | { .name="help", .has_arg=no_argument, .flag=NULL, .val='h'}, | ||
161 | { }, | ||
162 | }; | ||
163 | |||
164 | static inline void cpuidle_exit(int fail) | ||
165 | { | ||
166 | idle_info_help(); | ||
167 | exit(EXIT_FAILURE); | ||
168 | } | ||
169 | |||
170 | int cmd_idle_info(int argc, char **argv) | ||
171 | { | ||
172 | extern char *optarg; | ||
173 | extern int optind, opterr, optopt; | ||
174 | int ret = 0, cont = 1, output_param = 0, verbose = 1; | ||
175 | unsigned int cpu = 0; | ||
176 | |||
177 | do { | ||
178 | ret = getopt_long(argc, argv, "hos", info_opts, NULL); | ||
179 | if (ret == -1) | ||
180 | break; | ||
181 | switch (ret) { | ||
182 | case '?': | ||
183 | output_param = '?'; | ||
184 | cont = 0; | ||
185 | break; | ||
186 | case 'h': | ||
187 | output_param = 'h'; | ||
188 | cont = 0; | ||
189 | break; | ||
190 | case 's': | ||
191 | verbose = 0; | ||
192 | break; | ||
193 | case -1: | ||
194 | cont = 0; | ||
195 | break; | ||
196 | case 'o': | ||
197 | if (output_param) { | ||
198 | output_param = -1; | ||
199 | cont = 0; | ||
200 | break; | ||
201 | } | ||
202 | output_param = ret; | ||
203 | break; | ||
204 | } | ||
205 | } while(cont); | ||
206 | |||
207 | switch (output_param) { | ||
208 | case -1: | ||
209 | printf(_("You can't specify more than one " | ||
210 | "output-specific argument\n")); | ||
211 | cpuidle_exit(EXIT_FAILURE); | ||
212 | case '?': | ||
213 | printf(_("invalid or unknown argument\n")); | ||
214 | cpuidle_exit(EXIT_FAILURE); | ||
215 | case 'h': | ||
216 | cpuidle_exit(EXIT_SUCCESS); | ||
217 | } | ||
218 | |||
219 | /* Default is: show output of CPU 0 only */ | ||
220 | if (bitmask_isallclear(cpus_chosen)) | ||
221 | bitmask_setbit(cpus_chosen, 0); | ||
222 | |||
223 | if (output_param == 0) | ||
224 | cpuidle_general_output(); | ||
225 | |||
226 | for (cpu = bitmask_first(cpus_chosen); | ||
227 | cpu <= bitmask_last(cpus_chosen); cpu++) { | ||
228 | |||
229 | if (!bitmask_isbitset(cpus_chosen, cpu) || | ||
230 | cpufreq_cpu_exists(cpu)) | ||
231 | continue; | ||
232 | |||
233 | switch (output_param) { | ||
234 | |||
235 | case 'o': | ||
236 | proc_cpuidle_cpu_output(cpu); | ||
237 | break; | ||
238 | case 0: | ||
239 | printf("\n"); | ||
240 | cpuidle_cpu_output(cpu, verbose); | ||
241 | break; | ||
242 | } | ||
243 | } | ||
244 | return (EXIT_SUCCESS); | ||
245 | } | ||
diff --git a/tools/power/cpupower/utils/cpupower-info.c b/tools/power/cpupower/utils/cpupower-info.c new file mode 100644 index 00000000000..7add04ccbad --- /dev/null +++ b/tools/power/cpupower/utils/cpupower-info.c | |||
@@ -0,0 +1,154 @@ | |||
1 | /* | ||
2 | * (C) 2011 Thomas Renninger <trenn@suse.de>, Novell Inc. | ||
3 | * | ||
4 | * Licensed under the terms of the GNU GPL License version 2. | ||
5 | */ | ||
6 | |||
7 | |||
8 | #include <unistd.h> | ||
9 | #include <stdio.h> | ||
10 | #include <stdlib.h> | ||
11 | #include <errno.h> | ||
12 | #include <string.h> | ||
13 | #include <getopt.h> | ||
14 | |||
15 | #include <cpufreq.h> | ||
16 | #include "helpers/helpers.h" | ||
17 | #include "helpers/sysfs.h" | ||
18 | |||
19 | void info_help(void) | ||
20 | { | ||
21 | printf(_("Usage: cpupower info [ -b ] [ -m ] [ -s ]\n")); | ||
22 | printf(_("Options:\n")); | ||
23 | printf(_(" -b, --perf-bias Gets CPU's power vs performance policy on some\n" | ||
24 | " Intel models [0-15], see manpage for details\n")); | ||
25 | printf(_(" -m, --sched-mc Gets the kernel's multi core scheduler policy.\n")); | ||
26 | printf(_(" -s, --sched-smt Gets the kernel's thread sibling scheduler policy.\n")); | ||
27 | printf(_(" -h, --help Prints out this screen\n")); | ||
28 | printf(_("\nPassing no option will show all info, by default only on core 0\n")); | ||
29 | printf("\n"); | ||
30 | } | ||
31 | |||
32 | static struct option set_opts[] = { | ||
33 | { .name="perf-bias", .has_arg=optional_argument, .flag=NULL, .val='b'}, | ||
34 | { .name="sched-mc", .has_arg=optional_argument, .flag=NULL, .val='m'}, | ||
35 | { .name="sched-smt", .has_arg=optional_argument, .flag=NULL, .val='s'}, | ||
36 | { .name="help", .has_arg=no_argument, .flag=NULL, .val='h'}, | ||
37 | { }, | ||
38 | }; | ||
39 | |||
40 | static void print_wrong_arg_exit(void) | ||
41 | { | ||
42 | printf(_("invalid or unknown argument\n")); | ||
43 | info_help(); | ||
44 | exit(EXIT_FAILURE); | ||
45 | } | ||
46 | |||
47 | int cmd_info(int argc, char **argv) | ||
48 | { | ||
49 | extern char *optarg; | ||
50 | extern int optind, opterr, optopt; | ||
51 | unsigned int cpu; | ||
52 | |||
53 | union { | ||
54 | struct { | ||
55 | int sched_mc:1; | ||
56 | int sched_smt:1; | ||
57 | int perf_bias:1; | ||
58 | }; | ||
59 | int params; | ||
60 | |||
61 | } params = {}; | ||
62 | int ret = 0; | ||
63 | |||
64 | setlocale(LC_ALL, ""); | ||
65 | textdomain (PACKAGE); | ||
66 | |||
67 | /* parameter parsing */ | ||
68 | while ((ret = getopt_long(argc, argv, "msbh", set_opts, NULL)) != -1) { | ||
69 | switch (ret) { | ||
70 | case 'h': | ||
71 | info_help(); | ||
72 | return 0; | ||
73 | case 'b': | ||
74 | if (params.perf_bias) | ||
75 | print_wrong_arg_exit(); | ||
76 | params.perf_bias = 1; | ||
77 | break; | ||
78 | case 'm': | ||
79 | if (params.sched_mc) | ||
80 | print_wrong_arg_exit(); | ||
81 | params.sched_mc = 1; | ||
82 | break; | ||
83 | case 's': | ||
84 | if (params.sched_smt) | ||
85 | print_wrong_arg_exit(); | ||
86 | params.sched_smt = 1; | ||
87 | break; | ||
88 | default: | ||
89 | print_wrong_arg_exit(); | ||
90 | } | ||
91 | }; | ||
92 | |||
93 | if (!params.params) | ||
94 | params.params = 0x7; | ||
95 | |||
96 | /* Default is: show output of CPU 0 only */ | ||
97 | if (bitmask_isallclear(cpus_chosen)) | ||
98 | bitmask_setbit(cpus_chosen, 0); | ||
99 | |||
100 | if (params.sched_mc) { | ||
101 | ret = sysfs_get_sched("mc"); | ||
102 | printf(_("System's multi core scheduler setting: ")); | ||
103 | if (ret < 0) | ||
104 | /* if sysfs file is missing it's: errno == ENOENT */ | ||
105 | printf(_("not supported\n")); | ||
106 | else | ||
107 | printf("%d\n", ret); | ||
108 | } | ||
109 | if (params.sched_smt) { | ||
110 | ret = sysfs_get_sched("smt"); | ||
111 | printf(_("System's thread sibling scheduler setting: ")); | ||
112 | if (ret < 0) | ||
113 | /* if sysfs file is missing it's: errno == ENOENT */ | ||
114 | printf(_("not supported\n")); | ||
115 | else | ||
116 | printf("%d\n", ret); | ||
117 | } | ||
118 | |||
119 | /* Add more per cpu options here */ | ||
120 | if (!params.perf_bias) | ||
121 | return ret; | ||
122 | |||
123 | if (params.perf_bias) { | ||
124 | if (!run_as_root) { | ||
125 | params.perf_bias = 0; | ||
126 | printf (_("Intel's performance bias setting needs root privileges\n")); | ||
127 | } else if (!(cpupower_cpu_info.caps & CPUPOWER_CAP_PERF_BIAS)) { | ||
128 | printf(_("System does not support Intel's performance" | ||
129 | " bias setting\n")); | ||
130 | params.perf_bias = 0; | ||
131 | } | ||
132 | } | ||
133 | |||
134 | /* loop over CPUs */ | ||
135 | for (cpu = bitmask_first(cpus_chosen); | ||
136 | cpu <= bitmask_last(cpus_chosen); cpu++) { | ||
137 | |||
138 | if (!bitmask_isbitset(cpus_chosen, cpu) || | ||
139 | cpufreq_cpu_exists(cpu)) | ||
140 | continue; | ||
141 | |||
142 | printf(_("analyzing CPU %d:\n"), cpu); | ||
143 | |||
144 | if (params.perf_bias) { | ||
145 | ret = msr_intel_get_perf_bias(cpu); | ||
146 | if (ret < 0) { | ||
147 | printf(_("Could not read perf-bias value\n")); | ||
148 | break; | ||
149 | } else | ||
150 | printf(_("perf-bias: %d\n"), ret); | ||
151 | } | ||
152 | } | ||
153 | return ret; | ||
154 | } | ||
diff --git a/tools/power/cpupower/utils/cpupower-set.c b/tools/power/cpupower/utils/cpupower-set.c new file mode 100644 index 00000000000..3f807bc7a56 --- /dev/null +++ b/tools/power/cpupower/utils/cpupower-set.c | |||
@@ -0,0 +1,153 @@ | |||
1 | /* | ||
2 | * (C) 2011 Thomas Renninger <trenn@suse.de>, Novell Inc. | ||
3 | * | ||
4 | * Licensed under the terms of the GNU GPL License version 2. | ||
5 | */ | ||
6 | |||
7 | |||
8 | #include <unistd.h> | ||
9 | #include <stdio.h> | ||
10 | #include <stdlib.h> | ||
11 | #include <errno.h> | ||
12 | #include <string.h> | ||
13 | #include <getopt.h> | ||
14 | |||
15 | #include <cpufreq.h> | ||
16 | #include "helpers/helpers.h" | ||
17 | #include "helpers/sysfs.h" | ||
18 | #include "helpers/bitmask.h" | ||
19 | |||
20 | void set_help(void) | ||
21 | { | ||
22 | printf(_("Usage: cpupower set [ -b val ] [ -m val ] [ -s val ]\n")); | ||
23 | printf(_("Options:\n")); | ||
24 | printf(_(" -b, --perf-bias [VAL] Sets CPU's power vs performance policy on some\n" | ||
25 | " Intel models [0-15], see manpage for details\n")); | ||
26 | printf(_(" -m, --sched-mc [VAL] Sets the kernel's multi core scheduler policy.\n")); | ||
27 | printf(_(" -s, --sched-smt [VAL] Sets the kernel's thread sibling scheduler policy.\n")); | ||
28 | printf(_(" -h, --help Prints out this screen\n")); | ||
29 | printf("\n"); | ||
30 | } | ||
31 | |||
32 | static struct option set_opts[] = { | ||
33 | { .name="perf-bias", .has_arg=optional_argument, .flag=NULL, .val='b'}, | ||
34 | { .name="sched-mc", .has_arg=optional_argument, .flag=NULL, .val='m'}, | ||
35 | { .name="sched-smt", .has_arg=optional_argument, .flag=NULL, .val='s'}, | ||
36 | { .name="help", .has_arg=no_argument, .flag=NULL, .val='h'}, | ||
37 | { }, | ||
38 | }; | ||
39 | |||
40 | static void print_wrong_arg_exit(void) | ||
41 | { | ||
42 | printf(_("invalid or unknown argument\n")); | ||
43 | set_help(); | ||
44 | exit(EXIT_FAILURE); | ||
45 | } | ||
46 | |||
47 | int cmd_set(int argc, char **argv) | ||
48 | { | ||
49 | extern char *optarg; | ||
50 | extern int optind, opterr, optopt; | ||
51 | unsigned int cpu; | ||
52 | |||
53 | union { | ||
54 | struct { | ||
55 | int sched_mc:1; | ||
56 | int sched_smt:1; | ||
57 | int perf_bias:1; | ||
58 | }; | ||
59 | int params; | ||
60 | |||
61 | } params; | ||
62 | int sched_mc = 0, sched_smt = 0, perf_bias = 0; | ||
63 | int ret = 0; | ||
64 | |||
65 | setlocale(LC_ALL, ""); | ||
66 | textdomain (PACKAGE); | ||
67 | |||
68 | params.params = 0; | ||
69 | /* parameter parsing */ | ||
70 | while ((ret = getopt_long(argc, argv, "m:s:b:h", set_opts, NULL)) != -1) { | ||
71 | switch (ret) { | ||
72 | case 'h': | ||
73 | set_help(); | ||
74 | return 0; | ||
75 | case 'b': | ||
76 | if (params.perf_bias) | ||
77 | print_wrong_arg_exit(); | ||
78 | perf_bias = atoi(optarg); | ||
79 | if (perf_bias < 0 || perf_bias > 15) { | ||
80 | printf(_("--perf-bias param out " | ||
81 | "of range [0-%d]\n"), 15); | ||
82 | print_wrong_arg_exit(); | ||
83 | } | ||
84 | params.perf_bias = 1; | ||
85 | break; | ||
86 | case 'm': | ||
87 | if (params.sched_mc) | ||
88 | print_wrong_arg_exit(); | ||
89 | sched_mc = atoi(optarg); | ||
90 | if (sched_mc < 0 || sched_mc > 2) { | ||
91 | printf(_("--sched-mc param out " | ||
92 | "of range [0-%d]\n"), 2); | ||
93 | print_wrong_arg_exit(); | ||
94 | } | ||
95 | params.sched_mc = 1; | ||
96 | break; | ||
97 | case 's': | ||
98 | if (params.sched_smt) | ||
99 | print_wrong_arg_exit(); | ||
100 | sched_smt = atoi(optarg); | ||
101 | if (sched_smt < 0 || sched_smt > 2) { | ||
102 | printf(_("--sched-smt param out " | ||
103 | "of range [0-%d]\n"), 2); | ||
104 | print_wrong_arg_exit(); | ||
105 | } | ||
106 | params.sched_smt = 1; | ||
107 | break; | ||
108 | default: | ||
109 | print_wrong_arg_exit(); | ||
110 | } | ||
111 | }; | ||
112 | |||
113 | if (!params.params) { | ||
114 | set_help(); | ||
115 | return -EINVAL; | ||
116 | } | ||
117 | |||
118 | if (params.sched_mc) { | ||
119 | ret = sysfs_set_sched("mc", sched_mc); | ||
120 | if (ret) | ||
121 | fprintf(stderr, _("Error setting sched-mc %s\n"), | ||
122 | (ret == -ENODEV) ? "not supported" : ""); | ||
123 | } | ||
124 | if (params.sched_smt) { | ||
125 | ret = sysfs_set_sched("smt", sched_smt); | ||
126 | if (ret) | ||
127 | fprintf(stderr, _("Error setting sched-smt %s\n"), | ||
128 | (ret == -ENODEV) ? "not supported" : ""); | ||
129 | } | ||
130 | |||
131 | /* Default is: set all CPUs */ | ||
132 | if (bitmask_isallclear(cpus_chosen)) | ||
133 | bitmask_setall(cpus_chosen); | ||
134 | |||
135 | /* loop over CPUs */ | ||
136 | for (cpu = bitmask_first(cpus_chosen); | ||
137 | cpu <= bitmask_last(cpus_chosen); cpu++) { | ||
138 | |||
139 | if (!bitmask_isbitset(cpus_chosen, cpu) || | ||
140 | cpufreq_cpu_exists(cpu)) | ||
141 | continue; | ||
142 | |||
143 | if (params.perf_bias) { | ||
144 | ret = msr_intel_set_perf_bias(cpu, perf_bias); | ||
145 | if (ret) { | ||
146 | fprintf(stderr, _("Error setting perf-bias " | ||
147 | "value on CPU %d\n"), cpu); | ||
148 | break; | ||
149 | } | ||
150 | } | ||
151 | } | ||
152 | return ret; | ||
153 | } | ||
diff --git a/tools/power/cpupower/utils/cpupower.c b/tools/power/cpupower/utils/cpupower.c new file mode 100644 index 00000000000..b048e559535 --- /dev/null +++ b/tools/power/cpupower/utils/cpupower.c | |||
@@ -0,0 +1,201 @@ | |||
1 | /* | ||
2 | * (C) 2010,2011 Thomas Renninger <trenn@suse.de>, Novell Inc. | ||
3 | * | ||
4 | * Licensed under the terms of the GNU GPL License version 2. | ||
5 | * | ||
6 | * Ideas taken over from the perf userspace tool (included in the Linus | ||
7 | * kernel git repo): subcommand builtins and param parsing. | ||
8 | */ | ||
9 | |||
10 | #include <stdio.h> | ||
11 | #include <stdlib.h> | ||
12 | #include <string.h> | ||
13 | #include <unistd.h> | ||
14 | |||
15 | #include "builtin.h" | ||
16 | #include "helpers/helpers.h" | ||
17 | #include "helpers/bitmask.h" | ||
18 | |||
19 | struct cmd_struct { | ||
20 | const char *cmd; | ||
21 | int (*main)(int, const char **); | ||
22 | void (*usage)(void); | ||
23 | int needs_root; | ||
24 | }; | ||
25 | |||
26 | #define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0])) | ||
27 | |||
28 | int cmd_help(int argc, const char **argv); | ||
29 | |||
30 | /* Global cpu_info object available for all binaries | ||
31 | * Info only retrieved from CPU 0 | ||
32 | * | ||
33 | * Values will be zero/unknown on non X86 archs | ||
34 | */ | ||
35 | struct cpupower_cpu_info cpupower_cpu_info; | ||
36 | int run_as_root; | ||
37 | /* Affected cpus chosen by -c/--cpu param */ | ||
38 | struct bitmask *cpus_chosen; | ||
39 | |||
40 | #ifdef DEBUG | ||
41 | int be_verbose; | ||
42 | #endif | ||
43 | |||
44 | static void print_help(void); | ||
45 | |||
46 | static struct cmd_struct commands[] = { | ||
47 | { "frequency-info", cmd_freq_info, freq_info_help, 0 }, | ||
48 | { "frequency-set", cmd_freq_set, freq_set_help, 1 }, | ||
49 | { "idle-info", cmd_idle_info, idle_info_help, 0 }, | ||
50 | { "set", cmd_set, set_help, 1 }, | ||
51 | { "info", cmd_info, info_help, 0 }, | ||
52 | { "monitor", cmd_monitor, monitor_help, 0 }, | ||
53 | { "help", cmd_help, print_help, 0 }, | ||
54 | // { "bench", cmd_bench, NULL, 1 }, | ||
55 | }; | ||
56 | |||
57 | int cmd_help(int argc, const char **argv) | ||
58 | { | ||
59 | unsigned int i; | ||
60 | |||
61 | if (argc > 1) { | ||
62 | for (i = 0; i < ARRAY_SIZE(commands); i++) { | ||
63 | struct cmd_struct *p = commands + i; | ||
64 | if (strcmp(p->cmd, argv[1])) | ||
65 | continue; | ||
66 | if (p->usage) { | ||
67 | p->usage(); | ||
68 | return EXIT_SUCCESS; | ||
69 | } | ||
70 | } | ||
71 | } | ||
72 | print_help(); | ||
73 | if (argc == 1) | ||
74 | return EXIT_SUCCESS; /* cpupower help */ | ||
75 | return EXIT_FAILURE; | ||
76 | } | ||
77 | |||
78 | static void print_help(void) | ||
79 | { | ||
80 | unsigned int i; | ||
81 | |||
82 | #ifdef DEBUG | ||
83 | printf(_("cpupower [ -d ][ -c cpulist ] subcommand [ARGS]\n")); | ||
84 | printf(_(" -d, --debug May increase output (stderr) on some subcommands\n")); | ||
85 | #else | ||
86 | printf(_("cpupower [ -c cpulist ] subcommand [ARGS]\n")); | ||
87 | #endif | ||
88 | printf(_("cpupower --version\n")); | ||
89 | printf(_("Supported subcommands are:\n")); | ||
90 | for (i = 0; i < ARRAY_SIZE(commands); i++) | ||
91 | printf("\t%s\n", commands[i].cmd); | ||
92 | printf(_("\nSome subcommands can make use of the -c cpulist option.\n")); | ||
93 | printf(_("Look at the general cpupower manpage how to use it\n")); | ||
94 | printf(_("and read up the subcommand's manpage whether it is supported.\n")); | ||
95 | printf(_("\nUse cpupower help subcommand for getting help for above subcommands.\n")); | ||
96 | } | ||
97 | |||
98 | static void print_version(void) { | ||
99 | printf(PACKAGE " " VERSION "\n"); | ||
100 | printf(_("Report errors and bugs to %s, please.\n"), PACKAGE_BUGREPORT); | ||
101 | } | ||
102 | |||
103 | static void handle_options(int *argc, const char ***argv) | ||
104 | { | ||
105 | int ret, x, new_argc = 0; | ||
106 | |||
107 | if (*argc < 1) | ||
108 | return; | ||
109 | |||
110 | for (x = 0; x < *argc && ((*argv)[x])[0] == '-'; x++) { | ||
111 | const char *param = (*argv)[x]; | ||
112 | if (!strcmp(param, "-h") || !strcmp(param, "--help")){ | ||
113 | print_help(); | ||
114 | exit(EXIT_SUCCESS); | ||
115 | } else if (!strcmp(param, "-c") || !strcmp(param, "--cpu")){ | ||
116 | if (*argc < 2) { | ||
117 | print_help(); | ||
118 | exit(EXIT_FAILURE); | ||
119 | } | ||
120 | if (!strcmp((*argv)[x+1], "all")) | ||
121 | bitmask_setall(cpus_chosen); | ||
122 | else { | ||
123 | ret = bitmask_parselist( | ||
124 | (*argv)[x+1], cpus_chosen); | ||
125 | if (ret < 0) { | ||
126 | fprintf(stderr, _("Error parsing cpu " | ||
127 | "list\n")); | ||
128 | exit(EXIT_FAILURE); | ||
129 | } | ||
130 | } | ||
131 | x += 1; | ||
132 | /* Cut out param: cpupower -c 1 info -> cpupower info */ | ||
133 | new_argc += 2; | ||
134 | continue; | ||
135 | } else if (!strcmp(param, "-v") || !strcmp(param, "--version")){ | ||
136 | print_version(); | ||
137 | exit(EXIT_SUCCESS); | ||
138 | #ifdef DEBUG | ||
139 | } else if (!strcmp(param, "-d") || !strcmp(param, "--debug")){ | ||
140 | be_verbose = 1; | ||
141 | new_argc ++; | ||
142 | continue; | ||
143 | #endif | ||
144 | } else { | ||
145 | fprintf(stderr, "Unknown option: %s\n", param); | ||
146 | print_help(); | ||
147 | exit(EXIT_FAILURE); | ||
148 | } | ||
149 | } | ||
150 | *argc -= new_argc; | ||
151 | *argv += new_argc; | ||
152 | } | ||
153 | |||
154 | int main(int argc, const char *argv[]) | ||
155 | { | ||
156 | const char *cmd; | ||
157 | unsigned int i, ret; | ||
158 | |||
159 | cpus_chosen = bitmask_alloc(sysconf(_SC_NPROCESSORS_CONF)); | ||
160 | |||
161 | argc--; | ||
162 | argv += 1; | ||
163 | |||
164 | handle_options(&argc, &argv); | ||
165 | |||
166 | cmd = argv[0]; | ||
167 | |||
168 | if (argc < 1) { | ||
169 | print_help(); | ||
170 | return EXIT_FAILURE; | ||
171 | } | ||
172 | |||
173 | setlocale(LC_ALL, ""); | ||
174 | textdomain (PACKAGE); | ||
175 | |||
176 | /* Turn "perf cmd --help" into "perf help cmd" */ | ||
177 | if (argc > 1 && !strcmp(argv[1], "--help")) { | ||
178 | argv[1] = argv[0]; | ||
179 | argv[0] = cmd = "help"; | ||
180 | } | ||
181 | |||
182 | get_cpu_info(0, &cpupower_cpu_info); | ||
183 | run_as_root = !getuid(); | ||
184 | |||
185 | for (i = 0; i < ARRAY_SIZE(commands); i++) { | ||
186 | struct cmd_struct *p = commands + i; | ||
187 | if (strcmp(p->cmd, cmd)) | ||
188 | continue; | ||
189 | if (!run_as_root && p->needs_root) { | ||
190 | fprintf(stderr, _("Subcommand %s needs root " | ||
191 | "privileges\n"), cmd); | ||
192 | return EXIT_FAILURE; | ||
193 | } | ||
194 | ret = p->main(argc, argv); | ||
195 | if (cpus_chosen) | ||
196 | bitmask_free(cpus_chosen); | ||
197 | return ret; | ||
198 | } | ||
199 | print_help(); | ||
200 | return EXIT_FAILURE; | ||
201 | } | ||
diff --git a/tools/power/cpupower/utils/helpers/amd.c b/tools/power/cpupower/utils/helpers/amd.c new file mode 100644 index 00000000000..5e44e31fc7f --- /dev/null +++ b/tools/power/cpupower/utils/helpers/amd.c | |||
@@ -0,0 +1,137 @@ | |||
1 | #if defined(__i386__) || defined(__x86_64__) | ||
2 | #include <unistd.h> | ||
3 | #include <errno.h> | ||
4 | #include <stdio.h> | ||
5 | #include <stdint.h> | ||
6 | |||
7 | #include <pci/pci.h> | ||
8 | |||
9 | #include "helpers/helpers.h" | ||
10 | |||
11 | #define MSR_AMD_PSTATE_STATUS 0xc0010063 | ||
12 | #define MSR_AMD_PSTATE 0xc0010064 | ||
13 | #define MSR_AMD_PSTATE_LIMIT 0xc0010061 | ||
14 | |||
15 | union msr_pstate { | ||
16 | struct { | ||
17 | unsigned fid:6; | ||
18 | unsigned did:3; | ||
19 | unsigned vid:7; | ||
20 | unsigned res1:6; | ||
21 | unsigned nbdid:1; | ||
22 | unsigned res2:2; | ||
23 | unsigned nbvid:7; | ||
24 | unsigned iddval:8; | ||
25 | unsigned idddiv:2; | ||
26 | unsigned res3:21; | ||
27 | unsigned en:1; | ||
28 | } bits; | ||
29 | unsigned long long val; | ||
30 | }; | ||
31 | |||
32 | static int get_did(int family, union msr_pstate pstate) | ||
33 | { | ||
34 | int t; | ||
35 | |||
36 | if (family == 0x12) | ||
37 | t = pstate.val & 0xf; | ||
38 | else | ||
39 | t = pstate.bits.did; | ||
40 | |||
41 | return t; | ||
42 | } | ||
43 | |||
44 | static int get_cof(int family, union msr_pstate pstate) | ||
45 | { | ||
46 | int t; | ||
47 | int fid, did; | ||
48 | |||
49 | did = get_did(family, pstate); | ||
50 | |||
51 | t = 0x10; | ||
52 | fid = pstate.bits.fid; | ||
53 | if (family == 0x11) | ||
54 | t = 0x8; | ||
55 | |||
56 | return ((100 * (fid + t)) >> did); | ||
57 | } | ||
58 | |||
59 | /* Needs: | ||
60 | * cpu -> the cpu that gets evaluated | ||
61 | * cpu_family -> The cpu's family (0x10, 0x12,...) | ||
62 | * boots_states -> how much boost states the machines support | ||
63 | * | ||
64 | * Fills up: | ||
65 | * pstates -> a pointer to an array of size MAX_HW_PSTATES | ||
66 | * must be initialized with zeros. | ||
67 | * All available HW pstates (including boost states) | ||
68 | * no -> amount of pstates above array got filled up with | ||
69 | * | ||
70 | * returns zero on success, -1 on failure | ||
71 | */ | ||
72 | int decode_pstates(unsigned int cpu, unsigned int cpu_family, | ||
73 | int boost_states, unsigned long *pstates, int *no) | ||
74 | { | ||
75 | int i, psmax, pscur; | ||
76 | union msr_pstate pstate; | ||
77 | unsigned long long val; | ||
78 | |||
79 | /* Only read out frequencies from HW when CPU might be boostable | ||
80 | to keep the code as short and clean as possible. | ||
81 | Otherwise frequencies are exported via ACPI tables. | ||
82 | */ | ||
83 | if (cpu_family < 0x10 || cpu_family == 0x14) | ||
84 | return -1; | ||
85 | |||
86 | if (read_msr(cpu, MSR_AMD_PSTATE_LIMIT, &val)) | ||
87 | return -1; | ||
88 | |||
89 | psmax = (val >> 4) & 0x7; | ||
90 | |||
91 | if (read_msr(cpu, MSR_AMD_PSTATE_STATUS, &val)) | ||
92 | return -1; | ||
93 | |||
94 | pscur = val & 0x7; | ||
95 | |||
96 | pscur += boost_states; | ||
97 | psmax += boost_states; | ||
98 | for (i=0; i<=psmax; i++) { | ||
99 | if (i >= MAX_HW_PSTATES) { | ||
100 | fprintf(stderr, "HW pstates [%d] exceeding max [%d]\n", | ||
101 | psmax, MAX_HW_PSTATES); | ||
102 | return -1; | ||
103 | } | ||
104 | if (read_msr(cpu, MSR_AMD_PSTATE + i, &pstate.val)) | ||
105 | return -1; | ||
106 | pstates[i] = get_cof(cpu_family, pstate); | ||
107 | } | ||
108 | *no = i; | ||
109 | return 0; | ||
110 | } | ||
111 | |||
112 | int amd_pci_get_num_boost_states(int *active, int *states) | ||
113 | { | ||
114 | struct pci_access *pci_acc; | ||
115 | int vendor_id = 0x1022; | ||
116 | int boost_dev_ids[4] = {0x1204, 0x1604, 0x1704, 0}; | ||
117 | struct pci_dev *device; | ||
118 | uint8_t val = 0; | ||
119 | |||
120 | *active = *states = 0; | ||
121 | |||
122 | device = pci_acc_init(&pci_acc, vendor_id, boost_dev_ids); | ||
123 | |||
124 | if (device == NULL) | ||
125 | return -ENODEV; | ||
126 | |||
127 | val = pci_read_byte(device, 0x15c); | ||
128 | if (val & 3) | ||
129 | *active = 1; | ||
130 | else | ||
131 | *active = 0; | ||
132 | *states = (val >> 2) & 7; | ||
133 | |||
134 | pci_cleanup(pci_acc); | ||
135 | return 0; | ||
136 | } | ||
137 | #endif /* defined(__i386__) || defined(__x86_64__) */ | ||
diff --git a/tools/power/cpupower/utils/helpers/bitmask.c b/tools/power/cpupower/utils/helpers/bitmask.c new file mode 100644 index 00000000000..60f4d69bb20 --- /dev/null +++ b/tools/power/cpupower/utils/helpers/bitmask.c | |||
@@ -0,0 +1,290 @@ | |||
1 | #include <stdio.h> | ||
2 | #include <stdlib.h> | ||
3 | #include <string.h> | ||
4 | |||
5 | #include <helpers/bitmask.h> | ||
6 | |||
7 | /* How many bits in an unsigned long */ | ||
8 | #define bitsperlong (8 * sizeof(unsigned long)) | ||
9 | |||
10 | /* howmany(a,b) : how many elements of size b needed to hold all of a */ | ||
11 | #define howmany(x,y) (((x)+((y)-1))/(y)) | ||
12 | |||
13 | /* How many longs in mask of n bits */ | ||
14 | #define longsperbits(n) howmany(n, bitsperlong) | ||
15 | |||
16 | #define max(a,b) ((a) > (b) ? (a) : (b)) | ||
17 | |||
18 | /* | ||
19 | * Allocate and free `struct bitmask *` | ||
20 | */ | ||
21 | |||
22 | /* Allocate a new `struct bitmask` with a size of n bits */ | ||
23 | struct bitmask *bitmask_alloc(unsigned int n) | ||
24 | { | ||
25 | struct bitmask *bmp; | ||
26 | |||
27 | bmp = malloc(sizeof(*bmp)); | ||
28 | if (bmp == 0) | ||
29 | return 0; | ||
30 | bmp->size = n; | ||
31 | bmp->maskp = calloc(longsperbits(n), sizeof(unsigned long)); | ||
32 | if (bmp->maskp == 0) { | ||
33 | free(bmp); | ||
34 | return 0; | ||
35 | } | ||
36 | return bmp; | ||
37 | } | ||
38 | |||
39 | /* Free `struct bitmask` */ | ||
40 | void bitmask_free(struct bitmask *bmp) | ||
41 | { | ||
42 | if (bmp == 0) | ||
43 | return; | ||
44 | free(bmp->maskp); | ||
45 | bmp->maskp = (unsigned long *)0xdeadcdef; /* double free tripwire */ | ||
46 | free(bmp); | ||
47 | } | ||
48 | |||
49 | /* | ||
50 | * The routines _getbit() and _setbit() are the only | ||
51 | * routines that actually understand the layout of bmp->maskp[]. | ||
52 | * | ||
53 | * On little endian architectures, this could simply be an array of | ||
54 | * bytes. But the kernel layout of bitmasks _is_ visible to userspace | ||
55 | * via the sched_(set/get)affinity calls in Linux 2.6, and on big | ||
56 | * endian architectures, it is painfully obvious that this is an | ||
57 | * array of unsigned longs. | ||
58 | */ | ||
59 | |||
60 | /* Return the value (0 or 1) of bit n in bitmask bmp */ | ||
61 | static unsigned int _getbit(const struct bitmask *bmp, unsigned int n) | ||
62 | { | ||
63 | if (n < bmp->size) | ||
64 | return (bmp->maskp[n/bitsperlong] >> (n % bitsperlong)) & 1; | ||
65 | else | ||
66 | return 0; | ||
67 | } | ||
68 | |||
69 | /* Set bit n in bitmask bmp to value v (0 or 1) */ | ||
70 | static void _setbit(struct bitmask *bmp, unsigned int n, unsigned int v) | ||
71 | { | ||
72 | if (n < bmp->size) { | ||
73 | if (v) | ||
74 | bmp->maskp[n/bitsperlong] |= 1UL << (n % bitsperlong); | ||
75 | else | ||
76 | bmp->maskp[n/bitsperlong] &= ~(1UL << (n % bitsperlong)); | ||
77 | } | ||
78 | } | ||
79 | |||
80 | /* | ||
81 | * When parsing bitmask lists, only allow numbers, separated by one | ||
82 | * of the allowed next characters. | ||
83 | * | ||
84 | * The parameter 'sret' is the return from a sscanf "%u%c". It is | ||
85 | * -1 if the sscanf input string was empty. It is 0 if the first | ||
86 | * character in the sscanf input string was not a decimal number. | ||
87 | * It is 1 if the unsigned number matching the "%u" was the end of the | ||
88 | * input string. It is 2 if one or more additional characters followed | ||
89 | * the matched unsigned number. If it is 2, then 'nextc' is the first | ||
90 | * character following the number. The parameter 'ok_next_chars' | ||
91 | * is the nul-terminated list of allowed next characters. | ||
92 | * | ||
93 | * The mask term just scanned was ok if and only if either the numbers | ||
94 | * matching the %u were all of the input or if the next character in | ||
95 | * the input past the numbers was one of the allowed next characters. | ||
96 | */ | ||
97 | static int scan_was_ok(int sret, char nextc, const char *ok_next_chars) | ||
98 | { | ||
99 | return sret == 1 || | ||
100 | (sret == 2 && strchr(ok_next_chars, nextc) != NULL); | ||
101 | } | ||
102 | |||
103 | static const char *nexttoken(const char *q, int sep) | ||
104 | { | ||
105 | if (q) | ||
106 | q = strchr(q, sep); | ||
107 | if (q) | ||
108 | q++; | ||
109 | return q; | ||
110 | } | ||
111 | |||
112 | /* Set a single bit i in bitmask */ | ||
113 | struct bitmask *bitmask_setbit(struct bitmask *bmp, unsigned int i) | ||
114 | { | ||
115 | _setbit(bmp, i, 1); | ||
116 | return bmp; | ||
117 | } | ||
118 | |||
119 | /* Set all bits in bitmask: bmp = ~0 */ | ||
120 | struct bitmask *bitmask_setall(struct bitmask *bmp) | ||
121 | { | ||
122 | unsigned int i; | ||
123 | for (i = 0; i < bmp->size; i++) | ||
124 | _setbit(bmp, i, 1); | ||
125 | return bmp; | ||
126 | } | ||
127 | |||
128 | /* Clear all bits in bitmask: bmp = 0 */ | ||
129 | struct bitmask *bitmask_clearall(struct bitmask *bmp) | ||
130 | { | ||
131 | unsigned int i; | ||
132 | for (i = 0; i < bmp->size; i++) | ||
133 | _setbit(bmp, i, 0); | ||
134 | return bmp; | ||
135 | } | ||
136 | |||
137 | /* True if all bits are clear */ | ||
138 | int bitmask_isallclear(const struct bitmask *bmp) | ||
139 | { | ||
140 | unsigned int i; | ||
141 | for (i = 0; i < bmp->size; i++) | ||
142 | if (_getbit(bmp, i)) | ||
143 | return 0; | ||
144 | return 1; | ||
145 | } | ||
146 | |||
147 | /* True if specified bit i is set */ | ||
148 | int bitmask_isbitset(const struct bitmask *bmp, unsigned int i) | ||
149 | { | ||
150 | return _getbit(bmp, i); | ||
151 | } | ||
152 | |||
153 | /* Number of lowest set bit (min) */ | ||
154 | unsigned int bitmask_first(const struct bitmask *bmp) | ||
155 | { | ||
156 | return bitmask_next(bmp, 0); | ||
157 | } | ||
158 | |||
159 | /* Number of highest set bit (max) */ | ||
160 | unsigned int bitmask_last(const struct bitmask *bmp) | ||
161 | { | ||
162 | unsigned int i; | ||
163 | unsigned int m = bmp->size; | ||
164 | for (i = 0; i < bmp->size; i++) | ||
165 | if (_getbit(bmp, i)) | ||
166 | m = i; | ||
167 | return m; | ||
168 | } | ||
169 | |||
170 | /* Number of next set bit at or above given bit i */ | ||
171 | unsigned int bitmask_next(const struct bitmask *bmp, unsigned int i) | ||
172 | { | ||
173 | unsigned int n; | ||
174 | for (n = i; n < bmp->size; n++) | ||
175 | if (_getbit(bmp, n)) | ||
176 | break; | ||
177 | return n; | ||
178 | } | ||
179 | |||
180 | /* | ||
181 | * Parses a comma-separated list of numbers and ranges of numbers, | ||
182 | * with optional ':%u' strides modifying ranges, into provided bitmask. | ||
183 | * Some examples of input lists and their equivalent simple list: | ||
184 | * Input Equivalent to | ||
185 | * 0-3 0,1,2,3 | ||
186 | * 0-7:2 0,2,4,6 | ||
187 | * 1,3,5-7 1,3,5,6,7 | ||
188 | * 0-3:2,8-15:4 0,2,8,12 | ||
189 | */ | ||
190 | int bitmask_parselist(const char *buf, struct bitmask *bmp) | ||
191 | { | ||
192 | const char *p, *q; | ||
193 | |||
194 | bitmask_clearall(bmp); | ||
195 | |||
196 | q = buf; | ||
197 | while (p = q, q = nexttoken(q, ','), p) { | ||
198 | unsigned int a; /* begin of range */ | ||
199 | unsigned int b; /* end of range */ | ||
200 | unsigned int s; /* stride */ | ||
201 | const char *c1, *c2; /* next tokens after '-' or ',' */ | ||
202 | char nextc; /* char after sscanf %u match */ | ||
203 | int sret; /* sscanf return (number of matches) */ | ||
204 | |||
205 | sret = sscanf(p, "%u%c", &a, &nextc); | ||
206 | if (!scan_was_ok(sret, nextc, ",-")) | ||
207 | goto err; | ||
208 | b = a; | ||
209 | s = 1; | ||
210 | c1 = nexttoken(p, '-'); | ||
211 | c2 = nexttoken(p, ','); | ||
212 | if (c1 != NULL && (c2 == NULL || c1 < c2)) { | ||
213 | sret = sscanf(c1, "%u%c", &b, &nextc); | ||
214 | if (!scan_was_ok(sret, nextc, ",:")) | ||
215 | goto err; | ||
216 | c1 = nexttoken(c1, ':'); | ||
217 | if (c1 != NULL && (c2 == NULL || c1 < c2)) { | ||
218 | sret = sscanf(c1, "%u%c", &s, &nextc); | ||
219 | if (!scan_was_ok(sret, nextc, ",")) | ||
220 | goto err; | ||
221 | } | ||
222 | } | ||
223 | if (!(a <= b)) | ||
224 | goto err; | ||
225 | if (b >= bmp->size) | ||
226 | goto err; | ||
227 | while (a <= b) { | ||
228 | _setbit(bmp, a, 1); | ||
229 | a += s; | ||
230 | } | ||
231 | } | ||
232 | return 0; | ||
233 | err: | ||
234 | bitmask_clearall(bmp); | ||
235 | return -1; | ||
236 | } | ||
237 | |||
238 | /* | ||
239 | * emit(buf, buflen, rbot, rtop, len) | ||
240 | * | ||
241 | * Helper routine for bitmask_displaylist(). Write decimal number | ||
242 | * or range to buf+len, suppressing output past buf+buflen, with optional | ||
243 | * comma-prefix. Return len of what would be written to buf, if it | ||
244 | * all fit. | ||
245 | */ | ||
246 | |||
247 | static inline int emit(char *buf, int buflen, int rbot, int rtop, int len) | ||
248 | { | ||
249 | if (len > 0) | ||
250 | len += snprintf(buf + len, max(buflen - len, 0), ","); | ||
251 | if (rbot == rtop) | ||
252 | len += snprintf(buf + len, max(buflen - len, 0), "%d", rbot); | ||
253 | else | ||
254 | len += snprintf(buf + len, max(buflen - len, 0), "%d-%d", rbot, rtop); | ||
255 | return len; | ||
256 | } | ||
257 | |||
258 | /* | ||
259 | * Write decimal list representation of bmp to buf. | ||
260 | * | ||
261 | * Output format is a comma-separated list of decimal numbers and | ||
262 | * ranges. Consecutively set bits are shown as two hyphen-separated | ||
263 | * decimal numbers, the smallest and largest bit numbers set in | ||
264 | * the range. Output format is compatible with the format | ||
265 | * accepted as input by bitmap_parselist(). | ||
266 | * | ||
267 | * The return value is the number of characters which would be | ||
268 | * generated for the given input, excluding the trailing '\0', as | ||
269 | * per ISO C99. | ||
270 | */ | ||
271 | |||
272 | int bitmask_displaylist(char *buf, int buflen, const struct bitmask *bmp) | ||
273 | { | ||
274 | int len = 0; | ||
275 | /* current bit is 'cur', most recently seen range is [rbot, rtop] */ | ||
276 | unsigned int cur, rbot, rtop; | ||
277 | |||
278 | if (buflen > 0) | ||
279 | *buf = 0; | ||
280 | rbot = cur = bitmask_first(bmp); | ||
281 | while (cur < bmp->size) { | ||
282 | rtop = cur; | ||
283 | cur = bitmask_next(bmp, cur+1); | ||
284 | if (cur >= bmp->size || cur > rtop + 1) { | ||
285 | len = emit(buf, buflen, rbot, rtop, len); | ||
286 | rbot = cur; | ||
287 | } | ||
288 | } | ||
289 | return len; | ||
290 | } | ||
diff --git a/tools/power/cpupower/utils/helpers/bitmask.h b/tools/power/cpupower/utils/helpers/bitmask.h new file mode 100644 index 00000000000..eb289df4105 --- /dev/null +++ b/tools/power/cpupower/utils/helpers/bitmask.h | |||
@@ -0,0 +1,33 @@ | |||
1 | #ifndef __CPUPOWER_BITMASK__ | ||
2 | #define __CPUPOWER_BITMASK__ | ||
3 | |||
4 | /* Taken over from libbitmask, a project initiated from sgi: | ||
5 | * Url: http://oss.sgi.com/projects/cpusets/ | ||
6 | * Unfortunately it's not very widespread, therefore relevant parts are | ||
7 | * pasted here. | ||
8 | */ | ||
9 | |||
10 | struct bitmask { | ||
11 | unsigned int size; | ||
12 | unsigned long *maskp; | ||
13 | }; | ||
14 | |||
15 | struct bitmask *bitmask_alloc(unsigned int n); | ||
16 | void bitmask_free(struct bitmask *bmp); | ||
17 | |||
18 | struct bitmask *bitmask_setbit(struct bitmask *bmp, unsigned int i); | ||
19 | struct bitmask *bitmask_setall(struct bitmask *bmp); | ||
20 | struct bitmask *bitmask_clearall(struct bitmask *bmp); | ||
21 | |||
22 | unsigned int bitmask_first(const struct bitmask *bmp); | ||
23 | unsigned int bitmask_next(const struct bitmask *bmp, unsigned int i); | ||
24 | unsigned int bitmask_last(const struct bitmask *bmp); | ||
25 | int bitmask_isallclear(const struct bitmask *bmp); | ||
26 | int bitmask_isbitset(const struct bitmask *bmp, unsigned int i); | ||
27 | |||
28 | int bitmask_parselist(const char *buf, struct bitmask *bmp); | ||
29 | int bitmask_displaylist(char *buf, int len, const struct bitmask *bmp); | ||
30 | |||
31 | |||
32 | |||
33 | #endif /*__CPUPOWER_BITMASK__ */ | ||
diff --git a/tools/power/cpupower/utils/helpers/cpuid.c b/tools/power/cpupower/utils/helpers/cpuid.c new file mode 100644 index 00000000000..71021f3bb69 --- /dev/null +++ b/tools/power/cpupower/utils/helpers/cpuid.c | |||
@@ -0,0 +1,145 @@ | |||
1 | #include <stdio.h> | ||
2 | #include <errno.h> | ||
3 | #include <string.h> | ||
4 | #include <unistd.h> | ||
5 | #include <stdlib.h> | ||
6 | |||
7 | #include "helpers/helpers.h" | ||
8 | |||
9 | static const char *cpu_vendor_table[X86_VENDOR_MAX] = { | ||
10 | "Unknown", "GenuineIntel", "AuthenticAMD", | ||
11 | }; | ||
12 | |||
13 | #if defined(__i386__) || defined(__x86_64__) | ||
14 | |||
15 | /* from gcc */ | ||
16 | #include <cpuid.h> | ||
17 | |||
18 | /* | ||
19 | * CPUID functions returning a single datum | ||
20 | * | ||
21 | * Define unsigned int cpuid_e[abcd]x(unsigned int op) | ||
22 | */ | ||
23 | #define cpuid_func(reg) \ | ||
24 | unsigned int cpuid_##reg(unsigned int op) \ | ||
25 | { \ | ||
26 | unsigned int eax, ebx, ecx, edx; \ | ||
27 | __cpuid(op, eax, ebx, ecx, edx); \ | ||
28 | return reg; \ | ||
29 | } | ||
30 | cpuid_func(eax); | ||
31 | cpuid_func(ebx); | ||
32 | cpuid_func(ecx); | ||
33 | cpuid_func(edx); | ||
34 | |||
35 | #endif /* defined(__i386__) || defined(__x86_64__) */ | ||
36 | |||
37 | /* get_cpu_info | ||
38 | * | ||
39 | * Extract CPU vendor, family, model, stepping info from /proc/cpuinfo | ||
40 | * | ||
41 | * Returns 0 on success or a negativ error code | ||
42 | * | ||
43 | * TBD: Should there be a cpuid alternative for this if /proc is not mounted? | ||
44 | */ | ||
45 | int get_cpu_info(unsigned int cpu, struct cpupower_cpu_info *cpu_info) | ||
46 | { | ||
47 | FILE *fp; | ||
48 | char value[64]; | ||
49 | unsigned int proc, x; | ||
50 | unsigned int unknown = 0xffffff; | ||
51 | unsigned int cpuid_level, ext_cpuid_level; | ||
52 | |||
53 | int ret = -EINVAL; | ||
54 | |||
55 | cpu_info->vendor = X86_VENDOR_UNKNOWN; | ||
56 | cpu_info->family = unknown; | ||
57 | cpu_info->model = unknown; | ||
58 | cpu_info->stepping = unknown; | ||
59 | cpu_info->caps = 0; | ||
60 | |||
61 | fp = fopen("/proc/cpuinfo", "r"); | ||
62 | if (!fp) | ||
63 | return -EIO; | ||
64 | |||
65 | while (!feof(fp)) { | ||
66 | if (!fgets(value, 64, fp)) | ||
67 | continue; | ||
68 | value[63 - 1] = '\0'; | ||
69 | |||
70 | if (!strncmp(value, "processor\t: ", 12)) { | ||
71 | sscanf(value, "processor\t: %u", &proc); | ||
72 | } | ||
73 | if (proc != cpu) | ||
74 | continue; | ||
75 | |||
76 | /* Get CPU vendor */ | ||
77 | if (!strncmp(value, "vendor_id", 9)) | ||
78 | for (x = 1; x < X86_VENDOR_MAX; x++) { | ||
79 | if (strstr(value, cpu_vendor_table[x])) | ||
80 | cpu_info->vendor = x; | ||
81 | } | ||
82 | /* Get CPU family, etc. */ | ||
83 | else if (!strncmp(value, "cpu family\t: ", 13)) { | ||
84 | sscanf(value, "cpu family\t: %u", | ||
85 | &cpu_info->family); | ||
86 | } | ||
87 | else if (!strncmp(value, "model\t\t: ", 9)) { | ||
88 | sscanf(value, "model\t\t: %u", | ||
89 | &cpu_info->model); | ||
90 | } | ||
91 | else if (!strncmp(value, "stepping\t: ", 10)) { | ||
92 | sscanf(value, "stepping\t: %u", | ||
93 | &cpu_info->stepping); | ||
94 | |||
95 | /* Exit -> all values must have been set */ | ||
96 | if (cpu_info->vendor == X86_VENDOR_UNKNOWN || | ||
97 | cpu_info->family == unknown || | ||
98 | cpu_info->model == unknown || | ||
99 | cpu_info->stepping == unknown) { | ||
100 | ret = -EINVAL; | ||
101 | goto out; | ||
102 | } | ||
103 | |||
104 | ret = 0; | ||
105 | goto out; | ||
106 | } | ||
107 | } | ||
108 | ret = -ENODEV; | ||
109 | out: | ||
110 | fclose(fp); | ||
111 | /* Get some useful CPU capabilities from cpuid */ | ||
112 | if (cpu_info->vendor != X86_VENDOR_AMD && | ||
113 | cpu_info->vendor != X86_VENDOR_INTEL) | ||
114 | return ret; | ||
115 | |||
116 | cpuid_level = cpuid_eax(0); | ||
117 | ext_cpuid_level = cpuid_eax(0x80000000); | ||
118 | |||
119 | /* Invariant TSC */ | ||
120 | if (ext_cpuid_level >= 0x80000007 && | ||
121 | (cpuid_edx(0x80000007) & (1 << 8))) | ||
122 | cpu_info->caps |= CPUPOWER_CAP_INV_TSC; | ||
123 | |||
124 | /* Aperf/Mperf registers support */ | ||
125 | if (cpuid_level >= 6 && (cpuid_ecx(6) & 0x1)) | ||
126 | cpu_info->caps |= CPUPOWER_CAP_APERF; | ||
127 | |||
128 | /* AMD Boost state enable/disable register */ | ||
129 | if (cpu_info->vendor == X86_VENDOR_AMD) { | ||
130 | if (ext_cpuid_level >= 0x80000007 && | ||
131 | (cpuid_edx(0x80000007) & (1 << 9))) | ||
132 | cpu_info->caps |= CPUPOWER_CAP_AMD_CBP; | ||
133 | } | ||
134 | |||
135 | /* Intel's perf-bias MSR support */ | ||
136 | if (cpu_info->vendor == X86_VENDOR_INTEL) { | ||
137 | if (cpuid_level >= 6 && (cpuid_ecx(6) & (1 << 3))) | ||
138 | cpu_info->caps |= CPUPOWER_CAP_PERF_BIAS; | ||
139 | } | ||
140 | |||
141 | /* printf("ID: %u - Extid: 0x%x - Caps: 0x%llx\n", | ||
142 | cpuid_level, ext_cpuid_level, cpu_info->caps); | ||
143 | */ | ||
144 | return ret; | ||
145 | } | ||
diff --git a/tools/power/cpupower/utils/helpers/helpers.h b/tools/power/cpupower/utils/helpers/helpers.h new file mode 100644 index 00000000000..a487dadb4cf --- /dev/null +++ b/tools/power/cpupower/utils/helpers/helpers.h | |||
@@ -0,0 +1,180 @@ | |||
1 | /* | ||
2 | * (C) 2010,2011 Thomas Renninger <trenn@suse.de>, Novell Inc. | ||
3 | * | ||
4 | * Licensed under the terms of the GNU GPL License version 2. | ||
5 | * | ||
6 | * Miscellaneous helpers which do not fit or are worth | ||
7 | * to put into separate headers | ||
8 | */ | ||
9 | |||
10 | #ifndef __CPUPOWERUTILS_HELPERS__ | ||
11 | #define __CPUPOWERUTILS_HELPERS__ | ||
12 | |||
13 | #include <libintl.h> | ||
14 | #include <locale.h> | ||
15 | |||
16 | #include "helpers/bitmask.h" | ||
17 | |||
18 | /* Internationalization ****************************/ | ||
19 | #define _(String) gettext(String) | ||
20 | #ifndef gettext_noop | ||
21 | #define gettext_noop(String) String | ||
22 | #endif | ||
23 | #define N_(String) gettext_noop (String) | ||
24 | /* Internationalization ****************************/ | ||
25 | |||
26 | extern int run_as_root; | ||
27 | extern struct bitmask *cpus_chosen; | ||
28 | |||
29 | /* Global verbose (-d) stuff *********************************/ | ||
30 | /* | ||
31 | * define DEBUG via global Makefile variable | ||
32 | * Debug output is sent to stderr, do: | ||
33 | * cpupower monitor 2>/tmp/debug | ||
34 | * to split debug output away from normal output | ||
35 | */ | ||
36 | #ifdef DEBUG | ||
37 | extern int be_verbose; | ||
38 | |||
39 | #define dprint(fmt, ...) { \ | ||
40 | if (be_verbose) { \ | ||
41 | fprintf(stderr, "%s: " fmt, \ | ||
42 | __FUNCTION__, ##__VA_ARGS__); \ | ||
43 | } \ | ||
44 | } | ||
45 | #else | ||
46 | static inline void dprint(const char *fmt, ...) { } | ||
47 | #endif | ||
48 | extern int be_verbose; | ||
49 | /* Global verbose (-v) stuff *********************************/ | ||
50 | |||
51 | /* cpuid and cpuinfo helpers **************************/ | ||
52 | enum cpupower_cpu_vendor {X86_VENDOR_UNKNOWN = 0, X86_VENDOR_INTEL, | ||
53 | X86_VENDOR_AMD, X86_VENDOR_MAX}; | ||
54 | |||
55 | #define CPUPOWER_CAP_INV_TSC 0x00000001 | ||
56 | #define CPUPOWER_CAP_APERF 0x00000002 | ||
57 | #define CPUPOWER_CAP_AMD_CBP 0x00000004 | ||
58 | #define CPUPOWER_CAP_PERF_BIAS 0x00000008 | ||
59 | |||
60 | #define MAX_HW_PSTATES 10 | ||
61 | |||
62 | struct cpupower_cpu_info { | ||
63 | enum cpupower_cpu_vendor vendor; | ||
64 | unsigned int family; | ||
65 | unsigned int model; | ||
66 | unsigned int stepping; | ||
67 | /* CPU capabilities read out from cpuid */ | ||
68 | unsigned long long caps; | ||
69 | }; | ||
70 | |||
71 | /* get_cpu_info | ||
72 | * | ||
73 | * Extract CPU vendor, family, model, stepping info from /proc/cpuinfo | ||
74 | * | ||
75 | * Returns 0 on success or a negativ error code | ||
76 | * Only used on x86, below global's struct values are zero/unknown on | ||
77 | * other archs | ||
78 | */ | ||
79 | extern int get_cpu_info(unsigned int cpu, struct cpupower_cpu_info *cpu_info); | ||
80 | extern struct cpupower_cpu_info cpupower_cpu_info; | ||
81 | /* cpuid and cpuinfo helpers **************************/ | ||
82 | |||
83 | |||
84 | /* CPU topology/hierarchy parsing ******************/ | ||
85 | struct cpupower_topology { | ||
86 | /* Amount of CPU cores, packages and threads per core in the system */ | ||
87 | unsigned int cores; | ||
88 | unsigned int pkgs; | ||
89 | unsigned int threads; /* per core */ | ||
90 | |||
91 | /* Array gets mallocated with cores entries, holding per core info */ | ||
92 | struct { | ||
93 | int pkg; | ||
94 | int core; | ||
95 | int cpu; | ||
96 | } *core_info; | ||
97 | }; | ||
98 | |||
99 | extern int get_cpu_topology(struct cpupower_topology *cpu_top); | ||
100 | extern void cpu_topology_release(struct cpupower_topology cpu_top); | ||
101 | /* CPU topology/hierarchy parsing ******************/ | ||
102 | |||
103 | /* X86 ONLY ****************************************/ | ||
104 | #if defined(__i386__) || defined(__x86_64__) | ||
105 | |||
106 | #include <pci/pci.h> | ||
107 | |||
108 | /* Read/Write msr ****************************/ | ||
109 | extern int read_msr(int cpu, unsigned int idx, unsigned long long *val); | ||
110 | extern int write_msr(int cpu, unsigned int idx, unsigned long long val); | ||
111 | |||
112 | extern int msr_intel_set_perf_bias(unsigned int cpu, unsigned int val); | ||
113 | extern int msr_intel_get_perf_bias(unsigned int cpu); | ||
114 | |||
115 | extern int msr_intel_has_boost_support(unsigned int cpu); | ||
116 | extern int msr_intel_boost_is_active(unsigned int cpu); | ||
117 | |||
118 | /* Read/Write msr ****************************/ | ||
119 | |||
120 | /* PCI stuff ****************************/ | ||
121 | extern int amd_pci_get_num_boost_states(int *active, int *states); | ||
122 | extern struct pci_dev *pci_acc_init(struct pci_access **pacc, int vendor_id, | ||
123 | int *dev_ids); | ||
124 | |||
125 | /* PCI stuff ****************************/ | ||
126 | |||
127 | /* AMD HW pstate decoding **************************/ | ||
128 | |||
129 | extern int decode_pstates(unsigned int cpu, unsigned int cpu_family, | ||
130 | int boost_states, unsigned long *pstates, int *no); | ||
131 | |||
132 | /* AMD HW pstate decoding **************************/ | ||
133 | |||
134 | extern int cpufreq_has_boost_support(unsigned int cpu, int *support, | ||
135 | int *active, int * states); | ||
136 | /* | ||
137 | * CPUID functions returning a single datum | ||
138 | */ | ||
139 | unsigned int cpuid_eax(unsigned int op); | ||
140 | unsigned int cpuid_ebx(unsigned int op); | ||
141 | unsigned int cpuid_ecx(unsigned int op); | ||
142 | unsigned int cpuid_edx(unsigned int op); | ||
143 | |||
144 | /* cpuid and cpuinfo helpers **************************/ | ||
145 | /* X86 ONLY ********************************************/ | ||
146 | #else | ||
147 | static inline int decode_pstates(unsigned int cpu, unsigned int cpu_family, | ||
148 | int boost_states, unsigned long *pstates, | ||
149 | int *no) | ||
150 | { return -1; }; | ||
151 | |||
152 | static inline int read_msr(int cpu, unsigned int idx, unsigned long long *val) | ||
153 | { return -1; }; | ||
154 | static inline int write_msr(int cpu, unsigned int idx, unsigned long long val) | ||
155 | { return -1; }; | ||
156 | static inline int msr_intel_set_perf_bias(unsigned int cpu, unsigned int val) | ||
157 | { return -1; }; | ||
158 | static inline int msr_intel_get_perf_bias(unsigned int cpu) | ||
159 | { return -1; }; | ||
160 | |||
161 | static inline int msr_intel_has_boost_support(unsigned int cpu) | ||
162 | { return -1; }; | ||
163 | static inline int msr_intel_boost_is_active(unsigned int cpu) | ||
164 | { return -1; }; | ||
165 | |||
166 | /* Read/Write msr ****************************/ | ||
167 | |||
168 | static inline int cpufreq_has_boost_support(unsigned int cpu, int *support, | ||
169 | int *active, int * states) | ||
170 | { return -1; } | ||
171 | |||
172 | /* cpuid and cpuinfo helpers **************************/ | ||
173 | |||
174 | static inline unsigned int cpuid_eax(unsigned int op) { return 0; }; | ||
175 | static inline unsigned int cpuid_ebx(unsigned int op) { return 0; }; | ||
176 | static inline unsigned int cpuid_ecx(unsigned int op) { return 0; }; | ||
177 | static inline unsigned int cpuid_edx(unsigned int op) { return 0; }; | ||
178 | #endif /* defined(__i386__) || defined(__x86_64__) */ | ||
179 | |||
180 | #endif /* __CPUPOWERUTILS_HELPERS__ */ | ||
diff --git a/tools/power/cpupower/utils/helpers/misc.c b/tools/power/cpupower/utils/helpers/misc.c new file mode 100644 index 00000000000..c1566e93e0e --- /dev/null +++ b/tools/power/cpupower/utils/helpers/misc.c | |||
@@ -0,0 +1,34 @@ | |||
1 | #if defined(__i386__) || defined(__x86_64__) | ||
2 | |||
3 | #include "helpers/helpers.h" | ||
4 | |||
5 | int cpufreq_has_boost_support(unsigned int cpu, int *support, int *active, int * states) | ||
6 | { | ||
7 | struct cpupower_cpu_info cpu_info; | ||
8 | int ret; | ||
9 | |||
10 | *support = *active = *states = 0; | ||
11 | |||
12 | ret = get_cpu_info(0, &cpu_info); | ||
13 | if (ret) | ||
14 | return ret; | ||
15 | |||
16 | if (cpupower_cpu_info.caps & CPUPOWER_CAP_AMD_CBP) { | ||
17 | *support = 1; | ||
18 | amd_pci_get_num_boost_states(active, states); | ||
19 | if (ret <= 0) | ||
20 | return ret; | ||
21 | *support = 1; | ||
22 | } else if (cpupower_cpu_info.vendor == X86_VENDOR_INTEL) { | ||
23 | ret = msr_intel_has_boost_support(cpu); | ||
24 | if (ret <= 0) | ||
25 | return ret; | ||
26 | *support = ret; | ||
27 | ret = msr_intel_boost_is_active(cpu); | ||
28 | if (ret <= 0) | ||
29 | return ret; | ||
30 | *active = ret; | ||
31 | } | ||
32 | return 0; | ||
33 | } | ||
34 | #endif /* #if defined(__i386__) || defined(__x86_64__) */ | ||
diff --git a/tools/power/cpupower/utils/helpers/msr.c b/tools/power/cpupower/utils/helpers/msr.c new file mode 100644 index 00000000000..93d48bd56e5 --- /dev/null +++ b/tools/power/cpupower/utils/helpers/msr.c | |||
@@ -0,0 +1,122 @@ | |||
1 | #if defined(__i386__) || defined(__x86_64__) | ||
2 | |||
3 | #include <fcntl.h> | ||
4 | #include <stdio.h> | ||
5 | #include <unistd.h> | ||
6 | #include <stdint.h> | ||
7 | |||
8 | #include "helpers/helpers.h" | ||
9 | |||
10 | /* Intel specific MSRs */ | ||
11 | #define MSR_IA32_PERF_STATUS 0x198 | ||
12 | #define MSR_IA32_MISC_ENABLES 0x1a0 | ||
13 | #define MSR_IA32_ENERGY_PERF_BIAS 0x1b0 | ||
14 | |||
15 | /* | ||
16 | * read_msr | ||
17 | * | ||
18 | * Will return 0 on success and -1 on failure. | ||
19 | * Possible errno values could be: | ||
20 | * EFAULT -If the read/write did not fully complete | ||
21 | * EIO -If the CPU does not support MSRs | ||
22 | * ENXIO -If the CPU does not exist | ||
23 | */ | ||
24 | |||
25 | int read_msr(int cpu, unsigned int idx, unsigned long long *val) | ||
26 | { | ||
27 | int fd; | ||
28 | char msr_file_name[64]; | ||
29 | |||
30 | sprintf(msr_file_name, "/dev/cpu/%d/msr", cpu); | ||
31 | fd = open(msr_file_name, O_RDONLY); | ||
32 | if (fd < 0) | ||
33 | return -1; | ||
34 | if (lseek(fd, idx, SEEK_CUR) == -1) | ||
35 | goto err; | ||
36 | if (read(fd, val, sizeof *val) != sizeof *val) | ||
37 | goto err; | ||
38 | close(fd); | ||
39 | return 0; | ||
40 | err: | ||
41 | close(fd); | ||
42 | return -1; | ||
43 | } | ||
44 | |||
45 | /* | ||
46 | * write_msr | ||
47 | * | ||
48 | * Will return 0 on success and -1 on failure. | ||
49 | * Possible errno values could be: | ||
50 | * EFAULT -If the read/write did not fully complete | ||
51 | * EIO -If the CPU does not support MSRs | ||
52 | * ENXIO -If the CPU does not exist | ||
53 | */ | ||
54 | int write_msr(int cpu, unsigned int idx, unsigned long long val) | ||
55 | { | ||
56 | int fd; | ||
57 | char msr_file_name[64]; | ||
58 | |||
59 | sprintf(msr_file_name, "/dev/cpu/%d/msr", cpu); | ||
60 | fd = open(msr_file_name, O_WRONLY); | ||
61 | if (fd < 0) | ||
62 | return -1; | ||
63 | if (lseek(fd, idx, SEEK_CUR) == -1) | ||
64 | goto err; | ||
65 | if (write(fd, &val, sizeof val) != sizeof val) | ||
66 | goto err; | ||
67 | close(fd); | ||
68 | return 0; | ||
69 | err: | ||
70 | close(fd); | ||
71 | return -1; | ||
72 | } | ||
73 | |||
74 | int msr_intel_has_boost_support(unsigned int cpu) | ||
75 | { | ||
76 | unsigned long long misc_enables; | ||
77 | int ret; | ||
78 | |||
79 | ret = read_msr(cpu, MSR_IA32_MISC_ENABLES, &misc_enables); | ||
80 | if (ret) | ||
81 | return ret; | ||
82 | return (misc_enables >> 38) & 0x1; | ||
83 | } | ||
84 | |||
85 | int msr_intel_boost_is_active(unsigned int cpu) | ||
86 | { | ||
87 | unsigned long long perf_status; | ||
88 | int ret; | ||
89 | |||
90 | ret = read_msr(cpu, MSR_IA32_PERF_STATUS, &perf_status); | ||
91 | if (ret) | ||
92 | return ret; | ||
93 | return (perf_status >> 32) & 0x1; | ||
94 | } | ||
95 | |||
96 | int msr_intel_get_perf_bias(unsigned int cpu) | ||
97 | { | ||
98 | unsigned long long val; | ||
99 | int ret; | ||
100 | |||
101 | if (!(cpupower_cpu_info.caps & CPUPOWER_CAP_PERF_BIAS)) | ||
102 | return -1; | ||
103 | |||
104 | ret = read_msr(cpu, MSR_IA32_ENERGY_PERF_BIAS, &val); | ||
105 | if (ret) | ||
106 | return ret; | ||
107 | return val; | ||
108 | } | ||
109 | |||
110 | int msr_intel_set_perf_bias(unsigned int cpu, unsigned int val) | ||
111 | { | ||
112 | int ret; | ||
113 | |||
114 | if (!(cpupower_cpu_info.caps & CPUPOWER_CAP_PERF_BIAS)) | ||
115 | return -1; | ||
116 | |||
117 | ret = write_msr(cpu, MSR_IA32_ENERGY_PERF_BIAS, val); | ||
118 | if (ret) | ||
119 | return ret; | ||
120 | return 0; | ||
121 | } | ||
122 | #endif | ||
diff --git a/tools/power/cpupower/utils/helpers/pci.c b/tools/power/cpupower/utils/helpers/pci.c new file mode 100644 index 00000000000..8dcc9381371 --- /dev/null +++ b/tools/power/cpupower/utils/helpers/pci.c | |||
@@ -0,0 +1,44 @@ | |||
1 | #if defined(__i386__) || defined(__x86_64__) | ||
2 | |||
3 | #include <helpers/helpers.h> | ||
4 | |||
5 | /* | ||
6 | * pci_acc_init | ||
7 | * | ||
8 | * PCI access helper function depending on libpci | ||
9 | * | ||
10 | * **pacc : if a valid pci_dev is returned | ||
11 | * *pacc must be passed to pci_acc_cleanup to free it | ||
12 | * | ||
13 | * vendor_id : the pci vendor id matching the pci device to access | ||
14 | * dev_ids : device ids matching the pci device to access | ||
15 | * | ||
16 | * Returns : | ||
17 | * struct pci_dev which can be used with pci_{read,write}_* functions | ||
18 | * to access the PCI config space of matching pci devices | ||
19 | */ | ||
20 | struct pci_dev *pci_acc_init(struct pci_access **pacc, int vendor_id, | ||
21 | int *dev_ids) | ||
22 | { | ||
23 | struct pci_filter filter_nb_link = { -1, -1, -1, -1, vendor_id, 0}; | ||
24 | struct pci_dev *device; | ||
25 | unsigned int i; | ||
26 | |||
27 | *pacc = pci_alloc(); | ||
28 | if (*pacc == NULL) | ||
29 | return NULL; | ||
30 | |||
31 | pci_init(*pacc); | ||
32 | pci_scan_bus(*pacc); | ||
33 | |||
34 | for (i = 0; dev_ids[i] != 0; i++) { | ||
35 | filter_nb_link.device = dev_ids[i]; | ||
36 | for (device=(*pacc)->devices; device; device = device->next) { | ||
37 | if (pci_filter_match(&filter_nb_link, device)) | ||
38 | return device; | ||
39 | } | ||
40 | } | ||
41 | pci_cleanup(*pacc); | ||
42 | return NULL; | ||
43 | } | ||
44 | #endif /* defined(__i386__) || defined(__x86_64__) */ | ||
diff --git a/tools/power/cpupower/utils/helpers/sysfs.c b/tools/power/cpupower/utils/helpers/sysfs.c new file mode 100644 index 00000000000..0c534e79652 --- /dev/null +++ b/tools/power/cpupower/utils/helpers/sysfs.c | |||
@@ -0,0 +1,350 @@ | |||
1 | /* | ||
2 | * (C) 2004-2009 Dominik Brodowski <linux@dominikbrodowski.de> | ||
3 | * (C) 2011 Thomas Renninger <trenn@novell.com> Novell Inc. | ||
4 | * | ||
5 | * Licensed under the terms of the GNU GPL License version 2. | ||
6 | */ | ||
7 | |||
8 | #include <stdio.h> | ||
9 | #include <errno.h> | ||
10 | #include <stdlib.h> | ||
11 | #include <string.h> | ||
12 | #include <sys/types.h> | ||
13 | #include <sys/stat.h> | ||
14 | #include <fcntl.h> | ||
15 | #include <unistd.h> | ||
16 | |||
17 | #include "helpers/sysfs.h" | ||
18 | |||
19 | unsigned int sysfs_read_file(const char *path, char *buf, size_t buflen) | ||
20 | { | ||
21 | int fd; | ||
22 | size_t numread; | ||
23 | |||
24 | if ( ( fd = open(path, O_RDONLY) ) == -1 ) | ||
25 | return 0; | ||
26 | |||
27 | numread = read(fd, buf, buflen - 1); | ||
28 | if ( numread < 1 ) | ||
29 | { | ||
30 | close(fd); | ||
31 | return 0; | ||
32 | } | ||
33 | |||
34 | buf[numread] = '\0'; | ||
35 | close(fd); | ||
36 | |||
37 | return numread; | ||
38 | } | ||
39 | |||
40 | static unsigned int sysfs_write_file(const char *path, | ||
41 | const char *value, size_t len) | ||
42 | { | ||
43 | int fd; | ||
44 | size_t numwrite; | ||
45 | |||
46 | if ( ( fd = open(path, O_WRONLY) ) == -1 ) | ||
47 | return 0; | ||
48 | |||
49 | numwrite = write(fd, value, len); | ||
50 | if ( numwrite < 1 ) | ||
51 | { | ||
52 | close(fd); | ||
53 | return 0; | ||
54 | } | ||
55 | close(fd); | ||
56 | return numwrite; | ||
57 | } | ||
58 | |||
59 | /* CPUidle idlestate specific /sys/devices/system/cpu/cpuX/cpuidle/ access */ | ||
60 | |||
61 | /* | ||
62 | * helper function to read file from /sys into given buffer | ||
63 | * fname is a relative path under "cpuX/cpuidle/stateX/" dir | ||
64 | * cstates starting with 0, C0 is not counted as cstate. | ||
65 | * This means if you want C1 info, pass 0 as idlestate param | ||
66 | */ | ||
67 | unsigned int sysfs_idlestate_read_file(unsigned int cpu, unsigned int idlestate, | ||
68 | const char *fname, char *buf, size_t buflen) | ||
69 | { | ||
70 | char path[SYSFS_PATH_MAX]; | ||
71 | int fd; | ||
72 | size_t numread; | ||
73 | |||
74 | snprintf(path, sizeof(path), PATH_TO_CPU "cpu%u/cpuidle/state%u/%s", | ||
75 | cpu, idlestate, fname); | ||
76 | |||
77 | if ( ( fd = open(path, O_RDONLY) ) == -1 ) | ||
78 | return 0; | ||
79 | |||
80 | numread = read(fd, buf, buflen - 1); | ||
81 | if ( numread < 1 ) | ||
82 | { | ||
83 | close(fd); | ||
84 | return 0; | ||
85 | } | ||
86 | |||
87 | buf[numread] = '\0'; | ||
88 | close(fd); | ||
89 | |||
90 | return numread; | ||
91 | } | ||
92 | |||
93 | /* read access to files which contain one numeric value */ | ||
94 | |||
95 | enum idlestate_value { | ||
96 | IDLESTATE_USAGE, | ||
97 | IDLESTATE_POWER, | ||
98 | IDLESTATE_LATENCY, | ||
99 | IDLESTATE_TIME, | ||
100 | MAX_IDLESTATE_VALUE_FILES | ||
101 | }; | ||
102 | |||
103 | static const char *idlestate_value_files[MAX_IDLESTATE_VALUE_FILES] = { | ||
104 | [IDLESTATE_USAGE] = "usage", | ||
105 | [IDLESTATE_POWER] = "power", | ||
106 | [IDLESTATE_LATENCY] = "latency", | ||
107 | [IDLESTATE_TIME] = "time", | ||
108 | }; | ||
109 | |||
110 | static unsigned long long sysfs_idlestate_get_one_value(unsigned int cpu, | ||
111 | unsigned int idlestate, | ||
112 | enum idlestate_value which) | ||
113 | { | ||
114 | unsigned long long value; | ||
115 | unsigned int len; | ||
116 | char linebuf[MAX_LINE_LEN]; | ||
117 | char *endp; | ||
118 | |||
119 | if ( which >= MAX_IDLESTATE_VALUE_FILES ) | ||
120 | return 0; | ||
121 | |||
122 | if ( ( len = sysfs_idlestate_read_file(cpu, idlestate, | ||
123 | idlestate_value_files[which], | ||
124 | linebuf, sizeof(linebuf))) == 0 ) | ||
125 | { | ||
126 | return 0; | ||
127 | } | ||
128 | |||
129 | value = strtoull(linebuf, &endp, 0); | ||
130 | |||
131 | if ( endp == linebuf || errno == ERANGE ) | ||
132 | return 0; | ||
133 | |||
134 | return value; | ||
135 | } | ||
136 | |||
137 | /* read access to files which contain one string */ | ||
138 | |||
139 | enum idlestate_string { | ||
140 | IDLESTATE_DESC, | ||
141 | IDLESTATE_NAME, | ||
142 | MAX_IDLESTATE_STRING_FILES | ||
143 | }; | ||
144 | |||
145 | static const char *idlestate_string_files[MAX_IDLESTATE_STRING_FILES] = { | ||
146 | [IDLESTATE_DESC] = "desc", | ||
147 | [IDLESTATE_NAME] = "name", | ||
148 | }; | ||
149 | |||
150 | |||
151 | static char * sysfs_idlestate_get_one_string(unsigned int cpu, | ||
152 | unsigned int idlestate, | ||
153 | enum idlestate_string which) | ||
154 | { | ||
155 | char linebuf[MAX_LINE_LEN]; | ||
156 | char *result; | ||
157 | unsigned int len; | ||
158 | |||
159 | if (which >= MAX_IDLESTATE_STRING_FILES) | ||
160 | return NULL; | ||
161 | |||
162 | if ( ( len = sysfs_idlestate_read_file(cpu, idlestate, | ||
163 | idlestate_string_files[which], | ||
164 | linebuf, sizeof(linebuf))) == 0 ) | ||
165 | return NULL; | ||
166 | |||
167 | if ( ( result = strdup(linebuf) ) == NULL ) | ||
168 | return NULL; | ||
169 | |||
170 | if (result[strlen(result) - 1] == '\n') | ||
171 | result[strlen(result) - 1] = '\0'; | ||
172 | |||
173 | return result; | ||
174 | } | ||
175 | |||
176 | unsigned long sysfs_get_idlestate_latency(unsigned int cpu, unsigned int idlestate) | ||
177 | { | ||
178 | return sysfs_idlestate_get_one_value(cpu, idlestate, IDLESTATE_LATENCY); | ||
179 | } | ||
180 | |||
181 | unsigned long sysfs_get_idlestate_usage(unsigned int cpu, unsigned int idlestate) | ||
182 | { | ||
183 | return sysfs_idlestate_get_one_value(cpu, idlestate, IDLESTATE_USAGE); | ||
184 | } | ||
185 | |||
186 | unsigned long long sysfs_get_idlestate_time(unsigned int cpu, unsigned int idlestate) | ||
187 | { | ||
188 | return sysfs_idlestate_get_one_value(cpu, idlestate, IDLESTATE_TIME); | ||
189 | } | ||
190 | |||
191 | char * sysfs_get_idlestate_name(unsigned int cpu, unsigned int idlestate) | ||
192 | { | ||
193 | return sysfs_idlestate_get_one_string(cpu, idlestate, IDLESTATE_NAME); | ||
194 | } | ||
195 | |||
196 | char * sysfs_get_idlestate_desc(unsigned int cpu, unsigned int idlestate) | ||
197 | { | ||
198 | return sysfs_idlestate_get_one_string(cpu, idlestate, IDLESTATE_DESC); | ||
199 | } | ||
200 | |||
201 | /* | ||
202 | * Returns number of supported C-states of CPU core cpu | ||
203 | * Negativ in error case | ||
204 | * Zero if cpuidle does not export any C-states | ||
205 | */ | ||
206 | int sysfs_get_idlestate_count(unsigned int cpu) | ||
207 | { | ||
208 | char file[SYSFS_PATH_MAX]; | ||
209 | struct stat statbuf; | ||
210 | int idlestates = 1; | ||
211 | |||
212 | |||
213 | snprintf(file, SYSFS_PATH_MAX, PATH_TO_CPU "cpuidle"); | ||
214 | if ( stat(file, &statbuf) != 0 || !S_ISDIR(statbuf.st_mode)) | ||
215 | return -ENODEV; | ||
216 | |||
217 | snprintf(file, SYSFS_PATH_MAX, PATH_TO_CPU "cpu%u/cpuidle/state0", cpu); | ||
218 | if ( stat(file, &statbuf) != 0 || !S_ISDIR(statbuf.st_mode)) | ||
219 | return 0; | ||
220 | |||
221 | while(stat(file, &statbuf) == 0 && S_ISDIR(statbuf.st_mode)) { | ||
222 | snprintf(file, SYSFS_PATH_MAX, PATH_TO_CPU | ||
223 | "cpu%u/cpuidle/state%d", cpu, idlestates); | ||
224 | idlestates++; | ||
225 | } | ||
226 | idlestates--; | ||
227 | return idlestates; | ||
228 | } | ||
229 | |||
230 | /* CPUidle general /sys/devices/system/cpu/cpuidle/ sysfs access ********/ | ||
231 | |||
232 | /* | ||
233 | * helper function to read file from /sys into given buffer | ||
234 | * fname is a relative path under "cpu/cpuidle/" dir | ||
235 | */ | ||
236 | static unsigned int sysfs_cpuidle_read_file(const char *fname, char *buf, | ||
237 | size_t buflen) | ||
238 | { | ||
239 | char path[SYSFS_PATH_MAX]; | ||
240 | |||
241 | snprintf(path, sizeof(path), PATH_TO_CPU "cpuidle/%s", fname); | ||
242 | |||
243 | return sysfs_read_file(path, buf, buflen); | ||
244 | } | ||
245 | |||
246 | |||
247 | |||
248 | /* read access to files which contain one string */ | ||
249 | |||
250 | enum cpuidle_string { | ||
251 | CPUIDLE_GOVERNOR, | ||
252 | CPUIDLE_GOVERNOR_RO, | ||
253 | CPUIDLE_DRIVER, | ||
254 | MAX_CPUIDLE_STRING_FILES | ||
255 | }; | ||
256 | |||
257 | static const char *cpuidle_string_files[MAX_CPUIDLE_STRING_FILES] = { | ||
258 | [CPUIDLE_GOVERNOR] = "current_governor", | ||
259 | [CPUIDLE_GOVERNOR_RO] = "current_governor_ro", | ||
260 | [CPUIDLE_DRIVER] = "current_driver", | ||
261 | }; | ||
262 | |||
263 | |||
264 | static char * sysfs_cpuidle_get_one_string(enum cpuidle_string which) | ||
265 | { | ||
266 | char linebuf[MAX_LINE_LEN]; | ||
267 | char *result; | ||
268 | unsigned int len; | ||
269 | |||
270 | if (which >= MAX_CPUIDLE_STRING_FILES) | ||
271 | return NULL; | ||
272 | |||
273 | if ( ( len = sysfs_cpuidle_read_file(cpuidle_string_files[which], | ||
274 | linebuf, sizeof(linebuf))) == 0 ) | ||
275 | return NULL; | ||
276 | |||
277 | if ( ( result = strdup(linebuf) ) == NULL ) | ||
278 | return NULL; | ||
279 | |||
280 | if (result[strlen(result) - 1] == '\n') | ||
281 | result[strlen(result) - 1] = '\0'; | ||
282 | |||
283 | return result; | ||
284 | } | ||
285 | |||
286 | char * sysfs_get_cpuidle_governor(void) | ||
287 | { | ||
288 | char *tmp = sysfs_cpuidle_get_one_string(CPUIDLE_GOVERNOR_RO); | ||
289 | if (!tmp) | ||
290 | return sysfs_cpuidle_get_one_string(CPUIDLE_GOVERNOR); | ||
291 | else | ||
292 | return tmp; | ||
293 | } | ||
294 | |||
295 | char * sysfs_get_cpuidle_driver(void) | ||
296 | { | ||
297 | return sysfs_cpuidle_get_one_string(CPUIDLE_DRIVER); | ||
298 | } | ||
299 | /* CPUidle idlestate specific /sys/devices/system/cpu/cpuX/cpuidle/ access */ | ||
300 | |||
301 | /* | ||
302 | * Get sched_mc or sched_smt settings | ||
303 | * Pass "mc" or "smt" as argument | ||
304 | * | ||
305 | * Returns negative value on failure | ||
306 | */ | ||
307 | int sysfs_get_sched(const char* smt_mc) | ||
308 | { | ||
309 | unsigned long value; | ||
310 | char linebuf[MAX_LINE_LEN]; | ||
311 | char *endp; | ||
312 | char path[SYSFS_PATH_MAX]; | ||
313 | |||
314 | if (strcmp("mc", smt_mc) && strcmp("smt", smt_mc)) | ||
315 | return -EINVAL; | ||
316 | |||
317 | snprintf(path, sizeof(path), PATH_TO_CPU "sched_%s_power_savings", smt_mc); | ||
318 | if (sysfs_read_file(path, linebuf, MAX_LINE_LEN) == 0 ) | ||
319 | return -1; | ||
320 | value = strtoul(linebuf, &endp, 0); | ||
321 | if ( endp == linebuf || errno == ERANGE ) | ||
322 | return -1; | ||
323 | return value; | ||
324 | } | ||
325 | |||
326 | /* | ||
327 | * Get sched_mc or sched_smt settings | ||
328 | * Pass "mc" or "smt" as argument | ||
329 | * | ||
330 | * Returns negative value on failure | ||
331 | */ | ||
332 | int sysfs_set_sched(const char* smt_mc, int val) | ||
333 | { | ||
334 | char linebuf[MAX_LINE_LEN]; | ||
335 | char path[SYSFS_PATH_MAX]; | ||
336 | struct stat statbuf; | ||
337 | |||
338 | if (strcmp("mc", smt_mc) && strcmp("smt", smt_mc)) | ||
339 | return -EINVAL; | ||
340 | |||
341 | snprintf(path, sizeof(path), PATH_TO_CPU "sched_%s_power_savings", smt_mc); | ||
342 | sprintf(linebuf, "%d", val); | ||
343 | |||
344 | if ( stat(path, &statbuf) != 0 ) | ||
345 | return -ENODEV; | ||
346 | |||
347 | if (sysfs_write_file(path, linebuf, MAX_LINE_LEN) == 0 ) | ||
348 | return -1; | ||
349 | return 0; | ||
350 | } | ||
diff --git a/tools/power/cpupower/utils/helpers/sysfs.h b/tools/power/cpupower/utils/helpers/sysfs.h new file mode 100644 index 00000000000..5d02d2fc70e --- /dev/null +++ b/tools/power/cpupower/utils/helpers/sysfs.h | |||
@@ -0,0 +1,23 @@ | |||
1 | #ifndef __CPUPOWER_HELPERS_SYSFS_H__ | ||
2 | #define __CPUPOWER_HELPERS_SYSFS_H__ | ||
3 | |||
4 | #define PATH_TO_CPU "/sys/devices/system/cpu/" | ||
5 | #define MAX_LINE_LEN 255 | ||
6 | #define SYSFS_PATH_MAX 255 | ||
7 | |||
8 | extern unsigned int sysfs_read_file(const char *path, char *buf, size_t buflen); | ||
9 | |||
10 | extern unsigned long sysfs_get_idlestate_latency(unsigned int cpu, unsigned int idlestate); | ||
11 | extern unsigned long sysfs_get_idlestate_usage(unsigned int cpu, unsigned int idlestate); | ||
12 | extern unsigned long long sysfs_get_idlestate_time(unsigned int cpu, unsigned int idlestate); | ||
13 | extern char * sysfs_get_idlestate_name(unsigned int cpu, unsigned int idlestate); | ||
14 | extern char * sysfs_get_idlestate_desc(unsigned int cpu, unsigned int idlestate); | ||
15 | extern int sysfs_get_idlestate_count(unsigned int cpu); | ||
16 | |||
17 | extern char * sysfs_get_cpuidle_governor(void); | ||
18 | extern char * sysfs_get_cpuidle_driver(void); | ||
19 | |||
20 | extern int sysfs_get_sched(const char* smt_mc); | ||
21 | extern int sysfs_set_sched(const char* smt_mc, int val); | ||
22 | |||
23 | #endif /* __CPUPOWER_HELPERS_SYSFS_H__ */ | ||
diff --git a/tools/power/cpupower/utils/helpers/topology.c b/tools/power/cpupower/utils/helpers/topology.c new file mode 100644 index 00000000000..5ad842b956b --- /dev/null +++ b/tools/power/cpupower/utils/helpers/topology.c | |||
@@ -0,0 +1,108 @@ | |||
1 | /* | ||
2 | * (C) 2010,2011 Thomas Renninger <trenn@suse.de>, Novell Inc. | ||
3 | * | ||
4 | * Licensed under the terms of the GNU GPL License version 2. | ||
5 | * | ||
6 | * ToDo: Needs to be done more properly for AMD/Intel specifics | ||
7 | */ | ||
8 | |||
9 | /* Helper struct for qsort, must be in sync with cpupower_topology.cpu_info */ | ||
10 | /* Be careful: Need to pass unsigned to the sort, so that offlined cores are | ||
11 | in the end, but double check for -1 for offlined cpus at other places */ | ||
12 | |||
13 | #include <stdlib.h> | ||
14 | #include <stdio.h> | ||
15 | #include <unistd.h> | ||
16 | #include <errno.h> | ||
17 | #include <fcntl.h> | ||
18 | |||
19 | #include <helpers/helpers.h> | ||
20 | #include <helpers/sysfs.h> | ||
21 | |||
22 | /* returns -1 on failure, 0 on success */ | ||
23 | int sysfs_topology_read_file(unsigned int cpu, const char *fname) | ||
24 | { | ||
25 | unsigned long value; | ||
26 | char linebuf[MAX_LINE_LEN]; | ||
27 | char *endp; | ||
28 | char path[SYSFS_PATH_MAX]; | ||
29 | |||
30 | snprintf(path, sizeof(path), PATH_TO_CPU "cpu%u/topology/%s", | ||
31 | cpu, fname); | ||
32 | if (sysfs_read_file(path, linebuf, MAX_LINE_LEN) == 0 ) | ||
33 | return -1; | ||
34 | value = strtoul(linebuf, &endp, 0); | ||
35 | if ( endp == linebuf || errno == ERANGE ) | ||
36 | return -1; | ||
37 | return value; | ||
38 | } | ||
39 | |||
40 | struct cpuid_core_info { | ||
41 | unsigned int pkg; | ||
42 | unsigned int thread; | ||
43 | unsigned int cpu; | ||
44 | }; | ||
45 | |||
46 | static int __compare(const void *t1, const void *t2) | ||
47 | { | ||
48 | struct cpuid_core_info *top1 = (struct cpuid_core_info *)t1; | ||
49 | struct cpuid_core_info *top2 = (struct cpuid_core_info *)t2; | ||
50 | if (top1->pkg < top2->pkg) | ||
51 | return -1; | ||
52 | else if (top1->pkg > top2->pkg) | ||
53 | return 1; | ||
54 | else if (top1->thread < top2->thread) | ||
55 | return -1; | ||
56 | else if (top1->thread > top2->thread) | ||
57 | return 1; | ||
58 | else if (top1->cpu < top2->cpu) | ||
59 | return -1; | ||
60 | else if (top1->cpu > top2->cpu) | ||
61 | return 1; | ||
62 | else | ||
63 | return 0; | ||
64 | } | ||
65 | |||
66 | /* | ||
67 | * Returns amount of cpus, negative on error, cpu_top must be | ||
68 | * passed to cpu_topology_release to free resources | ||
69 | * | ||
70 | * Array is sorted after ->pkg, ->core, then ->cpu | ||
71 | */ | ||
72 | int get_cpu_topology(struct cpupower_topology *cpu_top) | ||
73 | { | ||
74 | int cpu, cpus = sysconf(_SC_NPROCESSORS_CONF); | ||
75 | |||
76 | cpu_top->core_info = malloc(sizeof(struct cpupower_topology) * cpus); | ||
77 | if (cpu_top->core_info == NULL) | ||
78 | return -ENOMEM; | ||
79 | cpu_top->pkgs = cpu_top->cores = 0; | ||
80 | for (cpu = 0; cpu < cpus; cpu++) { | ||
81 | cpu_top->core_info[cpu].pkg = | ||
82 | sysfs_topology_read_file(cpu, "physical_package_id"); | ||
83 | if ((int)cpu_top->core_info[cpu].pkg != -1 && | ||
84 | cpu_top->core_info[cpu].pkg > cpu_top->pkgs) | ||
85 | cpu_top->pkgs = cpu_top->core_info[cpu].pkg; | ||
86 | cpu_top->core_info[cpu].core = | ||
87 | sysfs_topology_read_file(cpu, "core_id"); | ||
88 | cpu_top->core_info[cpu].cpu = cpu; | ||
89 | } | ||
90 | cpu_top->pkgs++; | ||
91 | |||
92 | qsort(cpu_top->core_info, cpus, sizeof(struct cpuid_core_info), | ||
93 | __compare); | ||
94 | |||
95 | /* Intel's cores count is not consecutively numbered, there may | ||
96 | * be a core_id of 3, but none of 2. Assume there always is 0 | ||
97 | * Get amount of cores by counting duplicates in a package | ||
98 | for (cpu = 0; cpu_top->core_info[cpu].pkg = 0 && cpu < cpus; cpu++) { | ||
99 | if (cpu_top->core_info[cpu].core == 0) | ||
100 | cpu_top->cores++; | ||
101 | */ | ||
102 | return cpus; | ||
103 | } | ||
104 | |||
105 | void cpu_topology_release(struct cpupower_topology cpu_top) | ||
106 | { | ||
107 | free(cpu_top.core_info); | ||
108 | } | ||
diff --git a/tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c b/tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c new file mode 100644 index 00000000000..3de94322dfb --- /dev/null +++ b/tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c | |||
@@ -0,0 +1,340 @@ | |||
1 | /* | ||
2 | * (C) 2010,2011 Thomas Renninger <trenn@suse.de>, Novell Inc. | ||
3 | * | ||
4 | * Licensed under the terms of the GNU GPL License version 2. | ||
5 | * | ||
6 | * PCI initialization based on example code from: | ||
7 | * Andreas Herrmann <andreas.herrmann3@amd.com> | ||
8 | */ | ||
9 | |||
10 | #if defined(__i386__) || defined(__x86_64__) | ||
11 | |||
12 | #include <stdio.h> | ||
13 | #include <stdlib.h> | ||
14 | #include <stdint.h> | ||
15 | #include <time.h> | ||
16 | #include <string.h> | ||
17 | |||
18 | #include <pci/pci.h> | ||
19 | |||
20 | #include "idle_monitor/cpupower-monitor.h" | ||
21 | #include "helpers/helpers.h" | ||
22 | |||
23 | /******** PCI parts could go into own file and get shared ***************/ | ||
24 | |||
25 | #define PCI_NON_PC0_OFFSET 0xb0 | ||
26 | #define PCI_PC1_OFFSET 0xb4 | ||
27 | #define PCI_PC6_OFFSET 0xb8 | ||
28 | |||
29 | #define PCI_MONITOR_ENABLE_REG 0xe0 | ||
30 | |||
31 | #define PCI_NON_PC0_ENABLE_BIT 0 | ||
32 | #define PCI_PC1_ENABLE_BIT 1 | ||
33 | #define PCI_PC6_ENABLE_BIT 2 | ||
34 | |||
35 | #define PCI_NBP1_STAT_OFFSET 0x98 | ||
36 | #define PCI_NBP1_ACTIVE_BIT 2 | ||
37 | #define PCI_NBP1_ENTERED_BIT 1 | ||
38 | |||
39 | #define PCI_NBP1_CAP_OFFSET 0x90 | ||
40 | #define PCI_NBP1_CAPABLE_BIT 31 | ||
41 | |||
42 | #define OVERFLOW_MS 343597 /* 32 bit register filled at 12500 HZ | ||
43 | (1 tick per 80ns) */ | ||
44 | |||
45 | enum amd_fam14h_states {NON_PC0 = 0, PC1, PC6, NBP1, | ||
46 | AMD_FAM14H_STATE_NUM}; | ||
47 | |||
48 | static int fam14h_get_count_percent(unsigned int self_id, double *percent, | ||
49 | unsigned int cpu); | ||
50 | static int fam14h_nbp1_count(unsigned int id, unsigned long long *count, | ||
51 | unsigned int cpu); | ||
52 | |||
53 | static cstate_t amd_fam14h_cstates[AMD_FAM14H_STATE_NUM] = { | ||
54 | { | ||
55 | .name = "!PC0", | ||
56 | .desc = N_("Package in sleep state (PC1 or deeper)"), | ||
57 | .id = NON_PC0, | ||
58 | .range = RANGE_PACKAGE, | ||
59 | .get_count_percent = fam14h_get_count_percent, | ||
60 | }, | ||
61 | { | ||
62 | .name = "PC1", | ||
63 | .desc = N_("Processor Package C1"), | ||
64 | .id = PC1, | ||
65 | .range = RANGE_PACKAGE, | ||
66 | .get_count_percent = fam14h_get_count_percent, | ||
67 | }, | ||
68 | { | ||
69 | .name = "PC6", | ||
70 | .desc = N_("Processor Package C6"), | ||
71 | .id = PC6, | ||
72 | .range = RANGE_PACKAGE, | ||
73 | .get_count_percent = fam14h_get_count_percent, | ||
74 | }, | ||
75 | { | ||
76 | .name = "NBP1", | ||
77 | .desc = N_("North Bridge P1 boolean counter (returns 0 or 1)"), | ||
78 | .id = NBP1, | ||
79 | .range = RANGE_PACKAGE, | ||
80 | .get_count = fam14h_nbp1_count, | ||
81 | }, | ||
82 | }; | ||
83 | |||
84 | static struct pci_access *pci_acc; | ||
85 | static int pci_vendor_id = 0x1022; | ||
86 | static int pci_dev_ids[2] = {0x1716, 0}; | ||
87 | static struct pci_dev *amd_fam14h_pci_dev; | ||
88 | |||
89 | static int nbp1_entered; | ||
90 | |||
91 | struct timespec start_time; | ||
92 | static unsigned long long timediff; | ||
93 | |||
94 | #ifdef DEBUG | ||
95 | struct timespec dbg_time; | ||
96 | long dbg_timediff; | ||
97 | #endif | ||
98 | |||
99 | static unsigned long long *previous_count[AMD_FAM14H_STATE_NUM]; | ||
100 | static unsigned long long *current_count[AMD_FAM14H_STATE_NUM]; | ||
101 | |||
102 | static int amd_fam14h_get_pci_info(struct cstate *state, | ||
103 | unsigned int *pci_offset, | ||
104 | unsigned int *enable_bit, | ||
105 | unsigned int cpu) | ||
106 | { | ||
107 | switch(state->id) { | ||
108 | case NON_PC0: | ||
109 | *enable_bit = PCI_NON_PC0_ENABLE_BIT; | ||
110 | *pci_offset = PCI_NON_PC0_OFFSET; | ||
111 | break; | ||
112 | case PC1: | ||
113 | *enable_bit = PCI_PC1_ENABLE_BIT; | ||
114 | *pci_offset = PCI_PC1_OFFSET; | ||
115 | break; | ||
116 | case PC6: | ||
117 | *enable_bit = PCI_PC6_ENABLE_BIT; | ||
118 | *pci_offset = PCI_PC6_OFFSET; | ||
119 | break; | ||
120 | case NBP1: | ||
121 | *enable_bit = PCI_NBP1_ENTERED_BIT; | ||
122 | *pci_offset = PCI_NBP1_STAT_OFFSET; | ||
123 | break; | ||
124 | default: | ||
125 | return -1; | ||
126 | }; | ||
127 | return 0; | ||
128 | } | ||
129 | |||
130 | static int amd_fam14h_init(cstate_t *state, unsigned int cpu) | ||
131 | { | ||
132 | int enable_bit, pci_offset, ret; | ||
133 | uint32_t val; | ||
134 | |||
135 | ret = amd_fam14h_get_pci_info(state, &pci_offset, &enable_bit, cpu); | ||
136 | if (ret) | ||
137 | return ret; | ||
138 | |||
139 | /* NBP1 needs extra treating -> write 1 to D18F6x98 bit 1 for init */ | ||
140 | if (state->id == NBP1) { | ||
141 | val = pci_read_long(amd_fam14h_pci_dev, pci_offset); | ||
142 | val |= 1 << enable_bit; | ||
143 | val = pci_write_long(amd_fam14h_pci_dev, pci_offset, val); | ||
144 | return ret; | ||
145 | } | ||
146 | |||
147 | /* Enable monitor */ | ||
148 | val = pci_read_long(amd_fam14h_pci_dev, PCI_MONITOR_ENABLE_REG); | ||
149 | dprint("Init %s: read at offset: 0x%x val: %u\n", state->name, | ||
150 | PCI_MONITOR_ENABLE_REG, (unsigned int) val); | ||
151 | val |= 1 << enable_bit; | ||
152 | pci_write_long(amd_fam14h_pci_dev, PCI_MONITOR_ENABLE_REG, val); | ||
153 | |||
154 | dprint("Init %s: offset: 0x%x enable_bit: %d - val: %u (%u)\n", | ||
155 | state->name, PCI_MONITOR_ENABLE_REG, enable_bit, | ||
156 | (unsigned int) val, cpu); | ||
157 | |||
158 | /* Set counter to zero */ | ||
159 | pci_write_long(amd_fam14h_pci_dev, pci_offset, 0); | ||
160 | previous_count[state->id][cpu] = 0; | ||
161 | |||
162 | return 0; | ||
163 | } | ||
164 | |||
165 | static int amd_fam14h_disable(cstate_t *state, unsigned int cpu) | ||
166 | { | ||
167 | int enable_bit, pci_offset, ret; | ||
168 | uint32_t val; | ||
169 | |||
170 | ret = amd_fam14h_get_pci_info(state, &pci_offset, &enable_bit, cpu); | ||
171 | if (ret) | ||
172 | return ret; | ||
173 | |||
174 | val = pci_read_long(amd_fam14h_pci_dev, pci_offset); | ||
175 | dprint("%s: offset: 0x%x %u\n", state->name, pci_offset, val); | ||
176 | if (state->id == NBP1) { | ||
177 | /* was the bit whether NBP1 got entered set? */ | ||
178 | nbp1_entered = (val & (1 << PCI_NBP1_ACTIVE_BIT)) | | ||
179 | (val & (1 << PCI_NBP1_ENTERED_BIT)); | ||
180 | |||
181 | dprint("NBP1 was %sentered - 0x%x - enable_bit: " | ||
182 | "%d - pci_offset: 0x%x\n", | ||
183 | nbp1_entered ? "" : "not ", | ||
184 | val, enable_bit, pci_offset); | ||
185 | return ret; | ||
186 | } | ||
187 | current_count[state->id][cpu] = val; | ||
188 | |||
189 | dprint("%s: Current - %llu (%u)\n", state->name, | ||
190 | current_count[state->id][cpu], cpu); | ||
191 | dprint("%s: Previous - %llu (%u)\n", state->name, | ||
192 | previous_count[state->id][cpu], cpu); | ||
193 | |||
194 | val = pci_read_long(amd_fam14h_pci_dev, PCI_MONITOR_ENABLE_REG); | ||
195 | val &= ~(1 << enable_bit); | ||
196 | pci_write_long(amd_fam14h_pci_dev, PCI_MONITOR_ENABLE_REG, val); | ||
197 | |||
198 | return 0; | ||
199 | } | ||
200 | |||
201 | static int fam14h_nbp1_count(unsigned int id, unsigned long long *count, | ||
202 | unsigned int cpu) | ||
203 | { | ||
204 | if (id == NBP1) { | ||
205 | if (nbp1_entered) | ||
206 | *count = 1; | ||
207 | else | ||
208 | *count = 0; | ||
209 | return 0; | ||
210 | } | ||
211 | return -1; | ||
212 | } | ||
213 | static int fam14h_get_count_percent(unsigned int id, double *percent, | ||
214 | unsigned int cpu) | ||
215 | { | ||
216 | unsigned long diff; | ||
217 | |||
218 | if (id >= AMD_FAM14H_STATE_NUM) | ||
219 | return -1; | ||
220 | /* residency count in 80ns -> divide through 12.5 to get us residency */ | ||
221 | diff = current_count[id][cpu] - previous_count[id][cpu]; | ||
222 | |||
223 | if (timediff == 0) | ||
224 | *percent = 0.0; | ||
225 | else | ||
226 | *percent = 100.0 * diff / timediff / 12.5; | ||
227 | |||
228 | dprint("Timediff: %llu - res~: %lu us - percent: %.2f %%\n", | ||
229 | timediff, diff * 10 / 125, *percent); | ||
230 | |||
231 | return 0; | ||
232 | } | ||
233 | |||
234 | static int amd_fam14h_start(void) | ||
235 | { | ||
236 | int num, cpu; | ||
237 | clock_gettime(CLOCK_REALTIME, &start_time); | ||
238 | for (num = 0; num < AMD_FAM14H_STATE_NUM; num++) { | ||
239 | for (cpu = 0; cpu < cpu_count; cpu++) { | ||
240 | amd_fam14h_init(&amd_fam14h_cstates[num], cpu); | ||
241 | } | ||
242 | } | ||
243 | #ifdef DEBUG | ||
244 | clock_gettime(CLOCK_REALTIME, &dbg_time); | ||
245 | dbg_timediff = timespec_diff_us(start_time, dbg_time); | ||
246 | dprint("Enabling counters took: %lu us\n", | ||
247 | dbg_timediff); | ||
248 | #endif | ||
249 | return 0; | ||
250 | } | ||
251 | |||
252 | static int amd_fam14h_stop(void) | ||
253 | { | ||
254 | int num, cpu; | ||
255 | struct timespec end_time; | ||
256 | |||
257 | clock_gettime(CLOCK_REALTIME, &end_time); | ||
258 | |||
259 | for (num = 0; num < AMD_FAM14H_STATE_NUM; num++) { | ||
260 | for (cpu = 0; cpu < cpu_count; cpu++) { | ||
261 | amd_fam14h_disable(&amd_fam14h_cstates[num], cpu); | ||
262 | } | ||
263 | } | ||
264 | #ifdef DEBUG | ||
265 | clock_gettime(CLOCK_REALTIME, &dbg_time); | ||
266 | dbg_timediff = timespec_diff_us(end_time, dbg_time); | ||
267 | dprint("Disabling counters took: %lu ns\n", dbg_timediff); | ||
268 | #endif | ||
269 | timediff = timespec_diff_us(start_time, end_time); | ||
270 | if (timediff / 1000 > OVERFLOW_MS) | ||
271 | print_overflow_err((unsigned int)timediff / 1000000, | ||
272 | OVERFLOW_MS / 1000); | ||
273 | |||
274 | return 0; | ||
275 | } | ||
276 | |||
277 | static int is_nbp1_capable(void) | ||
278 | { | ||
279 | uint32_t val; | ||
280 | val = pci_read_long(amd_fam14h_pci_dev, PCI_NBP1_CAP_OFFSET); | ||
281 | return val & (1 << 31); | ||
282 | } | ||
283 | |||
284 | struct cpuidle_monitor* amd_fam14h_register(void) { | ||
285 | |||
286 | int num; | ||
287 | |||
288 | if (cpupower_cpu_info.vendor != X86_VENDOR_AMD) | ||
289 | return NULL; | ||
290 | |||
291 | if (cpupower_cpu_info.family == 0x14) { | ||
292 | if (cpu_count <= 0 || cpu_count > 2) { | ||
293 | fprintf(stderr, "AMD fam14h: Invalid cpu count: %d\n", | ||
294 | cpu_count); | ||
295 | return NULL; | ||
296 | } | ||
297 | } else | ||
298 | return NULL; | ||
299 | |||
300 | /* We do not alloc for nbp1 machine wide counter */ | ||
301 | for (num = 0; num < AMD_FAM14H_STATE_NUM - 1; num++) { | ||
302 | previous_count[num] = calloc (cpu_count, | ||
303 | sizeof(unsigned long long)); | ||
304 | current_count[num] = calloc (cpu_count, | ||
305 | sizeof(unsigned long long)); | ||
306 | } | ||
307 | |||
308 | amd_fam14h_pci_dev = pci_acc_init(&pci_acc, pci_vendor_id, pci_dev_ids); | ||
309 | if (amd_fam14h_pci_dev == NULL || pci_acc == NULL) | ||
310 | return NULL; | ||
311 | |||
312 | if (!is_nbp1_capable()) | ||
313 | amd_fam14h_monitor.hw_states_num = AMD_FAM14H_STATE_NUM - 1; | ||
314 | |||
315 | amd_fam14h_monitor.name_len = strlen(amd_fam14h_monitor.name); | ||
316 | return &amd_fam14h_monitor; | ||
317 | } | ||
318 | |||
319 | static void amd_fam14h_unregister(void) | ||
320 | { | ||
321 | int num; | ||
322 | for (num = 0; num < AMD_FAM14H_STATE_NUM - 1; num++) { | ||
323 | free(previous_count[num]); | ||
324 | free(current_count[num]); | ||
325 | } | ||
326 | pci_cleanup(pci_acc); | ||
327 | } | ||
328 | |||
329 | struct cpuidle_monitor amd_fam14h_monitor = { | ||
330 | .name = "Ontario", | ||
331 | .hw_states = amd_fam14h_cstates, | ||
332 | .hw_states_num = AMD_FAM14H_STATE_NUM, | ||
333 | .start = amd_fam14h_start, | ||
334 | .stop = amd_fam14h_stop, | ||
335 | .do_register = amd_fam14h_register, | ||
336 | .unregister = amd_fam14h_unregister, | ||
337 | .needs_root = 1, | ||
338 | .overflow_s = OVERFLOW_MS / 1000, | ||
339 | }; | ||
340 | #endif /* #if defined(__i386__) || defined(__x86_64__) */ | ||
diff --git a/tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c b/tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c new file mode 100644 index 00000000000..63f6d670517 --- /dev/null +++ b/tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c | |||
@@ -0,0 +1,185 @@ | |||
1 | /* | ||
2 | * (C) 2010,2011 Thomas Renninger <trenn@suse.de>, Novell Inc | ||
3 | * | ||
4 | * Licensed under the terms of the GNU GPL License version 2. | ||
5 | * | ||
6 | */ | ||
7 | |||
8 | #include <stdio.h> | ||
9 | #include <stdlib.h> | ||
10 | #include <stdint.h> | ||
11 | #include <string.h> | ||
12 | #include <limits.h> | ||
13 | |||
14 | #include "helpers/sysfs.h" | ||
15 | #include "helpers/helpers.h" | ||
16 | #include "idle_monitor/cpupower-monitor.h" | ||
17 | |||
18 | #define CPUIDLE_STATES_MAX 10 | ||
19 | static cstate_t cpuidle_cstates[CPUIDLE_STATES_MAX]; | ||
20 | struct cpuidle_monitor cpuidle_sysfs_monitor; | ||
21 | |||
22 | static unsigned long long **previous_count; | ||
23 | static unsigned long long **current_count; | ||
24 | struct timespec start_time; | ||
25 | static unsigned long long timediff; | ||
26 | |||
27 | static int cpuidle_get_count_percent(unsigned int id, double *percent, | ||
28 | unsigned int cpu) | ||
29 | { | ||
30 | unsigned long long statediff = current_count[cpu][id] | ||
31 | - previous_count[cpu][id]; | ||
32 | dprint("%s: - diff: %llu - percent: %f (%u)\n", | ||
33 | cpuidle_cstates[id].name, timediff, *percent, cpu); | ||
34 | |||
35 | if (timediff == 0) | ||
36 | *percent = 0.0; | ||
37 | else | ||
38 | *percent = ((100.0 * statediff) / timediff); | ||
39 | |||
40 | dprint("%s: - timediff: %llu - statediff: %llu - percent: %f (%u)\n", | ||
41 | cpuidle_cstates[id].name, timediff, statediff, *percent, cpu); | ||
42 | |||
43 | return 0; | ||
44 | } | ||
45 | |||
46 | static int cpuidle_start(void) | ||
47 | { | ||
48 | int cpu, state; | ||
49 | clock_gettime(CLOCK_REALTIME, &start_time); | ||
50 | for (cpu = 0; cpu < cpu_count; cpu++) { | ||
51 | for (state = 0; state < cpuidle_sysfs_monitor.hw_states_num; | ||
52 | state++) { | ||
53 | previous_count[cpu][state] = | ||
54 | sysfs_get_idlestate_time(cpu, state); | ||
55 | dprint("CPU %d - State: %d - Val: %llu\n", | ||
56 | cpu, state, previous_count[cpu][state]); | ||
57 | } | ||
58 | |||
59 | }; | ||
60 | return 0; | ||
61 | } | ||
62 | |||
63 | static int cpuidle_stop(void) | ||
64 | { | ||
65 | int cpu, state; | ||
66 | struct timespec end_time; | ||
67 | clock_gettime(CLOCK_REALTIME, &end_time); | ||
68 | timediff = timespec_diff_us(start_time, end_time); | ||
69 | |||
70 | for (cpu = 0; cpu < cpu_count; cpu++) { | ||
71 | for (state = 0; state < cpuidle_sysfs_monitor.hw_states_num; | ||
72 | state++) { | ||
73 | current_count[cpu][state] = | ||
74 | sysfs_get_idlestate_time(cpu, state); | ||
75 | dprint("CPU %d - State: %d - Val: %llu\n", | ||
76 | cpu, state, previous_count[cpu][state]); | ||
77 | } | ||
78 | }; | ||
79 | return 0; | ||
80 | } | ||
81 | |||
82 | void fix_up_intel_idle_driver_name(char *tmp, int num) | ||
83 | { | ||
84 | /* fix up cpuidle name for intel idle driver */ | ||
85 | if (!strncmp(tmp, "NHM-", 4)) { | ||
86 | switch(num) { | ||
87 | case 1: strcpy(tmp, "C1"); | ||
88 | break; | ||
89 | case 2: strcpy(tmp, "C3"); | ||
90 | break; | ||
91 | case 3: strcpy(tmp, "C6"); | ||
92 | break; | ||
93 | } | ||
94 | } else if (!strncmp(tmp, "SNB-", 4)) { | ||
95 | switch(num) { | ||
96 | case 1: strcpy(tmp, "C1"); | ||
97 | break; | ||
98 | case 2: strcpy(tmp, "C3"); | ||
99 | break; | ||
100 | case 3: strcpy(tmp, "C6"); | ||
101 | break; | ||
102 | case 4: strcpy(tmp, "C7"); | ||
103 | break; | ||
104 | } | ||
105 | } else if (!strncmp(tmp, "ATM-", 4)) { | ||
106 | switch(num) { | ||
107 | case 1: strcpy(tmp, "C1"); | ||
108 | break; | ||
109 | case 2: strcpy(tmp, "C2"); | ||
110 | break; | ||
111 | case 3: strcpy(tmp, "C4"); | ||
112 | break; | ||
113 | case 4: strcpy(tmp, "C6"); | ||
114 | break; | ||
115 | } | ||
116 | } | ||
117 | } | ||
118 | |||
119 | static struct cpuidle_monitor* cpuidle_register(void) | ||
120 | { | ||
121 | int num; | ||
122 | char *tmp; | ||
123 | |||
124 | /* Assume idle state count is the same for all CPUs */ | ||
125 | cpuidle_sysfs_monitor.hw_states_num = sysfs_get_idlestate_count(0); | ||
126 | |||
127 | if (cpuidle_sysfs_monitor.hw_states_num == 0) | ||
128 | return NULL; | ||
129 | |||
130 | for (num = 0; num < cpuidle_sysfs_monitor.hw_states_num; num ++) { | ||
131 | tmp = sysfs_get_idlestate_name(0, num); | ||
132 | if (tmp == NULL) | ||
133 | continue; | ||
134 | |||
135 | fix_up_intel_idle_driver_name(tmp, num); | ||
136 | strncpy(cpuidle_cstates[num].name, tmp, CSTATE_NAME_LEN - 1); | ||
137 | free(tmp); | ||
138 | |||
139 | tmp = sysfs_get_idlestate_desc(0, num); | ||
140 | if (tmp == NULL) | ||
141 | continue; | ||
142 | strncpy(cpuidle_cstates[num].desc, tmp, CSTATE_DESC_LEN - 1); | ||
143 | free(tmp); | ||
144 | |||
145 | cpuidle_cstates[num].range = RANGE_THREAD; | ||
146 | cpuidle_cstates[num].id = num; | ||
147 | cpuidle_cstates[num].get_count_percent = cpuidle_get_count_percent; | ||
148 | }; | ||
149 | |||
150 | /* Free this at program termination */ | ||
151 | previous_count = malloc(sizeof (long long*) * cpu_count); | ||
152 | current_count = malloc(sizeof (long long*) * cpu_count); | ||
153 | for (num = 0; num < cpu_count; num++) { | ||
154 | previous_count[num] = malloc (sizeof(long long) * | ||
155 | cpuidle_sysfs_monitor.hw_states_num); | ||
156 | current_count[num] = malloc (sizeof(long long) * | ||
157 | cpuidle_sysfs_monitor.hw_states_num); | ||
158 | } | ||
159 | |||
160 | cpuidle_sysfs_monitor.name_len = strlen(cpuidle_sysfs_monitor.name); | ||
161 | return &cpuidle_sysfs_monitor; | ||
162 | } | ||
163 | |||
164 | void cpuidle_unregister(void) | ||
165 | { | ||
166 | int num; | ||
167 | |||
168 | for (num = 0; num < cpu_count; num++) { | ||
169 | free(previous_count[num]); | ||
170 | free(current_count[num]); | ||
171 | } | ||
172 | free(previous_count); | ||
173 | free(current_count); | ||
174 | } | ||
175 | |||
176 | struct cpuidle_monitor cpuidle_sysfs_monitor = { | ||
177 | .name = "Idle_Stats", | ||
178 | .hw_states = cpuidle_cstates, | ||
179 | .start = cpuidle_start, | ||
180 | .stop = cpuidle_stop, | ||
181 | .do_register = cpuidle_register, | ||
182 | .unregister = cpuidle_unregister, | ||
183 | .needs_root = 0, | ||
184 | .overflow_s = UINT_MAX, | ||
185 | }; | ||
diff --git a/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c b/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c new file mode 100644 index 00000000000..3e96e79de3c --- /dev/null +++ b/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c | |||
@@ -0,0 +1,446 @@ | |||
1 | /* | ||
2 | * (C) 2010,2011 Thomas Renninger <trenn@suse.de>, Novell Inc. | ||
3 | * | ||
4 | * Licensed under the terms of the GNU GPL License version 2. | ||
5 | * | ||
6 | * Output format inspired by Len Brown's <lenb@kernel.org> turbostat tool. | ||
7 | * | ||
8 | */ | ||
9 | |||
10 | |||
11 | #include <stdio.h> | ||
12 | #include <unistd.h> | ||
13 | #include <stdlib.h> | ||
14 | #include <string.h> | ||
15 | #include <time.h> | ||
16 | #include <signal.h> | ||
17 | #include <sys/types.h> | ||
18 | #include <sys/wait.h> | ||
19 | #include <libgen.h> | ||
20 | |||
21 | #include "idle_monitor/cpupower-monitor.h" | ||
22 | #include "idle_monitor/idle_monitors.h" | ||
23 | #include "helpers/helpers.h" | ||
24 | |||
25 | /* Define pointers to all monitors. */ | ||
26 | #define DEF(x) & x ## _monitor , | ||
27 | struct cpuidle_monitor * all_monitors[] = { | ||
28 | #include "idle_monitors.def" | ||
29 | 0 | ||
30 | }; | ||
31 | |||
32 | static struct cpuidle_monitor *monitors[MONITORS_MAX]; | ||
33 | static unsigned int avail_monitors; | ||
34 | |||
35 | static char *progname; | ||
36 | |||
37 | enum operation_mode_e { list = 1, show, show_all }; | ||
38 | static int mode; | ||
39 | static int interval = 1; | ||
40 | static char *show_monitors_param; | ||
41 | static struct cpupower_topology cpu_top; | ||
42 | |||
43 | /* ToDo: Document this in the manpage */ | ||
44 | static char range_abbr[RANGE_MAX] = { 'T', 'C', 'P', 'M', }; | ||
45 | |||
46 | long long timespec_diff_us(struct timespec start, struct timespec end) | ||
47 | { | ||
48 | struct timespec temp; | ||
49 | if ((end.tv_nsec - start.tv_nsec) < 0) { | ||
50 | temp.tv_sec = end.tv_sec - start.tv_sec - 1; | ||
51 | temp.tv_nsec = 1000000000 + end.tv_nsec - start.tv_nsec; | ||
52 | } else { | ||
53 | temp.tv_sec = end.tv_sec - start.tv_sec; | ||
54 | temp.tv_nsec = end.tv_nsec - start.tv_nsec; | ||
55 | } | ||
56 | return (temp.tv_sec * 1000000) + (temp.tv_nsec / 1000); | ||
57 | } | ||
58 | |||
59 | void monitor_help(void) | ||
60 | { | ||
61 | printf(_("cpupower monitor: [-m <mon1>,[<mon2>],.. ] command\n")); | ||
62 | printf(_("cpupower monitor: [-m <mon1>,[<mon2>],.. ] [ -i interval_sec ]\n")); | ||
63 | printf(_("cpupower monitor: -l\n")); | ||
64 | printf(_("\t command: pass an arbitrary command to measure specific workload\n")); | ||
65 | printf(_("\t -i: time intervall to measure for in seconds (default 1)\n")); | ||
66 | printf(_("\t -l: list available CPU sleep monitors (for use with -m)\n")); | ||
67 | printf(_("\t -m: show specific CPU sleep monitors only (in same order)\n")); | ||
68 | printf(_("\t -h: print this help\n")); | ||
69 | printf("\n"); | ||
70 | printf(_("only one of: -l, -m are allowed\nIf none of them is passed,")); | ||
71 | printf(_(" all supported monitors are shown\n")); | ||
72 | } | ||
73 | |||
74 | void print_n_spaces(int n) | ||
75 | { | ||
76 | int x; | ||
77 | for (x = 0; x < n; x++) | ||
78 | printf(" "); | ||
79 | } | ||
80 | |||
81 | /* size of s must be at least n + 1 */ | ||
82 | int fill_string_with_spaces(char *s, int n) | ||
83 | { | ||
84 | int len = strlen(s); | ||
85 | if (len > n) | ||
86 | return -1; | ||
87 | for (; len < n; len++) | ||
88 | s[len] = ' '; | ||
89 | s[len] = '\0'; | ||
90 | return 0; | ||
91 | } | ||
92 | |||
93 | void print_header(int topology_depth) | ||
94 | { | ||
95 | int unsigned mon; | ||
96 | int state, need_len, pr_mon_len; | ||
97 | cstate_t s; | ||
98 | char buf[128] = ""; | ||
99 | int percent_width = 4; | ||
100 | |||
101 | fill_string_with_spaces(buf, topology_depth * 5 - 1); | ||
102 | printf("%s|", buf); | ||
103 | |||
104 | for (mon = 0; mon < avail_monitors; mon++) { | ||
105 | pr_mon_len = 0; | ||
106 | need_len = monitors[mon]->hw_states_num * (percent_width + 3) | ||
107 | - 1; | ||
108 | if (mon != 0) { | ||
109 | printf("|| "); | ||
110 | need_len --; | ||
111 | } | ||
112 | sprintf(buf, "%s", monitors[mon]->name); | ||
113 | fill_string_with_spaces(buf, need_len); | ||
114 | printf("%s", buf); | ||
115 | } | ||
116 | printf("\n"); | ||
117 | |||
118 | if (topology_depth > 2) | ||
119 | printf("PKG |"); | ||
120 | if (topology_depth > 1) | ||
121 | printf("CORE|"); | ||
122 | if (topology_depth > 0) | ||
123 | printf("CPU |"); | ||
124 | |||
125 | for (mon = 0; mon < avail_monitors; mon++) { | ||
126 | if (mon != 0) | ||
127 | printf("|| "); | ||
128 | else | ||
129 | printf(" "); | ||
130 | for (state = 0; state < monitors[mon]->hw_states_num; state++) { | ||
131 | if (state != 0) | ||
132 | printf(" | "); | ||
133 | s = monitors[mon]->hw_states[state]; | ||
134 | sprintf(buf, "%s", s.name); | ||
135 | fill_string_with_spaces(buf, percent_width); | ||
136 | printf("%s", buf); | ||
137 | } | ||
138 | printf(" "); | ||
139 | } | ||
140 | printf("\n"); | ||
141 | } | ||
142 | |||
143 | |||
144 | void print_results(int topology_depth, int cpu) | ||
145 | { | ||
146 | unsigned int mon; | ||
147 | int state, ret; | ||
148 | double percent; | ||
149 | unsigned long long result; | ||
150 | cstate_t s; | ||
151 | |||
152 | if (topology_depth > 2) | ||
153 | printf("%4d|", cpu_top.core_info[cpu].pkg); | ||
154 | if (topology_depth > 1) | ||
155 | printf("%4d|", cpu_top.core_info[cpu].core); | ||
156 | if (topology_depth > 0) | ||
157 | printf("%4d|", cpu_top.core_info[cpu].cpu); | ||
158 | |||
159 | for (mon = 0; mon < avail_monitors; mon++) { | ||
160 | if (mon != 0) | ||
161 | printf("||"); | ||
162 | |||
163 | for (state = 0; state < monitors[mon]->hw_states_num; state++) { | ||
164 | if (state != 0) | ||
165 | printf("|"); | ||
166 | |||
167 | s = monitors[mon]->hw_states[state]; | ||
168 | |||
169 | if (s.get_count_percent) { | ||
170 | ret = s.get_count_percent(s.id, &percent, | ||
171 | cpu_top.core_info[cpu].cpu); | ||
172 | if (ret) { | ||
173 | printf("******"); | ||
174 | } else if (percent >= 100.0) | ||
175 | printf("%6.1f", percent); | ||
176 | else | ||
177 | printf("%6.2f", percent); | ||
178 | } | ||
179 | else if (s.get_count) { | ||
180 | ret = s.get_count(s.id, &result, | ||
181 | cpu_top.core_info[cpu].cpu); | ||
182 | if (ret) { | ||
183 | printf("******"); | ||
184 | } else | ||
185 | printf("%6llu", result); | ||
186 | } | ||
187 | else { | ||
188 | printf(_("Monitor %s, Counter %s has no count " | ||
189 | "function. Implementation error\n"), | ||
190 | monitors[mon]->name, s.name); | ||
191 | exit (EXIT_FAILURE); | ||
192 | } | ||
193 | } | ||
194 | } | ||
195 | /* cpu offline */ | ||
196 | if (cpu_top.core_info[cpu].pkg == -1 || | ||
197 | cpu_top.core_info[cpu].core == -1) { | ||
198 | printf(_(" *is offline\n")); | ||
199 | return; | ||
200 | } else | ||
201 | printf("\n"); | ||
202 | } | ||
203 | |||
204 | |||
205 | /* param: string passed by -m param (The list of monitors to show) | ||
206 | * | ||
207 | * Monitors must have been registered already, matching monitors | ||
208 | * are picked out and available monitors array is overridden | ||
209 | * with matching ones | ||
210 | * | ||
211 | * Monitors get sorted in the same order the user passes them | ||
212 | */ | ||
213 | |||
214 | static void parse_monitor_param(char* param) | ||
215 | { | ||
216 | unsigned int num; | ||
217 | int mon, hits = 0; | ||
218 | char *tmp = param, *token; | ||
219 | struct cpuidle_monitor *tmp_mons[MONITORS_MAX]; | ||
220 | |||
221 | |||
222 | for (mon = 0; mon < MONITORS_MAX;mon++, tmp = NULL) { | ||
223 | token = strtok(tmp, ","); | ||
224 | if (token == NULL) | ||
225 | break; | ||
226 | if (strlen(token) >= MONITOR_NAME_LEN) { | ||
227 | printf(_("%s: max monitor name length" | ||
228 | " (%d) exceeded\n"), token, MONITOR_NAME_LEN); | ||
229 | continue; | ||
230 | } | ||
231 | |||
232 | for (num = 0; num < avail_monitors; num++) { | ||
233 | if (!strcmp(monitors[num]->name, token)) { | ||
234 | dprint("Found requested monitor: %s\n", token); | ||
235 | tmp_mons[hits] = monitors[num]; | ||
236 | hits++; | ||
237 | } | ||
238 | } | ||
239 | } | ||
240 | if (hits == 0) { | ||
241 | printf(_("No matching monitor found in %s, " | ||
242 | "try -l option\n"), param); | ||
243 | monitor_help(); | ||
244 | exit(EXIT_FAILURE); | ||
245 | } | ||
246 | /* Override detected/registerd monitors array with requested one */ | ||
247 | memcpy(monitors, tmp_mons, sizeof(struct cpuidle_monitor*) * MONITORS_MAX); | ||
248 | avail_monitors = hits; | ||
249 | } | ||
250 | |||
251 | void list_monitors(void) { | ||
252 | unsigned int mon; | ||
253 | int state; | ||
254 | cstate_t s; | ||
255 | |||
256 | for (mon = 0; mon < avail_monitors; mon++) { | ||
257 | printf(_("Monitor \"%s\" (%d states) - Might overflow after %u " | ||
258 | "s\n"), monitors[mon]->name, monitors[mon]->hw_states_num, | ||
259 | monitors[mon]->overflow_s); | ||
260 | |||
261 | for (state = 0; state < monitors[mon]->hw_states_num; state++) { | ||
262 | s = monitors[mon]->hw_states[state]; | ||
263 | /* | ||
264 | * ToDo show more state capabilities: | ||
265 | * percent, time (granlarity) | ||
266 | */ | ||
267 | printf("%s\t[%c] -> %s\n", s.name, range_abbr[s.range], | ||
268 | gettext(s.desc)); | ||
269 | } | ||
270 | } | ||
271 | } | ||
272 | |||
273 | int fork_it(char **argv) | ||
274 | { | ||
275 | int status; | ||
276 | unsigned int num; | ||
277 | unsigned long long timediff; | ||
278 | pid_t child_pid; | ||
279 | struct timespec start, end; | ||
280 | |||
281 | child_pid = fork(); | ||
282 | clock_gettime(CLOCK_REALTIME, &start); | ||
283 | |||
284 | for (num = 0; num < avail_monitors; num++) | ||
285 | monitors[num]->start(); | ||
286 | |||
287 | if (!child_pid) { | ||
288 | /* child */ | ||
289 | execvp(argv[0], argv); | ||
290 | } else { | ||
291 | /* parent */ | ||
292 | if (child_pid == -1) { | ||
293 | perror("fork"); | ||
294 | exit(1); | ||
295 | } | ||
296 | |||
297 | signal(SIGINT, SIG_IGN); | ||
298 | signal(SIGQUIT, SIG_IGN); | ||
299 | if (waitpid(child_pid, &status, 0) == -1) { | ||
300 | perror("wait"); | ||
301 | exit(1); | ||
302 | } | ||
303 | } | ||
304 | clock_gettime(CLOCK_REALTIME, &end); | ||
305 | for (num = 0; num < avail_monitors; num++) | ||
306 | monitors[num]->stop(); | ||
307 | |||
308 | timediff = timespec_diff_us(start, end); | ||
309 | if (WIFEXITED(status)) | ||
310 | printf(_("%s took %.5f seconds and exited with status %d\n"), | ||
311 | argv[0], timediff / (1000.0 * 1000), WEXITSTATUS(status)); | ||
312 | return 0; | ||
313 | } | ||
314 | |||
315 | int do_interval_measure(int i) | ||
316 | { | ||
317 | unsigned int num; | ||
318 | |||
319 | for (num = 0; num < avail_monitors; num++) { | ||
320 | dprint("HW C-state residency monitor: %s - States: %d\n", | ||
321 | monitors[num]->name, monitors[num]->hw_states_num); | ||
322 | monitors[num]->start(); | ||
323 | } | ||
324 | sleep(i); | ||
325 | for (num = 0; num < avail_monitors; num++) { | ||
326 | monitors[num]->stop(); | ||
327 | } | ||
328 | return 0; | ||
329 | } | ||
330 | |||
331 | static void cmdline(int argc, char *argv[]) | ||
332 | { | ||
333 | int opt; | ||
334 | progname = basename(argv[0]); | ||
335 | |||
336 | while ((opt = getopt(argc, argv, "+hli:m:")) != -1) { | ||
337 | switch (opt) { | ||
338 | case 'h': | ||
339 | monitor_help(); | ||
340 | exit(EXIT_SUCCESS); | ||
341 | case 'l': | ||
342 | if (mode) { | ||
343 | monitor_help(); | ||
344 | exit(EXIT_FAILURE); | ||
345 | } | ||
346 | mode = list; | ||
347 | break; | ||
348 | case 'i': | ||
349 | /* only allow -i with -m or no option */ | ||
350 | if (mode && mode != show) { | ||
351 | monitor_help(); | ||
352 | exit(EXIT_FAILURE); | ||
353 | } | ||
354 | interval = atoi(optarg); | ||
355 | break; | ||
356 | case 'm': | ||
357 | if (mode) { | ||
358 | monitor_help(); | ||
359 | exit(EXIT_FAILURE); | ||
360 | } | ||
361 | mode = show; | ||
362 | show_monitors_param = optarg; | ||
363 | break; | ||
364 | default: | ||
365 | monitor_help(); | ||
366 | exit(EXIT_FAILURE); | ||
367 | } | ||
368 | } | ||
369 | if (!mode) | ||
370 | mode = show_all; | ||
371 | } | ||
372 | |||
373 | int cmd_monitor(int argc, char **argv) | ||
374 | { | ||
375 | unsigned int num; | ||
376 | struct cpuidle_monitor *test_mon; | ||
377 | int cpu; | ||
378 | |||
379 | cmdline(argc, argv); | ||
380 | cpu_count = get_cpu_topology(&cpu_top); | ||
381 | if (cpu_count < 0) { | ||
382 | printf(_("Cannot read number of available processors\n")); | ||
383 | return EXIT_FAILURE; | ||
384 | } | ||
385 | |||
386 | dprint("System has up to %d CPU cores\n", cpu_count); | ||
387 | |||
388 | for (num = 0; all_monitors[num]; num++) { | ||
389 | dprint("Try to register: %s\n", all_monitors[num]->name); | ||
390 | test_mon = all_monitors[num]->do_register(); | ||
391 | if (test_mon) { | ||
392 | if (test_mon->needs_root && !run_as_root) { | ||
393 | fprintf(stderr, _("Available monitor %s needs " | ||
394 | "root access\n"), test_mon->name); | ||
395 | continue; | ||
396 | } | ||
397 | monitors[avail_monitors] = test_mon; | ||
398 | dprint("%s registered\n", all_monitors[num]->name); | ||
399 | avail_monitors++; | ||
400 | } | ||
401 | } | ||
402 | |||
403 | if (avail_monitors == 0) { | ||
404 | printf(_("No HW Cstate monitors found\n")); | ||
405 | return 1; | ||
406 | } | ||
407 | |||
408 | if (mode == list) { | ||
409 | list_monitors(); | ||
410 | exit(EXIT_SUCCESS); | ||
411 | } | ||
412 | |||
413 | if (mode == show) | ||
414 | parse_monitor_param(show_monitors_param); | ||
415 | |||
416 | dprint("Packages: %d - Cores: %d - CPUs: %d\n", | ||
417 | cpu_top.pkgs, cpu_top.cores, cpu_count); | ||
418 | |||
419 | /* | ||
420 | * if any params left, it must be a command to fork | ||
421 | */ | ||
422 | if (argc - optind) | ||
423 | fork_it(argv + optind); | ||
424 | else | ||
425 | do_interval_measure(interval); | ||
426 | |||
427 | /* ToDo: Topology parsing needs fixing first to do | ||
428 | this more generically */ | ||
429 | if (cpu_top.pkgs > 1) | ||
430 | print_header(3); | ||
431 | else | ||
432 | print_header(1); | ||
433 | |||
434 | for (cpu = 0; cpu < cpu_count; cpu++) { | ||
435 | if (cpu_top.pkgs > 1) | ||
436 | print_results(3, cpu); | ||
437 | else | ||
438 | print_results(1, cpu); | ||
439 | } | ||
440 | |||
441 | for (num = 0; num < avail_monitors; num++) { | ||
442 | monitors[num]->unregister(); | ||
443 | } | ||
444 | cpu_topology_release(cpu_top); | ||
445 | return 0; | ||
446 | } | ||
diff --git a/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.h b/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.h new file mode 100644 index 00000000000..9312ee1f2db --- /dev/null +++ b/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.h | |||
@@ -0,0 +1,68 @@ | |||
1 | /* | ||
2 | * (C) 2010,2011 Thomas Renninger <trenn@suse.de>, Novell Inc. | ||
3 | * | ||
4 | * Licensed under the terms of the GNU GPL License version 2. | ||
5 | * | ||
6 | */ | ||
7 | |||
8 | #ifndef __CPUIDLE_INFO_HW__ | ||
9 | #define __CPUIDLE_INFO_HW__ | ||
10 | |||
11 | #include <stdarg.h> | ||
12 | #include <time.h> | ||
13 | |||
14 | #include "idle_monitor/idle_monitors.h" | ||
15 | |||
16 | #define MONITORS_MAX 20 | ||
17 | #define MONITOR_NAME_LEN 20 | ||
18 | #define CSTATE_NAME_LEN 5 | ||
19 | #define CSTATE_DESC_LEN 60 | ||
20 | |||
21 | int cpu_count; | ||
22 | |||
23 | /* Hard to define the right names ...: */ | ||
24 | enum power_range_e { | ||
25 | RANGE_THREAD, /* Lowest in topology hierarcy, AMD: core, Intel: thread | ||
26 | kernel sysfs: cpu */ | ||
27 | RANGE_CORE, /* AMD: unit, Intel: core, kernel_sysfs: core_id */ | ||
28 | RANGE_PACKAGE, /* Package, processor socket */ | ||
29 | RANGE_MACHINE, /* Machine, platform wide */ | ||
30 | RANGE_MAX }; | ||
31 | |||
32 | typedef struct cstate { | ||
33 | int id; | ||
34 | enum power_range_e range; | ||
35 | char name[CSTATE_NAME_LEN]; | ||
36 | char desc[CSTATE_DESC_LEN]; | ||
37 | |||
38 | /* either provide a percentage or a general count */ | ||
39 | int (*get_count_percent)(unsigned int self_id, double *percent, | ||
40 | unsigned int cpu); | ||
41 | int (*get_count)(unsigned int self_id, unsigned long long *count, | ||
42 | unsigned int cpu); | ||
43 | } cstate_t; | ||
44 | |||
45 | struct cpuidle_monitor { | ||
46 | /* Name must not contain whitespaces */ | ||
47 | char name[MONITOR_NAME_LEN]; | ||
48 | int name_len; | ||
49 | int hw_states_num; | ||
50 | cstate_t *hw_states; | ||
51 | int (*start) (void); | ||
52 | int (*stop) (void); | ||
53 | struct cpuidle_monitor* (*do_register) (void); | ||
54 | void (*unregister)(void); | ||
55 | unsigned int overflow_s; | ||
56 | int needs_root; | ||
57 | }; | ||
58 | |||
59 | extern long long timespec_diff_us(struct timespec start, struct timespec end); | ||
60 | |||
61 | #define print_overflow_err(mes, ov) \ | ||
62 | { \ | ||
63 | fprintf(stderr, gettext("Measure took %u seconds, but registers could " \ | ||
64 | "overflow at %u seconds, results " \ | ||
65 | "could be inaccurate\n"), mes, ov); \ | ||
66 | } | ||
67 | |||
68 | #endif /* __CPUIDLE_INFO_HW__ */ | ||
diff --git a/tools/power/cpupower/utils/idle_monitor/idle_monitors.def b/tools/power/cpupower/utils/idle_monitor/idle_monitors.def new file mode 100644 index 00000000000..e3f8d9b2b18 --- /dev/null +++ b/tools/power/cpupower/utils/idle_monitor/idle_monitors.def | |||
@@ -0,0 +1,7 @@ | |||
1 | #if defined(__i386__) || defined(__x86_64__) | ||
2 | DEF(amd_fam14h) | ||
3 | DEF(intel_nhm) | ||
4 | DEF(intel_snb) | ||
5 | DEF(mperf) | ||
6 | #endif | ||
7 | DEF(cpuidle_sysfs) | ||
diff --git a/tools/power/cpupower/utils/idle_monitor/idle_monitors.h b/tools/power/cpupower/utils/idle_monitor/idle_monitors.h new file mode 100644 index 00000000000..4fcdeb1e07e --- /dev/null +++ b/tools/power/cpupower/utils/idle_monitor/idle_monitors.h | |||
@@ -0,0 +1,18 @@ | |||
1 | /* | ||
2 | * (C) 2010,2011 Thomas Renninger <trenn@suse.de>, Novell Inc. | ||
3 | * | ||
4 | * Licensed under the terms of the GNU GPL License version 2. | ||
5 | * | ||
6 | * Based on the idea from Michael Matz <matz@suse.de> | ||
7 | * | ||
8 | */ | ||
9 | |||
10 | #ifndef _CPUIDLE_IDLE_MONITORS_H_ | ||
11 | #define _CPUIDLE_IDLE_MONITORS_H_ | ||
12 | |||
13 | #define DEF(x) extern struct cpuidle_monitor x ##_monitor; | ||
14 | #include "idle_monitors.def" | ||
15 | #undef DEF | ||
16 | extern struct cpuidle_monitor *all_monitors[]; | ||
17 | |||
18 | #endif /* _CPUIDLE_IDLE_MONITORS_H_ */ | ||
diff --git a/tools/power/cpupower/utils/idle_monitor/mperf_monitor.c b/tools/power/cpupower/utils/idle_monitor/mperf_monitor.c new file mode 100644 index 00000000000..f8545e40e23 --- /dev/null +++ b/tools/power/cpupower/utils/idle_monitor/mperf_monitor.c | |||
@@ -0,0 +1,258 @@ | |||
1 | /* | ||
2 | * (C) 2010,2011 Thomas Renninger <trenn@suse.de>, Novell Inc. | ||
3 | * | ||
4 | * Licensed under the terms of the GNU GPL License version 2. | ||
5 | */ | ||
6 | |||
7 | #if defined(__i386__) || defined(__x86_64__) | ||
8 | |||
9 | #include <stdio.h> | ||
10 | #include <stdint.h> | ||
11 | #include <stdlib.h> | ||
12 | #include <string.h> | ||
13 | #include <limits.h> | ||
14 | |||
15 | #include <cpufreq.h> | ||
16 | |||
17 | #include "helpers/helpers.h" | ||
18 | #include "idle_monitor/cpupower-monitor.h" | ||
19 | |||
20 | #define MSR_APERF 0xE8 | ||
21 | #define MSR_MPERF 0xE7 | ||
22 | |||
23 | #define MSR_TSC 0x10 | ||
24 | |||
25 | enum mperf_id { C0 = 0, Cx, AVG_FREQ, MPERF_CSTATE_COUNT }; | ||
26 | |||
27 | static int mperf_get_count_percent(unsigned int self_id, double *percent, | ||
28 | unsigned int cpu); | ||
29 | static int mperf_get_count_freq(unsigned int id, unsigned long long *count, | ||
30 | unsigned int cpu); | ||
31 | |||
32 | static cstate_t mperf_cstates[MPERF_CSTATE_COUNT] = { | ||
33 | { | ||
34 | .name = "C0", | ||
35 | .desc = N_("Processor Core not idle"), | ||
36 | .id = C0, | ||
37 | .range = RANGE_THREAD, | ||
38 | .get_count_percent = mperf_get_count_percent, | ||
39 | }, | ||
40 | { | ||
41 | .name = "Cx", | ||
42 | .desc = N_("Processor Core in an idle state"), | ||
43 | .id = Cx, | ||
44 | .range = RANGE_THREAD, | ||
45 | .get_count_percent = mperf_get_count_percent, | ||
46 | }, | ||
47 | |||
48 | { | ||
49 | .name = "Freq", | ||
50 | .desc = N_("Average Frequency (including boost) in MHz"), | ||
51 | .id = AVG_FREQ, | ||
52 | .range = RANGE_THREAD, | ||
53 | .get_count = mperf_get_count_freq, | ||
54 | }, | ||
55 | }; | ||
56 | |||
57 | static unsigned long long tsc_at_measure_start; | ||
58 | static unsigned long long tsc_at_measure_end; | ||
59 | static unsigned long max_frequency; | ||
60 | static unsigned long long *mperf_previous_count; | ||
61 | static unsigned long long *aperf_previous_count; | ||
62 | static unsigned long long *mperf_current_count; | ||
63 | static unsigned long long *aperf_current_count; | ||
64 | /* valid flag for all CPUs. If a MSR read failed it will be zero */ | ||
65 | static int *is_valid; | ||
66 | |||
67 | static int mperf_get_tsc(unsigned long long *tsc) | ||
68 | { | ||
69 | return read_msr(0, MSR_TSC, tsc); | ||
70 | } | ||
71 | |||
72 | static int mperf_init_stats(unsigned int cpu) | ||
73 | { | ||
74 | unsigned long long val; | ||
75 | int ret; | ||
76 | |||
77 | ret = read_msr(cpu, MSR_APERF, &val); | ||
78 | aperf_previous_count[cpu] = val; | ||
79 | ret |= read_msr(cpu, MSR_MPERF, &val); | ||
80 | mperf_previous_count[cpu] = val; | ||
81 | is_valid[cpu] = !ret; | ||
82 | |||
83 | return 0; | ||
84 | } | ||
85 | |||
86 | static int mperf_measure_stats(unsigned int cpu) | ||
87 | { | ||
88 | unsigned long long val; | ||
89 | int ret; | ||
90 | |||
91 | ret = read_msr(cpu, MSR_APERF, &val); | ||
92 | aperf_current_count[cpu] = val; | ||
93 | ret |= read_msr(cpu, MSR_MPERF, &val); | ||
94 | mperf_current_count[cpu] = val; | ||
95 | is_valid[cpu] = !ret; | ||
96 | |||
97 | return 0; | ||
98 | } | ||
99 | |||
100 | /* | ||
101 | * get_average_perf() | ||
102 | * | ||
103 | * Returns the average performance (also considers boosted frequencies) | ||
104 | * | ||
105 | * Input: | ||
106 | * aperf_diff: Difference of the aperf register over a time period | ||
107 | * mperf_diff: Difference of the mperf register over the same time period | ||
108 | * max_freq: Maximum frequency (P0) | ||
109 | * | ||
110 | * Returns: | ||
111 | * Average performance over the time period | ||
112 | */ | ||
113 | static unsigned long get_average_perf(unsigned long long aperf_diff, | ||
114 | unsigned long long mperf_diff) | ||
115 | { | ||
116 | unsigned int perf_percent = 0; | ||
117 | if (((unsigned long)(-1) / 100) < aperf_diff) { | ||
118 | int shift_count = 7; | ||
119 | aperf_diff >>= shift_count; | ||
120 | mperf_diff >>= shift_count; | ||
121 | } | ||
122 | perf_percent = (aperf_diff * 100) / mperf_diff; | ||
123 | return (max_frequency * perf_percent) / 100; | ||
124 | } | ||
125 | |||
126 | static int mperf_get_count_percent(unsigned int id, double *percent, | ||
127 | unsigned int cpu) | ||
128 | { | ||
129 | unsigned long long aperf_diff, mperf_diff, tsc_diff; | ||
130 | |||
131 | if (!is_valid[cpu]) | ||
132 | return -1; | ||
133 | |||
134 | if (id != C0 && id != Cx) | ||
135 | return -1; | ||
136 | |||
137 | mperf_diff = mperf_current_count[cpu] - mperf_previous_count[cpu]; | ||
138 | aperf_diff = aperf_current_count[cpu] - aperf_previous_count[cpu]; | ||
139 | tsc_diff = tsc_at_measure_end - tsc_at_measure_start; | ||
140 | |||
141 | *percent = 100.0 * mperf_diff / tsc_diff; | ||
142 | dprint("%s: mperf_diff: %llu, tsc_diff: %llu\n", | ||
143 | mperf_cstates[id].name, mperf_diff, tsc_diff); | ||
144 | |||
145 | if (id == Cx) | ||
146 | *percent = 100.0 - *percent; | ||
147 | |||
148 | dprint("%s: previous: %llu - current: %llu - (%u)\n", mperf_cstates[id].name, | ||
149 | mperf_diff, aperf_diff, cpu); | ||
150 | dprint("%s: %f\n", mperf_cstates[id].name, *percent); | ||
151 | return 0; | ||
152 | } | ||
153 | |||
154 | static int mperf_get_count_freq(unsigned int id, unsigned long long *count, | ||
155 | unsigned int cpu) | ||
156 | { | ||
157 | unsigned long long aperf_diff, mperf_diff; | ||
158 | |||
159 | if (id != AVG_FREQ) | ||
160 | return 1; | ||
161 | |||
162 | if (!is_valid[cpu]) | ||
163 | return -1; | ||
164 | |||
165 | mperf_diff = mperf_current_count[cpu] - mperf_previous_count[cpu]; | ||
166 | aperf_diff = aperf_current_count[cpu] - aperf_previous_count[cpu]; | ||
167 | |||
168 | /* Return MHz for now, might want to return KHz if column width is more | ||
169 | generic */ | ||
170 | *count = get_average_perf(aperf_diff, mperf_diff) / 1000; | ||
171 | dprint("%s: %llu\n", mperf_cstates[id].name, *count); | ||
172 | |||
173 | return 0; | ||
174 | } | ||
175 | |||
176 | static int mperf_start(void) | ||
177 | { | ||
178 | int cpu; | ||
179 | unsigned long long dbg; | ||
180 | |||
181 | mperf_get_tsc(&tsc_at_measure_start); | ||
182 | |||
183 | for (cpu = 0; cpu < cpu_count; cpu++) | ||
184 | mperf_init_stats(cpu); | ||
185 | |||
186 | mperf_get_tsc(&dbg); | ||
187 | dprint("TSC diff: %llu\n", dbg - tsc_at_measure_start); | ||
188 | return 0; | ||
189 | } | ||
190 | |||
191 | static int mperf_stop(void) | ||
192 | { | ||
193 | unsigned long long dbg; | ||
194 | int cpu; | ||
195 | |||
196 | mperf_get_tsc(&tsc_at_measure_end); | ||
197 | |||
198 | for (cpu = 0; cpu < cpu_count; cpu++) | ||
199 | mperf_measure_stats(cpu); | ||
200 | |||
201 | mperf_get_tsc(&dbg); | ||
202 | dprint("TSC diff: %llu\n", dbg - tsc_at_measure_end); | ||
203 | |||
204 | return 0; | ||
205 | } | ||
206 | |||
207 | struct cpuidle_monitor mperf_monitor; | ||
208 | |||
209 | struct cpuidle_monitor* mperf_register(void) { | ||
210 | |||
211 | unsigned long min; | ||
212 | |||
213 | if (!(cpupower_cpu_info.caps & CPUPOWER_CAP_APERF)) | ||
214 | return NULL; | ||
215 | |||
216 | /* Assume min/max all the same on all cores */ | ||
217 | if (cpufreq_get_hardware_limits(0, &min, &max_frequency)) { | ||
218 | dprint("Cannot retrieve max freq from cpufreq kernel " | ||
219 | "subsystem\n"); | ||
220 | return NULL; | ||
221 | } | ||
222 | |||
223 | /* Free this at program termination */ | ||
224 | is_valid = calloc(cpu_count, sizeof (int)); | ||
225 | mperf_previous_count = calloc (cpu_count, | ||
226 | sizeof(unsigned long long)); | ||
227 | aperf_previous_count = calloc (cpu_count, | ||
228 | sizeof(unsigned long long)); | ||
229 | mperf_current_count = calloc (cpu_count, | ||
230 | sizeof(unsigned long long)); | ||
231 | aperf_current_count = calloc (cpu_count, | ||
232 | sizeof(unsigned long long)); | ||
233 | |||
234 | mperf_monitor.name_len = strlen(mperf_monitor.name); | ||
235 | return &mperf_monitor; | ||
236 | } | ||
237 | |||
238 | void mperf_unregister(void) { | ||
239 | free(mperf_previous_count); | ||
240 | free(aperf_previous_count); | ||
241 | free(mperf_current_count); | ||
242 | free(aperf_current_count); | ||
243 | free(is_valid); | ||
244 | } | ||
245 | |||
246 | struct cpuidle_monitor mperf_monitor = { | ||
247 | .name = "Mperf", | ||
248 | .hw_states_num = MPERF_CSTATE_COUNT, | ||
249 | .hw_states = mperf_cstates, | ||
250 | .start = mperf_start, | ||
251 | .stop = mperf_stop, | ||
252 | .do_register = mperf_register, | ||
253 | .unregister = mperf_unregister, | ||
254 | .needs_root = 1, | ||
255 | .overflow_s = 922000000 /* 922337203 seconds TSC overflow | ||
256 | at 20GHz */ | ||
257 | }; | ||
258 | #endif /* #if defined(__i386__) || defined(__x86_64__) */ | ||
diff --git a/tools/power/cpupower/utils/idle_monitor/nhm_idle.c b/tools/power/cpupower/utils/idle_monitor/nhm_idle.c new file mode 100644 index 00000000000..6424b6dd3fa --- /dev/null +++ b/tools/power/cpupower/utils/idle_monitor/nhm_idle.c | |||
@@ -0,0 +1,212 @@ | |||
1 | /* | ||
2 | * (C) 2010,2011 Thomas Renninger <trenn@suse.de>, Novell Inc. | ||
3 | * | ||
4 | * Licensed under the terms of the GNU GPL License version 2. | ||
5 | * | ||
6 | * Based on Len Brown's <lenb@kernel.org> turbostat tool. | ||
7 | */ | ||
8 | |||
9 | #if defined(__i386__) || defined(__x86_64__) | ||
10 | |||
11 | #include <stdio.h> | ||
12 | #include <stdint.h> | ||
13 | #include <stdlib.h> | ||
14 | #include <string.h> | ||
15 | |||
16 | #include "helpers/helpers.h" | ||
17 | #include "idle_monitor/cpupower-monitor.h" | ||
18 | |||
19 | #define MSR_PKG_C3_RESIDENCY 0x3F8 | ||
20 | #define MSR_PKG_C6_RESIDENCY 0x3F9 | ||
21 | #define MSR_CORE_C3_RESIDENCY 0x3FC | ||
22 | #define MSR_CORE_C6_RESIDENCY 0x3FD | ||
23 | |||
24 | #define MSR_TSC 0x10 | ||
25 | |||
26 | #define NHM_CSTATE_COUNT 4 | ||
27 | |||
28 | enum intel_nhm_id { C3 = 0, C6, PC3, PC6, TSC = 0xFFFF }; | ||
29 | |||
30 | static int nhm_get_count_percent(unsigned int self_id, double *percent, | ||
31 | unsigned int cpu); | ||
32 | |||
33 | static cstate_t nhm_cstates[NHM_CSTATE_COUNT] = { | ||
34 | { | ||
35 | .name = "C3", | ||
36 | .desc = N_("Processor Core C3"), | ||
37 | .id = C3, | ||
38 | .range = RANGE_CORE, | ||
39 | .get_count_percent = nhm_get_count_percent, | ||
40 | }, | ||
41 | { | ||
42 | .name = "C6", | ||
43 | .desc = N_("Processor Core C6"), | ||
44 | .id = C6, | ||
45 | .range = RANGE_CORE, | ||
46 | .get_count_percent = nhm_get_count_percent, | ||
47 | }, | ||
48 | |||
49 | { | ||
50 | .name = "PC3", | ||
51 | .desc = N_("Processor Package C3"), | ||
52 | .id = PC3, | ||
53 | .range = RANGE_PACKAGE, | ||
54 | .get_count_percent = nhm_get_count_percent, | ||
55 | }, | ||
56 | { | ||
57 | .name = "PC6", | ||
58 | .desc = N_("Processor Package C6"), | ||
59 | .id = PC6, | ||
60 | .range = RANGE_PACKAGE, | ||
61 | .get_count_percent = nhm_get_count_percent, | ||
62 | }, | ||
63 | }; | ||
64 | |||
65 | static unsigned long long tsc_at_measure_start; | ||
66 | static unsigned long long tsc_at_measure_end; | ||
67 | static unsigned long long *previous_count[NHM_CSTATE_COUNT]; | ||
68 | static unsigned long long *current_count[NHM_CSTATE_COUNT]; | ||
69 | /* valid flag for all CPUs. If a MSR read failed it will be zero */ | ||
70 | static int *is_valid; | ||
71 | |||
72 | static int nhm_get_count(enum intel_nhm_id id, unsigned long long *val, unsigned int cpu) | ||
73 | { | ||
74 | int msr; | ||
75 | |||
76 | switch(id) { | ||
77 | case C3: | ||
78 | msr = MSR_CORE_C3_RESIDENCY; | ||
79 | break; | ||
80 | case C6: | ||
81 | msr = MSR_CORE_C6_RESIDENCY; | ||
82 | break; | ||
83 | case PC3: | ||
84 | msr = MSR_PKG_C3_RESIDENCY; | ||
85 | break; | ||
86 | case PC6: | ||
87 | msr = MSR_PKG_C6_RESIDENCY; | ||
88 | break; | ||
89 | case TSC: | ||
90 | msr = MSR_TSC; | ||
91 | break; | ||
92 | default: | ||
93 | return -1; | ||
94 | }; | ||
95 | if (read_msr(cpu, msr, val)) | ||
96 | return -1; | ||
97 | |||
98 | return 0; | ||
99 | } | ||
100 | |||
101 | static int nhm_get_count_percent(unsigned int id, double *percent, | ||
102 | unsigned int cpu) | ||
103 | { | ||
104 | *percent = 0.0; | ||
105 | |||
106 | if (!is_valid[cpu]) | ||
107 | return -1; | ||
108 | |||
109 | *percent = (100.0 * (current_count[id][cpu] - previous_count[id][cpu])) / | ||
110 | (tsc_at_measure_end - tsc_at_measure_start); | ||
111 | |||
112 | dprint("%s: previous: %llu - current: %llu - (%u)\n", nhm_cstates[id].name, | ||
113 | previous_count[id][cpu], current_count[id][cpu], | ||
114 | cpu); | ||
115 | |||
116 | dprint("%s: tsc_diff: %llu - count_diff: %llu - percent: %2.f (%u)\n", | ||
117 | nhm_cstates[id].name, | ||
118 | (unsigned long long) tsc_at_measure_end - tsc_at_measure_start, | ||
119 | current_count[id][cpu] - previous_count[id][cpu], | ||
120 | *percent, cpu); | ||
121 | |||
122 | return 0; | ||
123 | } | ||
124 | |||
125 | static int nhm_start(void) | ||
126 | { | ||
127 | int num, cpu; | ||
128 | unsigned long long dbg, val; | ||
129 | |||
130 | nhm_get_count(TSC, &tsc_at_measure_start, 0); | ||
131 | |||
132 | for (num = 0; num < NHM_CSTATE_COUNT; num++) { | ||
133 | for (cpu = 0; cpu < cpu_count; cpu++) { | ||
134 | is_valid[cpu] = !nhm_get_count(num, &val, cpu); | ||
135 | previous_count[num][cpu] = val; | ||
136 | } | ||
137 | } | ||
138 | nhm_get_count(TSC, &dbg, 0); | ||
139 | dprint("TSC diff: %llu\n", dbg - tsc_at_measure_start); | ||
140 | return 0; | ||
141 | } | ||
142 | |||
143 | static int nhm_stop(void) | ||
144 | { | ||
145 | unsigned long long val; | ||
146 | unsigned long long dbg; | ||
147 | int num, cpu; | ||
148 | |||
149 | nhm_get_count(TSC, &tsc_at_measure_end, 0); | ||
150 | |||
151 | for (num = 0; num < NHM_CSTATE_COUNT; num++) { | ||
152 | for (cpu = 0; cpu < cpu_count; cpu++) { | ||
153 | is_valid[cpu] = !nhm_get_count(num, &val, cpu); | ||
154 | current_count[num][cpu] = val; | ||
155 | } | ||
156 | } | ||
157 | nhm_get_count(TSC, &dbg, 0); | ||
158 | dprint("TSC diff: %llu\n", dbg - tsc_at_measure_end); | ||
159 | |||
160 | return 0; | ||
161 | } | ||
162 | |||
163 | struct cpuidle_monitor intel_nhm_monitor; | ||
164 | |||
165 | struct cpuidle_monitor* intel_nhm_register(void) { | ||
166 | int num; | ||
167 | |||
168 | if (cpupower_cpu_info.vendor != X86_VENDOR_INTEL) | ||
169 | return NULL; | ||
170 | |||
171 | if (!(cpupower_cpu_info.caps & CPUPOWER_CAP_INV_TSC)) | ||
172 | return NULL; | ||
173 | |||
174 | if (!(cpupower_cpu_info.caps & CPUPOWER_CAP_APERF)) | ||
175 | return NULL; | ||
176 | |||
177 | /* Free this at program termination */ | ||
178 | is_valid = calloc(cpu_count, sizeof (int)); | ||
179 | for (num = 0; num < NHM_CSTATE_COUNT; num++) { | ||
180 | previous_count[num] = calloc (cpu_count, | ||
181 | sizeof(unsigned long long)); | ||
182 | current_count[num] = calloc (cpu_count, | ||
183 | sizeof(unsigned long long)); | ||
184 | } | ||
185 | |||
186 | intel_nhm_monitor.name_len = strlen(intel_nhm_monitor.name); | ||
187 | return &intel_nhm_monitor; | ||
188 | } | ||
189 | |||
190 | void intel_nhm_unregister(void) { | ||
191 | int num; | ||
192 | |||
193 | for (num = 0; num < NHM_CSTATE_COUNT; num++) { | ||
194 | free(previous_count[num]); | ||
195 | free(current_count[num]); | ||
196 | } | ||
197 | free(is_valid); | ||
198 | } | ||
199 | |||
200 | struct cpuidle_monitor intel_nhm_monitor = { | ||
201 | .name = "Nehalem", | ||
202 | .hw_states_num = NHM_CSTATE_COUNT, | ||
203 | .hw_states = nhm_cstates, | ||
204 | .start = nhm_start, | ||
205 | .stop = nhm_stop, | ||
206 | .do_register = intel_nhm_register, | ||
207 | .unregister = intel_nhm_unregister, | ||
208 | .needs_root = 1, | ||
209 | .overflow_s = 922000000 /* 922337203 seconds TSC overflow | ||
210 | at 20GHz */ | ||
211 | }; | ||
212 | #endif | ||
diff --git a/tools/power/cpupower/utils/idle_monitor/snb_idle.c b/tools/power/cpupower/utils/idle_monitor/snb_idle.c new file mode 100644 index 00000000000..8cc80a5b530 --- /dev/null +++ b/tools/power/cpupower/utils/idle_monitor/snb_idle.c | |||
@@ -0,0 +1,189 @@ | |||
1 | /* | ||
2 | * (C) 2010,2011 Thomas Renninger <trenn@suse.de>, Novell Inc. | ||
3 | * | ||
4 | * Licensed under the terms of the GNU GPL License version 2. | ||
5 | * | ||
6 | * Based on Len Brown's <lenb@kernel.org> turbostat tool. | ||
7 | */ | ||
8 | |||
9 | #if defined(__i386__) || defined(__x86_64__) | ||
10 | |||
11 | #include <stdio.h> | ||
12 | #include <stdint.h> | ||
13 | #include <stdlib.h> | ||
14 | #include <string.h> | ||
15 | |||
16 | #include "helpers/helpers.h" | ||
17 | #include "idle_monitor/cpupower-monitor.h" | ||
18 | |||
19 | #define MSR_PKG_C2_RESIDENCY 0x60D | ||
20 | #define MSR_PKG_C7_RESIDENCY 0x3FA | ||
21 | #define MSR_CORE_C7_RESIDENCY 0x3FE | ||
22 | |||
23 | #define MSR_TSC 0x10 | ||
24 | |||
25 | enum intel_snb_id { C7 = 0, PC2, PC7, SNB_CSTATE_COUNT, TSC = 0xFFFF }; | ||
26 | |||
27 | static int snb_get_count_percent(unsigned int self_id, double *percent, | ||
28 | unsigned int cpu); | ||
29 | |||
30 | static cstate_t snb_cstates[SNB_CSTATE_COUNT] = { | ||
31 | { | ||
32 | .name = "C7", | ||
33 | .desc = N_("Processor Core C7"), | ||
34 | .id = C7, | ||
35 | .range = RANGE_CORE, | ||
36 | .get_count_percent = snb_get_count_percent, | ||
37 | }, | ||
38 | { | ||
39 | .name = "PC2", | ||
40 | .desc = N_("Processor Package C2"), | ||
41 | .id = PC2, | ||
42 | .range = RANGE_PACKAGE, | ||
43 | .get_count_percent = snb_get_count_percent, | ||
44 | }, | ||
45 | { | ||
46 | .name = "PC7", | ||
47 | .desc = N_("Processor Package C7"), | ||
48 | .id = PC7, | ||
49 | .range = RANGE_PACKAGE, | ||
50 | .get_count_percent = snb_get_count_percent, | ||
51 | }, | ||
52 | }; | ||
53 | |||
54 | static unsigned long long tsc_at_measure_start; | ||
55 | static unsigned long long tsc_at_measure_end; | ||
56 | static unsigned long long *previous_count[SNB_CSTATE_COUNT]; | ||
57 | static unsigned long long *current_count[SNB_CSTATE_COUNT]; | ||
58 | /* valid flag for all CPUs. If a MSR read failed it will be zero */ | ||
59 | static int *is_valid; | ||
60 | |||
61 | static int snb_get_count(enum intel_snb_id id, unsigned long long *val, unsigned int cpu) | ||
62 | { | ||
63 | int msr; | ||
64 | |||
65 | switch(id) { | ||
66 | case C7: | ||
67 | msr = MSR_CORE_C7_RESIDENCY; | ||
68 | break; | ||
69 | case PC2: | ||
70 | msr = MSR_PKG_C2_RESIDENCY; | ||
71 | break; | ||
72 | case PC7: | ||
73 | msr = MSR_PKG_C7_RESIDENCY; | ||
74 | break; | ||
75 | case TSC: | ||
76 | msr = MSR_TSC; | ||
77 | break; | ||
78 | default: | ||
79 | return -1; | ||
80 | }; | ||
81 | if (read_msr(cpu, msr, val)) | ||
82 | return -1; | ||
83 | return 0; | ||
84 | } | ||
85 | |||
86 | static int snb_get_count_percent(unsigned int id, double *percent, | ||
87 | unsigned int cpu) | ||
88 | { | ||
89 | *percent = 0.0; | ||
90 | |||
91 | if (!is_valid[cpu]) | ||
92 | return -1; | ||
93 | |||
94 | *percent = (100.0 * (current_count[id][cpu] - previous_count[id][cpu])) / | ||
95 | (tsc_at_measure_end - tsc_at_measure_start); | ||
96 | |||
97 | dprint("%s: previous: %llu - current: %llu - (%u)\n", snb_cstates[id].name, | ||
98 | previous_count[id][cpu], current_count[id][cpu], | ||
99 | cpu); | ||
100 | |||
101 | dprint("%s: tsc_diff: %llu - count_diff: %llu - percent: %2.f (%u)\n", | ||
102 | snb_cstates[id].name, | ||
103 | (unsigned long long) tsc_at_measure_end - tsc_at_measure_start, | ||
104 | current_count[id][cpu] | ||
105 | - previous_count[id][cpu], | ||
106 | *percent, cpu); | ||
107 | |||
108 | return 0; | ||
109 | } | ||
110 | |||
111 | static int snb_start(void) | ||
112 | { | ||
113 | int num, cpu; | ||
114 | unsigned long long val; | ||
115 | |||
116 | for (num = 0; num < SNB_CSTATE_COUNT; num++) { | ||
117 | for (cpu = 0; cpu < cpu_count; cpu++) { | ||
118 | snb_get_count(num, &val, cpu); | ||
119 | previous_count[num][cpu] = val; | ||
120 | } | ||
121 | } | ||
122 | snb_get_count(TSC, &tsc_at_measure_start, 0); | ||
123 | return 0; | ||
124 | } | ||
125 | |||
126 | static int snb_stop(void) | ||
127 | { | ||
128 | unsigned long long val; | ||
129 | int num, cpu; | ||
130 | |||
131 | snb_get_count(TSC, &tsc_at_measure_end, 0); | ||
132 | |||
133 | for (num = 0; num < SNB_CSTATE_COUNT; num++) { | ||
134 | for (cpu = 0; cpu < cpu_count; cpu++) { | ||
135 | is_valid[cpu] = !snb_get_count(num, &val, cpu); | ||
136 | current_count[num][cpu] = val; | ||
137 | } | ||
138 | } | ||
139 | return 0; | ||
140 | } | ||
141 | |||
142 | struct cpuidle_monitor intel_snb_monitor; | ||
143 | |||
144 | static struct cpuidle_monitor* snb_register(void) { | ||
145 | |||
146 | int num; | ||
147 | |||
148 | if (cpupower_cpu_info.vendor != X86_VENDOR_INTEL | ||
149 | || cpupower_cpu_info.family != 6) | ||
150 | return NULL; | ||
151 | |||
152 | if (cpupower_cpu_info.model != 0x2A | ||
153 | && cpupower_cpu_info.model != 0x2D) | ||
154 | return NULL; | ||
155 | |||
156 | is_valid = calloc(cpu_count, sizeof (int)); | ||
157 | for (num = 0; num < SNB_CSTATE_COUNT; num++) { | ||
158 | previous_count[num] = calloc (cpu_count, | ||
159 | sizeof(unsigned long long)); | ||
160 | current_count[num] = calloc (cpu_count, | ||
161 | sizeof(unsigned long long)); | ||
162 | } | ||
163 | intel_snb_monitor.name_len = strlen(intel_snb_monitor.name); | ||
164 | return &intel_snb_monitor; | ||
165 | } | ||
166 | |||
167 | void snb_unregister(void) | ||
168 | { | ||
169 | int num; | ||
170 | free(is_valid); | ||
171 | for (num = 0; num < SNB_CSTATE_COUNT; num++) { | ||
172 | free(previous_count[num]); | ||
173 | free(current_count[num]); | ||
174 | } | ||
175 | } | ||
176 | |||
177 | struct cpuidle_monitor intel_snb_monitor = { | ||
178 | .name = "SandyBridge", | ||
179 | .hw_states = snb_cstates, | ||
180 | .hw_states_num = SNB_CSTATE_COUNT, | ||
181 | .start = snb_start, | ||
182 | .stop = snb_stop, | ||
183 | .do_register = snb_register, | ||
184 | .unregister = snb_unregister, | ||
185 | .needs_root = 1, | ||
186 | .overflow_s = 922000000 /* 922337203 seconds TSC overflow | ||
187 | at 20GHz */ | ||
188 | }; | ||
189 | #endif /* defined(__i386__) || defined(__x86_64__) */ | ||