Skip to contentSkip to conversation

Improvements to pybootchartgui

PATCH In review Peter Kjellerstedt 2 participants 17 messages Nov 15, 2013 – Nov 19, 2013

lore
Share & tools
lore
#0 lore raw

cover Improvements to pybootchartgui

This corrects and improves pybootchartgui. It starts by importing the relevant parts for pybootchartgui from the latest version (0.14.5) of bootchart2 from "https://github.com/mmeeks/bootchart". It then corrects a couple of problems (e.g., X scaling, X offset of the chart, and header height), and finally adds a couple of improvements (e.g., disable irrelevant options, draw a lot less ticks, and use "Show more" to show all processes).

//Peter

The following changes since commit 4fdc3d77d4a875b7236536bf78849a4d1f6a7449:

kbd: Fix stdarg related errors on uclibc (2013-11-08 17:31:36 +0000)

are available in the git repository at:

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

Peter Kjellerstedt (14):
pybootchartgui: Import pybootchartgui 0.14.5
pybootchartgui: Make the horizontal scaling stay within bounds
pybootchartgui: Set the initial state of "Show more" correctly
pybootchartgui: Correct the X offset for the chart
pybootchartgui: Use correct header height
pybootchartgui: Avoid having overlapping process bars
pybootchartgui: No need to do a double list comprehension over files
pybootchartgui: Disable options that do not make sense
pybootchartgui: Draw a lot less ticks
pybootchartgui: Make "Show more" show all processes
pybootchartgui: Make bars without a specified color white
pybootchartgui: Reorder the legend to match the task execution order
pybootchartgui: Add a color for the package_write_* tasks
pybootchartgui: Add option --minutes to show time in minutes

 scripts/pybootchartgui/AUTHORS                     |  10 +-
 scripts/pybootchartgui/COPYING                     | 912 +++++++--------------
 scripts/pybootchartgui/MAINTAINERS                 |   3 +
 scripts/pybootchartgui/NEWS                        | 204 +++++
 .../pybootchartgui/{README => README.pybootchart}  |  19 +-
 scripts/pybootchartgui/pybootchartgui.py           |  16 +
 scripts/pybootchartgui/pybootchartgui/batch.py     |  53 +-
 scripts/pybootchartgui/pybootchartgui/draw.py      | 763 +++++++++++++----
 scripts/pybootchartgui/pybootchartgui/gui.py       | 597 ++++++++------
 scripts/pybootchartgui/pybootchartgui/main.py      |  79 +-
 scripts/pybootchartgui/pybootchartgui/main.py.in   | 183 +++++
 scripts/pybootchartgui/pybootchartgui/parsing.py   | 796 ++++++++++++++----
 .../pybootchartgui/pybootchartgui/process_tree.py  | 126 +--
 scripts/pybootchartgui/pybootchartgui/samples.py   | 226 +++--
 .../pybootchartgui/tests/parser_test.py            |  82 +-
 .../pybootchartgui/tests/process_tree_test.py      |  30 +-
 16 files changed, 2623 insertions(+), 1476 deletions(-)
 create mode 100644 scripts/pybootchartgui/MAINTAINERS
 create mode 100644 scripts/pybootchartgui/NEWS
 rename scripts/pybootchartgui/{README => README.pybootchart} (61%)
 mode change 100644 => 120000 scripts/pybootchartgui/pybootchartgui/main.py
 create mode 100644 scripts/pybootchartgui/pybootchartgui/main.py.in
Signature · 1 line
1.8.4
#1 lore raw

PATCH 1/14 pybootchartgui: Import pybootchartgui 0.14.5

This update the pybootchartgui code to the latest release from its new location at "https://github.com/mmeeks/bootchart". This only imports the relevant parts, and not all of bootchart2.

---
 scripts/pybootchartgui/AUTHORS                     |  10 +-
 scripts/pybootchartgui/COPYING                     | 912 +++++++--------------
 scripts/pybootchartgui/MAINTAINERS                 |   3 +
 scripts/pybootchartgui/NEWS                        | 204 +++++
 .../pybootchartgui/{README => README.pybootchart}  |  19 +-
 scripts/pybootchartgui/pybootchartgui.py           |  16 +
 scripts/pybootchartgui/pybootchartgui/batch.py     |  53 +-
 scripts/pybootchartgui/pybootchartgui/draw.py      | 710 +++++++++++++---
 scripts/pybootchartgui/pybootchartgui/gui.py       | 594 ++++++++------
 scripts/pybootchartgui/pybootchartgui/main.py      |  79 +-
 scripts/pybootchartgui/pybootchartgui/main.py.in   | 171 ++++
 scripts/pybootchartgui/pybootchartgui/parsing.py   | 791 ++++++++++++++----
 .../pybootchartgui/pybootchartgui/process_tree.py  | 126 +--
 scripts/pybootchartgui/pybootchartgui/samples.py   | 226 +++--
 .../pybootchartgui/tests/parser_test.py            |  82 +-
 .../pybootchartgui/tests/process_tree_test.py      |  30 +-
 16 files changed, 2563 insertions(+), 1463 deletions(-)
 create mode 100644 scripts/pybootchartgui/MAINTAINERS
 create mode 100644 scripts/pybootchartgui/NEWS
 rename scripts/pybootchartgui/{README => README.pybootchart} (61%)
 mode change 100644 => 120000 scripts/pybootchartgui/pybootchartgui/main.py
 create mode 100644 scripts/pybootchartgui/pybootchartgui/main.py.in
