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"
25 xmlns:xi="http://www.w3.org/2001/XInclude">
28 <title>systemd-cgtop</title>
29 <productname>systemd</productname>
33 <contrib>Developer</contrib>
34 <firstname>Lennart</firstname>
35 <surname>Poettering</surname>
36 <email>lennart@poettering.net</email>
42 <refentrytitle>systemd-cgtop</refentrytitle>
43 <manvolnum>1</manvolnum>
47 <refname>systemd-cgtop</refname>
48 <refpurpose>Show top control groups by their resource usage</refpurpose>
53 <command>systemd-cgtop</command>
54 <arg choice="opt" rep="repeat">OPTIONS</arg>
59 <title>Description</title>
61 <para><command>systemd-cgtop</command> shows the top
62 control groups of the local Linux control group
63 hierarchy, ordered by their CPU, memory, or disk I/O load. The
64 display is refreshed in regular intervals (by default
65 every 1s), similar in style to
66 <citerefentry project='man-pages'><refentrytitle>top</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
67 If <command>systemd-cgtop</command> is not connected
68 to a tty, only one iteration is performed and no
69 columns headers are printed. This mode is suitable for
72 <para>Resource usage is only accounted for control
73 groups in the relevant hierarchy, i.e. CPU usage is
74 only accounted for control groups in the
75 <literal>cpuacct</literal> hierarchy, memory usage
76 only for those in <literal>memory</literal> and disk
77 I/O usage for those in <literal>blkio</literal>. If
78 resource monitoring for these resources is required,
79 it is recommended to add the
80 <varname>CPUAccounting=1</varname>,
81 <varname>MemoryAccounting=1</varname> and
82 <varname>BlockIOAccounting=1</varname> settings in the
83 unit files in question. See
84 <citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry>
87 <para>To emphasize this: unless
88 <literal>CPUAccounting=1</literal>,
89 <literal>MemoryAccounting=1</literal> and
90 <literal>BlockIOAccounting=1</literal> are enabled for
91 the services in question, no resource accounting will
92 be available for system services and the data shown by
93 <command>systemd-cgtop</command> will be
98 <title>Options</title>
100 <para>The following options are understood:</para>
104 <term><option>-p</option></term>
106 <listitem><para>Order by control group
107 path name.</para></listitem>
111 <term><option>-t</option></term>
113 <listitem><para>Order by number of
115 group (i.e. threads and processes).</para></listitem>
119 <term><option>-c</option></term>
121 <listitem><para>Order by CPU load.</para></listitem>
125 <term><option>-m</option></term>
127 <listitem><para>Order by memory usage.</para></listitem>
131 <term><option>-i</option></term>
133 <listitem><para>Order by disk I/O load.</para></listitem>
137 <term><option>-b</option></term>
138 <term><option>--batch</option></term>
140 <listitem><para>Run in "batch" mode:
141 do not accept input and run until the
142 iteration limit set with
143 <option>--iterations</option> is
144 exhausted or until killed. This mode
145 could be useful for sending output
146 from <command>systemd-cgtop</command>
147 to other programs or to a
148 file.</para></listitem>
152 <term><option>-n</option></term>
153 <term><option>--iterations=</option></term>
155 <listitem><para>Perform only this many
156 iterations.</para></listitem>
160 <term><option>-d</option></term>
161 <term><option>--delay=</option></term>
163 <listitem><para>Specify refresh delay
164 in seconds (or if one of
165 <literal>ms</literal>,
166 <literal>us</literal>,
167 <literal>min</literal> is specified as
169 unit).</para></listitem>
173 <term><option>--depth=</option></term>
175 <listitem><para>Maximum control group
176 tree traversal depth. Specifies how
177 deep <command>systemd-cgtop</command>
178 shall traverse the control group
179 hierarchies. If 0 is specified, only
180 the root group is monitored. For 1,
181 only the first level of control groups
182 is monitored, and so on. Defaults to
186 <xi:include href="standard-options.xml" xpointer="help" />
187 <xi:include href="standard-options.xml" xpointer="version" />
196 <para><command>systemd-cgtop</command> is an
197 interactive tool and may be controlled via user input
198 using the following keys:</para>
204 <listitem><para>Shows a short help text.</para></listitem>
210 <listitem><para>Immediately refresh output.</para></listitem>
216 <listitem><para>Terminate the program.</para></listitem>
227 <listitem><para>Sort the control groups
228 by path, number of tasks, CPU load,
230 load, respectively.</para></listitem>
236 <listitem><para>Toggle between showing CPU time as
237 time or percentage.</para></listitem>
244 <listitem><para>Increase
246 delay, respectively.</para></listitem>
253 <title>Exit status</title>
255 <para>On success, 0 is returned, a non-zero failure
256 code otherwise.</para>
260 <title>See Also</title>
262 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
263 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
264 <citerefentry><refentrytitle>systemd-cgls</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
265 <citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
266 <citerefentry project='man-pages'><refentrytitle>top</refentrytitle><manvolnum>1</manvolnum></citerefentry>