All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] Fixes for pybootchartgui
@ 2014-01-21 15:22 Peter Kjellerstedt
  2014-01-21 15:22 ` [PATCH 1/5] pybootchartgui: Make the -s option work again Peter Kjellerstedt
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Peter Kjellerstedt @ 2014-01-21 15:22 UTC (permalink / raw)
  To: openembedded-core

This corrects and improves pybootchartgui. It starts by correcting two
flaws introduced in my last update of pybootchartgui. It then makes a
little simplification, followed up by improving the naming of split
output files. Finally it introduces a new option (--full-time or -T)
which makes sure the graph(s) always show the full time span regadless
of which bars are currently shown (this is especially useful in
combination with the -s option).

//Peter

The following changes since commit 1105b46d8f0174edbc315370835546e8ba5f7fd9:

  poky.conf: Remove Debian Squeeze from SANITY_TESTED_DISTROS (2014-01-21 10:45:29 +0000)

are available in the git repository at:

  git://git.yoctoproject.org/poky-contrib pkj/pybootchartgui2
  http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=pkj/pybootchartgui2

Peter Kjellerstedt (5):
  pybootchartgui: Make the -s option work again
  pybootchartgui: Correct the legend
  pybootchartgui: Simplify adding processes to the trace
  pybootchartgui: Adopt the width of the index in split output files
  pybootchartgui: Add option -T to allways use the full time

 scripts/pybootchartgui/pybootchartgui/draw.py    |  8 ++-
 scripts/pybootchartgui/pybootchartgui/main.py.in |  8 ++-
 scripts/pybootchartgui/pybootchartgui/parsing.py | 63 ++++++++++++------------
 3 files changed, 43 insertions(+), 36 deletions(-)

-- 
1.8.4



^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/5] pybootchartgui: Make the -s option work again
  2014-01-21 15:22 [PATCH 0/5] Fixes for pybootchartgui Peter Kjellerstedt
@ 2014-01-21 15:22 ` Peter Kjellerstedt
  2014-01-21 15:22 ` [PATCH 2/5] pybootchartgui: Correct the legend Peter Kjellerstedt
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Peter Kjellerstedt @ 2014-01-21 15:22 UTC (permalink / raw)
  To: openembedded-core

[YOCTO #5588]

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
---
 scripts/pybootchartgui/pybootchartgui/parsing.py | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/scripts/pybootchartgui/pybootchartgui/parsing.py b/scripts/pybootchartgui/pybootchartgui/parsing.py
index daee593..0600b51 100644
--- a/scripts/pybootchartgui/pybootchartgui/parsing.py
+++ b/scripts/pybootchartgui/pybootchartgui/parsing.py
@@ -50,9 +50,10 @@ class Trace:
         self.parent_map = None
         self.mem_stats = None
 
-        parse_paths (writer, self, paths)
-        if not self.valid():
-            raise ParseError("empty state: '%s' does not contain a valid bootchart" % ", ".join(paths))
+        if len(paths):
+            parse_paths (writer, self, paths)
+            if not self.valid():
+                raise ParseError("empty state: '%s' does not contain a valid bootchart" % ", ".join(paths))
 
         return
 
@@ -713,7 +714,7 @@ def split_res(res, n):
         start = 0
         end = frag_size
         while start < end:
-            state = ParserState()
+            state = Trace(None, [], None)
             for i in range(start, end):
                 # Add these lines for reference
                 #state.processes[pn + ":" + task] = [start, end]
-- 
1.8.4



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/5] pybootchartgui: Correct the legend
  2014-01-21 15:22 [PATCH 0/5] Fixes for pybootchartgui Peter Kjellerstedt
  2014-01-21 15:22 ` [PATCH 1/5] pybootchartgui: Make the -s option work again Peter Kjellerstedt
@ 2014-01-21 15:22 ` Peter Kjellerstedt
  2014-01-21 15:22 ` [PATCH 3/5] pybootchartgui: Simplify adding processes to the trace Peter Kjellerstedt
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Peter Kjellerstedt @ 2014-01-21 15:22 UTC (permalink / raw)
  To: openembedded-core

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
---
 scripts/pybootchartgui/pybootchartgui/draw.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/pybootchartgui/pybootchartgui/draw.py b/scripts/pybootchartgui/pybootchartgui/draw.py
