]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
pybootchartgui: calcule elapsed_time when starting the loop
authorJose Quaresma <quaresma.jose@gmail.com>
Mon, 10 Jul 2023 22:24:17 +0000 (22:24 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 14 Jul 2023 16:31:02 +0000 (17:31 +0100)
Instaed of calculate the elapsed time over the loop when needed
do it on the loop startup.

Signed-off-by: Jose Quaresma <jose.quaresma@foundries.io>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
scripts/pybootchartgui/pybootchartgui/draw.py

index e71fe09ea65e91bc4b1359049f3622be4e3404c4..ddfa9a619224a71bedc9d902cc58410105935c6c 100644 (file)
@@ -646,8 +646,9 @@ def render_processes_chart(ctx, options, trace, curr_y, w, h, sec_w):
     offset = trace.min or min(trace.start.keys())
     for start in sorted(trace.start.keys()):
         for process in sorted(trace.start[start]):
+            elapsed_time = trace.processes[process][1] - start
             if not options.app_options.show_all and \
-                    trace.processes[process][1] - start < options.app_options.mintime:
+                    elapsed_time < options.app_options.mintime:
                 continue
             task = process.split(":")[1]
 
@@ -656,7 +657,7 @@ def render_processes_chart(ctx, options, trace, curr_y, w, h, sec_w):
             #print(s)
 
             x = chart_rect[0] + (start - offset) * sec_w
-            w = ((trace.processes[process][1] - start) * sec_w)
+            w = elapsed_time * sec_w
 
             #print("proc at %s %s %s %s" % (x, y, w, proc_h))
             col = None
@@ -684,7 +685,6 @@ def render_processes_chart(ctx, options, trace, curr_y, w, h, sec_w):
             draw_label_in_box(ctx, PROC_TEXT_COLOR, process, x, y + proc_h - 4, w, proc_h)
 
             # Show elapsed time for each task
-            elapsed_time = f"{trace.processes[process][1] - start}s"
             draw_text(ctx, elapsed_time, PROC_TEXT_COLOR, x + w + 4, y + proc_h - 4)
 
             y = y + proc_h