[systemd-devel] [PATCH 3/3] analyze: draw kernel boot time as well

Koen Kooi koen at dominion.thruhere.net
Thu Sep 22 06:26:51 PDT 2011


Sample output: http://dominion.thruhere.net/koen/angstrom/systemd/omap4430-panda-201109221422.svg

Signed-off-by: Koen Kooi <koen at dominion.thruhere.net>
---

This is just a start to see if something like this is acceptable, feedback welcome!

 src/systemd-analyze |   20 +++++++++++++-------
 1 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/src/systemd-analyze b/src/systemd-analyze
index d0db984..480f7aa 100755
--- a/src/systemd-analyze
+++ b/src/systemd-analyze
@@ -116,7 +116,8 @@ elif sys.argv[1] == 'plot':
         data = acquire_time_data()
         s = sorted(data, key = lambda i: i[1])
 
-        count = 0
+        # start at one to account for the kernel bar
+        count = 1
 
         for name, ixt, aet, axt, iet in s:
 
@@ -130,7 +131,7 @@ elif sys.argv[1] == 'plot':
         bar_space = bar_height * 0.1
 
         # 1000px = 10s, 1px = 10ms
-        width = (finish_time - start_time)/10000 + border*2
+        width = (finish_time)/10000 + border*2
         height = count * (bar_height + bar_space) + border * 2
 
         if width < 1000:
@@ -147,7 +148,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, max((finish_time - start_time)/10000,110), 100):
+        for x in range(0, max((finish_time)/10000,110), 100):
                 context.move_to(x, 0)
                 context.line_to(x, height-border*2)
 
@@ -163,11 +164,16 @@ elif sys.argv[1] == 'plot':
         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):
+        for x in range(0, max((finish_time)/10000,110), 100):
                 draw_text(context, x, -5, "%lus" % (x/100), vcenter = 0, hcenter = 0)
 
         y = 0
 
+        # draw box for kernel boot time
+        draw_box(context, 0, y, start_time/10000, bar_height, 0.8, 0.6, 0.6)
+        draw_text(context, 10, y + bar_height/2, "kernel", hcenter = 0)
+        y += bar_height + bar_space
+	
         for name, ixt, aet, axt, iet in s:
 
                 drawn = False
@@ -176,7 +182,7 @@ elif sys.argv[1] == 'plot':
                 if ixt >= start_time and ixt <= finish_time:
 
                         # Activating
-                        a = ixt - start_time
+                        a = ixt
                         b = min(filter(lambda x: x >= ixt, (aet, axt, iet, finish_time))) - ixt
 
                         draw_box(context, a/10000, y, b/10000, bar_height, 1, 0, 0)
@@ -188,7 +194,7 @@ elif sys.argv[1] == 'plot':
                 if aet >= start_time and aet <= finish_time:
 
                         # Active
-                        a = aet - start_time
+                        a = aet
                         b = min(filter(lambda x: x >= aet, (axt, iet, finish_time))) - aet
 
                         draw_box(context, a/10000, y, b/10000, bar_height, .8, .6, .6)
@@ -200,7 +206,7 @@ elif sys.argv[1] == 'plot':
                 if axt >= start_time and axt <= finish_time:
 
                         # Deactivating
-                        a = axt - start_time
+                        a = axt
                         b = min(filter(lambda x: x >= axt, (iet, finish_time))) - axt
 
                         draw_box(context, a/10000, y, b/10000, bar_height, .6, .4, .4)
-- 
1.6.6.1



More information about the systemd-devel mailing list