scripts/pybootchartgui/AUTHORS +5 -5
index 45bd1ac..672b7e9 100644
@@ -1,11 +1,11 @@
+Michael Meeks <[email protected]>
 Anders Norgaard <[email protected]>
+Scott James Remnant <[email protected]>
 Henning Niss <[email protected]>
-
-
+Riccardo Magliocchetti <[email protected]>
 
 Contributors:
-Brian Ewins
-
+	Brian Ewins
 
 Based on work by:
-Ziga Mahkovec
+	Ziga Mahkovec
scripts/pybootchartgui/COPYING +289 -623

960 lines not on this page · raw message

scripts/pybootchartgui/MAINTAINERS new file +3 -0
new file mode 100644
index 0000000..c65e131
@@ -0,0 +1,3 @@
+Riccardo Magliocchetti <[email protected]>
+Michael Meeks <[email protected]>
+Harald Hoyer <[email protected]>
scripts/pybootchartgui/NEWS new file +204 -0

204 lines not on this page · raw message

scripts/pybootchartgui/README.pybootchart renamed from scripts/pybootchartgui/README +10 -9
similarity index 61%
rename from scripts/pybootchartgui/README
rename to scripts/pybootchartgui/README.pybootchart
index 1b97c44..8642e64 100644
@@ -1,13 +1,14 @@
 			    PYBOOTCHARTGUI
 			   ----------------
 
