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