1 <?xml version='1.0'?> <!--*-nxml-*-->
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
6 This file is part of systemd.
8 Copyright 2012 Lennart Poettering
10 systemd is free software; you can redistribute it and/or modify it
11 under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
13 (at your option) any later version.
15 systemd is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Lesser General Public License for more details.
20 You should have received a copy of the GNU Lesser General Public License
21 along with systemd; If not, see <http://www.gnu.org/licenses/>.
24 <refentry id="systemd-cgtop">
27 <title>systemd-cgtop</title>
28 <productname>systemd</productname>
32 <contrib>Developer</contrib>
33 <firstname>Lennart</firstname>
34 <surname>Poettering</surname>
35 <email>lennart@poettering.net</email>
41 <refentrytitle>systemd-cgtop</refentrytitle>
42 <manvolnum>1</manvolnum>
46 <refname>systemd-cgtop</refname>
47 <refpurpose>Show top control groups by their resource usage</refpurpose>
52 <command>systemd-cgtop</command>
53 <arg choice="opt" rep="repeat">OPTIONS</arg>
58 <title>Description</title>
60 <para><command>systemd-cgtop</command> shows the top
61 control groups of the local Linux control group
62 hierarchy, ordered by their CPU, memory, or disk I/O load. The
63 display is refreshed in regular intervals (by default
64 every 1s), similar in style to
65 <citerefentry><refentrytitle>top</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
66 If <command>systemd-cgtop</command> is not connected
67 to a tty, only one iteration is performed and no
68 columns headers are printed. This mode is suitable for
71 <para>Resource usage is only accounted for control
72 groups in the relevant hierarchy, i.e. CPU usage is
73 only accounted for control groups in the
74 <literal>cpuacct</literal> hierarchy, memory usage
75 only for those in <literal>memory</literal> and disk
76 I/O usage for those in <literal>blkio</literal>. If
77 resource monitoring for these resources is required,
78 it is recommended to add the
79 <varname>CPUAccounting=1</varname>,
80 <varname>MemoryAccounting=1</varname> and
81 <varname>BlockIOAccounting=1</varname> settings in the
82 unit files in question. See
83 <citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry>
86 <para>To emphasize this: unless
87 <literal>CPUAccounting=1</literal>,
88 <literal>MemoryAccounting=1</literal> and
89 <literal>BlockIOAccounting=1</literal> are enabled for
90 the services in question, no resource accounting will
91 be available for system services and the data shown by
92 <command>systemd-cgtop</command> will be
97 <title>Options</title>
99 <para>The following options are understood:</para>
103 <term><option>-h</option></term>
104 <term><option>--help</option></term>
106 <listitem><para>Prints a short help
107 text and exits.</para></listitem>
111 <term><option>--version</option></term>
113 <listitem><para>Prints a version string and
114 exits.</para></listitem>
118 <term><option>-p</option></term>
120 <listitem><para>Order by control group
121 path name.</para></listitem>
125 <term><option>-t</option></term>
127 <listitem><para>Order by number of
129 group (i.e. threads and processes).</para></listitem>
133 <term><option>-c</option></term>
135 <listitem><para>Order by CPU load.</para></listitem>
139 <term><option>-m</option></term>
141 <listitem><para>Order by memory usage.</para></listitem>
145 <term><option>-i</option></term>
147 <listitem><para>Order by disk I/O load.</para></listitem>
151 <term><option>-b</option></term>
152 <term><option>--batch</option></term>
154 <listitem><para>Run in "batch" mode:
155 do not accept input and run until the
156 iteration limit set with
157 <option>--iterations</option> is
158 exhausted or until killed. This mode
159 could be useful for sending output
160 from <command>systemd-cgtop</command>
161 to other programs or to a
162 file.</para></listitem>
166 <term><option>-n</option></term>
167 <term><option>--iterations=</option></term>
169 <listitem><para>Perform only this many
170 iterations.</para></listitem>
174 <term><option>-d</option></term>
175 <term><option>--delay=</option></term>
177 <listitem><para>Specify refresh delay
178 in seconds (or if one of
179 <literal>ms</literal>,
180 <literal>us</literal>,
181 <literal>min</literal> is specified as
183 unit).</para></listitem>
187 <term><option>--depth=</option></term>
189 <listitem><para>Maximum control group
190 tree traversal depth. Specifies how
191 deep <command>systemd-cgtop</command>
192 shall traverse the control group
193 hierarchies. If 0 is specified, only
194 the root group is monitored. For 1,
195 only the first level of control groups
196 is monitored, and so on. Defaults to
208 <para><command>systemd-cgtop</command> is an
209 interactive tool and may be controlled via user input
210 using the following keys:</para>
216 <listitem><para>Shows a short help text.</para></listitem>
222 <listitem><para>Immediately refresh output.</para></listitem>
228 <listitem><para>Terminate the program.</para></listitem>
239 <listitem><para>Sort the control groups
240 by path, number of tasks, CPU load,
242 load, respectively.</para></listitem>
248 <listitem><para>Toggle between showing CPU time as
249 time or percentage.</para></listitem>
256 <listitem><para>Increase
258 delay, respectively.</para></listitem>
265 <title>Exit status</title>
267 <para>On success 0 is returned, a non-zero failure
268 code otherwise.</para>
272 <title>See Also</title>
274 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
275 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
276 <citerefentry><refentrytitle>systemd-cgls</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
277 <citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
278 <citerefentry><refentrytitle>top</refentrytitle><manvolnum>1</manvolnum></citerefentry>