-pybootchartgui is a tool for visualization and analysis of the
-GNU/Linux boot process. It renders the output of the boot-logger tool
-bootchart (see http://www.bootchart.org/) to either the screen or
-files of various formats. Bootchart collects information about the
-processes, their dependencies, and resource consumption during boot of
-a GNU/Linux system. The pybootchartgui tools visualizes the process
-tree and overall resource utilization.
+pybootchartgui is a tool (now included as part of bootchart2) for
+visualization and analysis of the GNU/Linux boot process. It renders
+the output of the boot-logger tool bootchart (see
+http://www.bootchart.org/) to either the screen or files of various
+formats. Bootchart collects information about the processes, their
+dependencies, and resource consumption during boot of a GNU/Linux
+system. The pybootchartgui tools visualizes the process tree and
+overall resource utilization.
 
 pybootchartgui is a port of the visualization part of bootchart from
 Java to Python and Cairo.
@@ -32,5 +33,5 @@ To get help for pybootchartgui, run
 
 $ pybootchartgui --help
 
-
-http://code.google.com/p/pybootchartgui/
+This code was originally hosted at:
+	http://code.google.com/p/pybootchartgui/
scripts/pybootchartgui/pybootchartgui.py +16 -0
index f301027..947ce10 100755
@@ -1,4 +1,20 @@
 #!/usr/bin/python
+#
+#  This file is part of pybootchartgui.
+
+#  pybootchartgui is free software: you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation, either version 3 of the License, or
+#  (at your option) any later version.
+
+#  pybootchartgui is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+
+#  You should have received a copy of the GNU General Public License
+#  along with pybootchartgui. If not, see <http://www.gnu.org/licenses/>.
+
 
 import sys
 from pybootchartgui.main import main
scripts/pybootchartgui/pybootchartgui/batch.py +38 -15

61 lines not on this page · raw message

scripts/pybootchartgui/pybootchartgui/draw.py +579 -131

925 lines not on this page · raw message

scripts/pybootchartgui/pybootchartgui/gui.py +334 -260

607 lines not on this page · raw message

scripts/pybootchartgui/pybootchartgui/main.py deleted +0 -78

78 lines not on this page · raw message

scripts/pybootchartgui/pybootchartgui/main.py new file +1 -0
new file mode 120000
index 0000000..b45ae0a
@@ -0,0 +1 @@
+main.py.in
\ No newline at end of file
scripts/pybootchartgui/pybootchartgui/main.py.in new file +171 -0

96 lines not on this page · raw message

scripts/pybootchartgui/pybootchartgui/parsing.py +628 -163

791 lines not on this page · raw message

scripts/pybootchartgui/pybootchartgui/process_tree.py +74 -52

126 lines not on this page · raw message

scripts/pybootchartgui/pybootchartgui/samples.py +142 -84

226 lines not on this page · raw message

scripts/pybootchartgui/pybootchartgui/tests/parser_test.py +47 -35

82 lines not on this page · raw message

scripts/pybootchartgui/pybootchartgui/tests/process_tree_test.py +22 -8
index 971e125..6f46a1c 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
1.8.4

Part of the diff is not shown here. View the raw message.

#2 lore raw

PATCH 2/14 pybootchartgui: Make the horizontal scaling stay within bounds

In reply to Peter Kjellerstedt
---
 scripts/pybootchartgui/pybootchartgui/gui.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/pybootchartgui/pybootchartgui/gui.py +2 -2
index ddeb88c..164bdfb 100644
@@ -101,10 +101,10 @@ class PyBootchartWidget(gtk.DrawingArea):
         self.zoom_image (self.zoom_ratio)
 
     def on_expand(self, action):
-        self.set_xscale (self.xscale * 1.5)
+        self.set_xscale (int(self.xscale * 1.5 + 0.5))
 
     def on_contract(self, action):
-        self.set_xscale (self.xscale / 1.5)
+        self.set_xscale (max(int(self.xscale / 1.5), 1))
 
     def on_zoom_in(self, action):
         self.zoom_image(self.zoom_ratio * self.ZOOM_INCREMENT)
Signature · 1 line
1.8.4
#3 lore raw

PATCH 3/14 pybootchartgui: Set the initial state of "Show more" correctly

In reply to Peter Kjellerstedt
---
 scripts/pybootchartgui/pybootchartgui/gui.py | 1 +
 1 file changed, 1 insertion(+)
scripts/pybootchartgui/pybootchartgui/gui.py +1 -0
index 164bdfb..1120701 100644
@@ -302,6 +302,7 @@ class PyBootchartShell(gtk.VBox):
             # Misc. options
             button = gtk.CheckButton("Show more")
             button.connect ('toggled', self.widget.show_toggled)
+            button.set_active(options.app_options.show_all)
             hbox.pack_start (button, False, True)
 
         self.pack_start(hbox, False)
Signature · 1 line
1.8.4
#4 lore raw

PATCH 4/14 pybootchartgui: Correct the X offset for the chart

In reply to Peter Kjellerstedt

This will make the first bar actually start within the graph. It will also move the graph to the right so the names of the first tasks are more likely to be visible.

---
 scripts/pybootchartgui/pybootchartgui/draw.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/pybootchartgui/pybootchartgui/draw.py +2 -2
index c3492c7..9cbcbc1 100644
@@ -280,7 +280,7 @@ bar_h = 55
 meminfo_bar_h = 2 * bar_h
 header_h = 110 + 2 * (30 + bar_h) + 1 * (30 + meminfo_bar_h)
 # offsets
-off_x, off_y = 10, 10
+off_x, off_y = 220, 10
 sec_w_base = 1 # the width of a second
 proc_h = 16 # the height of a process
 leg_s = 10
@@ -416,7 +416,7 @@ def render_processes_chart(ctx, options, trace, curr_y, w, h, sec_w):
                 #print val
                 #print trace.processes[val][1]
                 #print s
-                x = (s - offset) * sec_w
+                x = chart_rect[0] + (s - offset) * sec_w
                 w = ((trace.processes[val][1] - s) * sec_w)
 
                 #print "proc at %s %s %s %s" % (x, y, w, proc_h)
Signature · 1 line
1.8.4
#5 lore raw

PATCH 5/14 pybootchartgui: Use correct header height

In reply to Peter Kjellerstedt
---
 scripts/pybootchartgui/pybootchartgui/draw.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
scripts/pybootchartgui/pybootchartgui/draw.py +3 -3
index 9cbcbc1..b1ad6e6 100644
@@ -278,7 +278,7 @@ def draw_chart(ctx, color, fill, chart_bounds, data, proc_tree, data_range):
 
 bar_h = 55
 meminfo_bar_h = 2 * bar_h
-header_h = 110 + 2 * (30 + bar_h) + 1 * (30 + meminfo_bar_h)
+header_h = 60
 # offsets
 off_x, off_y = 220, 10
 sec_w_base = 1 # the width of a second
@@ -389,7 +389,7 @@ def render_charts(ctx, options, clip, trace, curr_y, w, h, sec_w):
 	return curr_y
 
 def render_processes_chart(ctx, options, trace, curr_y, w, h, sec_w):
-        chart_rect = [off_x, curr_y+60, w, h - 2 * off_y - (curr_y+60) + proc_h]
+        chart_rect = [off_x, curr_y+header_h, w, h - 2 * off_y - (curr_y+header_h) + proc_h]
 
 	draw_legend_box (ctx, "Configure", \
 			 TASK_COLOR_CONFIGURE, off_x  , curr_y + 45, leg_s)
@@ -407,7 +407,7 @@ def render_processes_chart(ctx, options, trace, curr_y, w, h, sec_w):
 	draw_box_ticks(ctx, chart_rect, sec_w)
 	draw_sec_labels(ctx, chart_rect, sec_w, 30)
 
-	y = curr_y+60
+	y = curr_y+header_h
 
         offset = min(trace.start.keys())
         for s in sorted(trace.start.keys()):
Signature · 1 line
1.8.4
#6 lore raw

PATCH 6/14 pybootchartgui: Avoid having overlapping process bars

In reply to Peter Kjellerstedt
---
 scripts/pybootchartgui/pybootchartgui/draw.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/pybootchartgui/pybootchartgui/draw.py +1 -1
index b1ad6e6..6b15d64 100644
@@ -432,9 +432,9 @@ def render_processes_chart(ctx, options, trace, curr_y, w, h, sec_w):
                 elif task == "do_populate_sysroot":
                     col = TASK_COLOR_SYSROOT
 
-                draw_rect(ctx, PROC_BORDER_COLOR, (x, y, w, proc_h))
                 if col:
                     draw_fill_rect(ctx, col, (x, y, w, proc_h))
+                draw_rect(ctx, PROC_BORDER_COLOR, (x, y, w, proc_h))
 
                 draw_label_in_box(ctx, PROC_TEXT_COLOR, val, x, y + proc_h - 4, w, proc_h)
                 y = y + proc_h
Signature · 1 line
1.8.4
#7 lore raw

PATCH 7/14 pybootchartgui: No need to do a double list comprehension over files

In reply to Peter Kjellerstedt
---
 scripts/pybootchartgui/pybootchartgui/parsing.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
scripts/pybootchartgui/pybootchartgui/parsing.py +1 -2
index c8a6a57..ed61825 100644
@@ -675,8 +675,7 @@ def parse_paths(writer, state, paths, mintime):
             continue
         #state.filename = path
         if os.path.isdir(path):
-            files = [ f for f in [os.path.join(path, f) for f in os.listdir(path)] ]
-            files.sort()
+            files = sorted([os.path.join(path, f) for f in os.listdir(path)])
             state = parse_paths(writer, state, files, mintime)
         elif extension in [".tar", ".tgz", ".gz"]:
             if extension == ".gz":
Signature · 1 line
1.8.4
#8 lore raw

PATCH 8/14 pybootchartgui: Disable options that do not make sense

In reply to Peter Kjellerstedt
---
 scripts/pybootchartgui/pybootchartgui/main.py.in | 40 +++++++++++++++---------
 1 file changed, 25 insertions(+), 15 deletions(-)
scripts/pybootchartgui/pybootchartgui/main.py.in +25 -15
index 265cb18..3927186 100644
@@ -40,29 +40,29 @@ def _mk_options_parser():
 			  help="split the output chart into <NUM> charts, only works with \"-o PATH\"")
 	parser.add_option("-m", "--mintime", dest="mintime", type=int, default=8,
 			  help="only tasks longer than this time will be displayed")
-	parser.add_option("-n", "--no-prune", action="store_false", dest="prune", default=True,
-			  help="do not prune the process tree")
+#	parser.add_option("-n", "--no-prune", action="store_false", dest="prune", default=True,
+#			  help="do not prune the process tree")
 	parser.add_option("-q", "--quiet", action="store_true", dest="quiet", default=False,
 			  help="suppress informational messages")
-	parser.add_option("-t", "--boot-time", action="store_true", dest="boottime", default=False,
-			  help="only display the boot time of the boot in text format (stdout)")	
+#	parser.add_option("-t", "--boot-time", action="store_true", dest="boottime", default=False,
+#			  help="only display the boot time of the boot in text format (stdout)")	
 	parser.add_option("--very-quiet", action="store_true", dest="veryquiet", default=False,
 			  help="suppress all messages except errors")
 	parser.add_option("--verbose", action="store_true", dest="verbose", default=False,
 			  help="print all messages")
-	parser.add_option("--profile", action="store_true", dest="profile", default=False,
-			  help="profile rendering of chart (only useful when in batch mode indicated by -f)")
-	parser.add_option("--show-pid", action="store_true", dest="show_pid", default=False,
-			  help="show process ids in the bootchart as 'processname [pid]'")
+#	parser.add_option("--profile", action="store_true", dest="profile", default=False,
+#			  help="profile rendering of chart (only useful when in batch mode indicated by -f)")
+#	parser.add_option("--show-pid", action="store_true", dest="show_pid", default=False,
+#			  help="show process ids in the bootchart as 'processname [pid]'")
 	parser.add_option("--show-all", action="store_true", dest="show_all", default=False,
 			  help="show all process information in the bootchart as '/process/path/exe [pid] [args]'")
-	parser.add_option("--crop-after", dest="crop_after", metavar="PROCESS", default=None,
-			  help="crop chart when idle after PROCESS is started")
-	parser.add_option("--annotate", action="append", dest="annotate", metavar="PROCESS", default=None,
-			  help="annotate position where PROCESS is started; can be specified multiple times. " +
-			       "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("--crop-after", dest="crop_after", metavar="PROCESS", default=None,
+#			  help="crop chart when idle after PROCESS is started")
+#	parser.add_option("--annotate", action="append", dest="annotate", metavar="PROCESS", default=None,
+#			  help="annotate position where PROCESS is started; can be specified multiple times. " +
+#			       "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")
 	return parser
 
 class Writer:
@@ -108,6 +108,16 @@ def main(argv=None):
 	
 		parser = _mk_options_parser()
 		options, args = parser.parse_args(argv)
+
+		# Default values for disabled options
+		options.prune = True
+		options.boottime = False
+		options.profile = False
+		options.show_pid = False
+		options.crop_after = None
+		options.annotate = None
+		options.annotate_file = None
+
 		writer = _mk_writer(options)
 
 		if len(args) == 0:
Signature · 1 line
1.8.4
#9 lore raw

PATCH 9/14 pybootchartgui: Draw a lot less ticks

In reply to Peter Kjellerstedt

With this, one second ticks are only enabled if the width of a second is five pixels or more. It is also possible to distinguish 1, 5 and 30 second ticks.

---
 scripts/pybootchartgui/pybootchartgui/draw.py | 7 +++++++
 1 file changed, 7 insertions(+)
scripts/pybootchartgui/pybootchartgui/draw.py +7 -0
index 6b15d64..a22ac80 100644
@@ -203,6 +203,12 @@ def draw_box_ticks(ctx, rect, sec_w):
 	ctx.set_line_cap(cairo.LINE_CAP_SQUARE)
 
 	for i in range(sec_w, rect[2] + 1, sec_w):
+		if ((i / sec_w) % 10 == 0) :
+			ctx.set_line_width(1.5)
+		elif sec_w < 5 :
+			continue
+		else :
+			ctx.set_line_width(1.0)
 		if ((i / sec_w) % 30 == 0) :
 			ctx.set_source_rgba(*TICK_COLOR_BOLD)
 		else :
@@ -210,6 +216,7 @@ def draw_box_ticks(ctx, rect, sec_w):
 		ctx.move_to(rect[0] + i, rect[1] + 1)
 		ctx.line_to(rect[0] + i, rect[1] + rect[3] - 1)
 		ctx.stroke()
+	ctx.set_line_width(1.0)
 
 	ctx.set_line_cap(cairo.LINE_CAP_BUTT)
 
Signature · 1 line
1.8.4
#10 lore raw

PATCH 10/14 pybootchartgui: Make "Show more" show all processes

In reply to Peter Kjellerstedt

While "Show more" is enabled, all processes are shown, regardless of --mintime.

This also has the added benefit of making the first shown bar start at its correct offset from the start time, rather than always starting at 0.

---
 scripts/pybootchartgui/pybootchartgui/draw.py    | 19 ++++++++++++++++---
 scripts/pybootchartgui/pybootchartgui/gui.py     |  2 ++
 scripts/pybootchartgui/pybootchartgui/main.py.in |  2 +-
 scripts/pybootchartgui/pybootchartgui/parsing.py | 16 ++++++++--------
 4 files changed, 27 insertions(+), 12 deletions(-)
scripts/pybootchartgui/pybootchartgui/draw.py +16 -3
index a22ac80..2aa348b 100644
@@ -297,10 +297,20 @@ OPTIONS = None
 
 def extents(options, xscale, trace):
 	start = min(trace.start.keys())
-	end = max(trace.end.keys())
+	end = start
 
-	w = int ((end - start) * sec_w_base * xscale) + 2*off_x
-	h = proc_h * len(trace.processes) + header_h + 2 * off_y
+        processes = 0
+        for proc in trace.processes:
+                if not options.app_options.show_all and \
+                   trace.processes[proc][1] - trace.processes[proc][0] < options.app_options.mintime:
+                        continue
+
+                if trace.processes[proc][1] > end:
+                        end = trace.processes[proc][1]
+                processes += 1
+
+	w = int ((end - start) * sec_w_base * xscale) + 2 * off_x
+	h = proc_h * processes + header_h + 2 * off_y
 
 	return (w, h)
 
@@ -419,6 +429,9 @@ def render_processes_chart(ctx, options, trace, curr_y, w, h, sec_w):
         offset = 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 \
+                   trace.processes[val][1] - s < options.app_options.mintime:
+                    continue
                 task = val.split(":")[1]
                 #print val
                 #print trace.processes[val][1]
scripts/pybootchartgui/pybootchartgui/gui.py +2 -0
index 1120701..7fedd23 100644
@@ -121,6 +121,8 @@ class PyBootchartWidget(gtk.DrawingArea):
 
     def show_toggled(self, button):
         self.options.app_options.show_all = button.get_property ('active')
+        self.chart_width, self.chart_height = draw.extents(self.options, self.xscale, self.trace)
+        self._set_scroll_adjustments(self.hadj, self.vadj)
         self.queue_draw()
 
     POS_INCREMENT = 100
scripts/pybootchartgui/pybootchartgui/main.py.in +1 -1
index 3927186..1d70271 100644
@@ -55,7 +55,7 @@ def _mk_options_parser():
 #	parser.add_option("--show-pid", action="store_true", dest="show_pid", default=False,
 #			  help="show process ids in the bootchart as 'processname [pid]'")
 	parser.add_option("--show-all", action="store_true", dest="show_all", default=False,
-			  help="show all process information in the bootchart as '/process/path/exe [pid] [args]'")
+			  help="show all processes in the chart")
 #	parser.add_option("--crop-after", dest="crop_after", metavar="PROCESS", default=None,
 #			  help="crop chart when idle after PROCESS is started")
 #	parser.add_option("--annotate", action="append", dest="annotate", metavar="PROCESS", default=None,
scripts/pybootchartgui/pybootchartgui/parsing.py +8 -8
index ed61825..daee593 100644
@@ -50,7 +50,7 @@ class Trace:
         self.parent_map = None
         self.mem_stats = None
 
-        parse_paths (writer, self, paths, options.mintime)
+        parse_paths (writer, self, paths)
         if not self.valid():
             raise ParseError("empty state: '%s' does not contain a valid bootchart" % ", ".join(paths))
 
@@ -630,7 +630,7 @@ def get_num_cpus(headers):
         return 1
     return max (int(mat.group(1)), 1)
 
-def _do_parse(writer, state, filename, file, mintime):
+def _do_parse(writer, state, filename, file):
     writer.info("parsing '%s'" % filename)
     t1 = clock()
     paths = filename.split("/")
@@ -643,7 +643,7 @@ def _do_parse(writer, state, filename, file, mintime):
             start = int(float(line.split()[-1]))
         elif line.startswith("Ended:"):
             end = int(float(line.split()[-1]))
-    if start and end and (end - start) >= mintime:
+    if start and end:
         k = pn + ":" + task
         state.processes[pn + ":" + task] = [start, end]
         if start not in state.start:
@@ -658,14 +658,14 @@ def _do_parse(writer, state, filename, file, mintime):
     writer.info("  %s seconds" % str(t2-t1))
     return state
 
-def parse_file(writer, state, filename, mintime):
+def parse_file(writer, state, filename):
     if state.filename is None:
         state.filename = filename
     basename = os.path.basename(filename)
     with open(filename, "rb") as file:
-        return _do_parse(writer, state, filename, file, mintime)
+        return _do_parse(writer, state, filename, file)
 
-def parse_paths(writer, state, paths, mintime):
+def parse_paths(writer, state, paths):
     for path in paths:
         if state.filename is None:
             state.filename = path
@@ -676,7 +676,7 @@ def parse_paths(writer, state, paths, mintime):
         #state.filename = path
         if os.path.isdir(path):
             files = sorted([os.path.join(path, f) for f in os.listdir(path)])
-            state = parse_paths(writer, state, files, mintime)
+            state = parse_paths(writer, state, files)
         elif extension in [".tar", ".tgz", ".gz"]:
             if extension == ".gz":
                 root, extension = os.path.splitext(root)
@@ -695,7 +695,7 @@ def parse_paths(writer, state, paths, mintime):
                 if tf != None:
                     tf.close()
         else:
-            state = parse_file(writer, state, path, mintime)
+            state = parse_file(writer, state, path)
     return state
 
 def split_res(res, n):
Signature · 1 line
1.8.4
#11 lore raw

PATCH 11/14 pybootchartgui: Make bars without a specified color white

In reply to Peter Kjellerstedt

Previously they were transparent.

---
 scripts/pybootchartgui/pybootchartgui/draw.py | 2 ++
 1 file changed, 2 insertions(+)
scripts/pybootchartgui/pybootchartgui/draw.py +2 -0
index 2aa348b..ea960f9 100644
@@ -451,6 +451,8 @@ def render_processes_chart(ctx, options, trace, curr_y, w, h, sec_w):
                     col = TASK_COLOR_PACKAGE
                 elif task == "do_populate_sysroot":
                     col = TASK_COLOR_SYSROOT
+                else:
+                    col = WHITE
 
                 if col:
                     draw_fill_rect(ctx, col, (x, y, w, proc_h))
Signature · 1 line
1.8.4
#12 lore raw

PATCH 12/14 pybootchartgui: Reorder the legend to match the task execution order

In reply to Peter Kjellerstedt
---
 scripts/pybootchartgui/pybootchartgui/draw.py | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
scripts/pybootchartgui/pybootchartgui/draw.py +6 -6
index ea960f9..718d95e 100644
@@ -126,10 +126,10 @@ TASK_COLOR_CONFIGURE = (1.0, 1.0, 0.00, 1.0)
 TASK_COLOR_COMPILE = (0.0, 1.00, 0.00, 1.0)
 # Install task color
 TASK_COLOR_INSTALL = (1.0, 0.00, 1.00, 1.0)
-# Package task color
-TASK_COLOR_PACKAGE = (0.0, 1.00, 1.00, 1.0)
 # Sysroot task color
 TASK_COLOR_SYSROOT = (0.0, 0.00, 1.00, 1.0)
+# Package task color
+TASK_COLOR_PACKAGE = (0.0, 1.00, 1.00, 1.0)
 
 # Process states
 STATE_UNDEFINED = 0
@@ -414,10 +414,10 @@ def render_processes_chart(ctx, options, trace, curr_y, w, h, sec_w):
 			 TASK_COLOR_COMPILE, off_x+120, curr_y + 45, leg_s)
 	draw_legend_box (ctx, "Install", \
 			 TASK_COLOR_INSTALL, off_x+240, curr_y + 45, leg_s)
