Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit d763deb

Browse files
committed
Merge tag 'linux-cpupower-6.11-rc1' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/shuah/linux
Merge cpupower utility updates for 6.11 from Shuah Khan: "This cpupower update for Linux 6.11-rc1 consists of cleanups to man pages, README files, and enhancements to add help to Makefile." * tag 'linux-cpupower-6.11-rc1' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/shuah/linux: cpupower: Change the var type of the 'monitor' subcommand display mode cpupower: Remove absent 'v' parameter from monitor man page cpupower: Improve cpupower build process description cpupower: Add 'help' target to the main Makefile cpupower: Replace a dead reference link with working ones
2 parents 8b2f0cb + 3e1f12c commit d763deb

File tree

4 files changed

+192
-20
lines changed

4 files changed

+192
-20
lines changed

tools/power/cpupower/Makefile

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,4 +332,39 @@ uninstall:
332332
rm -f $(DESTDIR)${localedir}/$$HLANG/LC_MESSAGES/cpupower.mo; \
333333
done;
334334

335-
.PHONY: all utils libcpupower update-po create-gmo install-lib install-tools install-man install-gmo install uninstall clean
335+
help:
336+
@echo 'Building targets:'
337+
@echo ' all - Default target. Could be omitted. Put build artifacts'
338+
@echo ' to "O" cmdline option dir (default: current dir)'
339+
@echo ' install - Install previously built project files from the output'
340+
@echo ' dir defined by "O" cmdline option (default: current dir)'
341+
@echo ' to the install dir defined by "DESTDIR" cmdline or'
342+
@echo ' Makefile config block option (default: "")'
343+
@echo ' install-lib - Install previously built library binary from the output'
344+
@echo ' dir defined by "O" cmdline option (default: current dir)'
345+
@echo ' and library headers from "lib/" for userspace to the install'
346+
@echo ' dir defined by "DESTDIR" cmdline (default: "")'
347+
@echo ' install-tools - Install previously built "cpupower" util from the output'
348+
@echo ' dir defined by "O" cmdline option (default: current dir) and'
349+
@echo ' "cpupower-completion.sh" script from the src dir to the'
350+
@echo ' install dir defined by "DESTDIR" cmdline or Makefile'
351+
@echo ' config block option (default: "")'
352+
@echo ' install-man - Install man pages from the "man" src subdir to the'
353+
@echo ' install dir defined by "DESTDIR" cmdline or Makefile'
354+
@echo ' config block option (default: "")'
355+
@echo ' install-gmo - Install previously built language files from the output'
356+
@echo ' dir defined by "O" cmdline option (default: current dir)'
357+
@echo ' to the install dir defined by "DESTDIR" cmdline or Makefile'
358+
@echo ' config block option (default: "")'
359+
@echo ' install-bench - Install previously built "cpufreq-bench" util files from the'
360+
@echo ' output dir defined by "O" cmdline option (default: current dir)'
361+
@echo ' to the install dir defined by "DESTDIR" cmdline or Makefile'
362+
@echo ' config block option (default: "")'
363+
@echo ''
364+
@echo 'Cleaning targets:'
365+
@echo ' clean - Clean build artifacts from the dir defined by "O" cmdline'
366+
@echo ' option (default: current dir)'
367+
@echo ' uninstall - Remove previously installed files from the dir defined by "DESTDIR"'
368+
@echo ' cmdline or Makefile config block option (default: "")'
369+
370+
.PHONY: all utils libcpupower update-po create-gmo install-lib install-tools install-man install-gmo install uninstall clean help

tools/power/cpupower/README

Lines changed: 150 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,156 @@ interfaces [depending on configuration, see below].
2222
compilation and installation
2323
----------------------------
2424

