diff options
author | Peter Kjellerstedt <peter.kjellerstedt@axis.com> | 2014-01-21 16:22:33 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-01-22 07:26:29 +0000 |
commit | 5fa869007b5ba762bf5679197cf98b1d14a34a22 (patch) | |
tree | 9d2d035cf6796fe5d7fe5f85162f783c1fde0c96 | |
parent | 1ca2e1a2ae3dc4d1e62a9daf25df588ec27a195a (diff) | |
download | openembedded-core-5fa869007b5ba762bf5679197cf98b1d14a34a22.tar.gz openembedded-core-5fa869007b5ba762bf5679197cf98b1d14a34a22.tar.bz2 openembedded-core-5fa869007b5ba762bf5679197cf98b1d14a34a22.zip |
pybootchartgui: Simplify adding processes to the trace
Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | scripts/pybootchartgui/pybootchartgui/parsing.py | 39 |
1 files changed, 14 insertions, 25 deletions
diff --git a/scripts/pybootchartgui/pybootchartgui/parsing.py b/scripts/pybootchartgui/pybootchartgui/parsing.py index 0600b5162b..1cb4466e6d 100644 --- a/scripts/pybootchartgui/pybootchartgui/parsing.py +++ b/scripts/pybootchartgui/pybootchartgui/parsing.py @@ -96,6 +96,16 @@ class Trace: return self.headers != None and self.disk_stats != None and \ self.ps_stats != None and self.cpu_stats != None + def add_process(self, process, start, end): + self.processes[process] = [start, end] + if start not in self.start: + self.start[start] = [] + if process not in self.start[start]: + self.start[start].append(process) + if end not in self.end: + self.end[end] = [] + if process not in self.end[end]: + self.end[end].append(process) def compile(self, writer): @@ -645,16 +655,7 @@ def _do_parse(writer, state, filename, file): elif line.startswith("Ended:"): end = int(float(line.split()[-1])) if start and end: - k = pn + ":" + task - state.processes[pn + ":" + task] = [start, end] - if start not in state.start: - 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) + state.add_process(pn + ":" + task, start, end) t2 = clock() writer.info(" %s seconds" % str(t2-t1)) return state @@ -716,22 +717,10 @@ def split_res(res, n): while start < end: state = Trace(None, [], None) for i in range(start, end): - # Add these lines for reference - #state.processes[pn + ":" + task] = [start, end] - #state.start[start] = pn + ":" + task - #state.end[end] = pn + ":" + task + # Add this line for reference + #state.add_process(pn + ":" + task, start, end) for p in res.start[s_list[i]]: - s = s_list[i] - e = res.processes[p][1] - state.processes[p] = [s, e] - if s not in state.start: - 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) + state.add_process(p, s_list[i], res.processes[p][1]) start = end end = end + frag_size if end > len(s_list): |