Commit d763debc authored by Rafael J. Wysocki's avatar Rafael J. Wysocki
Browse files

Merge tag 'linux-cpupower-6.11-rc1' of...

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
parents 8b2f0cb6 3e1f12c2
Loading
Loading
Loading
Loading
+36 −1
Original line number Diff line number Diff line
@@ -332,4 +332,39 @@ uninstall:
		rm -f $(DESTDIR)${localedir}/$$HLANG/LC_MESSAGES/cpupower.mo; \
	  done;

.PHONY: all utils libcpupower update-po create-gmo install-lib install-tools install-man install-gmo install uninstall clean
help:
	@echo  'Building targets:'
	@echo  '  all		  - Default target. Could be omitted. Put build artifacts'
	@echo  '                    to "O" cmdline option dir (default: current dir)'
	@echo  '  install	  - Install previously built project files from the output'
	@echo  '                    dir defined by "O" cmdline option (default: current dir)'
	@echo  '                    to the install dir  defined by "DESTDIR" cmdline or'
	@echo  '                    Makefile config block option (default: "")'
	@echo  '  install-lib	  - Install previously built library binary from the output'
	@echo  '                    dir defined by "O" cmdline option (default: current dir)'
	@echo  '                    and library headers from "lib/" for userspace to the install'
	@echo  '                    dir  defined by "DESTDIR" cmdline (default: "")'
	@echo  '  install-tools	  - Install previously built "cpupower" util from the output'
	@echo  '                    dir defined by "O" cmdline option (default: current dir) and'
	@echo  '                    "cpupower-completion.sh" script from the src dir to the'
	@echo  '                    install dir  defined by "DESTDIR" cmdline or Makefile'
	@echo  '                    config block option (default: "")'
	@echo  '  install-man	  - Install man pages from the "man" src subdir to the'
	@echo  '                    install dir  defined by "DESTDIR" cmdline or Makefile'
	@echo  '                    config block option (default: "")'
	@echo  '  install-gmo	  - Install previously built language files from the output'
	@echo  '                    dir defined by "O" cmdline option (default: current dir)'
	@echo  '                    to the install dir defined by "DESTDIR" cmdline or Makefile'
	@echo  '                    config block option (default: "")'
	@echo  '  install-bench	  - Install previously built "cpufreq-bench" util files from the'
	@echo  '                    output dir defined by "O" cmdline option (default: current dir)'
	@echo  '                    to the install dir  defined by "DESTDIR" cmdline or Makefile'
	@echo  '                    config block option (default: "")'
	@echo  ''
	@echo  'Cleaning targets:'
	@echo  '  clean		  - Clean build artifacts from the dir defined by "O" cmdline'
	@echo  '                    option (default: current dir)'
	@echo  '  uninstall	  - Remove previously installed files from the dir defined by "DESTDIR"'
	@echo  '                    cmdline or Makefile config block option (default: "")'

.PHONY: all utils libcpupower update-po create-gmo install-lib install-tools install-man install-gmo install uninstall clean help
+150 −10
Original line number Diff line number Diff line
@@ -22,16 +22,156 @@ interfaces [depending on configuration, see below].
compilation and installation
----------------------------

make
su
make install

should suffice on most systems. It builds libcpupower to put in
/usr/lib; cpupower, cpufreq-bench_plot.sh to put in /usr/bin; and
cpufreq-bench to put in /usr/sbin. If you want to set up the paths
differently and/or want to configure the package to your specific
needs, you need to open "Makefile" with an editor of your choice and
edit the block marked CONFIGURATION.
There are 2 output directories - one for the build output and another for
the installation of the build results, that is the utility, library,
man pages, etc...

default directory
-----------------

In the case of default directory, build and install process requires no
additional parameters:

build
-----

$ make

The output directory for the 'make' command is the current directory and
its subdirs in the kernel tree:
tools/power/cpupower

install
-------

$ sudo make install

'make install' command puts targets to default system dirs:

-----------------------------------------------------------------------
| Installing file        |               System dir                   |
-----------------------------------------------------------------------
| libcpupower            | /usr/lib                                   |
-----------------------------------------------------------------------
| cpupower               | /usr/bin                                   |
-----------------------------------------------------------------------
| cpufreq-bench_plot.sh  | /usr/bin                                   |
-----------------------------------------------------------------------
| man pages              | /usr/man                                   |
-----------------------------------------------------------------------

