pybootchartgui: calcule elapsed_time when starting the loop

Instaed of calculate the elapsed time over the loop when needed
do it on the loop startup.

(From OE-Core rev: 63a19626f10873cd7a4aabee7c9777fdede83bcb)

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>
This commit is contained in:
Jose Quaresma
2023-07-10 22:24:17 +00:00
committed by Richard Purdie
parent e62c3540f2
commit 174e1790b7

View 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