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" [
4 <!ENTITY % entities SYSTEM
"custom-entities.ent" >
9 This file is part of systemd.
11 Copyright 2012 Lennart Poettering
13 systemd is free software; you can redistribute it and/or modify it
14 under the terms of the GNU Lesser General Public License as published by
15 the Free Software Foundation; either version 2.1 of the License, or
16 (at your option) any later version.
18 systemd is distributed in the hope that it will be useful, but
19 WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 Lesser General Public License for more details.
23 You should have received a copy of the GNU Lesser General Public License
24 along with systemd; If not, see <http://www.gnu.org/licenses/>.
27 <refentry id=
"systemd-cgtop"
28 xmlns:
xi=
"http://www.w3.org/2001/XInclude">
31 <title>systemd-cgtop
</title>
32 <productname>systemd
</productname>
36 <contrib>Developer
</contrib>
37 <firstname>Lennart
</firstname>
38 <surname>Poettering
</surname>
39 <email>lennart@poettering.net
</email>
45 <refentrytitle>systemd-cgtop
</refentrytitle>
46 <manvolnum>1</manvolnum>
50 <refname>systemd-cgtop
</refname>
51 <refpurpose>Show top control groups by their resource usage
</refpurpose>
56 <command>systemd-cgtop
</command>
57 <arg choice=
"opt" rep=
"repeat">OPTIONS
</arg>
62 <title>Description
</title>
64 <para><command>systemd-cgtop
</command> shows the top control
65 groups of the local Linux control group hierarchy, ordered by
66 their CPU, memory, or disk I/O load. The display is refreshed in
67 regular intervals (by default every
1s), similar in style to
68 <citerefentry project='man-pages'
><refentrytitle>top
</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
</para>
70 <para>If
<command>systemd-cgtop
</command> is not connected to a tty, no
71 column headers are printed and the default is to only run one iteration.
72 The
<varname>--iterations
</varname> argument, if given, is still honored.
73 This mode is suitable for scripting.
</para>
75 <para>Resource usage is only accounted for control groups in the
76 relevant hierarchy, i.e. CPU usage is only accounted for control
77 groups in the
<literal>cpuacct
</literal> hierarchy, memory usage
78 only for those in
<literal>memory
</literal> and disk I/O usage for
79 those in
<literal>blkio
</literal>. If resource monitoring for
80 these resources is required, it is recommended to add the
81 <varname>CPUAccounting=
1</varname>,
82 <varname>MemoryAccounting=
1</varname> and
83 <varname>BlockIOAccounting=
1</varname> settings in the unit files
85 <citerefentry><refentrytitle>systemd.resource-control
</refentrytitle><manvolnum>5</manvolnum></citerefentry>
88 <para>The CPU load value can be between
0 and
100 times the number of
89 processors the system has. For example, if the system has
8 processors,
90 the CPU load value is going to be between
0% and
800%. The number of
91 processors can be found in
<literal>/proc/cpuinfo
</literal>.
</para>
93 <para>To emphasize this: unless
94 <literal>CPUAccounting=
1</literal>,
95 <literal>MemoryAccounting=
1</literal> and
96 <literal>BlockIOAccounting=
1</literal> are enabled for the
97 services in question, no resource accounting will be available for
98 system services and the data shown by
99 <command>systemd-cgtop
</command> will be incomplete.
</para>
103 <title>Options
</title>
105 <para>The following options are understood:
</para>
109 <term><option>-p
</option></term>
111 <listitem><para>Order by control group
112 path name.
</para></listitem>
116 <term><option>-t
</option></term>
118 <listitem><para>Order by number of tasks in control group
119 (i.e. threads and processes).
</para></listitem>
123 <term><option>-c
</option></term>
125 <listitem><para>Order by CPU load.
</para></listitem>
129 <term><option>-m
</option></term>
131 <listitem><para>Order by memory usage.
</para></listitem>
135 <term><option>-i
</option></term>
137 <listitem><para>Order by disk I/O load.
</para></listitem>
141 <term><option>-b
</option></term>
142 <term><option>--batch
</option></term>
144 <listitem><para>Run in
"batch" mode: do not accept input and
145 run until the iteration limit set with
146 <option>--iterations
</option> is exhausted or until killed.
147 This mode could be useful for sending output from
148 <command>systemd-cgtop
</command> to other programs or to a
149 file.
</para></listitem>
153 <term><option>-r
</option></term>
154 <term><option>--raw
</option></term>
156 <listitem><para>Format byte counts (as in memory usage and IO metrics)
157 with raw numeric values rather than human-readable
158 numbers.
</para></listitem>
162 <term><option>-n
</option></term>
163 <term><option>--iterations=
</option></term>
165 <listitem><para>Perform only this many iterations. A value of
0
166 indicates that the program should run indefinitely.
</para></listitem>
170 <term><option>-d
</option></term>
171 <term><option>--delay=
</option></term>
173 <listitem><para>Specify refresh delay in seconds (or if one of
174 <literal>ms
</literal>,
175 <literal>us
</literal>,
176 <literal>min
</literal> is specified as unit in this time
177 unit).
</para></listitem>
181 <term><option>--depth=
</option></term>
183 <listitem><para>Maximum control group tree traversal depth.
184 Specifies how deep
<command>systemd-cgtop
</command> shall
185 traverse the control group hierarchies. If
0 is specified,
186 only the root group is monitored. For
1, only the first level
187 of control groups is monitored, and so on. Defaults to
191 <xi:include href=
"standard-options.xml" xpointer=
"help" />
192 <xi:include href=
"standard-options.xml" xpointer=
"version" />
201 <para><command>systemd-cgtop
</command> is an interactive tool and
202 may be controlled via user input using the following keys:
</para>
208 <listitem><para>Shows a short help text.
</para></listitem>
214 <listitem><para>Immediately refresh output.
</para></listitem>
220 <listitem><para>Terminate the program.
</para></listitem>
231 <listitem><para>Sort the control groups by path, number of
232 tasks, CPU load, memory usage, or IO load, respectively.
239 <listitem><para>Toggle between showing CPU time as time or
240 percentage.
</para></listitem>
247 <listitem><para>Increase or decrease refresh delay,
248 respectively.
</para></listitem>
255 <title>Exit status
</title>
257 <para>On success,
0 is returned, a non-zero failure code
262 <title>See Also
</title>
264 <citerefentry><refentrytitle>systemd
</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
265 <citerefentry><refentrytitle>systemctl
</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
266 <citerefentry><refentrytitle>systemd-cgls
</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
267 <citerefentry><refentrytitle>systemd.resource-control
</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
268 <citerefentry project='man-pages'
><refentrytitle>top
</refentrytitle><manvolnum>1</manvolnum></citerefentry>