index 299cced..4a2ffd7 100644
--- a/scripts/pybootchartgui/pybootchartgui/draw.py
+++ b/scripts/pybootchartgui/pybootchartgui/draw.py
@@ -420,7 +420,7 @@ def render_processes_chart(ctx, options, trace, curr_y, w, h, sec_w):
 	draw_legend_box (ctx, "Install", \
 			 TASK_COLOR_INSTALL, off_x+240, curr_y + 45, leg_s)
 	draw_legend_box (ctx, "Populate Sysroot", \
-			 TASK_COLOR_SYSROOT, off_x+480, curr_y + 45, leg_s)
+			 TASK_COLOR_SYSROOT, off_x+360, curr_y + 45, leg_s)
 	draw_legend_box (ctx, "Package", \
 			 TASK_COLOR_PACKAGE, off_x+480, curr_y + 45, leg_s)
 	draw_legend_box (ctx, "Package Write",
-- 
1.8.4



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/5] pybootchartgui: Simplify adding processes to the trace
  2014-01-21 15:22 [PATCH 0/5] Fixes for pybootchartgui Peter Kjellerstedt
  2014-01-21 15:22 ` [PATCH 1/5] pybootchartgui: Make the -s option work again Peter Kjellerstedt
  2014-01-21 15:22 ` [PATCH 2/5] pybootchartgui: Correct the legend Peter Kjellerstedt
@ 2014-01-21 15:22 ` Peter Kjellerstedt
  2014-01-21 15:22 ` [PATCH 4/5] pybootchartgui: Adopt the width of the index in split output files Peter Kjellerstedt
  2014-01-21 15:22 ` [PATCH 5/5] pybootchartgui: Add option -T to allways use the full time Peter Kjellerstedt
  4 siblings, 0 replies; 6+ messages in thread
From: Peter Kjellerstedt @ 2014-01-21 15:22 UTC (permalink / raw)
  To: openembedded-core

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
---
 scripts/pybootchartgui/pybootchartgui/parsing.py | 39 +++++++++---------------
 1 file changed, 14 insertions(+), 25 deletions(-)

diff --git a/scripts/pybootchartgui/pybootchartgui/parsing.py b/scripts/pybootchartgui/pybootchartgui/parsing.py
index 0600b51..1cb4466 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):
-- 
1.8.4



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 4/5] pybootchartgui: Adopt the width of the index in split output files
  2014-01-21 15:22 [PATCH 0/5] Fixes for pybootchartgui Peter Kjellerstedt
                   ` (2 preceding siblings ...)
  2014-01-21 15:22 ` [PATCH 3/5] pybootchartgui: Simplify adding processes to the trace Peter Kjellerstedt
@ 2014-01-21 15:22 ` Peter Kjellerstedt
  2014-01-21 15:22 ` [PATCH 5/5] pybootchartgui: Add option -T to allways use the full time Peter Kjellerstedt
  4 siblings, 0 replies; 6+ messages in thread
From: Peter Kjellerstedt @ 2014-01-21 15:22 UTC (permalink / raw)
  To: openembedded-core

Add minimum width zero-padding to the index used in split output files
with -s and -o. I.e., if -s 200 is used, then the index will be
zero-padded to three digits width.

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
---
 scripts/pybootchartgui/pybootchartgui/main.py.in | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/scripts/pybootchartgui/pybootchartgui/main.py.in b/scripts/pybootchartgui/pybootchartgui/main.py.in
index cc9c40b..e9d2c74 100644
--- a/scripts/pybootchartgui/pybootchartgui/main.py.in
+++ b/scripts/pybootchartgui/pybootchartgui/main.py.in
@@ -155,11 +155,13 @@ def main(argv=None):
 			filename = _get_filename(options.output)
 			res_list = parsing.split_res(res, options.num)
 			n = 1
+			width = len(str(len(res_list)))
+			s = "_%%0%dd." % width
 			for r in res_list:
 				if len(res_list) == 1:
 					f = filename + "." + options.format
 				else:
-					f = filename + "_" + str(n) + "." + options.format
+					f = filename + s % n + options.format
 					n = n + 1
 				def render():
 					batch.render(writer, r, options, f)
-- 
1.8.4



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 5/5] pybootchartgui: Add option -T to allways use the full time
  2014-01-21 15:22 [PATCH 0/5] Fixes for pybootchartgui Peter Kjellerstedt
                   ` (3 preceding siblings ...)
  2014-01-21 15:22 ` [PATCH 4/5] pybootchartgui: Adopt the width of the index in split output files Peter Kjellerstedt
@ 2014-01-21 15:22 ` Peter Kjellerstedt
  4 siblings, 0 replies; 6+ messages in thread
From: Peter Kjellerstedt @ 2014-01-21 15:22 UTC (permalink / raw)
  To: openembedded-core

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.kjellerstedt@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



^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-01-21 15:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-21 15:22 [PATCH 0/5] Fixes for pybootchartgui Peter Kjellerstedt
2014-01-21 15:22 ` [PATCH 1/5] pybootchartgui: Make the -s option work again Peter Kjellerstedt
2014-01-21 15:22 ` [PATCH 2/5] pybootchartgui: Correct the legend Peter Kjellerstedt
2014-01-21 15:22 ` [PATCH 3/5] pybootchartgui: Simplify adding processes to the trace Peter Kjellerstedt
2014-01-21 15:22 ` [PATCH 4/5] pybootchartgui: Adopt the width of the index in split output files Peter Kjellerstedt
2014-01-21 15:22 ` [PATCH 5/5] pybootchartgui: Add option -T to allways use the full time Peter Kjellerstedt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.