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.

Signed-off-by: Peter Kjellerstedt <peter.kjellerst...@axis.com>
---
 scripts/pybootchartgui/pybootchartgui/draw.py    |  6 +++++-
 scripts/pybootchartgui/pybootchartgui/main.py.in |  4 +++-
 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 4a2ffd7..8c574be 100644
--- a/scripts/pybootchartgui/pybootchartgui/draw.py
+++ b/scripts/pybootchartgui/pybootchartgui/draw.py
@@ -314,6 +314,10 @@ def extents(options, xscale, trace):
                         end = trace.processes[proc][1]
                 processes += 1
 
+       if trace.min is not None and trace.max is not None:
+               start = trace.min
+               end = trace.max
+
        w = int ((end - start) * sec_w_base * xscale) + 2 * off_x
        h = proc_h * processes + header_h + 2 * off_y
 
@@ -433,7 +437,7 @@ def render_processes_chart(ctx, options, trace, curr_y, w, 
h, sec_w):
 
        y = curr_y+header_h
 
-        offset = min(trace.start.keys())
+        offset = trace.min or min(trace.start.keys())
         for s in sorted(trace.start.keys()):
             for val in sorted(trace.start[s]):
                 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 e9d2c74..21bb0be 100644
--- a/scripts/pybootchartgui/pybootchartgui/main.py.in
+++ b/scripts/pybootchartgui/pybootchartgui/main.py.in
@@ -65,6 +65,8 @@ def _mk_options_parser():
 #                             "To create a single annotation when any one of a 
set of processes is started, use commas to separate the names")
 #      parser.add_option("--annotate-file", dest="annotate_file", 
metavar="FILENAME", default=None,
 #                        help="filename to write annotation points to")
+       parser.add_option("-T", "--full-time", action="store_true", 
dest="full_time", default=False,
+                         help="display the full time regardless of which 
processes are currently shown")
        return parser
 
 class Writer:
@@ -153,7 +155,7 @@ def main(argv=None):
                                finally:
                                        f.close()
                        filename = _get_filename(options.output)
-                       res_list = parsing.split_res(res, options.num)
+                       res_list = parsing.split_res(res, options)
                        n = 1
                        width = len(str(len(res_list)))
                        s = "_%%0%dd." % width
diff --git a/scripts/pybootchartgui/pybootchartgui/parsing.py 
b/scripts/pybootchartgui/pybootchartgui/parsing.py
index 1cb4466..d423b9f 100644
--- a/scripts/pybootchartgui/pybootchartgui/parsing.py
+++ b/scripts/pybootchartgui/pybootchartgui/parsing.py
@@ -38,6 +38,8 @@ class Trace:
         self.processes = {}
         self.start = {}
         self.end = {}
+        self.min = None
+        self.max = None
         self.headers = None
         self.disk_stats = None
         self.ps_stats = None
@@ -55,6 +57,10 @@ class Trace:
             if not self.valid():
                 raise ParseError("empty state: '%s' does not contain a valid 
bootchart" % ", ".join(paths))
 
+            if options.full_time:
+                self.min = min(self.start.keys())
+                self.max = max(self.end.keys())
+
         return
 
         # Turn that parsed information into something more useful
@@ -700,12 +706,12 @@ def parse_paths(writer, state, paths):
             state = parse_file(writer, state, path)
     return state
 
-def split_res(res, n):
+def split_res(res, options):
     """ Split the res into n pieces """
     res_list = []
-    if n > 1:
+    if options.num > 1:
         s_list = sorted(res.start.keys())
-        frag_size = len(s_list) / float(n)
+        frag_size = len(s_list) / float(options.num)
         # Need the top value
         if frag_size > int(frag_size):
             frag_size = int(frag_size + 1)
@@ -716,6 +722,9 @@ def split_res(res, n):
         end = frag_size
         while start < end:
             state = Trace(None, [], None)
+            if options.full_time:
+                state.min = min(res.start.keys())
+                state.max = max(res.end.keys())
             for i in range(start, end):
                 # Add this line for reference
                 #state.add_process(pn + ":" + task, start, end)
-- 
1.8.4

_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Reply via email to