]>
Commit | Line | Data |
---|---|---|
359deb60 LP |
1 | <?xml version='1.0'?> <!--*-nxml-*--> |
2 | <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" | |
681eb9cf FB |
3 | "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [ |
4 | <!ENTITY % entities SYSTEM "custom-entities.ent" > | |
5 | %entities; | |
6 | ]> | |
359deb60 LP |
7 | |
8 | <!-- | |
9 | This file is part of systemd. | |
10 | ||
11 | Copyright 2012 Lennart Poettering | |
12 | ||
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. | |
17 | ||
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. | |
22 | ||
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/>. | |
25 | --> | |
26 | ||
21ac6ff1 | 27 | <refentry id="systemd-analyze" |
798d3a52 ZJS |
28 | xmlns:xi="http://www.w3.org/2001/XInclude"> |
29 | ||
30 | <refentryinfo> | |
31 | <title>systemd-analyze</title> | |
32 | <productname>systemd</productname> | |
33 | ||
34 | <authorgroup> | |
35 | <author> | |
36 | <contrib>Developer</contrib> | |
37 | <firstname>Lennart</firstname> | |
38 | <surname>Poettering</surname> | |
39 | <email>lennart@poettering.net</email> | |
40 | </author> | |
41 | <author> | |
42 | <contrib>Developer</contrib> | |
43 | <firstname>Harald</firstname> | |
44 | <surname>Hoyer</surname> | |
45 | <email>harald@redhat.com</email> | |
46 | </author> | |
47 | </authorgroup> | |
48 | </refentryinfo> | |
49 | ||
50 | <refmeta> | |
51 | <refentrytitle>systemd-analyze</refentrytitle> | |
52 | <manvolnum>1</manvolnum> | |
53 | </refmeta> | |
54 | ||
55 | <refnamediv> | |
56 | <refname>systemd-analyze</refname> | |
57 | <refpurpose>Analyze system boot-up performance</refpurpose> | |
58 | </refnamediv> | |
59 | ||
60 | <refsynopsisdiv> | |
61 | <cmdsynopsis> | |
62 | <command>systemd-analyze</command> | |
63 | <arg choice="opt" rep="repeat">OPTIONS</arg> | |
64 | <arg>time</arg> | |
65 | </cmdsynopsis> | |
66 | <cmdsynopsis> | |
67 | <command>systemd-analyze</command> | |
68 | <arg choice="opt" rep="repeat">OPTIONS</arg> | |
69 | <arg choice="plain">blame</arg> | |
70 | </cmdsynopsis> | |
71 | <cmdsynopsis> | |
72 | <command>systemd-analyze</command> | |
73 | <arg choice="opt" rep="repeat">OPTIONS</arg> | |
74 | <arg choice="plain">critical-chain</arg> | |
75 | <arg choice="opt" rep="repeat"><replaceable>UNIT</replaceable></arg> | |
76 | </cmdsynopsis> | |
77 | <cmdsynopsis> | |
78 | <command>systemd-analyze</command> | |
79 | <arg choice="opt" rep="repeat">OPTIONS</arg> | |
80 | <arg choice="plain">plot</arg> | |
81 | <arg choice="opt">> file.svg</arg> | |
82 | </cmdsynopsis> | |
83 | <cmdsynopsis> | |
84 | <command>systemd-analyze</command> | |
85 | <arg choice="opt" rep="repeat">OPTIONS</arg> | |
86 | <arg choice="plain">dot</arg> | |
87 | <arg choice="opt" rep="repeat"><replaceable>PATTERN</replaceable></arg> | |
88 | <arg choice="opt">> file.dot</arg> | |
89 | </cmdsynopsis> | |
90 | <cmdsynopsis> | |
91 | <command>systemd-analyze</command> | |
92 | <arg choice="opt" rep="repeat">OPTIONS</arg> | |
93 | <arg choice="plain">dump</arg> | |
94 | </cmdsynopsis> | |
95 | <cmdsynopsis> | |
96 | <command>systemd-analyze</command> | |
97 | <arg choice="opt" rep="repeat">OPTIONS</arg> | |
98 | <arg choice="plain">set-log-level</arg> | |
99 | <arg choice="opt"><replaceable>LEVEL</replaceable></arg> | |
100 | </cmdsynopsis> | |
101 | <cmdsynopsis> | |
102 | <command>systemd-analyze</command> | |
103 | <arg choice="opt" rep="repeat">OPTIONS</arg> | |
104 | <arg choice="plain">verify</arg> | |
105 | <arg choice="opt" rep="repeat"><replaceable>FILES</replaceable></arg> | |
106 | </cmdsynopsis> | |
107 | </refsynopsisdiv> | |
108 | ||
109 | <refsect1> | |
110 | <title>Description</title> | |
111 | ||
112 | <para><command>systemd-analyze</command> may be used to determine | |
113 | system boot-up performance statistics and retrieve other state and | |
114 | tracing information from the system and service manager, and to | |
115 | verify the correctness of unit files.</para> | |
116 | ||
117 | <para><command>systemd-analyze time</command> prints the time | |
118 | spent in the kernel before userspace has been reached, the time | |
119 | spent in the initial RAM disk (initrd) before normal system | |
120 | userspace has been reached, and the time normal system userspace | |
121 | took to initialize. Note that these measurements simply measure | |
122 | the time passed up to the point where all system services have | |
123 | been spawned, but not necessarily until they fully finished | |
124 | initialization or the disk is idle.</para> | |
125 | ||
126 | <para><command>systemd-analyze blame</command> prints a list of | |
127 | all running units, ordered by the time they took to initialize. | |
128 | This information may be used to optimize boot-up times. Note that | |
129 | the output might be misleading as the initialization of one | |
130 | service might be slow simply because it waits for the | |
131 | initialization of another service to complete.</para> | |
132 | ||
133 | <para><command>systemd-analyze critical-chain | |
134 | [<replaceable>UNIT...</replaceable>]</command> prints a tree of | |
135 | the time-critical chain of units (for each of the specified | |
136 | <replaceable>UNIT</replaceable>s or for the default target | |
137 | otherwise). The time after the unit is active or started is | |
138 | printed after the "@" character. The time the unit takes to start | |
139 | is printed after the "+" character. Note that the output might be | |
140 | misleading as the initialization of one service might depend on | |
141 | socket activation and because of the parallel execution of | |
142 | units.</para> | |
143 | ||
144 | <para><command>systemd-analyze plot</command> prints an SVG | |
145 | graphic detailing which system services have been started at what | |
146 | time, highlighting the time they spent on initialization.</para> | |
147 | ||
148 | <para><command>systemd-analyze dot</command> generates textual | |
149 | dependency graph description in dot format for further processing | |
150 | with the GraphViz | |
3ba3a79d | 151 | <citerefentry project='die-net'><refentrytitle>dot</refentrytitle><manvolnum>1</manvolnum></citerefentry> |
798d3a52 ZJS |
152 | tool. Use a command line like <command>systemd-analyze dot | dot |
153 | -Tsvg > systemd.svg</command> to generate a graphical dependency | |
154 | tree. Unless <option>--order</option> or | |
155 | <option>--require</option> is passed, the generated graph will | |
156 | show both ordering and requirement dependencies. Optional pattern | |
157 | globbing style specifications (e.g. <filename>*.target</filename>) | |
158 | may be given at the end. A unit dependency is included in the | |
159 | graph if any of these patterns match either the origin or | |
160 | destination node.</para> | |
161 | ||
162 | <para><command>systemd-analyze dump</command> outputs a (usually | |
163 | very long) human-readable serialization of the complete server | |
164 | state. Its format is subject to change without notice and should | |
165 | not be parsed by applications.</para> | |
166 | ||
167 | <para><command>systemd-analyze set-log-level | |
168 | <replaceable>LEVEL</replaceable></command> changes the current log | |
169 | level of the <command>systemd</command> daemon to | |
170 | <replaceable>LEVEL</replaceable> (accepts the same values as | |
171 | <option>--log-level=</option> described in | |
172 | <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>).</para> | |
173 | ||
174 | <para><command>systemd-analyze verify</command> will load unit | |
175 | files and print warnings if any errors are detected. Files | |
176 | specified on the command line will be loaded, but also any other | |
177 | units referenced by them. This command works by prepending the | |
178 | directories for all command line arguments at the beginning of the | |
179 | unit load path, which means that all units files found in those | |
180 | directories will be used in preference to the unit files found in | |
181 | the standard locations, even if not listed explicitly.</para> | |
182 | ||
183 | <para>If no command is passed, <command>systemd-analyze | |
184 | time</command> is implied.</para> | |
185 | ||
186 | </refsect1> | |
187 | ||
188 | <refsect1> | |
189 | <title>Options</title> | |
190 | ||
191 | <para>The following options are understood:</para> | |
192 | ||
193 | <variablelist> | |
194 | <varlistentry> | |
195 | <term><option>--user</option></term> | |
196 | ||
197 | <listitem><para>Operates on the user systemd | |
198 | instance.</para></listitem> | |
199 | </varlistentry> | |
200 | ||
201 | <varlistentry> | |
202 | <term><option>--system</option></term> | |
203 | ||
204 | <listitem><para>Operates on the system systemd instance. This | |
205 | is the implied default.</para></listitem> | |
206 | </varlistentry> | |
207 | ||
208 | <varlistentry> | |
209 | <term><option>--order</option></term> | |
210 | <term><option>--require</option></term> | |
211 | ||
212 | <listitem><para>When used in conjunction with the | |
213 | <command>dot</command> command (see above), selects which | |
214 | dependencies are shown in the dependency graph. If | |
215 | <option>--order</option> is passed, only dependencies of type | |
216 | <varname>After=</varname> or <varname>Before=</varname> are | |
217 | shown. If <option>--require</option> is passed, only | |
218 | dependencies of type <varname>Requires=</varname>, | |
219 | <varname>RequiresOverridable=</varname>, | |
220 | <varname>Requisite=</varname>, | |
221 | <varname>RequisiteOverridable=</varname>, | |
222 | <varname>Wants=</varname> and <varname>Conflicts=</varname> | |
223 | are shown. If neither is passed, this shows dependencies of | |
224 | all these types.</para></listitem> | |
225 | </varlistentry> | |
226 | ||
227 | <varlistentry> | |
228 | <term><option>--from-pattern=</option></term> | |
229 | <term><option>--to-pattern=</option></term> | |
230 | ||
231 | <listitem><para>When used in conjunction with the | |
232 | <command>dot</command> command (see above), this selects which | |
6ecb6cec ZJS |
233 | relationships are shown in the dependency graph. Both options |
234 | require a | |
3ba3a79d | 235 | <citerefentry project='die-net'><refentrytitle>glob</refentrytitle><manvolnum>7</manvolnum></citerefentry> |
6ecb6cec ZJS |
236 | pattern as an argument, which will be matched against the |
237 | left-hand and the right-hand, respectively, nodes of a | |
238 | relationship.</para> | |
239 | ||
240 | <para>Each of these can be used more than once, in which case | |
241 | the unit name must match one of the values. When tests for | |
242 | both sides of the relation are present, a relation must pass | |
243 | both tests to be shown. When patterns are also specified as | |
244 | positional arguments, they must match at least one side of the | |
245 | relation. In other words, patterns specified with those two | |
246 | options will trim the list of edges matched by the positional | |
247 | arguments, if any are given, and fully determine the list of | |
248 | edges shown otherwise.</para></listitem> | |
798d3a52 ZJS |
249 | </varlistentry> |
250 | ||
251 | <varlistentry> | |
252 | <term><option>--fuzz=</option><replaceable>timespan</replaceable></term> | |
253 | ||
254 | <listitem><para>When used in conjunction with the | |
255 | <command>critical-chain</command> command (see above), also | |
256 | show units, which finished <replaceable>timespan</replaceable> | |
257 | earlier, than the latest unit in the same level. The unit of | |
258 | <replaceable>timespan</replaceable> is seconds unless | |
259 | specified with a different unit, e.g. | |
260 | "50ms".</para></listitem> | |
261 | </varlistentry> | |
262 | ||
263 | <varlistentry> | |
264 | <term><option>--no-man</option></term> | |
265 | ||
266 | <listitem><para>Do not invoke man to verify the existence of | |
6ecb6cec | 267 | man pages listed in <varname>Documentation=</varname>. |
798d3a52 ZJS |
268 | </para></listitem> |
269 | </varlistentry> | |
270 | ||
271 | <xi:include href="user-system-options.xml" xpointer="host" /> | |
272 | <xi:include href="user-system-options.xml" xpointer="machine" /> | |
273 | ||
274 | <xi:include href="standard-options.xml" xpointer="help" /> | |
275 | <xi:include href="standard-options.xml" xpointer="version" /> | |
276 | <xi:include href="standard-options.xml" xpointer="no-pager" /> | |
277 | </variablelist> | |
278 | ||
279 | </refsect1> | |
280 | ||
281 | <refsect1> | |
282 | <title>Exit status</title> | |
283 | ||
284 | <para>On success, 0 is returned, a non-zero failure code | |
285 | otherwise.</para> | |
286 | </refsect1> | |
287 | ||
288 | <refsect1> | |
289 | <title>Examples for <command>dot</command></title> | |
290 | ||
291 | <example> | |
292 | <title>Plots all dependencies of any unit whose name starts with | |
293 | <literal>avahi-daemon</literal></title> | |
294 | ||
295 | <programlisting>$ systemd-analyze dot 'avahi-daemon.*' | dot -Tsvg > avahi.svg | |
296 | $ eog avahi.svg</programlisting> | |
297 | </example> | |
298 | ||
299 | <example> | |
300 | <title>Plots the dependencies between all known target units</title> | |
301 | ||
302 | <programlisting>systemd-analyze dot --to-pattern='*.target' --from-pattern='*.target' | dot -Tsvg > targets.svg | |
816f25e8 | 303 | $ eog targets.svg</programlisting> |
798d3a52 ZJS |
304 | </example> |
305 | </refsect1> | |
816f25e8 | 306 | |
798d3a52 ZJS |
307 | <refsect1> |
308 | <title>Examples for <command>verify</command></title> | |
142c4eca | 309 | |
798d3a52 ZJS |
310 | <para>The following errors are currently detected:</para> |
311 | <itemizedlist> | |
312 | <listitem><para>unknown sections and directives, | |
313 | </para></listitem> | |
142c4eca | 314 | |
798d3a52 ZJS |
315 | <listitem><para>missing dependencies which are required to start |
316 | the given unit, </para></listitem> | |
142c4eca | 317 | |
798d3a52 ZJS |
318 | <listitem><para>man pages listed in |
319 | <varname>Documentation=</varname> which are not found in the | |
320 | system,</para></listitem> | |
142c4eca | 321 | |
798d3a52 ZJS |
322 | <listitem><para>commands listed in <varname>ExecStart=</varname> |
323 | and similar which are not found in the system or not | |
324 | executable.</para></listitem> | |
325 | </itemizedlist> | |
142c4eca | 326 | |
798d3a52 ZJS |
327 | <example> |
328 | <title>Misspelt directives</title> | |
142c4eca | 329 | |
798d3a52 | 330 | <programlisting>$ cat ./user.slice |
142c4eca ZJS |
331 | [Unit] |
332 | WhatIsThis=11 | |
333 | Documentation=man:nosuchfile(1) | |
334 | Requires=different.service | |
335 | ||
336 | [Service] | |
337 | Desription=x | |
338 | ||
ee9c4ff4 | 339 | $ systemd-analyze verify ./user.slice |
142c4eca ZJS |
340 | [./user.slice:9] Unknown lvalue 'WhatIsThis' in section 'Unit' |
341 | [./user.slice:13] Unknown section 'Service'. Ignoring. | |
342 | Error: org.freedesktop.systemd1.LoadFailed: | |
798d3a52 ZJS |
343 | Unit different.service failed to load: |
344 | No such file or directory. | |
142c4eca ZJS |
345 | Failed to create user.slice/start: Invalid argument |
346 | user.slice: man nosuchfile(1) command failed with code 16 | |
798d3a52 ZJS |
347 | </programlisting> |
348 | </example> | |
142c4eca | 349 | |
798d3a52 ZJS |
350 | <example> |
351 | <title>Missing service units</title> | |
142c4eca | 352 | |
798d3a52 | 353 | <programlisting>$ tail ./a.socket ./b.socket |
142c4eca ZJS |
354 | ==> ./a.socket <== |
355 | [Socket] | |
356 | ListenStream=100 | |
357 | ||
358 | ==> ./b.socket <== | |
359 | [Socket] | |
360 | ListenStream=100 | |
361 | Accept=yes | |
362 | ||
ee9c4ff4 | 363 | $ systemd-analyze verify ./a.socket ./b.socket |
142c4eca ZJS |
364 | Service a.service not loaded, a.socket cannot be started. |
365 | Service b@0.service not loaded, b.socket cannot be started. | |
798d3a52 ZJS |
366 | </programlisting> |
367 | </example> | |
368 | </refsect1> | |
369 | ||
370 | <xi:include href="less-variables.xml" /> | |
371 | ||
372 | <refsect1> | |
373 | <title>See Also</title> | |
374 | <para> | |
375 | <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
376 | <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry> | |
377 | </para> | |
378 | </refsect1> | |
359deb60 LP |
379 | |
380 | </refentry> |