diff options
Diffstat (limited to 'scripts/pybootchartgui/pybootchartgui/parsing.py')
-rw-r--r-- | scripts/pybootchartgui/pybootchartgui/parsing.py | 36 |
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): | |||
226 | #monitored_app = state.headers.get("profile.process") | 226 | #monitored_app = state.headers.get("profile.process") |
227 | #proc_tree = ProcessTree(state.ps_stats, monitored_app, prune) | 227 | #proc_tree = ProcessTree(state.ps_stats, monitored_app, prune) |
228 | return state | 228 | return state |
229 | |||
230 | def split_res(res, n): | ||
231 | """ Split the res into n pieces """ | ||
232 | res_list = [] | ||
233 | if n > 1: | ||
234 | s_list = sorted(res.start.keys()) | ||
235 | frag_size = len(s_list) / float(n) | ||
236 | # Need the top value | ||
237 | if frag_size > int(frag_size): | ||
238 | frag_size = int(frag_size + 1) | ||
239 | else: | ||
240 | frag_size = int(frag_size) | ||
241 | |||
242 | start = 0 | ||
243 | end = frag_size | ||
244 | while start < end: | ||
245 | state = ParserState() | ||
246 | for i in range(start, end): | ||
247 | # Add these lines for reference | ||
248 | #state.processes[pn + ":" + task] = [start, end] | ||
249 | #state.start[start] = pn + ":" + task | ||
250 | #state.end[end] = pn + ":" + task | ||
251 | p = res.start[s_list[i]] | ||
252 | s = s_list[i] | ||
253 | e = res.processes[p][1] | ||
254 | state.processes[p] = [s, e] | ||
255 | state.start[s] = p | ||
256 | state.end[e] = p | ||
257 | start = end | ||
258 | end = end + frag_size | ||
259 | if end > len(s_list): | ||
260 | end = len(s_list) | ||
261 | res_list.append(state) | ||
262 | else: | ||
263 | res_list.append(res) | ||
264 | return res_list | ||