-	draw_legend_box (ctx, "Package", \
-			 TASK_COLOR_PACKAGE, off_x+360, curr_y + 45, leg_s)
 	draw_legend_box (ctx, "Populate Sysroot", \
 			 TASK_COLOR_SYSROOT, off_x+480, curr_y + 45, leg_s)
+	draw_legend_box (ctx, "Package", \
+			 TASK_COLOR_PACKAGE, off_x+480, curr_y + 45, leg_s)
 
 	ctx.set_font_size(PROC_TEXT_FONT_SIZE)
 
@@ -447,10 +447,10 @@ def render_processes_chart(ctx, options, trace, curr_y, w, h, sec_w):
                     col = TASK_COLOR_CONFIGURE
                 elif task == "do_install":
                     col = TASK_COLOR_INSTALL
-                elif task == "do_package":
-                    col = TASK_COLOR_PACKAGE
                 elif task == "do_populate_sysroot":
                     col = TASK_COLOR_SYSROOT
+                elif task == "do_package":
+                    col = TASK_COLOR_PACKAGE
                 else:
                     col = WHITE
 
Signature · 1 line
1.8.4
#13 lore raw

PATCH 13/14 pybootchartgui: Add a color for the package_write_* tasks

In reply to Peter Kjellerstedt
---
 scripts/pybootchartgui/pybootchartgui/draw.py | 8 ++++++++
 1 file changed, 8 insertions(+)
