summaryrefslogtreecommitdiffstats
path: root/scripts/pybootchartgui
diff options
context:
space:
mode:
authorPeter Kjellerstedt <pkj@axis.com>2013-11-14 15:11:16 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-11-18 12:44:56 +0000
commit46c45853f0fbf71fd153bcffacb1807363a1a857 (patch)
tree36f92fe8133487154406e24b232fad2f8764d9cc /scripts/pybootchartgui
parent65d43843b69416f17eac6092f69a3ac58a8a9c5d (diff)
downloadpoky-46c45853f0fbf71fd153bcffacb1807363a1a857.tar.gz
pybootchartgui: Make "Show more" show all processes
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. (From OE-Core rev: 5f1b8730f90099c0f73a6b08599990ee71e831b5) Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/pybootchartgui')
-rw-r--r--scripts/pybootchartgui/pybootchartgui/draw.py19
-rw-r--r--scripts/pybootchartgui/pybootchartgui/gui.py2
-rw-r--r--scripts/pybootchartgui/pybootchartgui/main.py.in2
-rw-r--r--scripts/pybootchartgui/pybootchartgui/parsing.py16
4 files changed, 27 insertions, 12 deletions
diff --git a/scripts/pybootchartgui/pybootchartgui/draw.py b/scripts/pybootchartgui/pybootchartgui/draw.py
index a22ac802f7..2aa348ba70 100644
--- a/scripts/pybootchartgui/pybootchartgui/draw.py
+++ b/scripts/pybootchartgui/pybootchartgui/draw.py
@@ -297,10 +297,20 @@ OPTIONS = None
297 297
298def extents(options, xscale, trace): 298def extents(options, xscale, trace):
299 start = min(trace.start.keys()) 299 start = min(trace.start.keys())
300 end = max(trace.end.keys()) 300 end = start
301 301
302 w = int ((end - start) * sec_w_base * xscale) + 2*off_x 302 processes = 0
303 h = proc_h * len(trace.processes) + header_h + 2 * off_y 303 for proc in trace.processes:
304 if not options.app_options.show_all and \
305 trace.processes[proc][1] - trace.processes[proc][0] < options.app_options.mintime:
306 continue
307
308 if trace.processes[proc][1] > end:
309 end = trace.processes[proc][1]
310 processes += 1
311
312 w = int ((end - start) * sec_w_base * xscale) + 2 * off_x
313 h = proc_h * processes + header_h + 2 * off_y
304 314
305 return (w, h) 315 return (w, h)
306 316
@@ -419,6 +429,9 @@ def render_processes_chart(ctx, options, trace, curr_y, w, h, sec_w):
419 offset = min(trace.start.keys()) 429 offset = min(trace.start.keys())
420 for s in sorted(trace.start.keys()): 430 for s in sorted(trace.start.keys()):
421 for val in sorted(trace.start[s]): 431 for val in sorted(trace.start[s]):
432 if not options.app_options.show_all and \
433 trace.processes[val][1] - s < options.app_options.mintime:
434 continue
422 task = val.split(":")[1] 435 task = val.split(":")[1]
423 #print val 436 #print val
424 #print trace.processes[val][1] 437 #print trace.processes[val][1]
diff --git a/scripts/pybootchartgui/pybootchartgui/gui.py b/scripts/pybootchartgui/pybootchartgui/gui.py
index 11207015d8..7fedd232df 100644
--- a/scripts/pybootchartgui/pybootchartgui/gui.py
+++ b/scripts/pybootchartgui/pybootchartgui/gui.py
@@ -121,6 +121,8 @@ class PyBootchartWidget(gtk.DrawingArea):
121 121
122 def show_toggled(self, button): 122 def show_toggled(self, button):
123 self.options.app_options.show_all = button.get_property ('active') 123 self.options.app_options.show_all = button.get_property ('active')
124 self.chart_width, self.chart_height = draw.extents(self.options, self.xscale, self.trace)
125 self._set_scroll_adjustments(self.hadj, self.vadj)
124 self.queue_draw() 126 self.queue_draw()
125 127
126 POS_INCREMENT = 100 128 POS_INCREMENT = 100
diff --git a/scripts/pybootchartgui/pybootchartgui/main.py.in b/scripts/pybootchartgui/pybootchartgui/main.py.in
index 39271865d6..1d70271f72 100644
--- a/scripts/pybootchartgui/pybootchartgui/main.py.in
+++ b/scripts/pybootchartgui/pybootchartgui/main.py.in
@@ -55,7 +55,7 @@ def _mk_options_parser():
55# parser.add_option("--show-pid", action="store_true", dest="show_pid", default=False, 55# parser.add_option("--show-pid", action="store_true", dest="show_pid", default=False,
56# help="show process ids in the bootchart as 'processname [pid]'") 56# help="show process ids in the bootchart as 'processname [pid]'")
57 parser.add_option("--show-all", action="store_true", dest="show_all", default=False, 57 parser.add_option("--show-all", action="store_true", dest="show_all", default=False,
58 help="show all process information in the bootchart as '/process/path/exe [pid] [args]'") 58 help="show all processes in the chart")
59# parser.add_option("--crop-after", dest="crop_after", metavar="PROCESS", default=None, 59# parser.add_option("--crop-after", dest="crop_after", metavar="PROCESS", default=None,
60# help="crop chart when idle after PROCESS is started") 60# help="crop chart when idle after PROCESS is started")
61# parser.add_option("--annotate", action="append", dest="annotate", metavar="PROCESS", default=None, 61# parser.add_option("--annotate", action="append", dest="annotate", metavar="PROCESS", default=None,
diff --git a/scripts/pybootchartgui/pybootchartgui/parsing.py b/scripts/pybootchartgui/pybootchartgui/parsing.py
index ed61825d23..daee5932cf 100644
--- a/scripts/pybootchartgui/pybootchartgui/parsing.py
+++ b/scripts/pybootchartgui/pybootchartgui/parsing.py
@@ -50,7 +50,7 @@ class Trace:
50 self.parent_map = None 50 self.parent_map = None
51 self.mem_stats = None 51 self.mem_stats = None
52 52
53 parse_paths (writer, self, paths, options.mintime) 53 parse_paths (writer, self, paths)
54 if not self.valid(): 54 if not self.valid():
55 raise ParseError("empty state: '%s' does not contain a valid bootchart" % ", ".join(paths)) 55 raise ParseError("empty state: '%s' does not contain a valid bootchart" % ", ".join(paths))
56 56
@@ -630,7 +630,7 @@ def get_num_cpus(headers):
630 return 1 630 return 1
631 return max (int(mat.group(1)), 1) 631 return max (int(mat.group(1)), 1)
632 632
633def _do_parse(writer, state, filename, file, mintime): 633def _do_parse(writer, state, filename, file):
634 writer.info("parsing '%s'" % filename) 634 writer.info("parsing '%s'" % filename)
635 t1 = clock() 635 t1 = clock()
636 paths = filename.split("/") 636 paths = filename.split("/")
@@ -643,7 +643,7 @@ def _do_parse(writer, state, filename, file, mintime):
643 start = int(float(line.split()[-1])) 643 start = int(float(line.split()[-1]))
644 elif line.startswith("Ended:"): 644 elif line.startswith("Ended:"):
645 end = int(float(line.split()[-1])) 645 end = int(float(line.split()[-1]))
646 if start and end and (end - start) >= mintime: 646 if start and end:
647 k = pn + ":" + task 647 k = pn + ":" + task
648 state.processes[pn + ":" + task] = [start, end] 648 state.processes[pn + ":" + task] = [start, end]
649 if start not in state.start: 649 if start not in state.start:
@@ -658,14 +658,14 @@ def _do_parse(writer, state, filename, file, mintime):
658 writer.info(" %s seconds" % str(t2-t1)) 658 writer.info(" %s seconds" % str(t2-t1))
659 return state 659 return state
660 660
661def parse_file(writer, state, filename, mintime): 661def parse_file(writer, state, filename):
662 if state.filename is None: 662 if state.filename is None:
663 state.filename = filename 663 state.filename = filename
664 basename = os.path.basename(filename) 664 basename = os.path.basename(filename)
665 with open(filename, "rb") as file: 665 with open(filename, "rb") as file:
666 return _do_parse(writer, state, filename, file, mintime) 666 return _do_parse(writer, state, filename, file)
667 667
668def parse_paths(writer, state, paths, mintime): 668def parse_paths(writer, state, paths):
669 for path in paths: 669 for path in paths:
670 if state.filename is None: 670 if state.filename is None:
671 state.filename = path 671 state.filename = path
@@ -676,7 +676,7 @@ def parse_paths(writer, state, paths, mintime):
676 #state.filename = path 676 #state.filename = path
677 if os.path.isdir(path): 677 if os.path.isdir(path):
678 files = sorted([os.path.join(path, f) for f in os.listdir(path)]) 678 files = sorted([os.path.join(path, f) for f in os.listdir(path)])
679 state = parse_paths(writer, state, files, mintime) 679 state = parse_paths(writer, state, files)
680 elif extension in [".tar", ".tgz", ".gz"]: 680 elif extension in [".tar", ".tgz", ".gz"]:
681 if extension == ".gz": 681 if extension == ".gz":
682 root, extension = os.path.splitext(root) 682 root, extension = os.path.splitext(root)
@@ -695,7 +695,7 @@ def parse_paths(writer, state, paths, mintime):
695 if tf != None: 695 if tf != None:
696 tf.close() 696 tf.close()
697 else: 697 else:
698 state = parse_file(writer, state, path, mintime) 698 state = parse_file(writer, state, path)
699 return state 699 return state
700 700
701def split_res(res, n): 701def split_res(res, n):