diff options
author | Peter Kjellerstedt <peter.kjellerstedt@axis.com> | 2014-01-21 16:22:35 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-01-23 10:17:36 +0000 |
commit | 7b171ed393b179e2b9cebf73019024617bf6a67f (patch) | |
tree | 7689506a26d5fe92ba96fda97d779e5a0cabfbc9 /scripts | |
parent | 57c93e35074da2de5a66001b24a31cd40a9b2ca7 (diff) | |
download | poky-7b171ed393b179e2b9cebf73019024617bf6a67f.tar.gz |
pybootchartgui: Add option -T to allways use the full time
When --full-time (or -T) is used, the graph allways shows the full
time regardless of which processes are currently shown. This is
especially useful in combinationm with the -s flag when outputting to
multiple files.
(From OE-Core rev: c6e88199ddf2c4ae243d42afc403d28ab56f00f0)
Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/pybootchartgui/pybootchartgui/draw.py | 6 | ||||
-rw-r--r-- | scripts/pybootchartgui/pybootchartgui/main.py.in | 4 | ||||
-rw-r--r-- | scripts/pybootchartgui/pybootchartgui/parsing.py | 15 |
3 files changed, 20 insertions, 5 deletions
diff --git a/scripts/pybootchartgui/pybootchartgui/draw.py b/scripts/pybootchartgui/pybootchartgui/draw.py index 4a2ffd79e1..8c574be50c 100644 --- a/scripts/pybootchartgui/pybootchartgui/draw.py +++ b/scripts/pybootchartgui/pybootchartgui/draw.py | |||
@@ -314,6 +314,10 @@ def extents(options, xscale, trace): | |||
314 | end = trace.processes[proc][1] | 314 | end = trace.processes[proc][1] |
315 | processes += 1 | 315 | processes += 1 |
316 | 316 | ||
317 | if trace.min is not None and trace.max is not None: | ||
318 | start = trace.min | ||
319 | end = trace.max | ||
320 | |||
317 | w = int ((end - start) * sec_w_base * xscale) + 2 * off_x | 321 | w = int ((end - start) * sec_w_base * xscale) + 2 * off_x |
318 | h = proc_h * processes + header_h + 2 * off_y | 322 | h = proc_h * processes + header_h + 2 * off_y |
319 | 323 | ||
@@ -433,7 +437,7 @@ def render_processes_chart(ctx, options, trace, curr_y, w, h, sec_w): | |||
433 | 437 | ||
434 | y = curr_y+header_h | 438 | y = curr_y+header_h |
435 | 439 | ||
436 | offset = min(trace.start.keys()) | 440 | offset = trace.min or min(trace.start.keys()) |
437 | for s in sorted(trace.start.keys()): | 441 | for s in sorted(trace.start.keys()): |
438 | for val in sorted(trace.start[s]): | 442 | for val in sorted(trace.start[s]): |
439 | if not options.app_options.show_all and \ | 443 | if not options.app_options.show_all and \ |
diff --git a/scripts/pybootchartgui/pybootchartgui/main.py.in b/scripts/pybootchartgui/pybootchartgui/main.py.in index e9d2c74f1e..21bb0be3a7 100644 --- a/scripts/pybootchartgui/pybootchartgui/main.py.in +++ b/scripts/pybootchartgui/pybootchartgui/main.py.in | |||
@@ -65,6 +65,8 @@ def _mk_options_parser(): | |||
65 | # "To create a single annotation when any one of a set of processes is started, use commas to separate the names") | 65 | # "To create a single annotation when any one of a set of processes is started, use commas to separate the names") |
66 | # parser.add_option("--annotate-file", dest="annotate_file", metavar="FILENAME", default=None, | 66 | # parser.add_option("--annotate-file", dest="annotate_file", metavar="FILENAME", default=None, |
67 | # help="filename to write annotation points to") | 67 | # help="filename to write annotation points to") |
68 | parser.add_option("-T", "--full-time", action="store_true", dest="full_time", default=False, | ||
69 | help="display the full time regardless of which processes are currently shown") | ||
68 | return parser | 70 | return parser |
69 | 71 | ||
70 | class Writer: | 72 | class Writer: |
@@ -153,7 +155,7 @@ def main(argv=None): | |||
153 | finally: | 155 | finally: |
154 | f.close() | 156 | f.close() |
155 | filename = _get_filename(options.output) | 157 | filename = _get_filename(options.output) |
156 | res_list = parsing.split_res(res, options.num) | 158 | res_list = parsing.split_res(res, options) |
157 | n = 1 | 159 | n = 1 |
158 | width = len(str(len(res_list))) | 160 | width = len(str(len(res_list))) |
159 | s = "_%%0%dd." % width | 161 | s = "_%%0%dd." % width |
diff --git a/scripts/pybootchartgui/pybootchartgui/parsing.py b/scripts/pybootchartgui/pybootchartgui/parsing.py index 1cb4466e6d..d423b9f77c 100644 --- a/scripts/pybootchartgui/pybootchartgui/parsing.py +++ b/scripts/pybootchartgui/pybootchartgui/parsing.py | |||
@@ -38,6 +38,8 @@ class Trace: | |||
38 | self.processes = {} | 38 | self.processes = {} |
39 | self.start = {} | 39 | self.start = {} |
40 | self.end = {} | 40 | self.end = {} |
41 | self.min = None | ||
42 | self.max = None | ||
41 | self.headers = None | 43 | self.headers = None |
42 | self.disk_stats = None | 44 | self.disk_stats = None |
43 | self.ps_stats = None | 45 | self.ps_stats = None |
@@ -55,6 +57,10 @@ class Trace: | |||
55 | if not self.valid(): | 57 | if not self.valid(): |
56 | raise ParseError("empty state: '%s' does not contain a valid bootchart" % ", ".join(paths)) | 58 | raise ParseError("empty state: '%s' does not contain a valid bootchart" % ", ".join(paths)) |
57 | 59 | ||
60 | if options.full_time: | ||
61 | self.min = min(self.start.keys()) | ||
62 | self.max = max(self.end.keys()) | ||
63 | |||
58 | return | 64 | return |
59 | 65 | ||
60 | # Turn that parsed information into something more useful | 66 | # Turn that parsed information into something more useful |
@@ -700,12 +706,12 @@ def parse_paths(writer, state, paths): | |||
700 | state = parse_file(writer, state, path) | 706 | state = parse_file(writer, state, path) |
701 | return state | 707 | return state |
702 | 708 | ||
703 | def split_res(res, n): | 709 | def split_res(res, options): |
704 | """ Split the res into n pieces """ | 710 | """ Split the res into n pieces """ |
705 | res_list = [] | 711 | res_list = [] |
706 | if n > 1: | 712 | if options.num > 1: |
707 | s_list = sorted(res.start.keys()) | 713 | s_list = sorted(res.start.keys()) |
708 | frag_size = len(s_list) / float(n) | 714 | frag_size = len(s_list) / float(options.num) |
709 | # Need the top value | 715 | # Need the top value |
710 | if frag_size > int(frag_size): | 716 | if frag_size > int(frag_size): |
711 | frag_size = int(frag_size + 1) | 717 | frag_size = int(frag_size + 1) |
@@ -716,6 +722,9 @@ def split_res(res, n): | |||
716 | end = frag_size | 722 | end = frag_size |
717 | while start < end: | 723 | while start < end: |
718 | state = Trace(None, [], None) | 724 | state = Trace(None, [], None) |
725 | if options.full_time: | ||
726 | state.min = min(res.start.keys()) | ||
727 | state.max = max(res.end.keys()) | ||
719 | for i in range(start, end): | 728 | for i in range(start, end): |
720 | # Add this line for reference | 729 | # Add this line for reference |
721 | #state.add_process(pn + ":" + task, start, end) | 730 | #state.add_process(pn + ":" + task, start, end) |