scripts/pybootchartgui/pybootchartgui/draw.py +8 -0
index 718d95e..2a26160 100644
@@ -130,6 +130,8 @@ TASK_COLOR_INSTALL = (1.0, 0.00, 1.00, 1.0)
 TASK_COLOR_SYSROOT = (0.0, 0.00, 1.00, 1.0)
 # Package task color
 TASK_COLOR_PACKAGE = (0.0, 1.00, 1.00, 1.0)
+# Package Write RPM/DEB/IPK task color
+TASK_COLOR_PACKAGE_WRITE = (0.0, 0.50, 0.50, 1.0)
 
 # Process states
 STATE_UNDEFINED = 0
@@ -418,6 +420,8 @@ def render_processes_chart(ctx, options, trace, curr_y, w, h, sec_w):
 			 TASK_COLOR_SYSROOT, off_x+480, 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",
+			 TASK_COLOR_PACKAGE_WRITE, off_x+600, curr_y + 45, leg_s)
 
 	ctx.set_font_size(PROC_TEXT_FONT_SIZE)
 
@@ -451,6 +455,10 @@ def render_processes_chart(ctx, options, trace, curr_y, w, h, sec_w):
                     col = TASK_COLOR_SYSROOT
                 elif task == "do_package":
                     col = TASK_COLOR_PACKAGE
