scripts/pybootchart: Fix missing entries bug

If two entries have the same start time, the data store used will cause
all but one of the entries to be lost. This patch enhances the data
storage structure to avoid this problem and allow more than one
event to start at the same time.

(From OE-Core rev: 220b071fd8d1cc6bdbca58f75489e3c9b34921ca)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Richard Purdie 2012-11-19 15:02:18 +00:00
parent 6e6dcbe340
commit 295f1608b0
2 changed files with 45 additions and 31 deletions

View File

@ -287,32 +287,33 @@ def render(ctx, res):
offset = min(res.start.keys()) offset = min(res.start.keys())
for s in sorted(res.start.keys()): for s in sorted(res.start.keys()):
task = res.start[s].split(":")[1] for val in sorted(res.start[s]):
#print res.start[s] task = val.split(":")[1]
#print res.processes[res.start[s]][1] #print val
#print s #print res.processes[val][1]
x = (s - offset) * sec_w #print s
w = ((res.processes[res.start[s]][1] - s) * sec_w) x = (s - offset) * sec_w
w = ((res.processes[val][1] - s) * sec_w)
#print "proc at %s %s %s %s" % (x, y, w, proc_h) #print "proc at %s %s %s %s" % (x, y, w, proc_h)
col = None col = None
if task == "do_compile": if task == "do_compile":
col = TASK_COLOR_COMPILE col = TASK_COLOR_COMPILE
elif task == "do_configure": elif task == "do_configure":
col = TASK_COLOR_CONFIGURE col = TASK_COLOR_CONFIGURE
elif task == "do_install": elif task == "do_install":
col = TASK_COLOR_INSTALL col = TASK_COLOR_INSTALL
elif task == "do_package": elif task == "do_package":
col = TASK_COLOR_PACKAGE col = TASK_COLOR_PACKAGE
elif task == "do_populate_sysroot": elif task == "do_populate_sysroot":
col = TASK_COLOR_SYSROOT col = TASK_COLOR_SYSROOT
draw_rect(ctx, PROC_BORDER_COLOR, (x, y, w, proc_h)) draw_rect(ctx, PROC_BORDER_COLOR, (x, y, w, proc_h))
if col: if col:
draw_fill_rect(ctx, col, (x, y, w, proc_h)) draw_fill_rect(ctx, col, (x, y, w, proc_h))
draw_label_in_box(ctx, PROC_TEXT_COLOR, res.start[s], x, y + proc_h - 4, w, proc_h) draw_label_in_box(ctx, PROC_TEXT_COLOR, val, x, y + proc_h - 4, w, proc_h)
y = y + proc_h y = y + proc_h
# draw process boxes # draw process boxes
#draw_process_bar_chart(ctx, proc_tree, curr_y + bar_h, w, h) #draw_process_bar_chart(ctx, proc_tree, curr_y + bar_h, w, h)

View File

@ -184,9 +184,16 @@ def _do_parse(state, filename, file):
elif line.startswith("Ended:"): elif line.startswith("Ended:"):
end = int(float(line.split()[-1])) end = int(float(line.split()[-1]))
if start and end and (end - start) > 8: if start and end and (end - start) > 8:
k = pn + ":" + task
state.processes[pn + ":" + task] = [start, end] state.processes[pn + ":" + task] = [start, end]
state.start[start] = pn + ":" + task if start not in state.start:
state.end[end] = pn + ":" + task state.start[start] = []
if k not in state.start[start]:
state.start[start].append(pn + ":" + task)
if end not in state.end:
state.end[end] = []
if k not in state.end[end]:
state.end[end].append(pn + ":" + task)
return state return state
def parse_file(state, filename): def parse_file(state, filename):
@ -248,12 +255,18 @@ def split_res(res, n):
#state.processes[pn + ":" + task] = [start, end] #state.processes[pn + ":" + task] = [start, end]
#state.start[start] = pn + ":" + task #state.start[start] = pn + ":" + task
#state.end[end] = pn + ":" + task #state.end[end] = pn + ":" + task
p = res.start[s_list[i]] for p in res.start[s_list[i]]:
s = s_list[i] s = s_list[i]
e = res.processes[p][1] e = res.processes[p][1]
state.processes[p] = [s, e] state.processes[p] = [s, e]
state.start[s] = p if s not in state.start:
state.end[e] = p state.start[s] = []
if p not in state.start[s]:
state.start[s].append(p)
if e not in state.end:
state.end[e] = []
if p not in state.end[e]:
state.end[e].append(p)
start = end start = end
end = end + frag_size end = end + frag_size
if end > len(s_list): if end > len(s_list):