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-analyze"
25 xmlns:
xi=
"http://www.w3.org/2001/XInclude">
28 <title>systemd-analyze
</title>
29 <productname>systemd
</productname>
33 <contrib>Developer
</contrib>
34 <firstname>Lennart
</firstname>
35 <surname>Poettering
</surname>
36 <email>lennart@poettering.net
</email>
39 <contrib>Developer
</contrib>
40 <firstname>Harald
</firstname>
41 <surname>Hoyer
</surname>
42 <email>harald@redhat.com
</email>
48 <refentrytitle>systemd-analyze
</refentrytitle>
49 <manvolnum>1</manvolnum>
53 <refname>systemd-analyze
</refname>
54 <refpurpose>Analyze system boot-up performance
</refpurpose>
59 <command>systemd-analyze
</command>
60 <arg choice=
"opt" rep=
"repeat">OPTIONS
</arg>
64 <command>systemd-analyze
</command>
65 <arg choice=
"opt" rep=
"repeat">OPTIONS
</arg>
66 <arg choice=
"plain">blame
</arg>
69 <command>systemd-analyze
</command>
70 <arg choice=
"opt" rep=
"repeat">OPTIONS
</arg>
71 <arg choice=
"plain">critical-chain
</arg>
72 <arg choice=
"opt" rep=
"repeat"><replaceable>UNIT
</replaceable></arg>
75 <command>systemd-analyze
</command>
76 <arg choice=
"opt" rep=
"repeat">OPTIONS
</arg>
77 <arg choice=
"plain">plot
</arg>
78 <arg choice=
"opt">> file.svg
</arg>
81 <command>systemd-analyze
</command>
82 <arg choice=
"opt" rep=
"repeat">OPTIONS
</arg>
83 <arg choice=
"plain">dot
</arg>
84 <arg choice=
"opt" rep=
"repeat"><replaceable>PATTERN
</replaceable></arg>
85 <arg choice=
"opt">> file.dot
</arg>
88 <command>systemd-analyze
</command>
89 <arg choice=
"opt" rep=
"repeat">OPTIONS
</arg>
90 <arg choice=
"plain">dump
</arg>
93 <command>systemd-analyze
</command>
94 <arg choice=
"opt" rep=
"repeat">OPTIONS
</arg>
95 <arg choice=
"plain">set-log-level
</arg>
96 <arg choice=
"plain"><replaceable>LEVEL
</replaceable></arg>
99 <command>systemd-analyze
</command>
100 <arg choice=
"opt" rep=
"repeat">OPTIONS
</arg>
101 <arg choice=
"plain">verify
</arg>
102 <arg choice=
"opt" rep=
"repeat"><replaceable>FILES
</replaceable></arg>
107 <title>Description
</title>
109 <para><command>systemd-analyze
</command> may be used to determine
110 system boot-up performance statistics and retrieve other state and
111 tracing information from the system and service manager, and to
112 verify the correctness of unit files.
</para>
114 <para><command>systemd-analyze time
</command> prints the time
115 spent in the kernel before userspace has been reached, the time
116 spent in the initial RAM disk (initrd) before normal system
117 userspace has been reached, and the time normal system userspace
118 took to initialize. Note that these measurements simply measure
119 the time passed up to the point where all system services have
120 been spawned, but not necessarily until they fully finished
121 initialization or the disk is idle.
</para>
123 <para><command>systemd-analyze blame
</command> prints a list of
124 all running units, ordered by the time they took to initialize.
125 This information may be used to optimize boot-up times. Note that
126 the output might be misleading as the initialization of one
127 service might be slow simply because it waits for the
128 initialization of another service to complete.
</para>
130 <para><command>systemd-analyze critical-chain
131 [
<replaceable>UNIT...
</replaceable>]
</command> prints a tree of
132 the time-critical chain of units (for each of the specified
133 <replaceable>UNIT
</replaceable>s or for the default target
134 otherwise). The time after the unit is active or started is
135 printed after the
"@" character. The time the unit takes to start
136 is printed after the
"+" character. Note that the output might be
137 misleading as the initialization of one service might depend on
138 socket activation and because of the parallel execution of
141 <para><command>systemd-analyze plot
</command> prints an SVG
142 graphic detailing which system services have been started at what
143 time, highlighting the time they spent on initialization.
</para>
145 <para><command>systemd-analyze dot
</command> generates textual
146 dependency graph description in dot format for further processing
148 <citerefentry project='die-net'
><refentrytitle>dot
</refentrytitle><manvolnum>1</manvolnum></citerefentry>
149 tool. Use a command line like
<command>systemd-analyze dot | dot
150 -Tsvg
> systemd.svg
</command> to generate a graphical dependency
151 tree. Unless
<option>--order
</option> or
152 <option>--require
</option> is passed, the generated graph will
153 show both ordering and requirement dependencies. Optional pattern
154 globbing style specifications (e.g.
<filename>*.target
</filename>)
155 may be given at the end. A unit dependency is included in the
156 graph if any of these patterns match either the origin or
157 destination node.
</para>
159 <para><command>systemd-analyze dump
</command> outputs a (usually
160 very long) human-readable serialization of the complete server
161 state. Its format is subject to change without notice and should
162 not be parsed by applications.
</para>
164 <para><command>systemd-analyze set-log-level
165 <replaceable>LEVEL
</replaceable></command> changes the current log
166 level of the
<command>systemd
</command> daemon to
167 <replaceable>LEVEL
</replaceable> (accepts the same values as
168 <option>--log-level=
</option> described in
169 <citerefentry><refentrytitle>systemd
</refentrytitle><manvolnum>1</manvolnum></citerefentry>).
</para>
171 <para><command>systemd-analyze set-log-target
172 <replaceable>TARGET
</replaceable></command> changes the current log
173 target of the
<command>systemd
</command> daemon to
174 <replaceable>TARGET
</replaceable> (accepts the same values as
175 <option>--log-target=
</option> described in
176 <citerefentry><refentrytitle>systemd
</refentrytitle><manvolnum>1</manvolnum></citerefentry>).
</para>
178 <para><command>systemd-analyze verify
</command> will load unit
179 files and print warnings if any errors are detected. Files
180 specified on the command line will be loaded, but also any other
181 units referenced by them. This command works by prepending the
182 directories for all command line arguments at the beginning of the
183 unit load path, which means that all units files found in those
184 directories will be used in preference to the unit files found in
185 the standard locations, even if not listed explicitly.
</para>
187 <para>If no command is passed,
<command>systemd-analyze
188 time
</command> is implied.
</para>
193 <title>Options
</title>
195 <para>The following options are understood:
</para>
199 <term><option>--user
</option></term>
201 <listitem><para>Operates on the user systemd
202 instance.
</para></listitem>
206 <term><option>--system
</option></term>
208 <listitem><para>Operates on the system systemd instance. This
209 is the implied default.
</para></listitem>
213 <term><option>--order
</option></term>
214 <term><option>--require
</option></term>
216 <listitem><para>When used in conjunction with the
217 <command>dot
</command> command (see above), selects which
218 dependencies are shown in the dependency graph. If
219 <option>--order
</option> is passed, only dependencies of type
220 <varname>After=
</varname> or
<varname>Before=
</varname> are
221 shown. If
<option>--require
</option> is passed, only
222 dependencies of type
<varname>Requires=
</varname>,
223 <varname>RequiresOverridable=
</varname>,
224 <varname>Requisite=
</varname>,
225 <varname>RequisiteOverridable=
</varname>,
226 <varname>Wants=
</varname> and
<varname>Conflicts=
</varname>
227 are shown. If neither is passed, this shows dependencies of
228 all these types.
</para></listitem>
232 <term><option>--from-pattern=
</option></term>
233 <term><option>--to-pattern=
</option></term>
235 <listitem><para>When used in conjunction with the
236 <command>dot
</command> command (see above), this selects which
237 relationships are shown in the dependency graph. Both options
239 <citerefentry project='die-net'
><refentrytitle>glob
</refentrytitle><manvolnum>7</manvolnum></citerefentry>
240 pattern as an argument, which will be matched against the
241 left-hand and the right-hand, respectively, nodes of a
244 <para>Each of these can be used more than once, in which case
245 the unit name must match one of the values. When tests for
246 both sides of the relation are present, a relation must pass
247 both tests to be shown. When patterns are also specified as
248 positional arguments, they must match at least one side of the
249 relation. In other words, patterns specified with those two
250 options will trim the list of edges matched by the positional
251 arguments, if any are given, and fully determine the list of
252 edges shown otherwise.
</para></listitem>
256 <term><option>--fuzz=
</option><replaceable>timespan
</replaceable></term>
258 <listitem><para>When used in conjunction with the
259 <command>critical-chain
</command> command (see above), also
260 show units, which finished
<replaceable>timespan
</replaceable>
261 earlier, than the latest unit in the same level. The unit of
262 <replaceable>timespan
</replaceable> is seconds unless
263 specified with a different unit, e.g.
264 "50ms".
</para></listitem>
268 <term><option>--no-man
</option></term>
270 <listitem><para>Do not invoke man to verify the existence of
271 man pages listed in
<varname>Documentation=
</varname>.
275 <xi:include href=
"user-system-options.xml" xpointer=
"host" />
276 <xi:include href=
"user-system-options.xml" xpointer=
"machine" />
278 <xi:include href=
"standard-options.xml" xpointer=
"help" />
279 <xi:include href=
"standard-options.xml" xpointer=
"version" />
280 <xi:include href=
"standard-options.xml" xpointer=
"no-pager" />
286 <title>Exit status
</title>
288 <para>On success,
0 is returned, a non-zero failure code
293 <title>Examples for
<command>dot
</command></title>
296 <title>Plots all dependencies of any unit whose name starts with
297 <literal>avahi-daemon
</literal></title>
299 <programlisting>$ systemd-analyze dot 'avahi-daemon.*' | dot -Tsvg
> avahi.svg
300 $ eog avahi.svg
</programlisting>
304 <title>Plots the dependencies between all known target units
</title>
306 <programlisting>systemd-analyze dot --to-pattern='*.target' --from-pattern='*.target' | dot -Tsvg
> targets.svg
307 $ eog targets.svg
</programlisting>
312 <title>Examples for
<command>verify
</command></title>
314 <para>The following errors are currently detected:
</para>
316 <listitem><para>unknown sections and directives,
319 <listitem><para>missing dependencies which are required to start
320 the given unit,
</para></listitem>
322 <listitem><para>man pages listed in
323 <varname>Documentation=
</varname> which are not found in the
324 system,
</para></listitem>
326 <listitem><para>commands listed in
<varname>ExecStart=
</varname>
327 and similar which are not found in the system or not
328 executable.
</para></listitem>
332 <title>Misspelt directives
</title>
334 <programlisting>$ cat ./user.slice
337 Documentation=man:nosuchfile(
1)
338 Requires=different.service
343 $ systemd-analyze verify ./user.slice
344 [./user.slice:
9] Unknown lvalue 'WhatIsThis' in section 'Unit'
345 [./user.slice:
13] Unknown section 'Service'. Ignoring.
346 Error: org.freedesktop.systemd1.LoadFailed:
347 Unit different.service failed to load:
348 No such file or directory.
349 Failed to create user.slice/start: Invalid argument
350 user.slice: man nosuchfile(
1) command failed with code
16
355 <title>Missing service units
</title>
357 <programlisting>$ tail ./a.socket ./b.socket
358 ==
> ./a.socket
<==
362 ==
> ./b.socket
<==
367 $ systemd-analyze verify ./a.socket ./b.socket
368 Service a.service not loaded, a.socket cannot be started.
369 Service b@
0.service not loaded, b.socket cannot be started.
374 <xi:include href=
"less-variables.xml" />
377 <title>See Also
</title>
379 <citerefentry><refentrytitle>systemd
</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
380 <citerefentry><refentrytitle>systemctl
</refentrytitle><manvolnum>1</manvolnum></citerefentry>