mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2] ftrace: draw_funcgraph.py: Fix regex handling
@ 2014-04-15 10:53 asnast
  2014-04-15 10:53 ` [PATCH 1/2] ftrace: draw_funcgraph.py: Handle dots in function names asnast
  2014-04-15 10:53 ` [PATCH 2/2] ftrace: draw_funcgraph.py: Allow reading input from files in addition to stdin asnast
  0 siblings, 2 replies; 3+ messages in thread
From: asnast @ 2014-04-15 10:53 UTC (permalink / raw)
  To: linux-kernel; +Cc: rostedt, Alex Snast

From: Alex Snast <alexsn@il.ibm.com>

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] ftrace: draw_funcgraph.py: Handle dots in function names
  2014-04-15 10:53 [PATCH 0/2] ftrace: draw_funcgraph.py: Fix regex handling asnast
@ 2014-04-15 10:53 ` asnast
  2014-04-15 10:53 ` [PATCH 2/2] ftrace: draw_funcgraph.py: Allow reading input from files in addition to stdin asnast
  1 sibling, 0 replies; 3+ messages in thread
From: asnast @ 2014-04-15 10:53 UTC (permalink / raw)
  To: linux-kernel; +Cc: rostedt, Alex Snast

From: Alex Snast <alexsn@il.ibm.com>

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

Signed-off-by: Alex Snast <alexsn@il.ibm.com>
---
 scripts/tracing/draw_functrace.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/tracing/draw_functrace.py b/scripts/tracing/draw_functrace.py
index db40fa0..358bc9f 100644
--- a/scripts/tracing/draw_functrace.py
+++ b/scripts/tracing/draw_functrace.py
@@ -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():
-- 
1.9.2


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 2/2] ftrace: draw_funcgraph.py: Allow reading input from files in addition to stdin
  2014-04-15 10:53 [PATCH 0/2] ftrace: draw_funcgraph.py: Fix regex handling asnast
  2014-04-15 10:53 ` [PATCH 1/2] ftrace: draw_funcgraph.py: Handle dots in function names asnast
@ 2014-04-15 10:53 ` asnast
  1 sibling, 0 replies; 3+ messages in thread
From: asnast @ 2014-04-15 10:53 UTC (permalink / raw)
  To: linux-kernel; +Cc: rostedt, Alex Snast

From: Alex Snast <alexsn@il.ibm.com>

Signed-off-by: Alex Snast <alexsn@il.ibm.com>
---
 scripts/tracing/draw_functrace.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/tracing/draw_functrace.py b/scripts/tracing/draw_functrace.py
index 358bc9f..333ab42 100644
--- a/scripts/tracing/draw_functrace.py
+++ b/scripts/tracing/draw_functrace.py
@@ -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:
-- 
1.9.2


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-04-15 10:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-15 10:53 [PATCH 0/2] ftrace: draw_funcgraph.py: Fix regex handling asnast
2014-04-15 10:53 ` [PATCH 1/2] ftrace: draw_funcgraph.py: Handle dots in function names asnast
2014-04-15 10:53 ` [PATCH 2/2] ftrace: draw_funcgraph.py: Allow reading input from files in addition to stdin asnast

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®