]> git.ipfire.org Git - thirdparty/systemd.git/blame_incremental - man/systemd-analyze.xml
NEWS update
[thirdparty/systemd.git] / man / systemd-analyze.xml
... / ...
CommitLineData
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
5<!--
6 This file is part of systemd.
7
8 Copyright 2012 Lennart Poettering
9
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.
14
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.
19
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/>.
22-->
23
24<refentry id="systemd-analyze"
25 xmlns:xi="http://www.w3.org/2001/XInclude">
26
27 <refentryinfo>
28 <title>systemd-analyze</title>
29 <productname>systemd</productname>
30
31 <authorgroup>
32 <author>
33 <contrib>Developer</contrib>
34 <firstname>Lennart</firstname>
35 <surname>Poettering</surname>
36 <email>lennart@poettering.net</email>
37 </author>
38 <author>
39 <contrib>Developer</contrib>
40 <firstname>Harald</firstname>
41 <surname>Hoyer</surname>
42 <email>harald@redhat.com</email>
43 </author>
44 </authorgroup>
45 </refentryinfo>
46
47 <refmeta>
48 <refentrytitle>systemd-analyze</refentrytitle>
49 <manvolnum>1</manvolnum>
50 </refmeta>
51
52 <refnamediv>
53 <refname>systemd-analyze</refname>
54 <refpurpose>Analyze system boot-up performance</refpurpose>
55 </refnamediv>
56
57 <refsynopsisdiv>
58 <cmdsynopsis>
59 <command>systemd-analyze</command>
60 <arg choice="opt" rep="repeat">OPTIONS</arg>
61 <arg>time</arg>
62 </cmdsynopsis>
63 <cmdsynopsis>
64 <command>systemd-analyze</command>
65 <arg choice="opt" rep="repeat">OPTIONS</arg>
66 <arg choice="plain">blame</arg>
67 </cmdsynopsis>
68 <cmdsynopsis>
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>
73 </cmdsynopsis>
74 <cmdsynopsis>
75 <command>systemd-analyze</command>
76 <arg choice="opt" rep="repeat">OPTIONS</arg>
77 <arg choice="plain">plot</arg>
78 <arg choice="opt">&gt; file.svg</arg>
79 </cmdsynopsis>
80 <cmdsynopsis>
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">&gt; file.dot</arg>
86 </cmdsynopsis>
87 <cmdsynopsis>
88 <command>systemd-analyze</command>
89 <arg choice="opt" rep="repeat">OPTIONS</arg>
90 <arg choice="plain">dump</arg>
91 </cmdsynopsis>
92 <cmdsynopsis>
93 <command>systemd-analyze</command>
94 <arg choice="opt" rep="repeat">OPTIONS</arg>
95 <arg choice="plain">set-log-level</arg>
96 <arg choice="opt"><replaceable>LEVEL</replaceable></arg>
97 </cmdsynopsis>
98 <cmdsynopsis>
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>
103 </cmdsynopsis>
104 </refsynopsisdiv>
105
106 <refsect1>
107 <title>Description</title>
108
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>
113
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>
122
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>
129
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
139 units.</para>
140
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>
144
145 <para><command>systemd-analyze dot</command> generates textual
146 dependency graph description in dot format for further processing
147 with the GraphViz
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>
158
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>
163
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>
170
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>
177
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>
186
187 <para>If no command is passed, <command>systemd-analyze
188 time</command> is implied.</para>
189
190 </refsect1>
191
192 <refsect1>
193 <title>Options</title>
194
195 <para>The following options are understood:</para>
196
197 <variablelist>
198 <varlistentry>
199 <term><option>--user</option></term>
200
201 <listitem><para>Operates on the user systemd
202 instance.</para></listitem>
203 </varlistentry>
204
205 <varlistentry>
206 <term><option>--system</option></term>
207
208 <listitem><para>Operates on the system systemd instance. This
209 is the implied default.</para></listitem>
210 </varlistentry>
211
212 <varlistentry>
213 <term><option>--order</option></term>
214 <term><option>--require</option></term>
215
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>
229 </varlistentry>
230
231 <varlistentry>
232 <term><option>--from-pattern=</option></term>
233 <term><option>--to-pattern=</option></term>
234
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
238 require a
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
242 relationship.</para>
243
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>
253 </varlistentry>
254
255 <varlistentry>
256 <term><option>--fuzz=</option><replaceable>timespan</replaceable></term>
257
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>
265 </varlistentry>
266
267 <varlistentry>
268 <term><option>--no-man</option></term>
269
270 <listitem><para>Do not invoke man to verify the existence of
271 man pages listed in <varname>Documentation=</varname>.
272 </para></listitem>
273 </varlistentry>
274
275 <xi:include href="user-system-options.xml" xpointer="host" />
276 <xi:include href="user-system-options.xml" xpointer="machine" />
277
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" />
281 </variablelist>
282
283 </refsect1>
284
285 <refsect1>
286 <title>Exit status</title>
287
288 <para>On success, 0 is returned, a non-zero failure code
289 otherwise.</para>
290 </refsect1>
291
292 <refsect1>
293 <title>Examples for <command>dot</command></title>
294
295 <example>
296 <title>Plots all dependencies of any unit whose name starts with
297 <literal>avahi-daemon</literal></title>
298
299 <programlisting>$ systemd-analyze dot 'avahi-daemon.*' | dot -Tsvg > avahi.svg
300 $ eog avahi.svg</programlisting>
301 </example>
302
303 <example>
304 <title>Plots the dependencies between all known target units</title>
305
306 <programlisting>systemd-analyze dot --to-pattern='*.target' --from-pattern='*.target' | dot -Tsvg > targets.svg
307$ eog targets.svg</programlisting>
308 </example>
309 </refsect1>
310
311 <refsect1>
312 <title>Examples for <command>verify</command></title>
313
314 <para>The following errors are currently detected:</para>
315 <itemizedlist>
316 <listitem><para>unknown sections and directives,
317 </para></listitem>
318
319 <listitem><para>missing dependencies which are required to start
320 the given unit, </para></listitem>
321
322 <listitem><para>man pages listed in
323 <varname>Documentation=</varname> which are not found in the
324 system,</para></listitem>
325
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>
329 </itemizedlist>
330
331 <example>
332 <title>Misspelt directives</title>
333
334 <programlisting>$ cat ./user.slice
335[Unit]
336WhatIsThis=11
337Documentation=man:nosuchfile(1)
338Requires=different.service
339
340[Service]
341Desription=x
342
343$ systemd-analyze verify ./user.slice
344[./user.slice:9] Unknown lvalue 'WhatIsThis' in section 'Unit'
345[./user.slice:13] Unknown section 'Service'. Ignoring.
346Error: org.freedesktop.systemd1.LoadFailed:
347 Unit different.service failed to load:
348 No such file or directory.
349Failed to create user.slice/start: Invalid argument
350user.slice: man nosuchfile(1) command failed with code 16
351 </programlisting>
352 </example>
353
354 <example>
355 <title>Missing service units</title>
356
357 <programlisting>$ tail ./a.socket ./b.socket
358==> ./a.socket &lt;==
359[Socket]
360ListenStream=100
361
362==> ./b.socket &lt;==
363[Socket]
364ListenStream=100
365Accept=yes
366
367$ systemd-analyze verify ./a.socket ./b.socket
368Service a.service not loaded, a.socket cannot be started.
369Service b@0.service not loaded, b.socket cannot be started.
370 </programlisting>
371 </example>
372 </refsect1>
373
374 <xi:include href="less-variables.xml" />
375
376 <refsect1>
377 <title>See Also</title>
378 <para>
379 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
380 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>
381 </para>
382 </refsect1>
383
384</refentry>