chiark / gitweb /
analyze: report startup time in plot mode as well
[elogind.git] / src / systemd-analyze
index 6f03d13bd07ec0cc2b25fb05bfc856f2dc8bd328..ac6404099e12efef93f5972e6527722ce7f0f801 100755 (executable)
@@ -89,7 +89,7 @@ if len(sys.argv) <= 1 or sys.argv[1] == 'time':
                         finish_time/1000)
         else:
                 print "Startup finished in %lums (kernel) + %lums (userspace) = %lums" % ( \
-                        startup_time/1000, \
+                        start_time/1000, \
                         (finish_time - start_time)/1000, \
                         finish_time/1000)
 
@@ -110,7 +110,7 @@ elif sys.argv[1] == 'blame':
                 sys.stdout.write("%6lums %s\n" % ((aet - ixt) / 1000, name))
 
 elif sys.argv[1] == 'plot':
-        import cairo
+        import cairo, os
 
         initrd_time, start_time, finish_time = acquire_start_time()
         data = acquire_time_data()
@@ -147,7 +147,7 @@ elif sys.argv[1] == 'plot':
         context.set_line_width(1)
         context.set_source_rgb(0.7, 0.7, 0.7)
 
-        for x in range(0, (finish_time - start_time)/10000, 100):
+        for x in range(0, max((finish_time - start_time)/10000,110), 100):
                 context.move_to(x, 0)
                 context.line_to(x, height-border*2)
 
@@ -160,7 +160,10 @@ elif sys.argv[1] == 'plot':
         context.stroke()
         context.restore()
 
-        for x in range(0, (finish_time - start_time)/10000, 100):
+        banner = "Running on %s (%s %s) %s" % (os.uname()[1], os.uname()[2], os.uname()[3], os.uname()[4])
+        draw_text(context, 0, -15, banner, hcenter = 0, vcenter = 1)
+
+        for x in range(0, max((finish_time - start_time)/10000,110), 100):
                 draw_text(context, x, -5, "%lus" % (x/100), vcenter = 0, hcenter = 0)
 
         y = 0
@@ -218,6 +221,18 @@ elif sys.argv[1] == 'plot':
 
         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 (initrd) + %lums (userspace) = %lums" % ( \
+                        initrd_time/1000, \
+                        (start_time - initrd_time)/1000, \
+                        (finish_time - start_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" % ( \
+                        start_time/1000, \
+                        (finish_time - start_time)/1000, \
+                        finish_time/1000), hcenter = 0, vcenter = -1)
+
         surface.finish()
 elif sys.argv[1] in ("help", "--help", "-h"):
         help()