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="opt"><replaceable>LEVEL</replaceable></arg>
101 <title>Description</title>
103 <para><command>systemd-analyze</command> may be used
104 to determine system boot-up performance statistics and
105 retrieve other state and tracing information from the
106 system and service manager.</para>
108 <para><command>systemd-analyze time</command>
109 prints the time spent in the kernel before
110 userspace has been reached, the time spent in the
111 initial RAM disk (initrd) before normal system
112 userspace has been reached, and the time normal system
113 userspace took to initialize. Note that these
114 measurements simply measure the time passed up to the
115 point where all system services have been spawned, but
116 not necessarily until they fully finished
117 initialization or the disk is idle.</para>
119 <para><command>systemd-analyze blame</command> prints
120 a list of all running units, ordered by the time they
121 took to initialize. This information may be used to
122 optimize boot-up times. Note that the output might be
123 misleading as the initialization of one service might
124 be slow simply because it waits for the initialization
125 of another service to complete.</para>
127 <para><command>systemd-analyze critical-chain [<replaceable>UNIT...</replaceable>]</command>
128 prints a tree of the time-critical chain of units
129 (for each of the specified <replaceable>UNIT</replaceable>s
130 or for the default target otherwise).
131 The time after the unit is active or started is printed
132 after the "@" character. The time the unit takes to
133 start is printed after the "+" character.
134 Note that the output might be misleading as the
135 initialization of one service might depend on socket
136 activation and because of the parallel execution
139 <para><command>systemd-analyze plot</command> prints
140 an SVG graphic detailing which system services have
141 been started at what time, highlighting the time they
142 spent on initialization.</para>
144 <para><command>systemd-analyze dot</command> generates
145 textual dependency graph description in dot format for
146 further processing with the GraphViz
147 <citerefentry><refentrytitle>dot</refentrytitle><manvolnum>1</manvolnum></citerefentry>
148 tool. Use a command line like <command>systemd-analyze
149 dot | dot -Tsvg > systemd.svg</command> to generate a
150 graphical dependency tree. Unless
151 <option>--order</option> or <option>--require</option>
152 is passed, the generated graph will show both ordering
153 and requirement dependencies. Optional pattern
154 globbing style specifications
155 (e.g. <filename>*.target</filename>) may be given at
156 the end. A unit dependency is included in the graph if
157 any of these patterns match either the origin or
158 destination node.</para>
160 <para><command>systemd-analyze dump</command> outputs
161 a (usually very long) human-readable serialization of
162 the complete server state. Its format is subject to
163 change without notice and should not be parsed by
166 <para><command>systemd-analyze set-log-level
167 <replaceable>LEVEL</replaceable></command> changes the
168 current log level of the <command>systemd</command>
169 daemon to <replaceable>LEVEL</replaceable> (accepts
170 the same values as <option>--log-level=</option>
172 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>).</para>
174 <para>If no command is passed, <command>systemd-analyze
175 time</command> is implied.</para>
180 <title>Options</title>
182 <para>The following options are understood:</para>
186 <term><option>-h</option></term>
187 <term><option>--help</option></term>
189 <listitem><para>Prints a short help
190 text and exits.</para></listitem>
194 <term><option>--user</option></term>
196 <listitem><para>Shows performance data
197 of user sessions instead of the system
198 manager.</para></listitem>
202 <term><option>--system</option></term>
204 <listitem><para>Shows performance data
205 of the system manager. This is the
206 implied default.</para></listitem>
210 <term><option>-H</option></term>
211 <term><option>--host=</option></term>
213 <listitem><para>Execute the operation
214 remotely. Specify a hostname, or
215 username and hostname separated by
216 <literal>@</literal>, to connect
217 to. This will use SSH to talk to the
218 remote machine manager
219 instance.</para></listitem>
223 <term><option>-M</option></term>
224 <term><option>--machine=</option></term>
226 <listitem><para>Execute the operation on a
227 local container. Specify a container
228 name to connect to.</para></listitem>
232 <term><option>--order</option></term>
233 <term><option>--require</option></term>
235 <listitem><para>When used in
237 <command>dot</command> command (see
238 above), selects which dependencies are
239 shown in the dependency graph. If
240 <option>--order</option> is passed,
241 only dependencies of type
242 <varname>After=</varname> or
243 <varname>Before=</varname> are
244 shown. If <option>--require</option>
245 is passed, only dependencies of type
246 <varname>Requires=</varname>,
247 <varname>RequiresOverridable=</varname>,
248 <varname>Requisite=</varname>,
249 <varname>RequisiteOverridable=</varname>,
250 <varname>Wants=</varname> and
251 <varname>Conflicts=</varname> are
252 shown. If neither is passed, this shows
253 dependencies of all these
254 types.</para></listitem>
258 <term><option>--from-pattern=</option></term>
259 <term><option>--to-pattern=</option></term>
261 <listitem><para>When used in
263 <command>dot</command> command (see
264 above), this selects which relationships
265 are shown in the dependency graph.
267 <citerefentry><refentrytitle>glob</refentrytitle><manvolnum>7</manvolnum></citerefentry>
268 patterns as arguments, which are
269 matched against left-hand and
270 right-hand, respectively, nodes of a
271 relationship. Each of these can be
272 used more than once, which means a
273 unit name must match one of the given
274 values.</para></listitem>
278 <term><option>--fuzz=</option><replaceable>timespan</replaceable></term>
280 <listitem><para>When used in conjunction
281 with the <command>critical-chain</command>
282 command (see above), also show units, which
283 finished <replaceable>timespan</replaceable> earlier, than the
284 latest unit in the same level. The unit of
285 <replaceable>timespan</replaceable> is seconds
286 unless specified with a different unit,
287 e.g. "50ms".</para></listitem>
291 <term><option>--no-pager</option></term>
294 <para>Do not pipe output into a pager.</para>
302 <title>Exit status</title>
304 <para>On success, 0 is returned, a non-zero failure
305 code otherwise.</para>
309 <title>Examples</title>
311 <para>This plots all dependencies of any unit whose
312 name starts with <literal>avahi-daemon.</literal>:</para>
314 <programlisting>$ systemd-analyze dot 'avahi-daemon.*' | dot -Tsvg > avahi.svg
315 $ eog avahi.svg</programlisting>
317 <para>This plots the dependencies between all known target units:</para>
319 <programlisting>systemd-analyze dot --to-pattern='*.target' --from-pattern='*.target' | dot -Tsvg > targets.svg
320 $ eog targets.svg</programlisting>
325 <xi:include href="less-variables.xml" />
328 <title>See Also</title>
330 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
331 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>