summaryrefslogtreecommitdiffstats
path: root/scripts/pybootchartgui/pybootchartgui/main.py
diff options
context:
space:
mode:
authorPeter Kjellerstedt <peter.kjellerstedt@axis.com>2013-11-15 18:08:50 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-11-18 12:40:46 +0000
commit6f1568e54a7808b2ab568618fc5bb244249579f1 (patch)
treebb16107b7fd8a3be426b0841da058c620374b4f1 /scripts/pybootchartgui/pybootchartgui/main.py
parent3cfce710faf82024c5d8973fe83a125d0375309b (diff)
downloadopenembedded-core-6f1568e54a7808b2ab568618fc5bb244249579f1.tar.gz
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. Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/pybootchartgui/pybootchartgui/main.py')
l---------[-rw-r--r--]scripts/pybootchartgui/pybootchartgui/main.py79
1 files changed, 1 insertions, 78 deletions
diff --git a/scripts/pybootchartgui/pybootchartgui/main.py b/scripts/pybootchartgui/pybootchartgui/main.py
index e22636c23e..b45ae0a3d2 100644..120000
--- a/scripts/pybootchartgui/pybootchartgui/main.py
+++ b/scripts/pybootchartgui/pybootchartgui/main.py
@@ -1,78 +1 @@
-import sys
-import os
-import optparse
-
-import parsing
-import gui
-import batch
-
-def _mk_options_parser():
- """Make an options parser."""
- usage = "%prog [options] /path/to/tmp/buildstats/<recipe-machine>/<BUILDNAME>/"
- version = "%prog v1.0.0"
- parser = optparse.OptionParser(usage, version=version)
- parser.add_option("-i", "--interactive", action="store_true", dest="interactive", default=False,
- help="start in active mode")
- parser.add_option("-f", "--format", dest="format", default="svg", choices=["svg", "pdf", "png"],
- help="image format: svg, pdf, png, [default: %default]")
- 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("-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("-q", "--quiet", action="store_true", dest="quiet", default=False,
- help="suppress informational messages")
- 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")
- return parser
-
-def _get_filename(path):
- """Construct a usable filename for outputs"""
- dir = "."
- file = "bootchart"
- if os.path.isdir(path):
- dir = path
- elif path != None:
- file = path
- return os.path.join(dir, file)
-
-def main(argv=None):
- try:
- if argv is None:
- argv = sys.argv[1:]
-
- parser = _mk_options_parser()
- options, args = parser.parse_args(argv)
-
- if len(args) == 0:
- parser.error("insufficient arguments, expected at least one path.")
- return 2
-
- res = parsing.parse(args, options.prune, options.mintime)
- if options.interactive or options.output == None:
- gui.show(res)
- else:
- filename = _get_filename(options.output)
- 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)
- return 2
-
-
-if __name__ == '__main__':
- sys.exit(main())
+main.py.in \ No newline at end of file