To put it in other words it makes build results available system-wide,
enabling any user to simply start using it without any additional steps

custom directory
----------------

There are 2 make's command-line variables 'O' and 'DESTDIR' that setup
appropriate dirs:
'O' - build directory
'DESTDIR' - installation directory. This variable could also be setup in
the 'CONFIGURATION' block of the "Makefile"

build
-----

$ make O=<your_custom_build_catalog>

Example:
$ make O=/home/hedin/prj/cpupower/build

install
-------

$ make O=<your_custom_build_catalog> DESTDIR=<your_custom_install_catalog>

Example:
$ make O=/home/hedin/prj/cpupower/build DESTDIR=/home/hedin/prj/cpupower \
> install

Notice that both variables 'O' and 'DESTDIR' have been provided. The reason
is that the build results are saved in the custom output dir defined by 'O'
variable. So, this dir is the source for the installation step. If only
'DESTDIR' were provided then the 'install' target would assume that the
build directory is the current one, build everything there and install
from the current dir.

The files will be installed to the following dirs:

-----------------------------------------------------------------------
| Installing file        |               System dir                   |
-----------------------------------------------------------------------
| libcpupower            | ${DESTDIR}/usr/lib                         |
-----------------------------------------------------------------------
| cpupower               | ${DESTDIR}/usr/bin                         |
-----------------------------------------------------------------------
| cpufreq-bench_plot.sh  | ${DESTDIR}/usr/bin                         |
-----------------------------------------------------------------------
| man pages              | ${DESTDIR}/usr/man                         |
-----------------------------------------------------------------------

If you look at the table for the default 'make' output dirs you will
notice that the only difference with the non-default case is the
${DESTDIR} prefix. So, the structure of the output dirs remains the same
regardles of the root output directory.


clean and uninstall
-------------------

'clean' target is intended for cleanup the build catalog from build results
'uninstall' target is intended for removing installed files from the
installation directory

default directory
-----------------

This case is a straightforward one:
$ make clean
$ make uninstall

custom directory
----------------

Use 'O' command line variable to remove previously built files from the
build dir:
$ make O=<your_custom_build_catalog> clean

Example:
$ make O=/home/hedin/prj/cpupower/build clean

Use 'DESTDIR' command line variable to uninstall previously installed files
from the given dir:
$ make DESTDIR=<your_custom_install_catalog>

Example:
make DESTDIR=/home/hedin/prj/cpupower uninstall


running the tool
----------------

default directory
-----------------

$ sudo cpupower

custom directory
----------------

When it comes to run the utility from the custom build catalog things
become a little bit complicated as 'just run' approach doesn't work.
Assuming that the current dir is '<your_custom_install_catalog>/usr',
issuing the following command:

$ sudo ./bin/cpupower
will produce the following error output:
./bin/cpupower: error while loading shared libraries: libcpupower.so.1:
cannot open shared object file: No such file or directory

The issue is that binary cannot find the 'libcpupower' library. So, we
shall point to the lib dir:
sudo LD_LIBRARY_PATH=lib64/ ./bin/cpupower


THANKS
+5 −8
Original line number Diff line number Diff line
@@ -81,11 +81,6 @@ Measure idle and frequency characteristics of an arbitrary command/workload.
The executable \fBcommand\fP is forked and upon its exit, statistics gathered since it was
forked are displayed.
.RE
.PP
\-v
.RS 4
Increase verbosity if the binary was compiled with the DEBUG option set.
.RE

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

"Intel® Turbo Boost Technology
in Intel® Core™ Microarchitecture (Nehalem) Based Processors"
http://download.intel.com/design/processor/applnots/320354.pdf
"What Is Intel® Turbo Boost Technology?"
https://www.intel.com/content/www/us/en/gaming/resources/turbo-boost.html

"Power Management - Technology Overview"
https://cdrdv2.intel.com/v1/dl/getContent/637748

"Intel® 64 and IA-32 Architectures Software Developer's Manual
Volume 3B: System Programming Guide"
+1 −1
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ static unsigned int avail_monitors;
static char *progname;

enum operation_mode_e { list = 1, show, show_all };
static int mode;
static enum operation_mode_e mode;
static int interval = 1;
static char *show_monitors_param;
static struct cpupower_topology cpu_top;