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