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">
27 <title>systemd-analyze</title>
28 <productname>systemd</productname>
32 <contrib>Developer</contrib>
33 <firstname>Lennart</firstname>
34 <surname>Poettering</surname>
35 <email>lennart@poettering.net</email>
38 <contrib>Developer</contrib>
39 <firstname>Harald</firstname>
40 <surname>Hoyer</surname>
41 <email>harald@redhat.com</email>
47 <refentrytitle>systemd-analyze</refentrytitle>
48 <manvolnum>1</manvolnum>
52 <refname>systemd-analyze</refname>
53 <refpurpose>Analyze system boot-up performance</refpurpose>
58 <command>systemd-analyze <arg choice="opt" rep="repeat">OPTIONS</arg> time</command>
61 <command>systemd-analyze <arg choice="opt" rep="repeat">OPTIONS</arg> blame </command>
64 <command>systemd-analyze <arg choice="opt" rep="repeat">OPTIONS</arg> critical-chain </command>
67 <command>systemd-analyze <arg choice="opt" rep="repeat">OPTIONS</arg> plot <arg choice="opt">> file.svg</arg></command>
70 <command>systemd-analyze <arg choice="opt" rep="repeat">OPTIONS</arg> dot <arg choice="opt">pattern...</arg> </command>
75 <title>Description</title>
77 <para><command>systemd-analyze</command> may be used
78 to determine system boot-up performance of the current
81 <para><command>systemd-analyze time</command>
82 prints the time spent in the kernel before
83 userspace has been reached, the time spent in the
84 initial RAM disk (initrd) before normal system
85 userspace has been reached and the time normal system
86 userspace took to initialize. Note that these
87 measurements simply measure the time passed up to the
88 point where all system services have been spawned, but
89 not necessarily until they fully finished
90 initialization or the disk is idle.</para>
92 <para><command>systemd-analyze blame</command> prints
93 a list of all running units, ordered by the time they
94 took to initialize. This information may be used to
95 optimize boot-up times. Note that the output might be
96 misleading as the initialization of one service might
97 be slow simply because it waits for the initialization
98 of another service to complete.</para>
100 <para><command>systemd-analyze critical-chain</command>
101 prints a tree of the time critical chain of units.
102 The time after the unit is active or started is printed
103 after the "@" character. The time the unit takes to
104 start is printed after the "+" character.
105 Note that the output might be misleading as the
106 initialization of one service might depend on socket
107 activation and because of the parallel execution
110 <para><command>systemd-analyze plot</command> prints
111 an SVG graphic detailing which system services have
112 been started at what time, highlighting the time they
113 spent on initialization.</para>
115 <para><command>systemd-analyze dot</command> Generate
116 textual dependency graph description in dot format for
117 further processing with the GraphViz
118 <citerefentry><refentrytitle>dot</refentrytitle><manvolnum>1</manvolnum></citerefentry>
119 tool. Use a command line like <command>systemd-analyze
120 dot | dot -Tsvg > systemd.svg</command> to generate a
121 graphical dependency tree. Unless
122 <option>--order</option> or <option>--require</option>
123 is passed the generated graph will show both ordering
124 and requirement dependencies. Optional pattern
125 globbing style specifications
126 (e.g. <filename>*.target</filename>) may be given at
127 the end. A unit dependency is included in the graph if
128 any of these patterns match either the origin or
129 destination node.</para>
131 <para>If no command is passed <command>systemd-analyze
132 time</command> is implied.</para>
137 <title>Options</title>
139 <para>The following options are understood:</para>
143 <term><option>-h</option></term>
144 <term><option>--help</option></term>
146 <listitem><para>Prints a short help
147 text and exits.</para></listitem>
151 <term><option>--user</option></term>
153 <listitem><para>Shows performance data
154 of user sessions instead of the system
155 manager.</para></listitem>
159 <term><option>--order</option></term>
160 <term><option>--require</option></term>
162 <listitem><para>When used in
164 <command>dot</command> command (see
165 above), selects which dependencies are
166 shown in the dependency graph. If
167 <option>--order</option> is passed
168 only dependencies of type
169 <varname>After=</varname> or
170 <varname>Before=</varname> are
171 shown. If <option>--require</option>
172 is passed only dependencies of type
173 <varname>Requires=</varname>,
174 <varname>RequiresOverridable=</varname>,
175 <varname>Requisite=</varname>,
176 <varname>RequisiteOverridable=</varname>,
177 <varname>Wants=</varname> and
178 <varname>Conflicts=</varname> are
179 shown. If neither is passed, shows
180 dependencies of all these
181 types.</para></listitem>
185 <term><option>--from-pattern=</option></term>
186 <term><option>--to-pattern=</option></term>
188 <listitem><para>When used in
190 <command>dot</command> command (see
191 above), selects which relationships
192 are shown in the dependency graph.
194 <citerefentry><refentrytitle>glob</refentrytitle><manvolnum>7</manvolnum></citerefentry>
195 patterns as arguments, which are
196 matched against lefthand and
197 righthand, respectively, nodes of a
198 relationship. Each of these can be
199 used more than once which means a
200 unit name must match one of given
201 values.</para></listitem>
205 <term><option>--fuzz=</option><replaceable>timespan</replaceable></term>
207 <listitem><para>When used in conjunction
208 with the <command>critical-chain</command>
209 command (see above), also show units, which
210 finished <replaceable>timespan</replaceable> earlier, than the
211 latest unit in the same level. The unit of
212 <replaceable>timespan</replaceable> is seconds
213 unless specified with a different unit,
214 i.e. "50ms".</para></listitem>
221 <title>Exit status</title>
223 <para>On success 0 is returned, a non-zero failure
224 code otherwise.</para>
228 <title>Examples</title>
230 <para>This plots all dependencies of any unit whose
231 name starts with "<literal>avahi-daemon.</literal>":</para>
233 <programlisting>$ systemd-analyze dot 'avahi-daemon.*' | dot -Tsvg > avahi.svg
234 $ eog avahi.svg</programlisting>
236 <para>This plots the dependencies between all known target units:</para>
238 <programlisting>systemd-analyze dot --to-pattern='*.target' --from-patter='*.target' | dot -Tsvg > targets.svg
239 $ eog targets.svg</programlisting>
245 <title>See Also</title>
247 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
248 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>