summaryrefslogtreecommitdiff
path: root/tools/power/cpupower/README
blob: 2678ed81d311f33b160c747750c4e1d22311498c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
The cpupower package consists of the following elements:

requirements
------------

On x86 pciutils is needed at runtime (-lpci).
For compilation pciutils-devel (pci/pci.h) and a gcc version
providing cpuid.h is needed.
For both it's not explicitly checked for (yet).


libcpupower
----------

"libcpupower" is a library which offers a unified access method for userspace
tools and programs to the cpufreq core and drivers in the Linux kernel. This
allows for code reduction in userspace tools, a clean implementation of
the interaction to the cpufreq core, and support for both the sysfs and proc
interfaces [depending on configuration, see below].


compilation and installation
----------------------------

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
------
Many thanks to Mattia Dongili who wrote the autotoolization and
libtoolization, the manpages and the italian language file for cpupower;
to Dave Jones for his feedback and his dump_psb tool; to Bruno Ducrot for his
powernow-k8-decode and intel_gsic tools as well as the french language file;
and to various others commenting on the previous (pre-)releases of 
cpupower.


        Dominik Brodowski