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 SPDX-License-Identifier: LGPL-2.1+
8 This file is part of systemd.
10 Copyright 2012 Lennart Poettering
12 systemd is free software; you can redistribute it and/or modify it
13 under the terms of the GNU Lesser General Public License as published by
14 the Free Software Foundation; either version 2.1 of the License, or
15 (at your option) any later version.
17 systemd is distributed in the hope that it will be useful, but
18 WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 Lesser General Public License for more details.
22 You should have received a copy of the GNU Lesser General Public License
23 along with systemd; If not, see <http://www.gnu.org/licenses/>.
26 <refentry id=
"systemd-analyze"
27 xmlns:
xi=
"http://www.w3.org/2001/XInclude">
30 <title>systemd-analyze
</title>
31 <productname>systemd
</productname>
35 <contrib>Developer
</contrib>
36 <firstname>Lennart
</firstname>
37 <surname>Poettering
</surname>
38 <email>lennart@poettering.net
</email>
41 <contrib>Developer
</contrib>
42 <firstname>Harald
</firstname>
43 <surname>Hoyer
</surname>
44 <email>harald@redhat.com
</email>
50 <refentrytitle>systemd-analyze
</refentrytitle>
51 <manvolnum>1</manvolnum>
55 <refname>systemd-analyze
</refname>
56 <refpurpose>Analyze system boot-up performance
</refpurpose>
61 <command>systemd-analyze
</command>
62 <arg choice=
"opt" rep=
"repeat">OPTIONS
</arg>
66 <command>systemd-analyze
</command>
67 <arg choice=
"opt" rep=
"repeat">OPTIONS
</arg>
68 <arg choice=
"plain">blame
</arg>
71 <command>systemd-analyze
</command>
72 <arg choice=
"opt" rep=
"repeat">OPTIONS
</arg>
73 <arg choice=
"plain">critical-chain
</arg>
74 <arg choice=
"opt" rep=
"repeat"><replaceable>UNIT
</replaceable></arg>
77 <command>systemd-analyze
</command>
78 <arg choice=
"opt" rep=
"repeat">OPTIONS
</arg>
79 <arg choice=
"plain">plot
</arg>
80 <arg choice=
"opt">> file.svg
</arg>
83 <command>systemd-analyze
</command>
84 <arg choice=
"opt" rep=
"repeat">OPTIONS
</arg>
85 <arg choice=
"plain">dot
</arg>
86 <arg choice=
"opt" rep=
"repeat"><replaceable>PATTERN
</replaceable></arg>
87 <arg choice=
"opt">> file.dot
</arg>
90 <command>systemd-analyze
</command>
91 <arg choice=
"opt" rep=
"repeat">OPTIONS
</arg>
92 <arg choice=
"plain">dump
</arg>
95 <command>systemd-analyze
</command>
96 <arg choice=
"opt" rep=
"repeat">OPTIONS
</arg>
97 <arg choice=
"plain">set-log-level
</arg>
98 <arg choice=
"plain"><replaceable>LEVEL
</replaceable></arg>
101 <command>systemd-analyze
</command>
102 <arg choice=
"opt" rep=
"repeat">OPTIONS
</arg>
103 <arg choice=
"plain">set-log-target
</arg>
104 <arg choice=
"plain"><replaceable>TARGET
</replaceable></arg>
107 <command>systemd-analyze
</command>
108 <arg choice=
"opt" rep=
"repeat">OPTIONS
</arg>
109 <arg choice=
"plain">get-log-level
</arg>
112 <command>systemd-analyze
</command>
113 <arg choice=
"opt" rep=
"repeat">OPTIONS
</arg>
114 <arg choice=
"plain">get-log-target
</arg>
117 <command>systemd-analyze
</command>
118 <arg choice=
"opt" rep=
"repeat">OPTIONS
</arg>
119 <arg choice=
"plain">syscall-filter
</arg>
120 <arg choice=
"opt"><replaceable>SET
</replaceable>…
</arg>
123 <command>systemd-analyze
</command>
124 <arg choice=
"opt" rep=
"repeat">OPTIONS
</arg>
125 <arg choice=
"plain">verify
</arg>
126 <arg choice=
"opt" rep=
"repeat"><replaceable>FILES
</replaceable></arg>
131 <title>Description
</title>
133 <para><command>systemd-analyze
</command> may be used to determine
134 system boot-up performance statistics and retrieve other state and
135 tracing information from the system and service manager, and to
136 verify the correctness of unit files.
</para>
138 <para><command>systemd-analyze time
</command> prints the time
139 spent in the kernel before userspace has been reached, the time
140 spent in the initial RAM disk (initrd) before normal system
141 userspace has been reached, and the time normal system userspace
142 took to initialize. Note that these measurements simply measure
143 the time passed up to the point where all system services have
144 been spawned, but not necessarily until they fully finished
145 initialization or the disk is idle.
</para>
147 <para><command>systemd-analyze blame
</command> prints a list of
148 all running units, ordered by the time they took to initialize.
149 This information may be used to optimize boot-up times. Note that
150 the output might be misleading as the initialization of one
151 service might be slow simply because it waits for the
152 initialization of another service to complete.
</para>
154 <para><command>systemd-analyze critical-chain
155 [
<replaceable>UNIT…
</replaceable>]
</command> prints a tree of
156 the time-critical chain of units (for each of the specified
157 <replaceable>UNIT
</replaceable>s or for the default target
158 otherwise). The time after the unit is active or started is
159 printed after the
"@" character. The time the unit takes to start
160 is printed after the
"+" character. Note that the output might be
161 misleading as the initialization of one service might depend on
162 socket activation and because of the parallel execution of
165 <para><command>systemd-analyze plot
</command> prints an SVG
166 graphic detailing which system services have been started at what
167 time, highlighting the time they spent on initialization.
</para>
169 <para><command>systemd-analyze dot
</command> generates textual
170 dependency graph description in dot format for further processing
172 <citerefentry project='die-net'
><refentrytitle>dot
</refentrytitle><manvolnum>1</manvolnum></citerefentry>
173 tool. Use a command line like
<command>systemd-analyze dot | dot
174 -Tsvg
> systemd.svg
</command> to generate a graphical dependency
175 tree. Unless
<option>--order
</option> or
176 <option>--require
</option> is passed, the generated graph will
177 show both ordering and requirement dependencies. Optional pattern
178 globbing style specifications (e.g.
<filename>*.target
</filename>)
179 may be given at the end. A unit dependency is included in the
180 graph if any of these patterns match either the origin or
181 destination node.
</para>
183 <para><command>systemd-analyze dump
</command> outputs a (usually
184 very long) human-readable serialization of the complete server
185 state. Its format is subject to change without notice and should
186 not be parsed by applications.
</para>
188 <para><command>systemd-analyze set-log-level
189 <replaceable>LEVEL
</replaceable></command> changes the current log
190 level of the
<command>systemd
</command> daemon to
191 <replaceable>LEVEL
</replaceable> (accepts the same values as
192 <option>--log-level=
</option> described in
193 <citerefentry><refentrytitle>systemd
</refentrytitle><manvolnum>1</manvolnum></citerefentry>).
</para>
195 <para><command>systemd-analyze set-log-target
196 <replaceable>TARGET
</replaceable></command> changes the current log
197 target of the
<command>systemd
</command> daemon to
198 <replaceable>TARGET
</replaceable> (accepts the same values as
199 <option>--log-target=
</option>, described in
200 <citerefentry><refentrytitle>systemd
</refentrytitle><manvolnum>1</manvolnum></citerefentry>).
</para>
202 <para><command>systemd-analyze get-log-level
</command>
203 prints the current log level of the
<command>systemd
</command> daemon.
</para>
205 <para><command>systemd-analyze get-log-target
</command>
206 prints the current log target of the
<command>systemd
</command> daemon.
</para>
208 <para><command>systemd-analyze syscall-filter
<optional><replaceable>SET
</replaceable>…
</optional></command>
209 will list system calls contained in the specified system call set
<replaceable>SET
</replaceable>,
210 or all known sets if no sets are specified. Argument
<replaceable>SET
</replaceable> must include
211 the
<literal>@
</literal> prefix.
</para>
213 <para><command>systemd-analyze verify
</command> will load unit files and print
214 warnings if any errors are detected. Files specified on the command line will be
215 loaded, but also any other units referenced by them. The full unit search path is
216 formed by combining the directories for all command line arguments, and the usual unit
217 load paths (variable
<varname>$SYSTEMD_UNIT_PATH
</varname> is supported, and may be
218 used to replace or augment the compiled in set of unit load paths; see
219 <citerefentry><refentrytitle>systemd.unit
</refentrytitle><manvolnum>5</manvolnum></citerefentry>).
220 All units files present in the directories containing the command line arguments will
221 be used in preference to the other paths.
</para>
223 <para>If no command is passed,
<command>systemd-analyze
224 time
</command> is implied.
</para>
229 <title>Options
</title>
231 <para>The following options are understood:
</para>
235 <term><option>--user
</option></term>
237 <listitem><para>Operates on the user systemd
238 instance.
</para></listitem>
242 <term><option>--system
</option></term>
244 <listitem><para>Operates on the system systemd instance. This
245 is the implied default.
</para></listitem>
249 <term><option>--order
</option></term>
250 <term><option>--require
</option></term>
252 <listitem><para>When used in conjunction with the
253 <command>dot
</command> command (see above), selects which
254 dependencies are shown in the dependency graph. If
255 <option>--order
</option> is passed, only dependencies of type
256 <varname>After=
</varname> or
<varname>Before=
</varname> are
257 shown. If
<option>--require
</option> is passed, only
258 dependencies of type
<varname>Requires=
</varname>,
259 <varname>Requisite=
</varname>,
260 <varname>Wants=
</varname> and
<varname>Conflicts=
</varname>
261 are shown. If neither is passed, this shows dependencies of
262 all these types.
</para></listitem>
266 <term><option>--from-pattern=
</option></term>
267 <term><option>--to-pattern=
</option></term>
269 <listitem><para>When used in conjunction with the
270 <command>dot
</command> command (see above), this selects which
271 relationships are shown in the dependency graph. Both options
273 <citerefentry project='die-net'
><refentrytitle>glob
</refentrytitle><manvolnum>7</manvolnum></citerefentry>
274 pattern as an argument, which will be matched against the
275 left-hand and the right-hand, respectively, nodes of a
278 <para>Each of these can be used more than once, in which case
279 the unit name must match one of the values. When tests for
280 both sides of the relation are present, a relation must pass
281 both tests to be shown. When patterns are also specified as
282 positional arguments, they must match at least one side of the
283 relation. In other words, patterns specified with those two
284 options will trim the list of edges matched by the positional
285 arguments, if any are given, and fully determine the list of
286 edges shown otherwise.
</para></listitem>
290 <term><option>--fuzz=
</option><replaceable>timespan
</replaceable></term>
292 <listitem><para>When used in conjunction with the
293 <command>critical-chain
</command> command (see above), also
294 show units, which finished
<replaceable>timespan
</replaceable>
295 earlier, than the latest unit in the same level. The unit of
296 <replaceable>timespan
</replaceable> is seconds unless
297 specified with a different unit, e.g.
298 "50ms".
</para></listitem>
302 <term><option>--man=no
</option></term>
304 <listitem><para>Do not invoke man to verify the existence of
305 man pages listed in
<varname>Documentation=
</varname>.
310 <term><option>--generators
</option></term>
312 <listitem><para>Invoke unit generators, see
313 <citerefentry><refentrytitle>systemd.generator
</refentrytitle><manvolnum>7</manvolnum></citerefentry>.
314 Some generators require root privileges. When run under a
315 normal users, enabling generators will generally result in
316 some warnings.
</para></listitem>
319 <xi:include href=
"user-system-options.xml" xpointer=
"host" />
320 <xi:include href=
"user-system-options.xml" xpointer=
"machine" />
322 <xi:include href=
"standard-options.xml" xpointer=
"help" />
323 <xi:include href=
"standard-options.xml" xpointer=
"version" />
324 <xi:include href=
"standard-options.xml" xpointer=
"no-pager" />
330 <title>Exit status
</title>
332 <para>On success,
0 is returned, a non-zero failure code
337 <title>Examples for
<command>dot
</command></title>
340 <title>Plots all dependencies of any unit whose name starts with
341 <literal>avahi-daemon
</literal></title>
343 <programlisting>$ systemd-analyze dot 'avahi-daemon.*' | dot -Tsvg
> avahi.svg
344 $ eog avahi.svg
</programlisting>
348 <title>Plots the dependencies between all known target units
</title>
350 <programlisting>$ systemd-analyze dot --to-pattern='*.target' --from-pattern='*.target' | dot -Tsvg
> targets.svg
351 $ eog targets.svg
</programlisting>
356 <title>Examples for
<command>verify
</command></title>
358 <para>The following errors are currently detected:
</para>
360 <listitem><para>unknown sections and directives,
363 <listitem><para>missing dependencies which are required to start
364 the given unit,
</para></listitem>
366 <listitem><para>man pages listed in
367 <varname>Documentation=
</varname> which are not found in the
368 system,
</para></listitem>
370 <listitem><para>commands listed in
<varname>ExecStart=
</varname>
371 and similar which are not found in the system or not
372 executable.
</para></listitem>
376 <title>Misspelt directives
</title>
378 <programlisting>$ cat ./user.slice
381 Documentation=man:nosuchfile(
1)
382 Requires=different.service
387 $ systemd-analyze verify ./user.slice
388 [./user.slice:
9] Unknown lvalue 'WhatIsThis' in section 'Unit'
389 [./user.slice:
13] Unknown section 'Service'. Ignoring.
390 Error: org.freedesktop.systemd1.LoadFailed:
391 Unit different.service failed to load:
392 No such file or directory.
393 Failed to create user.slice/start: Invalid argument
394 user.slice: man nosuchfile(
1) command failed with code
16
399 <title>Missing service units
</title>
401 <programlisting>$ tail ./a.socket ./b.socket
402 ==
> ./a.socket
<==
406 ==
> ./b.socket
<==
411 $ systemd-analyze verify ./a.socket ./b.socket
412 Service a.service not loaded, a.socket cannot be started.
413 Service b@
0.service not loaded, b.socket cannot be started.
418 <xi:include href=
"less-variables.xml" />
421 <title>See Also
</title>
423 <citerefentry><refentrytitle>systemd
</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
424 <citerefentry><refentrytitle>systemctl
</refentrytitle><manvolnum>1</manvolnum></citerefentry>