systemd-analyze.in revision 2f4da3e6c298bc0ae6243cae47aedb01c50fa870
#!@PYTHON_BINARY@
try:
None, 'org.freedesktop.systemd1', '/org/freedesktop/systemd1', 'org.freedesktop.systemd1.Manager', None)
l = []
if i[5] != "":
continue
return l
None, 'org.freedesktop.systemd1', '/org/freedesktop/systemd1', 'org.freedesktop.DBus.Properties', None)
# values but are actually considered negative from the point
# in time of kernel initialization. Also, the monotonic kernel
# time will always be 0 since that's the epoch of the
# monotonic clock. Since we want to know whether the kernel
# timestamp is set at all we will instead ask for the realtime
# clock for this timestamp.
firmware_time = properties.Get('(ss)', 'org.freedesktop.systemd1.Manager', 'FirmwareTimestampMonotonic')
loader_time = properties.Get('(ss)', 'org.freedesktop.systemd1.Manager', 'LoaderTimestampMonotonic')
initrd_time = properties.Get('(ss)', 'org.freedesktop.systemd1.Manager', 'InitRDTimestampMonotonic')
userspace_time = properties.Get('(ss)', 'org.freedesktop.systemd1.Manager', 'UserspaceTimestampMonotonic')
finish_time = properties.Get('(ss)', 'org.freedesktop.systemd1.Manager', 'FinishTimestampMonotonic')
if finish_time == 0:
context.rectangle(j, k, l, m)
if hcenter:
if vcenter:
def time():
firmware_time, loader_time, kernel_time, initrd_time, userspace_time, finish_time = acquire_start_time()
if firmware_time > 0:
if loader_time > 0:
if initrd_time > 0:
sys.stdout.write("%lums (kernel) + %lums (initrd) + " % (initrd_time / 1000, (userspace_time - initrd_time) / 1000))
elif kernel_time > 0:
if kernel_time > 0:
else:
continue
continue
firmware_time, loader_time, kernel_time, initrd_time, userspace_time, finish_time = acquire_start_time()
# Account for kernel and initramfs bars if they exist
if initrd_time > 0:
count = 3
else:
count = 2
if (ixt >= userspace_time and ixt <= finish_time) or \
(aet >= userspace_time and aet <= finish_time) or \
(axt >= userspace_time and axt <= finish_time):
count += 1
border = 100
bar_height = 20
# 1000px = 10s, 1px = 10ms
if width < 1000:
width = 1000
context.translate(border + 0.5, border + 0.5)
osrel = "Linux"
break
y = 0
# draw boxes for kernel and initramfs boot time
if initrd_time > 0:
draw_box(context, 0, y, initrd_time/10000, bar_height, 0.7, 0.7, 0.7)
y += bar_height + bar_space
draw_box(context, initrd_time/10000, y, userspace_time/10000-initrd_time/10000, bar_height, 0.7, 0.7, 0.7)
y += bar_height + bar_space
else:
draw_box(context, 0, y, userspace_time/10000, bar_height, 0.6, 0.6, 0.6)
y += bar_height + bar_space
draw_box(context, userspace_time/10000, y, finish_time/10000-userspace_time/10000, bar_height, 0.7, 0.7, 0.7)
y += bar_height + bar_space
left = -1
# Activating
a = ixt
draw_box(context, a/10000, y, b/10000, bar_height, 1, 0, 0)
if left < 0:
left = a
# Active
a = aet
draw_box(context, a/10000, y, b/10000, bar_height, .8, .6, .6)
if left < 0:
left = a
# Deactivating
a = axt
draw_box(context, a/10000, y, b/10000, bar_height, .6, .4, .4)
if left < 0:
left = a
if drawn:
x = left/10000
draw_text(context, x + 10, y + bar_height/2, name, hcenter = 0)
else:
draw_text(context, x - 10, y + bar_height/2, name, hcenter = 1)
y += bar_height + bar_space
draw_text(context, 0, height-border*2, "Legend: Red = Activating; Pink = Active; Dark Pink = Deactivating", hcenter = 0, vcenter = -1)
if initrd_time > 0:
draw_text(context, 0, height-border*2 + bar_height, "Startup finished in %lums (kernel) + %lums (initramfs) + %lums (userspace) = %lums" % ( \
initrd_time/1000, \
finish_time/1000), hcenter = 0, vcenter = -1)
else:
draw_text(context, 0, height-border*2 + bar_height, "Startup finished in %lums (kernel) + %lums (userspace) = %lums" % ( \
userspace_time/1000, \
finish_time/1000), hcenter = 0, vcenter = -1)
epilog='''\
time - print time spent in the kernel before reaching userspace
blame - print list of running units ordered by time to init
plot - output SVG graphic showing service initialization
''')
if args.user:
else:
verb = {'time' : time,
'blame': blame,
'plot' : plot,
}