]>
Commit | Line | Data |
---|---|---|
514094f9 | 1 | <?xml version='1.0'?> |
3a54a157 | 2 | <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" |
12b42c76 | 3 | "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> |
db9ecf05 | 4 | <!-- SPDX-License-Identifier: LGPL-2.1-or-later --> |
caa94887 | 5 | |
dfdebb1b | 6 | <refentry id="systemd-cgtop" |
798d3a52 ZJS |
7 | xmlns:xi="http://www.w3.org/2001/XInclude"> |
8 | ||
9 | <refentryinfo> | |
10 | <title>systemd-cgtop</title> | |
11 | <productname>systemd</productname> | |
798d3a52 ZJS |
12 | </refentryinfo> |
13 | ||
14 | <refmeta> | |
15 | <refentrytitle>systemd-cgtop</refentrytitle> | |
16 | <manvolnum>1</manvolnum> | |
17 | </refmeta> | |
18 | ||
19 | <refnamediv> | |
20 | <refname>systemd-cgtop</refname> | |
21 | <refpurpose>Show top control groups by their resource usage</refpurpose> | |
22 | </refnamediv> | |
23 | ||
24 | <refsynopsisdiv> | |
25 | <cmdsynopsis> | |
26 | <command>systemd-cgtop</command> | |
27 | <arg choice="opt" rep="repeat">OPTIONS</arg> | |
308253c5 | 28 | <arg choice="opt">GROUP</arg> |
798d3a52 ZJS |
29 | </cmdsynopsis> |
30 | </refsynopsisdiv> | |
31 | ||
32 | <refsect1> | |
33 | <title>Description</title> | |
34 | ||
35 | <para><command>systemd-cgtop</command> shows the top control | |
36 | groups of the local Linux control group hierarchy, ordered by | |
37 | their CPU, memory, or disk I/O load. The display is refreshed in | |
38 | regular intervals (by default every 1s), similar in style to | |
308253c5 AP |
39 | <citerefentry project='man-pages'><refentrytitle>top</refentrytitle><manvolnum>1</manvolnum></citerefentry>. |
40 | If a control group path is specified, shows only the services of | |
41 | the specified control group.</para> | |
780fe62e | 42 | |
45d7a8bb LP |
43 | <para>If <command>systemd-cgtop</command> is not connected to a |
44 | tty, no column headers are printed and the default is to only run | |
f8b68539 | 45 | one iteration. The <option>--iterations=</option> argument, if |
45d7a8bb | 46 | given, is honored. This mode is suitable for scripting.</para> |
798d3a52 | 47 | |
6d48c7cf LP |
48 | <para>Resource usage is only accounted for control groups with the appropriate controllers turned on: |
49 | <literal>cpu</literal> controller for CPU usage, <literal>memory</literal> controller for memory usage, | |
6dd3b818 | 50 | and <literal>io</literal> controller for disk I/O consumption. If resource monitoring for these resources |
6d48c7cf LP |
51 | is required, it is recommended to add the <varname>CPUAccounting=1</varname>, |
52 | <varname>MemoryAccounting=1</varname> and <varname>IOAccounting=1</varname> settings in the unit files in | |
53 | question. See | |
798d3a52 ZJS |
54 | <citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry> |
55 | for details.</para> | |
56 | ||
b0f5a510 UTL |
57 | <para>The CPU load value can be between 0 and 100 times the number of |
58 | processors the system has. For example, if the system has 8 processors, | |
59 | the CPU load value is going to be between 0% and 800%. The number of | |
60 | processors can be found in <literal>/proc/cpuinfo</literal>.</para> | |
61 | ||
6d48c7cf LP |
62 | <para>To emphasize: unless <literal>CPUAccounting=1</literal>, <literal>MemoryAccounting=1</literal>, and |
63 | <literal>IOAccounting=1</literal> are enabled for the services in question, no resource accounting will | |
64 | be available for system services and the data shown by <command>systemd-cgtop</command> will be | |
65 | incomplete.</para> | |
798d3a52 ZJS |
66 | </refsect1> |
67 | ||
68 | <refsect1> | |
69 | <title>Options</title> | |
70 | ||
71 | <para>The following options are understood:</para> | |
72 | ||
73 | <variablelist> | |
74 | <varlistentry> | |
75 | <term><option>-p</option></term> | |
45d7a8bb | 76 | <term><option>--order=path</option></term> |
798d3a52 ZJS |
77 | |
78 | <listitem><para>Order by control group | |
79 | path name.</para></listitem> | |
80 | </varlistentry> | |
81 | ||
82 | <varlistentry> | |
83 | <term><option>-t</option></term> | |
45d7a8bb | 84 | <term><option>--order=tasks</option></term> |
798d3a52 | 85 | |
03a7b521 | 86 | <listitem><para>Order by number of tasks/processes in the control group.</para></listitem> |
798d3a52 ZJS |
87 | </varlistentry> |
88 | ||
89 | <varlistentry> | |
90 | <term><option>-c</option></term> | |
45d7a8bb | 91 | <term><option>--order=cpu</option></term> |
798d3a52 ZJS |
92 | |
93 | <listitem><para>Order by CPU load.</para></listitem> | |
94 | </varlistentry> | |
95 | ||
96 | <varlistentry> | |
97 | <term><option>-m</option></term> | |
45d7a8bb | 98 | <term><option>--order=memory</option></term> |
798d3a52 ZJS |
99 | |
100 | <listitem><para>Order by memory usage.</para></listitem> | |
101 | </varlistentry> | |
102 | ||
103 | <varlistentry> | |
104 | <term><option>-i</option></term> | |
45d7a8bb | 105 | <term><option>--order=io</option></term> |
798d3a52 ZJS |
106 | |
107 | <listitem><para>Order by disk I/O load.</para></listitem> | |
108 | </varlistentry> | |
109 | ||
110 | <varlistentry> | |
111 | <term><option>-b</option></term> | |
112 | <term><option>--batch</option></term> | |
113 | ||
114 | <listitem><para>Run in "batch" mode: do not accept input and | |
115 | run until the iteration limit set with | |
45d7a8bb | 116 | <option>--iterations=</option> is exhausted or until killed. |
798d3a52 ZJS |
117 | This mode could be useful for sending output from |
118 | <command>systemd-cgtop</command> to other programs or to a | |
ec07c3c8 AK |
119 | file.</para> |
120 | ||
121 | <xi:include href="version-info.xml" xpointer="v188"/></listitem> | |
798d3a52 ZJS |
122 | </varlistentry> |
123 | ||
a2c9f631 CD |
124 | <varlistentry> |
125 | <term><option>-r</option></term> | |
126 | <term><option>--raw</option></term> | |
127 | ||
42949516 | 128 | <listitem><para>Format byte counts (as in memory usage and I/O metrics) and CPU time |
a5201ed6 | 129 | with raw numeric values rather than human-readable |
ec07c3c8 AK |
130 | numbers.</para> |
131 | ||
132 | <xi:include href="version-info.xml" xpointer="v221"/></listitem> | |
a2c9f631 CD |
133 | </varlistentry> |
134 | ||
45d7a8bb LP |
135 | <varlistentry> |
136 | <term><option>--cpu=percentage</option></term> | |
137 | <term><option>--cpu=time</option></term> | |
138 | ||
139 | <listitem><para>Controls whether the CPU usage is shown as | |
b938cb90 | 140 | percentage or time. By default, the CPU usage is shown as |
6d3eefd2 | 141 | percentage. This setting may also be toggled at runtime by |
ec07c3c8 AK |
142 | pressing the <keycap>%</keycap> key.</para> |
143 | ||
144 | <xi:include href="version-info.xml" xpointer="v226"/></listitem> | |
45d7a8bb LP |
145 | </varlistentry> |
146 | ||
03a7b521 LP |
147 | <varlistentry> |
148 | <term><option>-P</option></term> | |
149 | ||
150 | <listitem><para>Count only userspace processes instead of all | |
b938cb90 JE |
151 | tasks. By default, all tasks are counted: each kernel thread |
152 | and each userspace thread individually. With this setting, | |
ade79000 AH |
153 | kernel threads are excluded from the count and each userspace |
154 | process only counts as one task, regardless of how many | |
03a7b521 LP |
155 | threads it consists of. This setting may also be toggled at |
156 | runtime by pressing the <keycap>P</keycap> key. This option | |
157 | may not be combined with | |
ec07c3c8 AK |
158 | <option>-k</option>.</para> |
159 | ||
160 | <xi:include href="version-info.xml" xpointer="v227"/></listitem> | |
03a7b521 LP |
161 | </varlistentry> |
162 | ||
41ba8b6e LP |
163 | <varlistentry> |
164 | <term><option>-k</option></term> | |
165 | ||
03a7b521 | 166 | <listitem><para>Count only userspace processes and kernel |
b938cb90 | 167 | threads instead of all tasks. By default, all tasks are |
03a7b521 | 168 | counted: each kernel thread and each userspace thread |
b938cb90 | 169 | individually. With this setting, kernel threads are included in |
ade79000 AH |
170 | the count and each userspace process only counts as one task, |
171 | regardless of how many threads it consists of. This setting may | |
03a7b521 LP |
172 | also be toggled at runtime by pressing the <keycap>k</keycap> |
173 | key. This option may not be combined with | |
ec07c3c8 AK |
174 | <option>-P</option>.</para> |
175 | ||
176 | <xi:include href="version-info.xml" xpointer="v226"/></listitem> | |
41ba8b6e LP |
177 | </varlistentry> |
178 | ||
3cb5beea LP |
179 | <varlistentry> |
180 | <term><option>--recursive=</option></term> | |
181 | ||
03a7b521 LP |
182 | <listitem><para>Controls whether the number of processes shown |
183 | for a control group shall include all processes that are | |
184 | contained in any of the child control groups as well. Takes a | |
a8eaaee7 | 185 | boolean argument, which defaults to <literal>yes</literal>. If |
b938cb90 JE |
186 | enabled, the processes in child control groups are included, if |
187 | disabled, only the processes in the control group itself are | |
03a7b521 LP |
188 | counted. This setting may also be toggled at runtime by |
189 | pressing the <keycap>r</keycap> key. Note that this setting | |
190 | only applies to process counting, i.e. when the | |
191 | <option>-P</option> or <option>-k</option> options are | |
192 | used. It has not effect if all tasks are counted, in which | |
ec07c3c8 AK |
193 | case the counting is always recursive.</para> |
194 | ||
195 | <xi:include href="version-info.xml" xpointer="v226"/></listitem> | |
3cb5beea LP |
196 | </varlistentry> |
197 | ||
798d3a52 ZJS |
198 | <varlistentry> |
199 | <term><option>-n</option></term> | |
200 | <term><option>--iterations=</option></term> | |
201 | ||
6d3eefd2 LP |
202 | <listitem><para>Perform only this many iterations. A value of |
203 | 0 indicates that the program should run | |
ec07c3c8 AK |
204 | indefinitely.</para> |
205 | ||
206 | <xi:include href="version-info.xml" xpointer="v188"/></listitem> | |
798d3a52 ZJS |
207 | </varlistentry> |
208 | ||
4fc9ffab LP |
209 | <varlistentry> |
210 | <term><option>-1</option></term> | |
211 | ||
ec07c3c8 AK |
212 | <listitem><para>A shortcut for <option>--iterations=1</option>.</para> |
213 | ||
214 | <xi:include href="version-info.xml" xpointer="v238"/></listitem> | |
4fc9ffab LP |
215 | </varlistentry> |
216 | ||
798d3a52 ZJS |
217 | <varlistentry> |
218 | <term><option>-d</option></term> | |
219 | <term><option>--delay=</option></term> | |
220 | ||
221 | <listitem><para>Specify refresh delay in seconds (or if one of | |
6d3eefd2 | 222 | <literal>ms</literal>, <literal>us</literal>, |
798d3a52 | 223 | <literal>min</literal> is specified as unit in this time |
6d3eefd2 LP |
224 | unit). This setting may also be increased and decreased at |
225 | runtime by pressing the <keycap>+</keycap> and | |
226 | <keycap>-</keycap> keys.</para></listitem> | |
798d3a52 ZJS |
227 | </varlistentry> |
228 | ||
229 | <varlistentry> | |
230 | <term><option>--depth=</option></term> | |
231 | ||
232 | <listitem><para>Maximum control group tree traversal depth. | |
233 | Specifies how deep <command>systemd-cgtop</command> shall | |
234 | traverse the control group hierarchies. If 0 is specified, | |
235 | only the root group is monitored. For 1, only the first level | |
236 | of control groups is monitored, and so on. Defaults to | |
237 | 3.</para></listitem> | |
238 | </varlistentry> | |
239 | ||
96a6426f EV |
240 | <varlistentry> |
241 | <term><option>-M <replaceable>MACHINE</replaceable></option></term> | |
242 | <term><option>--machine=<replaceable>MACHINE</replaceable></option></term> | |
243 | ||
244 | <listitem><para>Limit control groups shown to the part | |
245 | corresponding to the container | |
308253c5 | 246 | <replaceable>MACHINE</replaceable>. |
ec07c3c8 AK |
247 | This option may not be used when a control group path is specified.</para> |
248 | ||
249 | <xi:include href="version-info.xml" xpointer="v227"/></listitem> | |
96a6426f EV |
250 | </varlistentry> |
251 | ||
798d3a52 ZJS |
252 | <xi:include href="standard-options.xml" xpointer="help" /> |
253 | <xi:include href="standard-options.xml" xpointer="version" /> | |
254 | </variablelist> | |
255 | ||
256 | </refsect1> | |
257 | ||
798d3a52 ZJS |
258 | <refsect1> |
259 | <title>Keys</title> | |
260 | ||
261 | <para><command>systemd-cgtop</command> is an interactive tool and | |
262 | may be controlled via user input using the following keys:</para> | |
263 | ||
264 | <variablelist> | |
265 | <varlistentry> | |
6d3eefd2 | 266 | <term><keycap>h</keycap></term> |
798d3a52 ZJS |
267 | |
268 | <listitem><para>Shows a short help text.</para></listitem> | |
269 | </varlistentry> | |
270 | ||
271 | <varlistentry> | |
6d3eefd2 | 272 | <term><keycap function="space"/></term> |
798d3a52 | 273 | |
ec07c3c8 AK |
274 | <listitem><para>Immediately refresh output.</para> |
275 | ||
276 | <xi:include href="version-info.xml" xpointer="v226"/></listitem> | |
798d3a52 ZJS |
277 | </varlistentry> |
278 | ||
279 | <varlistentry> | |
6d3eefd2 | 280 | <term><keycap>q</keycap></term> |
798d3a52 ZJS |
281 | |
282 | <listitem><para>Terminate the program.</para></listitem> | |
283 | </varlistentry> | |
284 | ||
798d3a52 | 285 | <varlistentry> |
6d3eefd2 LP |
286 | <term><keycap>p</keycap></term> |
287 | <term><keycap>t</keycap></term> | |
288 | <term><keycap>c</keycap></term> | |
289 | <term><keycap>m</keycap></term> | |
290 | <term><keycap>i</keycap></term> | |
798d3a52 ZJS |
291 | |
292 | <listitem><para>Sort the control groups by path, number of | |
b938cb90 | 293 | tasks, CPU load, memory usage, or I/O load, respectively. This |
6d3eefd2 LP |
294 | setting may also be controlled using the |
295 | <option>--order=</option> command line | |
296 | switch.</para></listitem> | |
798d3a52 ZJS |
297 | </varlistentry> |
298 | ||
299 | <varlistentry> | |
6d3eefd2 | 300 | <term><keycap>%</keycap></term> |
798d3a52 ZJS |
301 | |
302 | <listitem><para>Toggle between showing CPU time as time or | |
6d3eefd2 | 303 | percentage. This setting may also be controlled using the |
ec07c3c8 AK |
304 | <option>--cpu=</option> command line switch.</para> |
305 | ||
306 | <xi:include href="version-info.xml" xpointer="v201"/></listitem> | |
798d3a52 ZJS |
307 | </varlistentry> |
308 | ||
309 | <varlistentry> | |
6d3eefd2 LP |
310 | <term><keycap>+</keycap></term> |
311 | <term><keycap>-</keycap></term> | |
798d3a52 ZJS |
312 | |
313 | <listitem><para>Increase or decrease refresh delay, | |
6d3eefd2 LP |
314 | respectively. This setting may also be controlled using the |
315 | <option>--delay=</option> command line | |
316 | switch.</para></listitem> | |
798d3a52 ZJS |
317 | </varlistentry> |
318 | ||
03a7b521 LP |
319 | <varlistentry> |
320 | <term><keycap>P</keycap></term> | |
321 | ||
322 | <listitem><para>Toggle between counting all tasks, or only | |
323 | userspace processes. This setting may also be controlled using | |
324 | the <option>-P</option> command line switch (see | |
ec07c3c8 AK |
325 | above).</para> |
326 | ||
327 | <xi:include href="version-info.xml" xpointer="v227"/></listitem> | |
03a7b521 LP |
328 | </varlistentry> |
329 | ||
7fcfb7ee | 330 | <varlistentry> |
6d3eefd2 | 331 | <term><keycap>k</keycap></term> |
7fcfb7ee | 332 | |
03a7b521 LP |
333 | <listitem><para>Toggle between counting all tasks, or only |
334 | userspace processes and kernel threads. This setting may also | |
335 | be controlled using the <option>-k</option> command line | |
ec07c3c8 AK |
336 | switch (see above).</para> |
337 | ||
338 | <xi:include href="version-info.xml" xpointer="v226"/></listitem> | |
7fcfb7ee LP |
339 | </varlistentry> |
340 | ||
341 | <varlistentry> | |
6d3eefd2 | 342 | <term><keycap>r</keycap></term> |
7fcfb7ee LP |
343 | |
344 | <listitem><para>Toggle between recursively including or | |
03a7b521 LP |
345 | excluding processes in child control groups in control group |
346 | process counts. This setting may also be controlled using the | |
347 | <option>--recursive=</option> command line switch. This key is | |
a8eaaee7 | 348 | not available if all tasks are counted, it is only available |
03a7b521 LP |
349 | if processes are counted, as enabled with the |
350 | <keycap>P</keycap> or <keycap>k</keycap> | |
ec07c3c8 AK |
351 | keys.</para> |
352 | ||
353 | <xi:include href="version-info.xml" xpointer="v226"/></listitem> | |
7fcfb7ee LP |
354 | </varlistentry> |
355 | ||
798d3a52 ZJS |
356 | </variablelist> |
357 | </refsect1> | |
358 | ||
359 | <refsect1> | |
360 | <title>Exit status</title> | |
361 | ||
362 | <para>On success, 0 is returned, a non-zero failure code | |
363 | otherwise.</para> | |
364 | </refsect1> | |
365 | ||
366 | <refsect1> | |
367 | <title>See Also</title> | |
368 | <para> | |
369 | <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
370 | <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
371 | <citerefentry><refentrytitle>systemd-cgls</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
372 | <citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry>, | |
373 | <citerefentry project='man-pages'><refentrytitle>top</refentrytitle><manvolnum>1</manvolnum></citerefentry> | |
374 | </para> | |
375 | </refsect1> | |
caa94887 LP |
376 | |
377 | </refentry> |