diff options
author | Robert Yang <liezhi.yang@windriver.com> | 2012-06-06 14:10:11 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-06-15 15:09:16 +0100 |
commit | 04a34899e1c15a70babd97a3a59ccb9f8af05bad (patch) | |
tree | 91c91ce05a1ba8e98cf9f047ddc66e4fb2757afe /scripts/pybootchartgui/pybootchartgui/main.py | |
parent | 6ea0c02d0db08f6b4570769c6811ecdb051646ad (diff) | |
download | openembedded-core-contrib-04a34899e1c15a70babd97a3a59ccb9f8af05bad.tar.gz |
pybootchartgui: split the output chart into multiple ones
Split the output chart into multiple ones to make it more readable, it
only works with "-o path", which means that it doesn't work if the user
doesn't want to save the chart to the disk. For example:
$ ./pybootchartgui.py /path/to/tmp/buildstats/core-image-sato-qemux86/201205301810/ -f svg -s 5 -o /tmp/
bootchart written to /tmp/bootchart_1.svg
bootchart written to /tmp/bootchart_2.svg
bootchart written to /tmp/bootchart_3.svg
bootchart written to /tmp/bootchart_4.svg
bootchart written to /tmp/bootchart_5.svg
[YOCTO #2403]
Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Diffstat (limited to 'scripts/pybootchartgui/pybootchartgui/main.py')
-rw-r--r-- | scripts/pybootchartgui/pybootchartgui/main.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/scripts/pybootchartgui/pybootchartgui/main.py b/scripts/pybootchartgui/pybootchartgui/main.py index bf50afb6c3..fce8dd35cf 100644 --- a/scripts/pybootchartgui/pybootchartgui/main.py +++ b/scripts/pybootchartgui/pybootchartgui/main.py @@ -17,6 +17,8 @@ def _mk_options_parser(): help="image format (...); default format ...") parser.add_option("-o", "--output", dest="output", metavar="PATH", default=None, help="output path (file or directory) where charts are stored") + parser.add_option("-s", "--split", dest="num", type=int, default=1, + help="split the output chart into <NUM> charts, only works with \"-o PATH\"") 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, @@ -59,8 +61,16 @@ def main(argv=None): gui.show(res) else: filename = _get_filename(args, options) - batch.render(res, options.format, filename) - print "bootchart written to", filename + res_list = parsing.split_res(res, options.num) + n = 1 + for r in res_list: + if len(res_list) == 1: + f = filename + "." + options.format + else: + f = filename + "_" + str(n) + "." + options.format + n = n + 1 + batch.render(r, options.format, f) + print "bootchart written to", f return 0 except parsing.ParseError, ex: print("Parse error: %s" % ex) |