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>
41 <refentrytitle>systemd-analyze</refentrytitle>
42 <manvolnum>1</manvolnum>
46 <refname>systemd-analyze</refname>
47 <refpurpose>Analyze system boot-up performance</refpurpose>
52 <command>systemd-analyze <arg choice="opt" rep="repeat">OPTIONS</arg> time</command>
55 <command>systemd-analyze <arg choice="opt" rep="repeat">OPTIONS</arg> blame </command>
58 <command>systemd-analyze <arg choice="opt" rep="repeat">OPTIONS</arg> plot <arg choice="opt">> file.svg</arg></command>
61 <command>systemd-analyze <arg choice="opt" rep="repeat">OPTIONS</arg> dot <arg choice="opt">pattern...</arg> </command>
66 <title>Description</title>
68 <para><command>systemd-analyze</command> may be used
69 to determine system boot-up performance of the current
72 <para><command>systemd-analyze time</command>
73 prints the time spent in the kernel before
74 userspace has been reached, the time spent in the
75 initial RAM disk (initrd) before normal system
76 userspace has been reached and the time normal system
77 userspace took to initialize. Note that these
78 measurements simply measure the time passed up to the
79 point where all system services have been spawned, but
80 not necessarily until they fully finished
81 initialization or the disk is idle.</para>
83 <para><command>systemd-analyze blame</command> prints
84 a list of all running units, ordered by the time they
85 took to initialize. This information may be used to
86 optimize boot-up times. Note that the output might be
87 misleading as the initialization of one service might
88 be slow simply because it waits for the initialization
89 of another service to complete.</para>
91 <para><command>systemd-analyze plot</command> prints
92 an SVG graphic detailing which system services have
93 been started at what time, highlighting the time they
94 spent on initialization.</para>
96 <para><command>systemd-analyze dot</command> Generate
97 textual dependency graph description in dot format for
98 further processing with the GraphViz
99 <citerefentry><refentrytitle>dot</refentrytitle><manvolnum>1</manvolnum></citerefentry>
100 tool. Use a command line like <command>systemd-analyze
101 dot | dot -Tsvg > systemd.svg</command> to generate a
102 graphical dependency tree. Unless
103 <option>--order</option> or <option>--require</option>
104 is passed the generated graph will show both ordering
105 and requirement dependencies. Optional pattern
106 globbing style specifications
107 (e.g. <filename>*.target</filename>) may be given at
108 the end. A unit dependency is included in the graph if
109 any of these patterns match either the origin or
110 destination node.</para>
112 <para>If no command is passed <command>systemd-analyze
113 time</command> is implied.</para>
118 <title>Options</title>
120 <para>The following options are understood:</para>
124 <term><option>-h</option></term>
125 <term><option>--help</option></term>
127 <listitem><para>Prints a short help
128 text and exits.</para></listitem>
132 <term><option>--user</option></term>
134 <listitem><para>Shows performance data
135 of user sessions instead of the system
136 manager.</para></listitem>
140 <term><option>--order</option></term>
141 <term><option>--require</option></term>
143 <listitem><para>When used in
145 <command>dot</command> command (see
146 above), selects which dependencies are
147 shown in the dependency graph. If
148 <option>--order</option> is passed
149 only dependencies of type
150 <varname>After=</varname> or
151 <varname>Before=</varname> are
152 shown. If <option>--require</option>
153 is passed only dependencies of type
154 <varname>Requires=</varname>,
155 <varname>RequiresOverridable=</varname>,
156 <varname>Requisite=</varname>,
157 <varname>RequisiteOverridable=</varname>,
158 <varname>Wants=</varname> and
159 <varname>Conflicts=</varname> are
160 shown. If neither is passed, shows
161 dependencies of all these
162 types.</para></listitem>
166 <term><option>--from-pattern=</option></term>
167 <term><option>--to-pattern=</option></term>
169 <listitem><para>When used in
171 <command>dot</command> command (see
172 above), selects which relationships
173 are shown in the dependency graph.
175 <citerefentry><refentrytitle>glob</refentrytitle><manvolnum>7</manvolnum></citerefentry>
176 patterns as arguments, which are
177 matched against lefthand and
178 righthand, respectively, nodes of a
179 relationship. Each of these can be
180 used more than once which means a
181 unit name must match one of given
182 values.</para></listitem>
189 <title>Exit status</title>
191 <para>On success 0 is returned, a non-zero failure
192 code otherwise.</para>
196 <title>Examples</title>
198 <para>This plots all dependencies of any unit whose
199 name starts with "<literal>avahi-daemon.</literal>":</para>
201 <programlisting>$ systemd-analyze dot 'avahi-daemon.*' | dot -Tsvg > avahi.svg
202 $ eog avahi.svg</programlisting>
204 <para>This plots the dependencies between all known target units:</para>
206 <programlisting>systemd-analyze dot --to-pattern='*.target' --from-patter='*.target' | dot -Tsvg > targets.svg
207 $ eog targets.svg</programlisting>
213 <title>See Also</title>
215 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
216 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>