ftrace: draw_funcgraph.py: Fix regex handling
cover ftrace: draw_funcgraph.py: Fix regex handling
From: Alex Snast <[email protected]>
Hi,
This patch set fixes a small regex handling bug I've encountered while using draw_funcgraph.py tool.
In addition I've found it more convenient to pass raw function trace input from files as opposed to stdin only so I've added support for that.
Alex Snast (2):
ftrace: draw_funcgraph.py: Handle dots in function names
ftrace: draw_funcgraph.py: Allow reading input from files in addition
to stdin
scripts/tracing/draw_functrace.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
--
1.9.2
PATCH 1/2 ftrace: draw_funcgraph.py: Handle dots in function names
From: Alex Snast <[email protected]>
ftrace function tracer can output the following line:
mmcommon-3250 [001] 969103.003748: clear_buddies.isra.59 <-dequeue_task_fair
However the regex used by draw_functrace.py would fail to match the '.' character
--- scripts/tracing/draw_functrace.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/tracing/draw_functrace.py +2 -2
@@ -103,10 +103,10 @@ def parseLine(line): line = line.strip() if line.startswith("#"): raise CommentLineException - m = re.match("[^]]+?\\] +([0-9.]+): (\\w+) <-(\\w+)", line) + m = re.match(r"[^]]+?\] +(\d+\.\d+): ([\w.]+) <-([\w.]+)", line) if m is None: raise BrokenLineException - return (m.group(1), m.group(2), m.group(3)) + return m.group(1, 2, 3) def main():
Signature · 1 line
1.9.2
PATCH 2/2 ftrace: draw_funcgraph.py: Allow reading input from files in addition to stdin
In reply to [email protected]From: Alex Snast <[email protected]>
--- scripts/tracing/draw_functrace.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/tracing/draw_functrace.py +2 -2
@@ -22,7 +22,7 @@ Usage: """ -import sys, re +import fileinput, re class CallTree: """ This class provides a tree representation of the functions
@@ -113,7 +113,7 @@ def main(): CallTree.ROOT = CallTree("Root (Nowhere)", None, None) tree = CallTree.ROOT - for line in sys.stdin: + for line in fileinput.input(): try: calltime, callee, caller = parseLine(line) except BrokenLineException:
Signature · 1 line
1.9.2