+                elif task == "do_package_write_rpm" or \
+                     task == "do_package_write_deb" or \
+                     task == "do_package_write_ipk":
+                    col = TASK_COLOR_PACKAGE_WRITE
                 else:
                     col = WHITE
 
Signature · 1 line
1.8.4
#14 lore raw

PATCH 14/14 pybootchartgui: Add option --minutes to show time in minutes

In reply to Peter Kjellerstedt
---
 scripts/pybootchartgui/pybootchartgui/draw.py    | 11 +++++++----
 scripts/pybootchartgui/pybootchartgui/main.py.in |  2 ++
 2 files changed, 9 insertions(+), 4 deletions(-)
scripts/pybootchartgui/pybootchartgui/draw.py +7 -4
index 2a26160..299cced 100644
@@ -187,12 +187,15 @@ def draw_label_in_box(ctx, color, label, x, y, w, maxx):
 		label_x = x - label_w - 5
 	draw_text(ctx, label, color, label_x, y)
 
-def draw_sec_labels(ctx, rect, sec_w, nsecs):
+def draw_sec_labels(ctx, options, rect, sec_w, nsecs):
 	ctx.set_font_size(AXIS_FONT_SIZE)
 	prev_x = 0
 	for i in range(0, rect[2] + 1, sec_w):
 		if ((i / sec_w) % nsecs == 0) :