25-
make
26-
su
27-
make install
28-
29-
should suffice on most systems. It builds libcpupower to put in
30-
/usr/lib; cpupower, cpufreq-bench_plot.sh to put in /usr/bin; and
31-
cpufreq-bench to put in /usr/sbin. If you want to set up the paths
32-
differently and/or want to configure the package to your specific
33-
needs, you need to open "Makefile" with an editor of your choice and
34-
edit the block marked CONFIGURATION.
25+
There are 2 output directories - one for the build output and another for
26+
the installation of the build results, that is the utility, library,
27+
man pages, etc...
28+
29+
default directory
30+
-----------------
31+
32+
In the case of default directory, build and install process requires no
33+
additional parameters:
34+
35+
build
36+
-----
37+
38+
$ make
39+
40+
The output directory for the 'make' command is the current directory and
41+
its subdirs in the kernel tree:
42+
tools/power/cpupower
43+
44+
install
45+
-------
46+
47+
$ sudo make install
48+
49+
'make install' command puts targets to default system dirs:
50+
51+
-----------------------------------------------------------------------
52+
| Installing file | System dir |
53+
-----------------------------------------------------------------------
54+
| libcpupower | /usr/lib |
55+
-----------------------------------------------------------------------
56+
| cpupower | /usr/bin |
57+
-----------------------------------------------------------------------
58+
| cpufreq-bench_plot.sh | /usr/bin |
59+
-----------------------------------------------------------------------
60+
| man pages | /usr/man |
61+
-----------------------------------------------------------------------
62+
63+
To put it in other words it makes build results available system-wide,
64+
enabling any user to simply start using it without any additional steps
65+
66+
custom directory
67+
----------------
68+
69+
There are 2 make's command-line variables 'O' and 'DESTDIR' that setup
70+
appropriate dirs:
71+
'O' - build directory
72+
'DESTDIR' - installation directory. This variable could also be setup in
73+
the 'CONFIGURATION' block of the "Makefile"
74+
75+
build
76+
-----
77+
78+
$ make O=<your_custom_build_catalog>
79+
80+
Example:
81+
$ make O=/home/hedin/prj/cpupower/build
82+
83+
install
84+
-------
85+
86+
$ make O=<your_custom_build_catalog> DESTDIR=<your_custom_install_catalog>
87+
88+
Example:
89+
$ make O=/home/hedin/prj/cpupower/build DESTDIR=/home/hedin/prj/cpupower \
90+
> install
91+
92+
Notice that both variables 'O' and 'DESTDIR' have been provided. The reason
93+
is that the build results are saved in the custom output dir defined by 'O'
94+
variable. So, this dir is the source for the installation step. If only
95+
'DESTDIR' were provided then the 'install' target would assume that the
96+
build directory is the current one, build everything there and install
97+
from the current dir.
98+
99+
The files will be installed to the following dirs:
100+
101+
-----------------------------------------------------------------------
102+
| Installing file | System dir |
103+
-----------------------------------------------------------------------
104+
| libcpupower | ${DESTDIR}/usr/lib |
105+
-----------------------------------------------------------------------
106+
| cpupower | ${DESTDIR}/usr/bin |
107+
-----------------------------------------------------------------------
108+
| cpufreq-bench_plot.sh | ${DESTDIR}/usr/bin |
109+
-----------------------------------------------------------------------
110+
| man pages | ${DESTDIR}/usr/man |
111+
-----------------------------------------------------------------------
112+
113+
If you look at the table for the default 'make' output dirs you will
114+
notice that the only difference with the non-default case is the
115+
${DESTDIR} prefix. So, the structure of the output dirs remains the same
116+
regardles of the root output directory.
117+
118+
119+
clean and uninstall
120+
-------------------
121+
122+
'clean' target is intended for cleanup the build catalog from build results
123+
'uninstall' target is intended for removing installed files from the
124+
installation directory
125+
126+
default directory
127+
-----------------
128+
129+
This case is a straightforward one:
130+
$ make clean
131+
$ make uninstall
132+
133+
custom directory
134+
----------------
135+
136+
Use 'O' command line variable to remove previously built files from the
137+
build dir:
138+
$ make O=<your_custom_build_catalog> clean
139+
140+
Example:
141+
$ make O=/home/hedin/prj/cpupower/build clean
142+
143+
Use 'DESTDIR' command line variable to uninstall previously installed files
144+
from the given dir:
145+
$ make DESTDIR=<your_custom_install_catalog>
146+
147+
Example:
148+
make DESTDIR=/home/hedin/prj/cpupower uninstall
149+
150+
151+
running the tool
152+
----------------
153+
154+
default directory
155+
-----------------
156+
157+
$ sudo cpupower
158+
159+
custom directory
160+
----------------
161+
162+
When it comes to run the utility from the custom build catalog things
163+
become a little bit complicated as 'just run' approach doesn't work.
164+
Assuming that the current dir is '<your_custom_install_catalog>/usr',
165+
issuing the following command:
166+
167+
$ sudo ./bin/cpupower
168+
will produce the following error output:
169+
./bin/cpupower: error while loading shared libraries: libcpupower.so.1:
170+
cannot open shared object file: No such file or directory
171+
172+
The issue is that binary cannot find the 'libcpupower' library. So, we
173+
shall point to the lib dir:
174+
sudo LD_LIBRARY_PATH=lib64/ ./bin/cpupower
35175

36176

37177
THANKS

tools/power/cpupower/man/cpupower-monitor.1

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,6 @@ Measure idle and frequency characteristics of an arbitrary command/workload.
8181
The executable \fBcommand\fP is forked and upon its exit, statistics gathered since it was
8282
forked are displayed.
8383
.RE
84-
.PP
85-
\-v
86-
.RS 4
87-
Increase verbosity if the binary was compiled with the DEBUG option set.
88-
.RE
8984

9085
.SH MONITOR DESCRIPTIONS
9186
.SS "Idle_Stats"
@@ -172,9 +167,11 @@ displayed.
172167
"BIOS and Kernel Developer’s Guide (BKDG) for AMD Family 14h Processors"
173168
https://support.amd.com/us/Processor_TechDocs/43170.pdf
174169

175-
"Intel® Turbo Boost Technology
176-
in Intel® Core™ Microarchitecture (Nehalem) Based Processors"
177-
http://download.intel.com/design/processor/applnots/320354.pdf
170+
"What Is Intel® Turbo Boost Technology?"
171+
https://www.intel.com/content/www/us/en/gaming/resources/turbo-boost.html
172+
173+
"Power Management - Technology Overview"
174+
https://cdrdv2.intel.com/v1/dl/getContent/637748
178175

179176
"Intel® 64 and IA-32 Architectures Software Developer's Manual
180177
Volume 3B: System Programming Guide"

tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ static unsigned int avail_monitors;
3535
static char *progname;
3636

3737
enum operation_mode_e { list = 1, show, show_all };
38-
static int mode;
38+
static enum operation_mode_e mode;
3939
static int interval = 1;
4040
static char *show_monitors_param;
4141
static struct cpupower_topology cpu_top;

0 commit comments

Comments
 (0)