LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* (no subject)
@ 2011-02-10 9:07 Masami Hiramatsu
2011-02-10 9:08 ` [PATCH -perf/perf/core 1/2] perf probe: Support function@filename syntax for --line Masami Hiramatsu
2011-02-10 9:08 ` [PATCH -perf/perf/core 2/2] perf probe: Show filename which contains target function Masami Hiramatsu
0 siblings, 2 replies; 5+ messages in thread
From: Masami Hiramatsu @ 2011-02-10 9:07 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Ingo Molnar
Cc: Peter Zijlstra, Paul Mackerras, Ingo Molnar,
Arnaldo Carvalho de Melo, Franck Bui-Huu, linux-kernel,
2nddept-manager
Subject: [PATCH -perf/perf/core 0/2] Perf probe update for show-line option
Hi,
These patches update perf-probe to enhance
show-lines option (--line). 2nd patch has been
sent by Franck Bui-Huu. I've tweaked it a bit to
fit for current usage.
Thank you,
---
Masami Hiramatsu (2):
perf probe: Show filename which contains target function
perf probe: Support function@filename syntax for --line
tools/perf/Documentation/perf-probe.txt | 7 ++++---
tools/perf/util/probe-event.c | 17 +++++++++++++----
2 files changed, 17 insertions(+), 7 deletions(-)
--
Masami HIRAMATSU
2nd Dept. Linux Technology Center
Hitachi, Ltd., Systems Development Laboratory
E-mail: masami.hiramatsu.pt@hitachi.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH -perf/perf/core 1/2] perf probe: Support function@filename syntax for --line
2011-02-10 9:07 Masami Hiramatsu
@ 2011-02-10 9:08 ` Masami Hiramatsu
2011-02-17 15:04 ` [tip:perf/core] " tip-bot for Masami Hiramatsu
2011-02-10 9:08 ` [PATCH -perf/perf/core 2/2] perf probe: Show filename which contains target function Masami Hiramatsu
1 sibling, 1 reply; 5+ messages in thread
From: Masami Hiramatsu @ 2011-02-10 9:08 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Ingo Molnar
Cc: Franck Bui-Huu, linux-kernel, 2nddept-manager, Masami Hiramatsu,
Franck Bui-Huu, Peter Zijlstra, Paul Mackerras, Ingo Molnar,
Arnaldo Carvalho de Melo, linux-kernel
Since "perf probe --add" supports function@filename syntax,
--line option should also support it.
Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Franck Bui-Huu <fbuihuu@gmail.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: linux-kernel@vger.kernel.org
---
tools/perf/Documentation/perf-probe.txt | 7 ++++---
tools/perf/util/probe-event.c | 15 ++++++++++++---
2 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/tools/perf/Documentation/perf-probe.txt b/tools/perf/Documentation/perf-probe.txt
index 81c3220..02bafce 100644
--- a/tools/perf/Documentation/perf-probe.txt
+++ b/tools/perf/Documentation/perf-probe.txt
@@ -16,7 +16,7 @@ or
or
'perf probe' --list
or
-'perf probe' [options] --line='FUNC[:RLN[+NUM|:RLN2]]|SRC:ALN[+NUM|:ALN2]'
+'perf probe' [options] --line='LINE'
or
'perf probe' [options] --vars='PROBEPOINT'
@@ -128,13 +128,14 @@ LINE SYNTAX
-----------
Line range is described by following syntax.
- "FUNC[:RLN[+NUM|-RLN2]]|SRC[:ALN[+NUM|-ALN2]]"
+ "FUNC[@SRC][:RLN[+NUM|-RLN2]]|SRC[:ALN[+NUM|-ALN2]]"
FUNC specifies the function name of showing lines. 'RLN' is the start line
number from function entry line, and 'RLN2' is the end line number. As same as
probe syntax, 'SRC' means the source file path, 'ALN' is start line number,
and 'ALN2' is end line number in the file. It is also possible to specify how
-many lines to show by using 'NUM'.
+many lines to show by using 'NUM'. Moreover, 'FUNC@SRC' combination is good
+for searching a specific function when several functions share same name.
So, "source.c:100-120" shows lines between 100th to l20th in source.c file. And "func:10+20" shows 20 lines from 10th line of func function.
LAZY MATCHING
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index 9d237e3..cbd7650 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -595,11 +595,11 @@ static int parse_line_num(char **ptr, int *val, const char *what)
* The line range syntax is described by:
*
* SRC[:SLN[+NUM|-ELN]]
- * FNC[:SLN[+NUM|-ELN]]
+ * FNC[@SRC][:SLN[+NUM|-ELN]]
*/
int parse_line_range_desc(const char *arg, struct line_range *lr)
{
- char *range, *name = strdup(arg);
+ char *range, *file, *name = strdup(arg);
int err;
if (!name)
@@ -649,7 +649,16 @@ int parse_line_range_desc(const char *arg, struct line_range *lr)
}
}
- if (strchr(name, '.'))
+ file = strchr(name, '@');
+ if (file) {
+ *file = '\0';
+ lr->file = strdup(++file);
+ if (lr->file == NULL) {
+ err = -ENOMEM;
+ goto err;
+ }
+ lr->function = name;
+ } else if (strchr(name, '.'))
lr->file = name;
else
lr->function = name;
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH -perf/perf/core 2/2] perf probe: Show filename which contains target function
2011-02-10 9:07 Masami Hiramatsu
2011-02-10 9:08 ` [PATCH -perf/perf/core 1/2] perf probe: Support function@filename syntax for --line Masami Hiramatsu
@ 2011-02-10 9:08 ` Masami Hiramatsu
2011-02-17 15:04 ` [tip:perf/core] " tip-bot for Masami Hiramatsu
1 sibling, 1 reply; 5+ messages in thread
From: Masami Hiramatsu @ 2011-02-10 9:08 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Ingo Molnar
Cc: Franck Bui-Huu, linux-kernel, 2nddept-manager, Masami Hiramatsu,
Peter Zijlstra, Paul Mackerras, Ingo Molnar,
Arnaldo Carvalho de Melo, linux-kernel
Show filename which contains a target function with the
function name on "--lines" mode, because perf-probe just
shows the first function even if there are many same-name
functions.
Originally adopted by Franck Bui-Huu's patch which shows
file name instead of function name. I've just modified it
to show both of function name and file name, because of
completeness of output.
E.g.)
$ perf probe -L t_show
<t_show@/home/mhiramat/ksrc/linux-2.6-tip/kernel/trace/ftrace.c:0>
0 static int t_show(struct seq_file *m, void *v)
1 {
2 struct ftrace_iterator *iter = m->private;
...
$ perf probe -L t_show@trace/trace.c
<t_show@/home/mhiramat/ksrc/linux-2.6-tip/kernel/trace/trace.c:0>
0 static int t_show(struct seq_file *m, void *v)
1 {
struct tracer *t = v;
...
Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Original-patch-by: Franck Bui-Huu <fbuihuu@gmail.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: linux-kernel@vger.kernel.org
---
tools/perf/util/probe-event.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index cbd7650..0e3ea13 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -409,7 +409,7 @@ int show_line_range(struct line_range *lr, const char *module)
setup_pager();
if (lr->function)
- fprintf(stdout, "<%s:%d>\n", lr->function,
+ fprintf(stdout, "<%s@%s:%d>\n", lr->function, lr->path,
lr->start - lr->offset);
else
fprintf(stdout, "<%s:%d>\n", lr->path, lr->start);
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [tip:perf/core] perf probe: Support function@filename syntax for --line
2011-02-10 9:08 ` [PATCH -perf/perf/core 1/2] perf probe: Support function@filename syntax for --line Masami Hiramatsu
@ 2011-02-17 15:04 ` tip-bot for Masami Hiramatsu
0 siblings, 0 replies; 5+ messages in thread
From: tip-bot for Masami Hiramatsu @ 2011-02-17 15:04 UTC (permalink / raw)
To: linux-tip-commits
Cc: acme, linux-kernel, paulus, hpa, mingo, a.p.zijlstra, fbuihuu,
masami.hiramatsu.pt, tglx, mingo
Commit-ID: e116dfa1c357da49f55e1555767ec991225a8321
Gitweb: http://git.kernel.org/tip/e116dfa1c357da49f55e1555767ec991225a8321
Author: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
AuthorDate: Thu, 10 Feb 2011 18:08:10 +0900
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 16 Feb 2011 17:03:23 -0200
perf probe: Support function@filename syntax for --line
Since "perf probe --add" supports function@filename syntax, --line
option should also support it.
Cc: 2nddept-manager@sdl.hitachi.co.jp
Cc: Franck Bui-Huu <fbuihuu@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: linux-kernel@vger.kernel.org
LKML-Reference: <20110210090810.1809.26913.stgit@ltc236.sdl.hitachi.co.jp>
Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/Documentation/perf-probe.txt | 7 ++++---
tools/perf/util/probe-event.c | 15 ++++++++++++---
2 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/tools/perf/Documentation/perf-probe.txt b/tools/perf/Documentation/perf-probe.txt
index 81c3220..02bafce 100644
--- a/tools/perf/Documentation/perf-probe.txt
+++ b/tools/perf/Documentation/perf-probe.txt
@@ -16,7 +16,7 @@ or
or
'perf probe' --list
or
-'perf probe' [options] --line='FUNC[:RLN[+NUM|:RLN2]]|SRC:ALN[+NUM|:ALN2]'
+'perf probe' [options] --line='LINE'
or
'perf probe' [options] --vars='PROBEPOINT'
@@ -128,13 +128,14 @@ LINE SYNTAX
-----------
Line range is described by following syntax.
- "FUNC[:RLN[+NUM|-RLN2]]|SRC[:ALN[+NUM|-ALN2]]"
+ "FUNC[@SRC][:RLN[+NUM|-RLN2]]|SRC[:ALN[+NUM|-ALN2]]"
FUNC specifies the function name of showing lines. 'RLN' is the start line
number from function entry line, and 'RLN2' is the end line number. As same as
probe syntax, 'SRC' means the source file path, 'ALN' is start line number,
and 'ALN2' is end line number in the file. It is also possible to specify how
-many lines to show by using 'NUM'.
+many lines to show by using 'NUM'. Moreover, 'FUNC@SRC' combination is good
+for searching a specific function when several functions share same name.
So, "source.c:100-120" shows lines between 100th to l20th in source.c file. And "func:10+20" shows 20 lines from 10th line of func function.
LAZY MATCHING
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index 9d237e3..cbd7650 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -595,11 +595,11 @@ static int parse_line_num(char **ptr, int *val, const char *what)
* The line range syntax is described by:
*
* SRC[:SLN[+NUM|-ELN]]
- * FNC[:SLN[+NUM|-ELN]]
+ * FNC[@SRC][:SLN[+NUM|-ELN]]
*/
int parse_line_range_desc(const char *arg, struct line_range *lr)
{
- char *range, *name = strdup(arg);
+ char *range, *file, *name = strdup(arg);
int err;
if (!name)
@@ -649,7 +649,16 @@ int parse_line_range_desc(const char *arg, struct line_range *lr)
}
}
- if (strchr(name, '.'))
+ file = strchr(name, '@');
+ if (file) {
+ *file = '\0';
+ lr->file = strdup(++file);
+ if (lr->file == NULL) {
+ err = -ENOMEM;
+ goto err;
+ }
+ lr->function = name;
+ } else if (strchr(name, '.'))
lr->file = name;
else
lr->function = name;
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [tip:perf/core] perf probe: Show filename which contains target function
2011-02-10 9:08 ` [PATCH -perf/perf/core 2/2] perf probe: Show filename which contains target function Masami Hiramatsu
@ 2011-02-17 15:04 ` tip-bot for Masami Hiramatsu
0 siblings, 0 replies; 5+ messages in thread
From: tip-bot for Masami Hiramatsu @ 2011-02-17 15:04 UTC (permalink / raw)
To: linux-tip-commits
Cc: acme, linux-kernel, paulus, hpa, mingo, a.p.zijlstra, fbuihuu,
masami.hiramatsu.pt, tglx, mingo
Commit-ID: 8737ebdea02315eaffaebb3b73d55f2f726a4fe0
Gitweb: http://git.kernel.org/tip/8737ebdea02315eaffaebb3b73d55f2f726a4fe0
Author: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
AuthorDate: Thu, 10 Feb 2011 18:08:16 +0900
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 16 Feb 2011 17:04:09 -0200
perf probe: Show filename which contains target function
Show filename which contains a target function with the function name on
"--lines" mode, because perf-probe just shows the first function even if
there are many same-name functions.
Originally adopted by Franck Bui-Huu's patch which shows file name
instead of function name. I've just modified it to show both of function
name and file name, because of completeness of output.
E.g.)
$ perf probe -L t_show
<t_show@/home/mhiramat/ksrc/linux-2.6-tip/kernel/trace/ftrace.c:0>
0 static int t_show(struct seq_file *m, void *v)
1 {
2 struct ftrace_iterator *iter = m->private;
...
$ perf probe -L t_show@trace/trace.c
<t_show@/home/mhiramat/ksrc/linux-2.6-tip/kernel/trace/trace.c:0>
0 static int t_show(struct seq_file *m, void *v)
1 {
struct tracer *t = v;
...
Original-patch-by: Franck Bui-Huu <fbuihuu@gmail.com>
Cc: 2nddept-manager@sdl.hitachi.co.jp
Cc: Franck Bui-Huu <fbuihuu@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <20110210090816.1809.43426.stgit@ltc236.sdl.hitachi.co.jp>
Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/probe-event.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index cbd7650..0e3ea13 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -409,7 +409,7 @@ int show_line_range(struct line_range *lr, const char *module)
setup_pager();
if (lr->function)
- fprintf(stdout, "<%s:%d>\n", lr->function,
+ fprintf(stdout, "<%s@%s:%d>\n", lr->function, lr->path,
lr->start - lr->offset);
else
fprintf(stdout, "<%s:%d>\n", lr->path, lr->start);
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-02-17 15:05 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-10 9:07 Masami Hiramatsu
2011-02-10 9:08 ` [PATCH -perf/perf/core 1/2] perf probe: Support function@filename syntax for --line Masami Hiramatsu
2011-02-17 15:04 ` [tip:perf/core] " tip-bot for Masami Hiramatsu
2011-02-10 9:08 ` [PATCH -perf/perf/core 2/2] perf probe: Show filename which contains target function Masami Hiramatsu
2011-02-17 15:04 ` [tip:perf/core] " tip-bot for Masami Hiramatsu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).