-			label = "%ds" % (i / sec_w)
+			if options.app_options.as_minutes :
+				label = "%.1f" % (i / sec_w / 60.0)
+			else :
+				label = "%d" % (i / sec_w)
 			label_w = ctx.text_extents(label)[2]
 			x = rect[0] + i - label_w/2
 			if x >= prev_x:
@@ -426,7 +429,7 @@ def render_processes_chart(ctx, options, trace, curr_y, w, h, sec_w):
 	ctx.set_font_size(PROC_TEXT_FONT_SIZE)
 
 	draw_box_ticks(ctx, chart_rect, sec_w)
-	draw_sec_labels(ctx, chart_rect, sec_w, 30)
+	draw_sec_labels(ctx, options, chart_rect, sec_w, 30)
 
 	y = curr_y+header_h
 
@@ -555,7 +558,7 @@ def draw_process_bar_chart(ctx, clip, options, proc_tree, times, curr_y, w, h, s
 		nsec = 1
 	else:
 		nsec = 5
-	draw_sec_labels (ctx, chart_rect, sec_w, nsec)
+	draw_sec_labels (ctx, options, chart_rect, sec_w, nsec)
 	draw_annotations (ctx, proc_tree, times, chart_rect)
 
 	y = curr_y + 60
scripts/pybootchartgui/pybootchartgui/main.py.in +2 -0
index 1d70271..cc9c40b 100644
@@ -40,6 +40,8 @@ def _mk_options_parser():
 			  help="split the output chart into <NUM> charts, only works with \"-o PATH\"")
 	parser.add_option("-m", "--mintime", dest="mintime", type=int, default=8,
 			  help="only tasks longer than this time will be displayed")
