aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/pybootchartgui/README.pybootchart
blob: 8642e64679fd0a2cf0848e535c0da4b18d297160 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
			    PYBOOTCHARTGUI
			   ----------------

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.

Adapted from the bootchart-documentation:

  The CPU and disk statistics are used to render stacked area and line
  charts. The process information is used to create a Gantt chart
  showing process dependency, states and CPU usage.

  A typical boot sequence consists of several hundred processes. Since
  it is difficult to visualize such amount of data in a comprehensible
  way, tree pruning is utilized. Idle background processes and
  short-lived processes are removed. Similar processes running in
  parallel are also merged together.

  Finally, the performance and dependency charts are rendered as a
  single image to either the screen or in PNG, PDF or SVG format.


To get help for pybootchartgui, run

$ pybootchartgui --help

This code was originally hosted at:
	http://code.google.com/p/pybootchartgui/
">subprocess def exec_watch(cmd, **options): """Run program with stdout shown on sys.stdout""" if isinstance(cmd, basestring) and not "shell" in options: options["shell"] = True process = subprocess.Popen( cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, **options ) buf = '' while True: out = process.stdout.read(1) if out: sys.stdout.write(out) sys.stdout.flush() buf += out elif out == '' and process.poll() != None: break return process.returncode, buf def main(): if len(sys.argv) < 2: print('Please specify target to prepare with') return 1 sdk_targets = ' '.join(sys.argv[1:]).split() print('Preparing SDK for %s...' % ', '.join(sdk_targets)) ret, out = exec_watch('bitbake %s --setscene-only' % ' '.join(sdk_targets)) if ret: return ret targetlist = [] for target in sdk_targets: if ':' in target: target = target.split(':')[0] if not target in targetlist: targetlist.append(target) recipes = [] for target in targetlist: try: out = subprocess.check_output(('bitbake -e %s' % target).split(), stderr=subprocess.STDOUT) for line in out.splitlines(): if line.startswith('FILE='): splitval = line.rstrip().split('=') if len(splitval) > 1: recipes.append(splitval[1].strip('"')) break except subprocess.CalledProcessError as e: print('ERROR: Failed to get recipe for target %s:\n%s' % (target, e.output)) return 1 try: out = subprocess.check_output('bitbake %s -n' % ' '.join(sdk_targets), stderr=subprocess.STDOUT, shell=True) unexpected = [] for line in out.splitlines(): if 'Running task' in line: for recipe in recipes: if recipe in line: break else: line = line.split('Running', 1)[-1] unexpected.append(line.rstrip()) elif 'Running setscene' in line: unexpected.append(line.rstrip()) except subprocess.CalledProcessError as e: print('ERROR: Failed to execute dry-run:\n%s' % e.output) return 1 if unexpected: print('ERROR: Unexpected tasks or setscene left over to be executed:') for line in unexpected: print(' ' + line) return 1 if __name__ == "__main__": try: ret = main() except Exception: ret = 1 import traceback traceback.print_exc(5) sys.exit(ret)