summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2013-01-23 22:04:02 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-01-28 12:29:31 +0000
commitde51b425962091a7760c7002a2a8a77221e78cda (patch)
tree8a6b5e97af06ed36ab5b4b41a6696f26924b88f3 /meta
parentf366fd3f4a3a3d75ca2fabc112ccf068c04a4688 (diff)
downloadpoky-de51b425962091a7760c7002a2a8a77221e78cda.tar.gz
systemd: Upgrade to 197
LGPL-2.1 licensce is updated to reflect the new FSF address Drop patches to disable argparse and dbus-python analyser has been implemented in C lets use that patch and get rid of the python version disable hostname detection for uclibc bases systems since uclibc lacks NSS (From OE-Core rev: af17e816dd4ee0c2a7401f26a148129ad8f8e1fa) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Conflicts: meta/recipes-core/systemd/systemd_197.bb Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/recipes-core/systemd/systemd/0001-Revert-systemd-analyze-use-argparse-instead-of-getop.patch106
-rw-r--r--meta/recipes-core/systemd/systemd/0001-systemd-analyze-rewrite-in-C.patch1087
-rw-r--r--meta/recipes-core/systemd/systemd/0002-Revert-analyze-use-GDBus-instead-of-dbus-python.patch94
-rw-r--r--meta/recipes-core/systemd/systemd_197.bb (renamed from meta/recipes-core/systemd/systemd_196.bb)12
4 files changed, 1094 insertions, 205 deletions
diff --git a/meta/recipes-core/systemd/systemd/0001-Revert-systemd-analyze-use-argparse-instead-of-getop.patch b/meta/recipes-core/systemd/systemd/0001-Revert-systemd-analyze-use-argparse-instead-of-getop.patch
deleted file mode 100644
index 1e208a244f..0000000000
--- a/meta/recipes-core/systemd/systemd/0001-Revert-systemd-analyze-use-argparse-instead-of-getop.patch
+++ /dev/null
@@ -1,106 +0,0 @@
1Upstream-Status: Backport [revert]
2Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
3
4From 2003e63f48cee2f497de7b90b66284f98c1c9919 Mon Sep 17 00:00:00 2001
5From: Koen Kooi <koen@dominion.thruhere.net>
6Date: Mon, 10 Dec 2012 12:24:32 +0100
7Subject: [PATCH 1/2] Revert "systemd-analyze: use argparse instead of getopt"
8
9This reverts commit 0c0271841ab45595f71528c50bcf1904d4b841d5.
10
11Argparse is broken in current OE python
12---
13 src/analyze/systemd-analyze | 60 ++++++++++++++++++++++++++++---------------
14 1 files changed, 39 insertions(+), 21 deletions(-)
15
16diff --git a/src/analyze/systemd-analyze b/src/analyze/systemd-analyze
17index 88699d6..87a83dd 100755
18--- a/src/analyze/systemd-analyze
19+++ b/src/analyze/systemd-analyze
20@@ -1,7 +1,6 @@
21 #!/usr/bin/python
22
23-import sys, os
24-import argparse
25+import getopt, sys, os
26 from gi.repository import Gio
27 try:
28 import cairo
29@@ -76,6 +75,20 @@ def draw_text(context, x, y, text, size = 12, r = 0, g = 0, b = 0, vcenter = 0.5
30
31 context.restore()
32
33+def usage():
34+ sys.stdout.write("""systemd-analyze [--user] time
35+systemd-analyze [--user] blame
36+systemd-analyze [--user] plot
37+
38+Process systemd profiling information
39+
40+ -h --help Show this help
41+""")
42+
43+def help():
44+ usage()
45+ sys.exit()
46+
47 def time():
48
49 initrd_time, start_time, finish_time = acquire_start_time()
50@@ -266,29 +279,34 @@ def plot():
51
52 surface.finish()
53
54-parser = argparse.ArgumentParser(formatter_class=argparse.RawDescriptionHelpFormatter,
55- description='Process systemd profiling information',
56- epilog='''\
57-time - print time spent in the kernel before reaching userspace
58-blame - print list of running units ordered by time to init
59-plot - output SVG graphic showing service initialization
60-''')
61-
62-parser.add_argument('action', choices=('time', 'blame', 'plot'),
63- default='time', nargs='?',
64- help='action to perform (default: time)')
65-parser.add_argument('--user', action='store_true',
66- help='use the session bus')
67+def unknown_verb():
68+ sys.stderr.write("Unknown verb '%s'.\n" % args[0])
69+ usage()
70+ sys.exit(1)
71
72-args = parser.parse_args()
73+bus = Gio.BusType.SYSTEM
74
75-if args.user:
76- bus = Gio.BusType.SESSION
77-else:
78- bus = Gio.BusType.SYSTEM
79+try:
80+ opts, args = getopt.gnu_getopt(sys.argv[1:], "h", ["help", "user"])
81+except getopt.GetoptError as err:
82+ sys.stdout.write(str(err) + "\n")
83+ usage()
84+ sys.exit(2)
85+for o, a in opts:
86+ if o in ("-h", "--help"):
87+ help()
88+ elif o == '--user':
89+ bus = Gio.BusType.SESSION
90+ else:
91+ assert False, "unhandled option"
92
93 verb = {'time' : time,
94 'blame': blame,
95 'plot' : plot,
96+ 'help' : help,
97 }
98-verb.get(args.action)()
99+
100+if len(args) == 0:
101+ time()
102+else:
103+ verb.get(args[0], unknown_verb)()
104--
1051.7.7.6
106
diff --git a/meta/recipes-core/systemd/systemd/0001-systemd-analyze-rewrite-in-C.patch b/meta/recipes-core/systemd/systemd/0001-systemd-analyze-rewrite-in-C.patch
new file mode 100644
index 0000000000..b278390fef
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0001-systemd-analyze-rewrite-in-C.patch
@@ -0,0 +1,1087 @@
1Upstream-Status: Pending
2
3From 523f304facdf3dbc09dbcdcff500ddce60274987 Mon Sep 17 00:00:00 2001
4From: Peeters Simon <peeters.simon@gmail.com>
5Date: Thu, 17 Jan 2013 14:34:25 -0800
6Subject: [PATCH] systemd-analyze: rewrite in C.
7
8Written by Peeters Simon <peeters.simon@gmail.com>. Makefile stuff
9and cleaned up a bit by Auke Kok <auke-jan.h.kok@intel.com>.
10---
11 Makefile.am | 21 +-
12 src/analyze/systemd-analyze.c | 684 +++++++++++++++++++++++++++++++++++++++++
13 src/analyze/systemd-analyze.in | 328 --------------------
14 3 files changed, 694 insertions(+), 339 deletions(-)
15 create mode 100644 src/analyze/systemd-analyze.c
16 delete mode 100755 src/analyze/systemd-analyze.in
17
18Index: systemd-197/Makefile.am
19===================================================================
20--- systemd-197.orig/Makefile.am 2013-01-07 17:37:15.391966148 -0800
21+++ systemd-197/Makefile.am 2013-01-24 10:06:11.219490786 -0800
22@@ -185,7 +185,8 @@
23 systemd-ask-password \
24 systemd-tty-ask-password-agent \
25 systemd-tmpfiles \
26- systemd-machine-id-setup
27+ systemd-machine-id-setup \
28+ systemd-analyze
29
30 bin_PROGRAMS = \
31 systemd-cgls \
32@@ -220,14 +221,16 @@
33 systemd-fstab-generator \
34 systemd-system-update-generator
35
36-dist_bin_SCRIPTS = \
37- src/analyze/systemd-analyze
38+systemd_analyze_SOURCES = \
39+ src/analyze/systemd-analyze.c
40
41-EXTRA_DIST += \
42- src/analyze/systemd-analyze.in
43+systemd_analyze_CFLAGS = \
44+ $(AM_CFLAGS) \
45+ $(DBUS_CFLAGS)
46
47-CLEANFILES += \
48- src/analyze/systemd-analyze
49+systemd_analyze_LDADD = \
50+ libsystemd-shared.la \
51+ libsystemd-dbus.la
52
53 dist_bashcompletion_DATA = \
54 shell-completion/systemd-bash-completion.sh
55@@ -3839,10 +3842,6 @@
56 $(SED_PROCESS)
57 $(AM_V_GEN)chmod +x $@
58
59-src/analyze/systemd-analyze: %: %.in Makefile
60- $(SED_PROCESS)
61- $(AM_V_GEN)chmod +x $@
62-
63 src/%.c: src/%.gperf
64 $(AM_V_at)$(MKDIR_P) $(dir $@)
65 $(AM_V_GEN)$(GPERF) < $< > $@
66Index: systemd-197/src/analyze/systemd-analyze.c
67===================================================================
68--- /dev/null 1970-01-01 00:00:00.000000000 +0000
69+++ systemd-197/src/analyze/systemd-analyze.c 2013-01-24 10:06:11.219490786 -0800
70@@ -0,0 +1,684 @@
71+#include <stdio.h>
72+#include <stdlib.h>
73+#include <getopt.h>
74+#include <locale.h>
75+
76+#include "install.h"
77+#include "log.h"
78+#include "dbus-common.h"
79+#include "build.h"
80+#include "util.h"
81+
82+#define svg(...) printf(__VA_ARGS__)
83+
84+static UnitFileScope arg_scope = UNIT_FILE_SYSTEM;
85+
86+struct unit_times {
87+ char *name;
88+ unsigned long long int ixt;
89+ unsigned long long int iet;
90+ unsigned long long int axt;
91+ unsigned long long int aet;
92+};
93+
94+
95+unsigned long long int property_getull(
96+ DBusConnection *bus,
97+ const char *dest,
98+ const char *path,
99+ const char *interface,
100+ const char *property)
101+{
102+ _cleanup_dbus_message_unref_ DBusMessage *reply = NULL;
103+ DBusMessageIter iter, sub;
104+ unsigned long long int result = 0;
105+ union {
106+ char byte;
107+ dbus_int16_t i16;
108+ dbus_uint16_t u16;
109+ dbus_int32_t i32;
110+ dbus_uint32_t u32;
111+ dbus_int64_t i64;
112+ dbus_uint64_t u64;
113+ } dbus_result;
114+
115+ int r = bus_method_call_with_reply (
116+ bus,
117+ dest,
118+ path,
119+ "org.freedesktop.DBus.Properties",
120+ "Get",
121+ &reply,
122+ NULL,
123+ DBUS_TYPE_STRING, &interface,
124+ DBUS_TYPE_STRING, &property,
125+ DBUS_TYPE_INVALID);
126+ if (r)
127+ goto finish;
128+
129+ if (!dbus_message_iter_init(reply, &iter) ||
130+ dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_VARIANT)
131+ goto finish;
132+
133+ dbus_message_iter_recurse(&iter, &sub);
134+
135+ switch(dbus_message_iter_get_arg_type(&sub)) {
136+ case DBUS_TYPE_BYTE:
137+ dbus_message_iter_get_basic(&sub, &dbus_result.byte);
138+ result = dbus_result.byte;
139+ break;
140+ case DBUS_TYPE_INT16:
141+ dbus_message_iter_get_basic(&sub, &dbus_result.i16);
142+ result = dbus_result.i16;
143+ break;
144+ case DBUS_TYPE_UINT16:
145+ dbus_message_iter_get_basic(&sub, &dbus_result.u16);
146+ result = dbus_result.u16;
147+ break;
148+ case DBUS_TYPE_INT32:
149+ dbus_message_iter_get_basic(&sub, &dbus_result.i32);
150+ result = dbus_result.i32;
151+ break;
152+ case DBUS_TYPE_UINT32:
153+ dbus_message_iter_get_basic(&sub, &dbus_result.u32);
154+ result = dbus_result.u32;
155+ break;
156+ case DBUS_TYPE_INT64:
157+ dbus_message_iter_get_basic(&sub, &dbus_result.i64);
158+ result = dbus_result.i64;
159+ break;
160+ case DBUS_TYPE_UINT64:
161+ dbus_message_iter_get_basic(&sub, &dbus_result.u64);
162+ result = dbus_result.u64;
163+ break;
164+ default:
165+ goto finish;
166+ }
167+finish:
168+ return result;
169+}
170+
171+static int compare_unit_times1(const void *a, const void *b) {
172+ const struct unit_times *u = a, *v = b;
173+
174+ return (int)(v->aet - v->ixt) - (int)(u->aet - u->ixt);
175+}
176+
177+static int compare_unit_times2(const void *a, const void *b) {
178+ const struct unit_times *u = a, *v = b;
179+
180+ return (long long int)(u->ixt) - (long long int)(v->ixt);
181+}
182+
183+int acquire_time_data(DBusConnection *bus, struct unit_times **out)
184+{
185+ _cleanup_dbus_message_unref_ DBusMessage *reply = NULL;
186+ DBusMessageIter iter, sub, sub2;
187+ unsigned int c = 0, n_units = 0;
188+ struct unit_times *unit_times = NULL;
189+ int r = bus_method_call_with_reply (
190+ bus,
191+ "org.freedesktop.systemd1",
192+ "/org/freedesktop/systemd1",
193+ "org.freedesktop.systemd1.Manager",
194+ "ListUnits",
195+ &reply,
196+ NULL,
197+ DBUS_TYPE_INVALID);
198+ if (r)
199+ goto finish;
200+
201+ if (!dbus_message_iter_init(reply, &iter) ||
202+ dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_ARRAY ||
203+ dbus_message_iter_get_element_type(&iter) != DBUS_TYPE_STRUCT) {
204+ log_error("Failed to parse reply.");
205+ r = -EIO;
206+ goto finish;
207+ }
208+
209+ dbus_message_iter_recurse(&iter, &sub);
210+
211+ while (dbus_message_iter_get_arg_type(&sub) != DBUS_TYPE_INVALID) {
212+ struct unit_times *u;
213+ char *path;
214+
215+ if (dbus_message_iter_get_arg_type(&sub) != DBUS_TYPE_STRUCT) {
216+ log_error("Failed to parse reply.");
217+ r = -EIO;
218+ goto finish;
219+ }
220+
221+ if (c >= n_units) {
222+ struct unit_times *w;
223+
224+ n_units = MAX(2*c, 16);
225+ w = realloc(unit_times, sizeof(struct unit_times) * n_units);
226+
227+ if (!w) {
228+ log_error("Failed to allocate unit array.");
229+ r = -ENOMEM;
230+ goto finish;
231+ }
232+
233+ unit_times = w;
234+ }
235+ u = unit_times+c;
236+
237+ dbus_message_iter_recurse(&sub, &sub2);
238+
239+ if (bus_iter_get_basic_and_next(&sub2, DBUS_TYPE_STRING, &u->name, true) < 0 ||
240+ dbus_message_iter_next(&sub2), dbus_message_iter_next(&sub2), dbus_message_iter_next(&sub2),
241+ dbus_message_iter_next(&sub2), dbus_message_iter_next(&sub2),
242+ bus_iter_get_basic_and_next(&sub2, DBUS_TYPE_OBJECT_PATH, &path, true) < 0) {
243+ log_error("Failed to parse reply.");
244+ r = -EIO;
245+ goto finish;
246+ }
247+ u->name = strdup(u->name);
248+ u->ixt = property_getull(bus,
249+ "org.freedesktop.systemd1",
250+ path,
251+ "org.freedesktop.systemd1.Unit",
252+ "InactiveExitTimestampMonotonic");
253+ u->iet = property_getull(bus,
254+ "org.freedesktop.systemd1",
255+ path,
256+ "org.freedesktop.systemd1.Unit",
257+ "InactiveEnterTimestampMonotonic");
258+ u->axt = property_getull(bus,
259+ "org.freedesktop.systemd1",
260+ path,
261+ "org.freedesktop.systemd1.Unit",
262+ "ActiveExitTimestampMonotonic");
263+ u->aet = property_getull(bus,
264+ "org.freedesktop.systemd1",
265+ path,
266+ "org.freedesktop.systemd1.Unit",
267+ "ActiveEnterTimestampMonotonic");
268+ dbus_message_iter_next(&sub);
269+ if (u->ixt == 0)
270+ continue;
271+ c++;
272+ }
273+
274+ *out = unit_times;
275+ return c;
276+finish:
277+ free(unit_times);
278+ return r;
279+}
280+
281+static void svg_graph_box(int height, long long int begin, long long int end, float scale_x, float scale_y)
282+{
283+ double d = 0.0;
284+ int i = 0;
285+
286+ /* outside box, fill */
287+ svg("<rect class=\"box\" x=\"%.03f\" y=\"0\" width=\"%.03f\" height=\"%.03f\" />\n",
288+ 0,
289+ scale_x * (end - begin),
290+ scale_y * height);
291+
292+ for (d = 0.000001 * begin; d <= 0.000001 * end;
293+ d += 0.1) {
294+ /* lines for each second */
295+ if (i % 50 == 0)
296+ svg(" <line class=\"sec5\" x1=\"%.03f\" y1=\"0\" x2=\"%.03f\" y2=\"%.03f\" />\n",
297+ scale_x * d,
298+ scale_x * d,
299+ scale_y * height);
300+ else if (i % 10 == 0)
301+ svg(" <line class=\"sec1\" x1=\"%.03f\" y1=\"0\" x2=\"%.03f\" y2=\"%.03f\" />\n",
302+ scale_x * d,
303+ scale_x * d,
304+ scale_y * height);
305+ else
306+ svg(" <line class=\"sec01\" x1=\"%.03f\" y1=\"0\" x2=\"%.03f\" y2=\"%.03f\" />\n",
307+ scale_x * d,
308+ scale_x * d,
309+ scale_y * height);
310+
311+ /* time label */
312+ if (i % 10 == 0)
313+ svg(" <text class=\"sec\" x=\"%.03f\" y=\"%.03f\" >%.01fs</text>\n",
314+ scale_x * d, -5.0, d);
315+
316+ i++;
317+ }
318+}
319+
320+int analyze_plot(DBusConnection *bus)
321+{
322+ struct unit_times *times;
323+ int n = acquire_time_data(bus, &times);
324+ int m = n + 1;
325+ unsigned long long int firmware_time, loader_time, kernel_time, initrd_time, userspace_time, finish_time;
326+ long long int starttime = 0;
327+
328+ float scale_x = 100.0;
329+ float scale_y = 20.0;
330+
331+ if (n<=0)
332+ return -n;
333+
334+ qsort(times, n, sizeof(struct unit_times), compare_unit_times2);
335+
336+ firmware_time = property_getull(bus,
337+ "org.freedesktop.systemd1",
338+ "/org/freedesktop/systemd1",
339+ "org.freedesktop.systemd1.Manager",
340+ "FirmwareTimestampMonotonic");
341+ loader_time = property_getull(bus,
342+ "org.freedesktop.systemd1",
343+ "/org/freedesktop/systemd1",
344+ "org.freedesktop.systemd1.Manager",
345+ "LoaderTimestampMonotonic");
346+ kernel_time = property_getull(bus,
347+ "org.freedesktop.systemd1",
348+ "/org/freedesktop/systemd1",
349+ "org.freedesktop.systemd1.Manager",
350+ "KernelTimestamp");
351+ initrd_time = property_getull(bus,
352+ "org.freedesktop.systemd1",
353+ "/org/freedesktop/systemd1",
354+ "org.freedesktop.systemd1.Manager",
355+ "InitRDTimestampMonotonic");
356+ userspace_time = property_getull(bus,
357+ "org.freedesktop.systemd1",
358+ "/org/freedesktop/systemd1",
359+ "org.freedesktop.systemd1.Manager",
360+ "UserspaceTimestampMonotonic");
361+ finish_time = property_getull(bus,
362+ "org.freedesktop.systemd1",
363+ "/org/freedesktop/systemd1",
364+ "org.freedesktop.systemd1.Manager",
365+ "FinishTimestampMonotonic");
366+
367+
368+ if (firmware_time > 0) {
369+ m++;
370+ starttime += firmware_time - loader_time;
371+ }
372+ if (loader_time > 0) {
373+ m++;
374+ starttime += loader_time;
375+ }
376+ if (initrd_time > 0)
377+ m += 2;
378+ else if (kernel_time > 0)
379+ m++;
380+
381+ float width = 80.0 + (scale_x * (starttime + finish_time) * 0.000001);
382+ float height = 150.0 + (m* scale_y);
383+
384+ svg("<?xml version=\"1.0\" standalone=\"no\"?>\n");
385+ svg("<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" ");
386+ svg("\"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n");
387+
388+ //svg("<g transform=\"translate(10,%d)\">\n", 1000 + 150 + (pcount * 20));
389+ svg("<svg width=\"%.0fpx\" height=\"%.0fpx\" version=\"1.1\" ", width, height);
390+ svg("xmlns=\"http://www.w3.org/2000/svg\">\n\n");
391+
392+ /* write some basic info as a comment, including some help */
393+ svg("<!-- This file is a systemd-analyze SVG file. It is best rendered in a -->\n");
394+ svg("<!-- browser such as Chrome/Chromium, firefox. Other applications that -->\n");
395+ svg("<!-- render these files properly but much more slow are ImageMagick, -->\n");
396+ svg("<!-- gimp, inkscape, etc.. To display the files on your system, just -->\n");
397+ svg("<!-- point your browser to file:///var/log/ and click. -->\n\n");
398+ svg("<!-- this plot was generated by systemd-analyze version %-16.16s -->\n\n", VERSION);
399+
400+ /* style sheet */
401+ svg("<defs>\n <style type=\"text/css\">\n <![CDATA[\n");
402+
403+ svg(" rect { stroke-width: 1; stroke-opacity: 0; }\n");
404+ svg(" rect.activating { fill: rgb(255,0,0); fill-opacity: 0.7; }\n");
405+ svg(" rect.active { fill: rgb(200,150,150); fill-opacity: 0.7; }\n");
406+ svg(" rect.deactivating { fill: rgb(150,100,100); fill-opacity: 0.7; }\n");
407+ svg(" rect.kernel { fill: rgb(150,150,150); fill-opacity: 0.7; }\n");
408+ svg(" rect.initrd { fill: rgb(150,150,150); fill-opacity: 0.7; }\n");
409+ svg(" rect.firmware { fill: rgb(150,150,150); fill-opacity: 0.7; }\n");
410+ svg(" rect.loader { fill: rgb(150,150,150); fill-opacity: 0.7; }\n");
411+ svg(" rect.userspace { fill: rgb(150,150,150); fill-opacity: 0.7; }\n");
412+ svg(" rect.cpu { fill: rgb(64,64,240); stroke-width: 0; fill-opacity: 0.7; }\n");
413+ svg(" rect.wait { fill: rgb(240,240,0); stroke-width: 0; fill-opacity: 0.7; }\n");
414+ svg(" rect.bi { fill: rgb(240,128,128); stroke-width: 0; fill-opacity: 0.7; }\n");
415+ svg(" rect.bo { fill: rgb(192,64,64); stroke-width: 0; fill-opacity: 0.7; }\n");
416+ svg(" rect.ps { fill: rgb(192,192,192); stroke: rgb(128,128,128); fill-opacity: 0.7; }\n");
417+ svg(" rect.krnl { fill: rgb(240,240,0); stroke: rgb(128,128,128); fill-opacity: 0.7; }\n");
418+ svg(" rect.box { fill: rgb(240,240,240); stroke: rgb(192,192,192); }\n");
419+ svg(" rect.clrw { stroke-width: 0; fill-opacity: 0.7;}\n");
420+ svg(" line { stroke: rgb(64,64,64); stroke-width: 1; }\n");
421+ svg("// line.sec1 { }\n");
422+ svg(" line.sec5 { stroke-width: 2; }\n");
423+ svg(" line.sec01 { stroke: rgb(224,224,224); stroke-width: 1; }\n");
424+ svg(" line.dot { stroke-dasharray: 2 4; }\n");
425+ svg(" line.idle { stroke: rgb(64,64,64); stroke-dasharray: 10 6; stroke-opacity: 0.7; }\n");
426+
427+ svg(" .run { font-size: 8; font-style: italic; }\n");
428+ svg(" text { font-family: Verdana, Helvetica; font-size: 10; }\n");
429+ svg(" text.sec { font-size: 8; }\n");
430+ svg(" text.t1 { font-size: 24; }\n");
431+ svg(" text.t2 { font-size: 12; }\n");
432+ svg(" text.idle { font-size: 18; }\n");
433+
434+ svg(" ]]>\n </style>\n</defs>\n\n");
435+
436+ svg("<text x=\"20\" y=\"40\">Startup finished in ");
437+
438+ if (firmware_time > 0)
439+ svg("%llums (firmware) + ", (firmware_time - loader_time) / 1000);
440+ if (loader_time > 0)
441+ svg("%llums (loader) + ", loader_time / 1000);
442+ if (initrd_time > 0)
443+ svg("%llums (kernel) + %llums (initrd) + ", initrd_time / 1000, (userspace_time - initrd_time) / 1000);
444+ else if (kernel_time > 0)
445+ svg("%llums (kernel) + ", userspace_time / 1000);
446+ svg("%llums (userspace) ", (finish_time - userspace_time) / 1000);
447+ if (kernel_time > 0)
448+ svg("= %llums\n", (firmware_time + finish_time) / 1000);
449+ else
450+ svg("= %llums\n", (finish_time - userspace_time) / 1000);
451+ svg("</text>");
452+
453+ svg("<g transform=\"translate(20,100)\">\n");
454+ svg_graph_box(m, starttime, finish_time, scale_x, scale_y);
455+
456+ float top = 0.0;
457+
458+ if (firmware_time > 0) {
459+ svg(" <rect class=\"firmware\" x=\"%.03f\" y=\"%.03f\" width=\"%.03f\" height=\"%.03f\" />\n",
460+ scale_x * (starttime - firmware_time) * 0.000001,
461+ top,
462+ scale_x * (firmware_time - loader_time) * 0.000001,
463+ scale_y - 1.0);
464+ svg(" <text x=\"%.03f\" y=\"%.03f\">firmware</text>\n",
465+ scale_x * (starttime - firmware_time) * 0.000001 + 5.0,
466+ top + 14.0);
467+ top += scale_y;
468+ }
469+ if (loader_time > 0) {
470+ svg(" <rect class=\"loader\" x=\"%.03f\" y=\"%.03f\" width=\"%.03f\" height=\"%.03f\" />\n",
471+ scale_x * (starttime - loader_time) * 0.000001,
472+ top,
473+ scale_x * (loader_time) * 0.000001,
474+ scale_y - 1.0);
475+ svg(" <text x=\"%.03f\" y=\"%.03f\">loader</text>\n",
476+ scale_x * (starttime - loader_time) * 0.000001 + 5.0,
477+ top + 14.0);
478+ top += scale_y;
479+ }
480+ if (initrd_time > 0) {
481+ svg(" <rect class=\"kernel\" x=\"%.03f\" y=\"%.03f\" width=\"%.03f\" height=\"%.03f\" />\n",
482+ scale_x * (starttime) * 0.000001,
483+ top,
484+ scale_x * (initrd_time) * 0.000001,
485+ scale_y - 1.0);
486+ svg(" <text x=\"%.03f\" y=\"%.03f\">kernel</text>\n",
487+ scale_x * (starttime) * 0.000001 + 5.0,
488+ top + 14.0);
489+ top += scale_y;
490+ svg(" <rect class=\"inird\" x=\"%.03f\" y=\"%.03f\" width=\"%.03f\" height=\"%.03f\" />\n",
491+ scale_x * (starttime + initrd_time) * 0.000001,
492+ top,
493+ scale_x * (userspace_time - initrd_time) * 0.000001,
494+ scale_y - 1.0);
495+ svg(" <text x=\"%.03f\" y=\"%.03f\">initrd</text>\n",
496+ scale_x * (starttime + initrd_time) * 0.000001 + 5.0,
497+ top + 14.0);
498+ top += scale_y;
499+ } else if (kernel_time > 0) {
500+ svg(" <rect class=\"kernel\" x=\"%.03f\" y=\"%.03f\" width=\"%.03f\" height=\"%.03f\" />\n",
501+ scale_x * (starttime) * 0.000001,
502+ top,
503+ scale_x * (userspace_time) * 0.000001,
504+ scale_y - 1.0);
505+ svg(" <text x=\"%.03f\" y=\"%.03f\">kernel</text>\n",
506+ scale_x * (starttime) * 0.000001 + 5.0,
507+ top + 14.0);
508+ top += scale_y;
509+ }
510+
511+ svg(" <rect class=\"userspace\" x=\"%.03f\" y=\"%.03f\" width=\"%.03f\" height=\"%.03f\" />\n",
512+ scale_x * (userspace_time) * 0.000001,
513+ top,
514+ scale_x * (finish_time - userspace_time) * 0.000001,
515+ scale_y - 1.0);
516+ svg(" <text x=\"%.03f\" y=\"%.03f\">userspace</text>\n",
517+ scale_x * (userspace_time) * 0.000001 + 5.0,
518+ top + 14.0);
519+ top += scale_y;
520+
521+
522+ for (int i=0; i < n; i++) {
523+ //draw times[i]
524+
525+ bool drawn = false;
526+
527+ if (times[i].ixt >= userspace_time && times[i].ixt <= finish_time) {
528+ unsigned long long int end = finish_time;
529+ if (times[i].aet >= times[i].ixt && times[i].aet < end)
530+ end = times[i].aet;
531+ if (times[i].axt >= times[i].ixt && times[i].axt < end)
532+ end = times[i].axt;
533+ if (times[i].iet >= times[i].ixt && times[i].iet < end)
534+ end = times[i].iet;
535+ svg(" <rect class=\"activating\" x=\"%.03f\" y=\"%.03f\" width=\"%.03f\" height=\"%.03f\" />\n",
536+ scale_x * (starttime + times[i].ixt) * 0.000001,
537+ top + (scale_y * i),
538+ scale_x * (end - times[i].ixt) * 0.000001,
539+ scale_y - 1.0);
540+ }
541+ if (times[i].aet >= userspace_time && times[i].aet <= finish_time) {
542+ unsigned long long int end = finish_time;
543+ if (times[i].axt >= times[i].aet && times[i].axt < end)
544+ end = times[i].axt;
545+ if (times[i].iet >= times[i].aet && times[i].iet < end)
546+ end = times[i].iet;
547+ svg(" <rect class=\"active\" x=\"%.03f\" y=\"%.03f\" width=\"%.03f\" height=\"%.03f\" />\n",
548+ scale_x * (starttime + times[i].aet) * 0.000001,
549+ top + (scale_y * i),
550+ scale_x * (end - times[i].aet) * 0.000001,
551+ scale_y - 1.0);
552+ }
553+ if (times[i].axt >= userspace_time && times[i].axt <= finish_time) {
554+ unsigned long long int end = finish_time;
555+ if (times[i].iet >= times[i].axt && times[i].iet < end)
556+ end = times[i].iet;
557+ svg(" <rect class=\"deactivating\" x=\"%.03f\" y=\"%.03f\" width=\"%.03f\" height=\"%.03f\" />\n",
558+ scale_x * (starttime + times[i].axt) * 0.000001,
559+ top + (scale_y * i),
560+ scale_x * (end - times[i].axt) * 0.000001,
561+ scale_y - 1.0);
562+ }
563+
564+ svg(" <text x=\"%.03f\" y=\"%.03f\">%s</text>\n",
565+ (starttime + times[i].ixt) * scale_x * 0.000001 + 5.0,
566+ top + (scale_y * i) + 14.0,
567+ times[i].name);
568+
569+ }
570+ svg("</g>\n\n");
571+
572+ svg("</svg>");
573+ return 0;
574+}
575+
576+int analyze_blame(DBusConnection *bus)
577+{
578+ struct unit_times *times;
579+ int n = acquire_time_data(bus, &times);
580+ if (n<=0)
581+ return -n;
582+
583+ qsort(times, n, sizeof(struct unit_times), compare_unit_times1);
584+
585+ for (int i = 0; i < n; i++) {
586+ if (times[i].ixt <= 0 || times[i].aet <= 0)
587+ continue;
588+ if (times[i].aet <= times[i].ixt)
589+ continue;
590+ printf("%6llums %s\n", (times[i].aet - times[i].ixt) / 1000, times[i].name);
591+ }
592+ return 0;
593+}
594+int analyze_time(DBusConnection *bus)
595+{
596+ unsigned long long firmware_time, loader_time, kernel_time, initrd_time, userspace_time, finish_time;
597+
598+ firmware_time = property_getull(bus,
599+ "org.freedesktop.systemd1",
600+ "/org/freedesktop/systemd1",
601+ "org.freedesktop.systemd1.Manager",
602+ "FirmwareTimestampMonotonic");
603+ loader_time = property_getull(bus,
604+ "org.freedesktop.systemd1",
605+ "/org/freedesktop/systemd1",
606+ "org.freedesktop.systemd1.Manager",
607+ "LoaderTimestampMonotonic");
608+ kernel_time = property_getull(bus,
609+ "org.freedesktop.systemd1",
610+ "/org/freedesktop/systemd1",
611+ "org.freedesktop.systemd1.Manager",
612+ "KernelTimestamp");
613+ initrd_time = property_getull(bus,
614+ "org.freedesktop.systemd1",
615+ "/org/freedesktop/systemd1",
616+ "org.freedesktop.systemd1.Manager",
617+ "InitRDTimestampMonotonic");
618+ userspace_time = property_getull(bus,
619+ "org.freedesktop.systemd1",
620+ "/org/freedesktop/systemd1",
621+ "org.freedesktop.systemd1.Manager",
622+ "UserspaceTimestampMonotonic");
623+ finish_time = property_getull(bus,
624+ "org.freedesktop.systemd1",
625+ "/org/freedesktop/systemd1",
626+ "org.freedesktop.systemd1.Manager",
627+ "FinishTimestampMonotonic");
628+
629+ printf("Startup finished in ");
630+
631+ if (firmware_time > 0)
632+ printf("%llums (firmware) + ", (firmware_time - loader_time) / 1000);
633+ if (loader_time > 0)
634+ printf("%llums (loader) + ", loader_time / 1000);
635+ if (initrd_time > 0)
636+ printf("%llums (kernel) + %llums (initrd) + ", initrd_time / 1000, (userspace_time - initrd_time) / 1000);
637+ else if (kernel_time > 0)
638+ printf("%llums (kernel) + ", userspace_time / 1000);
639+
640+ printf("%llums (userspace) ", (finish_time - userspace_time) / 1000);
641+
642+ if (kernel_time > 0)
643+ printf("= %llums\n", (firmware_time + finish_time) / 1000);
644+ else
645+ printf("= %llums\n", (finish_time - userspace_time) / 1000);
646+
647+ return 0;
648+}
649+
650+void analyze_help()
651+{
652+ printf("%s [OPTIONS...] {COMMAND} ...\n\n"
653+ " -h --help Show this help\n"
654+ " --version Show package version\n"
655+ " --system Connect to system manager\n"
656+ " --user Connect to user service manager\n\n"
657+ "Commands:\n"
658+ " time\n"
659+ " blame\n",
660+ program_invocation_short_name);
661+
662+}
663+
664+static int parse_argv(int argc, char *argv[])
665+{
666+ enum {
667+ ARG_VERSION = 0x100,
668+ ARG_USER,
669+ ARG_SYSTEM
670+ };
671+
672+ static const struct option options[] = {
673+ { "help", no_argument, NULL, 'h' },
674+ { "version", no_argument, NULL, ARG_VERSION },
675+ { "user", no_argument, NULL, ARG_USER },
676+ { "system", no_argument, NULL, ARG_SYSTEM },
677+ { NULL, 0, NULL, 0 }
678+ };
679+
680+ int c;
681+
682+ assert(argc >= 0);
683+ assert(argv);
684+
685+ while ((c = getopt_long(argc, argv, "h", options, NULL)) >= 0) {
686+ switch (c) {
687+ case 'h':
688+ analyze_help();
689+ return 0;
690+ case ARG_VERSION:
691+ puts(PACKAGE_STRING);
692+ puts(SYSTEMD_FEATURES);
693+ return 0;
694+ case ARG_USER:
695+ arg_scope = UNIT_FILE_USER;
696+ break;
697+ case ARG_SYSTEM:
698+ arg_scope = UNIT_FILE_SYSTEM;
699+ break;
700+
701+ case '?':
702+ return -EINVAL;
703+
704+ default:
705+ log_error("Unknown option code '%c'.", c);
706+ return -EINVAL;
707+ }
708+ }
709+ return 1;
710+}
711+
712+
713+int main(int argc, char*argv[]) {
714+ int r, retval = EXIT_FAILURE;
715+ DBusConnection *bus = NULL;
716+ DBusError error;
717+ bool private_bus = false;
718+
719+ dbus_error_init(&error);
720+
721+ setlocale(LC_ALL, "");
722+ log_parse_environment();
723+ log_open();
724+
725+ r = parse_argv(argc, argv);
726+ if (r < 0)
727+ goto finish;
728+ else if (r == 0) {
729+ retval = EXIT_SUCCESS;
730+ goto finish;
731+ }
732+
733+ bus_connect(arg_scope == UNIT_FILE_SYSTEM ? DBUS_BUS_SYSTEM : DBUS_BUS_SESSION, &bus, &private_bus, &error);
734+
735+ if (!argv[optind] || streq(argv[optind], "time"))
736+ retval = analyze_time(bus);
737+ else if (streq(argv[optind], "blame"))
738+ retval = analyze_blame(bus);
739+ else if (streq(argv[optind], "plot"))
740+ retval = analyze_plot(bus);
741+ else
742+ log_error("Unknown operation '%s'.", argv[optind]);
743+
744+finish:
745+ if (bus) {
746+ dbus_connection_flush(bus);
747+ dbus_connection_close(bus);
748+ dbus_connection_unref(bus);
749+ }
750+
751+ dbus_error_free(&error);
752+
753+ return retval;
754+}
755Index: systemd-197/src/analyze/systemd-analyze.in
756===================================================================
757--- systemd-197.orig/src/analyze/systemd-analyze.in 2013-01-07 16:27:01.000000000 -0800
758+++ /dev/null 1970-01-01 00:00:00.000000000 +0000
759@@ -1,328 +0,0 @@
760-#!@PYTHON_BINARY@
761-# -*-python-*-
762-
763-# This file is part of systemd.
764-#
765-# Copyright 2010-2013 Lennart Poettering
766-#
767-# systemd is free software; you can redistribute it and/or modify it
768-# under the terms of the GNU Lesser General Public License as published by
769-# the Free Software Foundation; either version 2.1 of the License, or
770-# (at your option) any later version.
771-#
772-# systemd is distributed in the hope that it will be useful, but
773-# WITHOUT ANY WARRANTY; without even the implied warranty of
774-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
775-# Lesser General Public License for more details.
776-#
777-# You should have received a copy of the GNU Lesser General Public License
778-# along with systemd; If not, see <http://www.gnu.org/licenses/>.
779-
780-import sys, os
781-import argparse
782-from gi.repository import Gio
783-try:
784- import cairo
785-except ImportError:
786- cairo = None
787-
788-def acquire_time_data():
789- manager = Gio.DBusProxy.new_for_bus_sync(bus, Gio.DBusProxyFlags.NONE,
790- None, 'org.freedesktop.systemd1', '/org/freedesktop/systemd1', 'org.freedesktop.systemd1.Manager', None)
791- units = manager.ListUnits()
792-
793- l = []
794-
795- for i in units:
796- if i[5] != "":
797- continue
798-
799- properties = Gio.DBusProxy.new_for_bus_sync(bus, Gio.DBusProxyFlags.NONE,
800- None, 'org.freedesktop.systemd1', i[6], 'org.freedesktop.DBus.Properties', None)
801-
802- ixt = properties.Get('(ss)', 'org.freedesktop.systemd1.Unit', 'InactiveExitTimestampMonotonic')
803- aet = properties.Get('(ss)', 'org.freedesktop.systemd1.Unit', 'ActiveEnterTimestampMonotonic')
804- axt = properties.Get('(ss)', 'org.freedesktop.systemd1.Unit', 'ActiveExitTimestampMonotonic')
805- iet = properties.Get('(ss)', 'org.freedesktop.systemd1.Unit', 'InactiveEnterTimestampMonotonic')
806-
807- l.append((str(i[0]), ixt, aet, axt, iet))
808-
809- return l
810-
811-def acquire_start_time():
812- properties = Gio.DBusProxy.new_for_bus_sync(bus, Gio.DBusProxyFlags.NONE,
813- None, 'org.freedesktop.systemd1', '/org/freedesktop/systemd1', 'org.freedesktop.DBus.Properties', None)
814-
815- # Note that the firmware/loader times are returned as positive
816- # values but are actually considered negative from the point
817- # in time of kernel initialization. Also, the monotonic kernel
818- # time will always be 0 since that's the epoch of the
819- # monotonic clock. Since we want to know whether the kernel
820- # timestamp is set at all we will instead ask for the realtime
821- # clock for this timestamp.
822-
823- firmware_time = properties.Get('(ss)', 'org.freedesktop.systemd1.Manager', 'FirmwareTimestampMonotonic')
824- loader_time = properties.Get('(ss)', 'org.freedesktop.systemd1.Manager', 'LoaderTimestampMonotonic')
825- kernel_time = properties.Get('(ss)', 'org.freedesktop.systemd1.Manager', 'KernelTimestamp')
826- initrd_time = properties.Get('(ss)', 'org.freedesktop.systemd1.Manager', 'InitRDTimestampMonotonic')
827- userspace_time = properties.Get('(ss)', 'org.freedesktop.systemd1.Manager', 'UserspaceTimestampMonotonic')
828- finish_time = properties.Get('(ss)', 'org.freedesktop.systemd1.Manager', 'FinishTimestampMonotonic')
829-
830- if finish_time == 0:
831- sys.exit("Bootup is not yet finished. Please try again later.")
832-
833- assert firmware_time >= loader_time
834- assert initrd_time <= userspace_time
835- assert userspace_time <= finish_time
836-
837- return firmware_time, loader_time, kernel_time, initrd_time, userspace_time, finish_time
838-
839-def draw_box(context, j, k, l, m, r = 0, g = 0, b = 0):
840- context.save()
841- context.set_source_rgb(r, g, b)
842- context.rectangle(j, k, l, m)
843- context.fill()
844- context.restore()
845-
846-def draw_text(context, x, y, text, size = 12, r = 0, g = 0, b = 0, vcenter = 0.5, hcenter = 0.5):
847- context.save()
848-
849- context.set_source_rgb(r, g, b)
850- context.select_font_face("Sans", cairo.FONT_SLANT_NORMAL, cairo.FONT_WEIGHT_NORMAL)
851- context.set_font_size(size)
852-
853- if vcenter or hcenter:
854- x_bearing, y_bearing, width, height = context.text_extents(text)[:4]
855-
856- if hcenter:
857- x = x - width*hcenter - x_bearing
858-
859- if vcenter:
860- y = y - height*vcenter - y_bearing
861-
862- context.move_to(x, y)
863- context.show_text(text)
864-
865- context.restore()
866-
867-def time():
868-
869- firmware_time, loader_time, kernel_time, initrd_time, userspace_time, finish_time = acquire_start_time()
870-
871- sys.stdout.write("Startup finished in ")
872-
873- if firmware_time > 0:
874- sys.stdout.write("%lums (firmware) + " % ((firmware_time - loader_time) / 1000))
875- if loader_time > 0:
876- sys.stdout.write("%lums (loader) + " % (loader_time / 1000))
877- if initrd_time > 0:
878- sys.stdout.write("%lums (kernel) + %lums (initrd) + " % (initrd_time / 1000, (userspace_time - initrd_time) / 1000))
879- elif kernel_time > 0:
880- sys.stdout.write("%lums (kernel) + " % (userspace_time / 1000))
881-
882- sys.stdout.write("%lums (userspace) " % ((finish_time - userspace_time) / 1000))
883-
884- if kernel_time > 0:
885- sys.stdout.write("= %lums\n" % ((firmware_time + finish_time) / 1000))
886- else:
887- sys.stdout.write("= %lums\n" % ((finish_time - userspace_time) / 1000))
888-
889-def blame():
890-
891- data = acquire_time_data()
892- s = sorted(data, key = lambda i: i[2] - i[1], reverse = True)
893-
894- for name, ixt, aet, axt, iet in s:
895-
896- if ixt <= 0 or aet <= 0:
897- continue
898-
899- if aet <= ixt:
900- continue
901-
902- sys.stdout.write("%6lums %s\n" % ((aet - ixt) / 1000, name))
903-
904-def plot():
905- if cairo is None:
906- sys.exit("Failed to initilize python-cairo required for 'plot' verb.")
907- firmware_time, loader_time, kernel_time, initrd_time, userspace_time, finish_time = acquire_start_time()
908- data = acquire_time_data()
909- s = sorted(data, key = lambda i: i[1])
910-
911- # Account for kernel and initramfs bars if they exist
912- if initrd_time > 0:
913- count = 3
914- else:
915- count = 2
916-
917- for name, ixt, aet, axt, iet in s:
918-
919- if (ixt >= userspace_time and ixt <= finish_time) or \
920- (aet >= userspace_time and aet <= finish_time) or \
921- (axt >= userspace_time and axt <= finish_time):
922- count += 1
923-
924- border = 100
925- bar_height = 20
926- bar_space = bar_height * 0.1
927-
928- # 1000px = 10s, 1px = 10ms
929- width = finish_time/10000 + border*2
930- height = count * (bar_height + bar_space) + border * 2
931-
932- if width < 1000:
933- width = 1000
934-
935- surface = cairo.SVGSurface(sys.stdout, width, height)
936- context = cairo.Context(surface)
937-
938- draw_box(context, 0, 0, width, height, 1, 1, 1)
939-
940- context.translate(border + 0.5, border + 0.5)
941-
942- context.save()
943- context.set_line_width(1)
944- context.set_source_rgb(0.7, 0.7, 0.7)
945-
946- for x in range(0, int(finish_time/10000) + 100, 100):
947- context.move_to(x, 0)
948- context.line_to(x, height-border*2)
949-
950- context.move_to(0, 0)
951- context.line_to(width-border*2, 0)
952-
953- context.move_to(0, height-border*2)
954- context.line_to(width-border*2, height-border*2)
955-
956- context.stroke()
957- context.restore()
958-
959- osrel = "Linux"
960- if os.path.exists("/etc/os-release"):
961- for line in open("/etc/os-release"):
962- if line.startswith('PRETTY_NAME='):
963- osrel = line[12:]
964- osrel = osrel.strip('\"\n')
965- break
966-
967- banner = "{} {} ({} {}) {}".format(osrel, *(os.uname()[1:5]))
968- draw_text(context, 0, -15, banner, hcenter = 0, vcenter = 1)
969-
970- for x in range(0, int(finish_time/10000) + 100, 100):
971- draw_text(context, x, -5, "%lus" % (x/100), vcenter = 0, hcenter = 0)
972-
973- y = 0
974-
975- # draw boxes for kernel and initramfs boot time
976- if initrd_time > 0:
977- draw_box(context, 0, y, initrd_time/10000, bar_height, 0.7, 0.7, 0.7)
978- draw_text(context, 10, y + bar_height/2, "kernel", hcenter = 0)
979- y += bar_height + bar_space
980-
981- draw_box(context, initrd_time/10000, y, userspace_time/10000-initrd_time/10000, bar_height, 0.7, 0.7, 0.7)
982- draw_text(context, initrd_time/10000 + 10, y + bar_height/2, "initramfs", hcenter = 0)
983- y += bar_height + bar_space
984-
985- else:
986- draw_box(context, 0, y, userspace_time/10000, bar_height, 0.6, 0.6, 0.6)
987- draw_text(context, 10, y + bar_height/2, "kernel", hcenter = 0)
988- y += bar_height + bar_space
989-
990- draw_box(context, userspace_time/10000, y, finish_time/10000-userspace_time/10000, bar_height, 0.7, 0.7, 0.7)
991- draw_text(context, userspace_time/10000 + 10, y + bar_height/2, "userspace", hcenter = 0)
992- y += bar_height + bar_space
993-
994- for name, ixt, aet, axt, iet in s:
995-
996- drawn = False
997- left = -1
998-
999- if ixt >= userspace_time and ixt <= finish_time:
1000-
1001- # Activating
1002- a = ixt
1003- b = min(filter(lambda x: x >= ixt, (aet, axt, iet, finish_time))) - ixt
1004-
1005- draw_box(context, a/10000, y, b/10000, bar_height, 1, 0, 0)
1006- drawn = True
1007-
1008- if left < 0:
1009- left = a
1010-
1011- if aet >= userspace_time and aet <= finish_time:
1012-
1013- # Active
1014- a = aet
1015- b = min(filter(lambda x: x >= aet, (axt, iet, finish_time))) - aet
1016-
1017- draw_box(context, a/10000, y, b/10000, bar_height, .8, .6, .6)
1018- drawn = True
1019-
1020- if left < 0:
1021- left = a
1022-
1023- if axt >= userspace_time and axt <= finish_time:
1024-
1025- # Deactivating
1026- a = axt
1027- b = min(filter(lambda x: x >= axt, (iet, finish_time))) - axt
1028-
1029- draw_box(context, a/10000, y, b/10000, bar_height, .6, .4, .4)
1030- drawn = True
1031-
1032- if left < 0:
1033- left = a
1034-
1035- if drawn:
1036- x = left/10000
1037-
1038- if x < width/2-border:
1039- draw_text(context, x + 10, y + bar_height/2, name, hcenter = 0)
1040- else:
1041- draw_text(context, x - 10, y + bar_height/2, name, hcenter = 1)
1042-
1043- y += bar_height + bar_space
1044-
1045- draw_text(context, 0, height-border*2, "Legend: Red = Activating; Pink = Active; Dark Pink = Deactivating", hcenter = 0, vcenter = -1)
1046-
1047- if initrd_time > 0:
1048- draw_text(context, 0, height-border*2 + bar_height, "Startup finished in %lums (kernel) + %lums (initramfs) + %lums (userspace) = %lums" % ( \
1049- initrd_time/1000, \
1050- (userspace_time - initrd_time)/1000, \
1051- (finish_time - userspace_time)/1000, \
1052- finish_time/1000), hcenter = 0, vcenter = -1)
1053- else:
1054- draw_text(context, 0, height-border*2 + bar_height, "Startup finished in %lums (kernel) + %lums (userspace) = %lums" % ( \
1055- userspace_time/1000, \
1056- (finish_time - userspace_time)/1000, \
1057- finish_time/1000), hcenter = 0, vcenter = -1)
1058-
1059- surface.finish()
1060-
1061-parser = argparse.ArgumentParser(formatter_class=argparse.RawDescriptionHelpFormatter,
1062- version='systemd-analyze @PACKAGE_VERSION@',
1063- description='Process systemd profiling information',
1064- epilog='''\
1065-time - print time spent in the kernel before reaching userspace
1066-blame - print list of running units ordered by time to init
1067-plot - output SVG graphic showing service initialization
1068-''')
1069-
1070-parser.add_argument('action', choices=('time', 'blame', 'plot'),
1071- default='time', nargs='?',
1072- help='action to perform (default: time)')
1073-parser.add_argument('--user', action='store_true',
1074- help='use the session bus')
1075-
1076-args = parser.parse_args()
1077-
1078-if args.user:
1079- bus = Gio.BusType.SESSION
1080-else:
1081- bus = Gio.BusType.SYSTEM
1082-
1083-verb = {'time' : time,
1084- 'blame': blame,
1085- 'plot' : plot,
1086- }
1087-verb.get(args.action)()
diff --git a/meta/recipes-core/systemd/systemd/0002-Revert-analyze-use-GDBus-instead-of-dbus-python.patch b/meta/recipes-core/systemd/systemd/0002-Revert-analyze-use-GDBus-instead-of-dbus-python.patch
deleted file mode 100644
index 96ad323509..0000000000
--- a/meta/recipes-core/systemd/systemd/0002-Revert-analyze-use-GDBus-instead-of-dbus-python.patch
+++ /dev/null
@@ -1,94 +0,0 @@
1Upstream-Status: Backport [revert]
2Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
3
4From 8079db861b8ffdce69fa10a9ab9ef4740045187f Mon Sep 17 00:00:00 2001
5From: Koen Kooi <koen@dominion.thruhere.net>
6Date: Mon, 10 Dec 2012 12:25:00 +0100
7Subject: [PATCH 2/2] Revert "analyze: use GDBus instead of dbus-python"
8
9This reverts commit 4940c64240541e91411620b7dc0963e012aa6b91.
10
11Python-gobject is too old in current OE
12---
13 src/analyze/systemd-analyze | 31 ++++++++++++++-----------------
14 1 files changed, 14 insertions(+), 17 deletions(-)
15
16diff --git a/src/analyze/systemd-analyze b/src/analyze/systemd-analyze
17index 87a83dd..636fd74 100755
18--- a/src/analyze/systemd-analyze
19+++ b/src/analyze/systemd-analyze
20@@ -1,15 +1,14 @@
21 #!/usr/bin/python
22
23-import getopt, sys, os
24-from gi.repository import Gio
25+import getopt, dbus, sys, os
26 try:
27 import cairo
28 except ImportError:
29 cairo = None
30
31 def acquire_time_data():
32- manager = Gio.DBusProxy.new_for_bus_sync(bus, Gio.DBusProxyFlags.NONE,
33- None, 'org.freedesktop.systemd1', '/org/freedesktop/systemd1', 'org.freedesktop.systemd1.Manager', None)
34+
35+ manager = dbus.Interface(bus.get_object('org.freedesktop.systemd1', '/org/freedesktop/systemd1'), 'org.freedesktop.systemd1.Manager')
36 units = manager.ListUnits()
37
38 l = []
39@@ -18,25 +17,23 @@ def acquire_time_data():
40 if i[5] != "":
41 continue
42
43- properties = Gio.DBusProxy.new_for_bus_sync(bus, Gio.DBusProxyFlags.NONE,
44- None, 'org.freedesktop.systemd1', i[6], 'org.freedesktop.DBus.Properties', None)
45+ properties = dbus.Interface(bus.get_object('org.freedesktop.systemd1', i[6]), 'org.freedesktop.DBus.Properties')
46
47- ixt = properties.Get('(ss)', 'org.freedesktop.systemd1.Unit', 'InactiveExitTimestampMonotonic')
48- aet = properties.Get('(ss)', 'org.freedesktop.systemd1.Unit', 'ActiveEnterTimestampMonotonic')
49- axt = properties.Get('(ss)', 'org.freedesktop.systemd1.Unit', 'ActiveExitTimestampMonotonic')
50- iet = properties.Get('(ss)', 'org.freedesktop.systemd1.Unit', 'InactiveEnterTimestampMonotonic')
51+ ixt = int(properties.Get('org.freedesktop.systemd1.Unit', 'InactiveExitTimestampMonotonic'))
52+ aet = int(properties.Get('org.freedesktop.systemd1.Unit', 'ActiveEnterTimestampMonotonic'))
53+ axt = int(properties.Get('org.freedesktop.systemd1.Unit', 'ActiveExitTimestampMonotonic'))
54+ iet = int(properties.Get('org.freedesktop.systemd1.Unit', 'InactiveEnterTimestampMonotonic'))
55
56 l.append((str(i[0]), ixt, aet, axt, iet))
57
58 return l
59
60 def acquire_start_time():
61- properties = Gio.DBusProxy.new_for_bus_sync(bus, Gio.DBusProxyFlags.NONE,
62- None, 'org.freedesktop.systemd1', '/org/freedesktop/systemd1', 'org.freedesktop.DBus.Properties', None)
63+ properties = dbus.Interface(bus.get_object('org.freedesktop.systemd1', '/org/freedesktop/systemd1'), 'org.freedesktop.DBus.Properties')
64
65- initrd_time = properties.Get('(ss)', 'org.freedesktop.systemd1.Manager', 'InitRDTimestampMonotonic')
66- userspace_time = properties.Get('(ss)', 'org.freedesktop.systemd1.Manager', 'UserspaceTimestampMonotonic')
67- finish_time = properties.Get('(ss)', 'org.freedesktop.systemd1.Manager', 'FinishTimestampMonotonic')
68+ initrd_time = int(properties.Get('org.freedesktop.systemd1.Manager', 'InitRDTimestampMonotonic'))
69+ userspace_time = int(properties.Get('org.freedesktop.systemd1.Manager', 'UserspaceTimestampMonotonic'))
70+ finish_time = int(properties.Get('org.freedesktop.systemd1.Manager', 'FinishTimestampMonotonic'))
71
72 if finish_time == 0:
73 sys.stderr.write("Bootup is not yet finished. Please try again later.\n")
74@@ -284,7 +281,7 @@ def unknown_verb():
75 usage()
76 sys.exit(1)
77
78-bus = Gio.BusType.SYSTEM
79+bus = dbus.SystemBus()
80
81 try:
82 opts, args = getopt.gnu_getopt(sys.argv[1:], "h", ["help", "user"])
83@@ -296,7 +293,7 @@ for o, a in opts:
84 if o in ("-h", "--help"):
85 help()
86 elif o == '--user':
87- bus = Gio.BusType.SESSION
88+ bus = dbus.SessionBus()
89 else:
90 assert False, "unhandled option"
91
92--
931.7.7.6
94
diff --git a/meta/recipes-core/systemd/systemd_196.bb b/meta/recipes-core/systemd/systemd_197.bb
index 2854aaef8a..500c3ec68a 100644
--- a/meta/recipes-core/systemd/systemd_196.bb
+++ b/meta/recipes-core/systemd/systemd_197.bb
@@ -3,7 +3,7 @@ HOMEPAGE = "http://www.freedesktop.org/wiki/Software/systemd"
3 3
4LICENSE = "GPLv2 & LGPLv2.1 & MIT" 4LICENSE = "GPLv2 & LGPLv2.1 & MIT"
5LIC_FILES_CHKSUM = "file://LICENSE.GPL2;md5=751419260aa954499f7abaabaa882bbe \ 5LIC_FILES_CHKSUM = "file://LICENSE.GPL2;md5=751419260aa954499f7abaabaa882bbe \
6 file://LICENSE.LGPL2.1;md5=fb919cc88dbe06ec0b0bd50e001ccf1f \ 6 file://LICENSE.LGPL2.1;md5=4fbd65380cdd255951079008b364516c \
7 file://LICENSE.MIT;md5=544799d0b492f119fa04641d1b8868ed" 7 file://LICENSE.MIT;md5=544799d0b492f119fa04641d1b8868ed"
8 8
9PROVIDES = "udev" 9PROVIDES = "udev"
@@ -18,17 +18,16 @@ SECTION = "base/shell"
18inherit gtk-doc useradd pkgconfig autotools perlnative 18inherit gtk-doc useradd pkgconfig autotools perlnative
19 19
20SRC_URI = "http://www.freedesktop.org/software/systemd/systemd-${PV}.tar.xz \ 20SRC_URI = "http://www.freedesktop.org/software/systemd/systemd-${PV}.tar.xz \
21 file://0001-Revert-systemd-analyze-use-argparse-instead-of-getop.patch \
22 file://0002-Revert-analyze-use-GDBus-instead-of-dbus-python.patch \
23 file://touchscreen.rules \ 21 file://touchscreen.rules \
24 file://modprobe.rules \ 22 file://modprobe.rules \
25 file://var-run.conf \ 23 file://var-run.conf \
26 ${UCLIBCPATCHES} \ 24 ${UCLIBCPATCHES} \
27 file://00-create-volatile.conf \ 25 file://00-create-volatile.conf \
26 file://0001-systemd-analyze-rewrite-in-C.patch \
28 file://0001-test-unit-file-Add-libsystemd-daemon.la-to-LDADD.patch \ 27 file://0001-test-unit-file-Add-libsystemd-daemon.la-to-LDADD.patch \
29 " 28 "
30SRC_URI[md5sum] = "05ebd7f108e420e2b4e4810ea4b3c810" 29SRC_URI[md5sum] = "56a860dceadfafe59f40141eb5223743"
31SRC_URI[sha256sum] = "6bd4a658a5dd8198235b17ad1b1f0cc56d9e6f00d646ddcffdfc6f058b55e4bf" 30SRC_URI[sha256sum] = "e6857ea21ae24d7056e7b0f4c2aaaba73b8bf57025b8949c0a8af0c1bc9774b5"
32 31
33UCLIBCPATCHES = "" 32UCLIBCPATCHES = ""
34UCLIBCPATCHES_libc-uclibc = "file://systemd-pam-configure-check-uclibc.patch \ 33UCLIBCPATCHES_libc-uclibc = "file://systemd-pam-configure-check-uclibc.patch \
@@ -67,6 +66,8 @@ EXTRA_OECONF = " --with-distro=${SYSTEMDDISTRO} \
67 --disable-microhttpd \ 66 --disable-microhttpd \
68 --without-python \ 67 --without-python \
69 " 68 "
69# uclibc does not have NSS
70EXTRA_OECONF_append_libc-uclibc = " --disable-myhostname "
70 71
71# There's no docbook-xsl-native, so for the xsltproc check to false 72# There's no docbook-xsl-native, so for the xsltproc check to false
72do_configure_prepend() { 73do_configure_prepend() {
@@ -150,6 +151,7 @@ FILES_${PN} = " ${base_bindir}/* \
150 ${systemd_unitdir}/system/* \ 151 ${systemd_unitdir}/system/* \
151 /lib/udev/rules.d/99-systemd.rules \ 152 /lib/udev/rules.d/99-systemd.rules \
152 ${base_libdir}/security/*.so \ 153 ${base_libdir}/security/*.so \
154 ${libdir}/libnss_myhostname.so.2 \
153 /cgroup \ 155 /cgroup \
154 ${bindir}/systemd* \ 156 ${bindir}/systemd* \
155 ${bindir}/localectl \ 157 ${bindir}/localectl \