+	parser.add_option("-M", "--minutes", action="store_true", dest="as_minutes", default=False,
+			  help="display time in minutes instead of seconds")
 #	parser.add_option("-n", "--no-prune", action="store_false", dest="prune", default=True,
 #			  help="do not prune the process tree")
 	parser.add_option("-q", "--quiet", action="store_true", dest="quiet", default=False,
Signature · 1 line
1.8.4
#15 lore raw
In reply to Peter Kjellerstedt

Hi,

Quoted 7 lines · Peter Kjellerstedt

This corrects and improves pybootchartgui. It starts by importing the relevant parts for pybootchartgui from the latest version (0.14.5) of bootchart2 from "https://github.com/mmeeks/bootchart". It then corrects a couple of problems (e.g., X scaling, X offset of the chart, and header height), and finally adds a couple of improvements (e.g., disable irrelevant options, draw a lot less ticks, and use "Show more" to show all processes).

Excellent stuff, thanks for working on this. Some time ago I spoke to the bootchart2 maintainers and they were open to generalising their code and merging our codebases - is this something you'd be interesting in looking at?

Ross

#16 lore raw
Quoted 20 lines

-----Original Message-----
From: Burton, Ross [mailto:[email protected]]
Sent: den 16 november 2013 00:25
To: Peter Kjellerstedt
Cc: OE-core
Subject: Re: [OE-core] [PATCH 00/14] Improvements to pybootchartgui

Hi,

Quoted 3 lines · Peter Kjellerstedt

This corrects and improves pybootchartgui. It starts by importing the relevant parts for pybootchartgui from the latest version (0.14.5) of bootchart2 from "https://github.com/mmeeks/bootchart". It then

corrects

Quoted 1 line

a couple of problems (e.g., X scaling, X offset of the chart, and

header

Quoted 2 lines

height), and finally adds a couple of improvements (e.g., disable irrelevant options, draw a lot less ticks, and use "Show more" to

show

Quoted 8 lines
Quoted 1 line

all processes).

Excellent stuff, thanks for working on this. Some time ago I spoke to the bootchart2 maintainers and they were open to generalising their code and merging our codebases - is this something you'd be interesting in looking at?

Ross

Unfortunately I do not think so at this time.

//Peter