summaryrefslogtreecommitdiffstats
path: root/scripts/pybootchartgui/pybootchartgui/parsing.py
diff options
context:
space:
mode:
authorRobert Yang <liezhi.yang@windriver.com>2012-06-06 14:10:11 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-06-15 15:09:16 +0100
commit04a34899e1c15a70babd97a3a59ccb9f8af05bad (patch)
tree91c91ce05a1ba8e98cf9f047ddc66e4fb2757afe /scripts/pybootchartgui/pybootchartgui/parsing.py
parent6ea0c02d0db08f6b4570769c6811ecdb051646ad (diff)
downloadopenembedded-core-04a34899e1c15a70babd97a3a59ccb9f8af05bad.tar.gz
pybootchartgui: split the output chart into multiple ones
Split the output chart into multiple ones to make it more readable, it only works with "-o path", which means that it doesn't work if the user doesn't want to save the chart to the disk. For example: $ ./pybootchartgui.py /path/to/tmp/buildstats/core-image-sato-qemux86/201205301810/ -f svg -s 5 -o /tmp/ bootchart written to /tmp/bootchart_1.svg bootchart written to /tmp/bootchart_2.svg bootchart written to /tmp/bootchart_3.svg bootchart written to /tmp/bootchart_4.svg bootchart written to /tmp/bootchart_5.svg [YOCTO #2403] Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Diffstat (limited to 'scripts/pybootchartgui/pybootchartgui/parsing.py')
-rw-r--r--scripts/pybootchartgui/pybootchartgui/parsing.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/scripts/pybootchartgui/pybootchartgui/parsing.py b/scripts/pybootchartgui/pybootchartgui/parsing.py
index 11a082941c..c64eba0a4d 100644
--- a/scripts/pybootchartgui/pybootchartgui/parsing.py
+++ b/scripts/pybootchartgui/pybootchartgui/parsing.py
@@ -226,3 +226,39 @@ def parse(paths, prune):
#monitored_app = state.headers.get("profile.process")
#proc_tree = ProcessTree(state.ps_stats, monitored_app, prune)
return state
+
+def split_res(res, n):
+ """ Split the res into n pieces """
+ res_list = []
+ if n > 1:
+ s_list = sorted(res.start.keys())
+ frag_size = len(s_list) / float(n)
+ # Need the top value
+ if frag_size > int(frag_size):
+ frag_size = int(frag_size + 1)
+ else:
+ frag_size = int(frag_size)
+
+ start = 0
+ end = frag_size
+ while start < end:
+ state = ParserState()
+ 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
+ p = res.start[s_list[i]]
+ s = s_list[i]
+ e = res.processes[p][1]
+ state.processes[p] = [s, e]
+ state.start[s] = p
+ state.end[e] = p
+ start = end
+ end = end + frag_size
+ if end > len(s_list):
+ end = len(s_list)
+ res_list.append(state)
+ else:
+ res_list.append(res)
+ return res_list