From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: openembedded-core <openembedded-core@lists.openembedded.org>
Subject: [PATCH] scripts/pybootchart: Allow minimum task length to be configured from the commandline
Date: Mon, 19 Nov 2012 15:03:09 +0000 [thread overview]
Message-ID: <1353337389.3709.169.camel@ted> (raw)
Rather than hardcode the value of "8", allow the minimum task length to be
configured from the commandline using the -m option. "-m 0" means all
tasks will be graphed.
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
diff --git a/scripts/pybootchartgui/pybootchartgui/main.py b/scripts/pybootchartgui/pybootchartgui/main.py
index e70ab13..e22636c 100644
--- a/scripts/pybootchartgui/pybootchartgui/main.py
+++ b/scripts/pybootchartgui/pybootchartgui/main.py
@@ -19,6 +19,8 @@ def _mk_options_parser():
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,
@@ -51,7 +53,7 @@ def main(argv=None):
parser.error("insufficient arguments, expected at least one path.")
return 2
- res = parsing.parse(args, options.prune)
+ res = parsing.parse(args, options.prune, options.mintime)
if options.interactive or options.output == None:
gui.show(res)
else:
diff --git a/scripts/pybootchartgui/pybootchartgui/parsing.py b/scripts/pybootchartgui/pybootchartgui/parsing.py
index a0f6e8e..6343fd5 100644
--- a/scripts/pybootchartgui/pybootchartgui/parsing.py
+++ b/scripts/pybootchartgui/pybootchartgui/parsing.py
@@ -170,7 +170,7 @@ class ParserState:
_relevant_files = set(["header", "proc_diskstats.log", "proc_ps.log", "proc_stat.log"])
-def _do_parse(state, filename, file):
+def _do_parse(state, filename, file, mintime):
#print filename
#writer.status("parsing '%s'" % filename)
paths = filename.split("/")
@@ -183,7 +183,7 @@ def _do_parse(state, filename, file):
start = int(float(line.split()[-1]))
elif line.startswith("Ended:"):
end = int(float(line.split()[-1]))
- if start and end and (end - start) > 8:
+ if start and end and (end - start) >= mintime:
k = pn + ":" + task
state.processes[pn + ":" + task] = [start, end]
if start not in state.start:
@@ -196,12 +196,12 @@ def _do_parse(state, filename, file):
state.end[end].append(pn + ":" + task)
return state
-def parse_file(state, filename):
+def parse_file(state, filename, mintime):
basename = os.path.basename(filename)
with open(filename, "rb") as file:
- return _do_parse(state, filename, file)
+ return _do_parse(state, filename, file, mintime)
-def parse_paths(state, paths):
+def parse_paths(state, paths, mintime):
for path in paths:
root,extension = os.path.splitext(path)
if not(os.path.exists(path)):
@@ -210,7 +210,7 @@ def parse_paths(state, paths):
if os.path.isdir(path):
files = [ f for f in [os.path.join(path, f) for f in os.listdir(path)] ]
files.sort()
- state = parse_paths(state, files)
+ state = parse_paths(state, files, mintime)
elif extension in [".tar", ".tgz", ".tar.gz"]:
tf = None
try:
@@ -223,11 +223,11 @@ def parse_paths(state, paths):
if tf != None:
tf.close()
else:
- state = parse_file(state, path)
+ state = parse_file(state, path, mintime)
return state
-def parse(paths, prune):
- state = parse_paths(ParserState(), paths)
+def parse(paths, prune, mintime):
+ state = parse_paths(ParserState(), paths, mintime)
if not state.valid():
raise ParseError("empty state: '%s' does not contain a valid bootchart" % ", ".join(paths))
#monitored_app = state.headers.get("profile.process")
reply other threads:[~2012-11-19 15:17 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1353337389.3709.169.camel@ted \
--to=richard.purdie@linuxfoundation.org \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.