From: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
To: Peter Zijlstra <peterz@infradead.org>, Ingo Molnar <mingo@elte.hu>
Cc: Steven Rostedt <rostedt@goodmis.org>,
Srikar Dronamraju <srikar@linux.vnet.ibm.com>,
Randy Dunlap <rdunlap@xenotime.net>,
Arnaldo Carvalho de Melo <acme@infradead.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
Christoph Hellwig <hch@infradead.org>,
Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>,
Oleg Nesterov <oleg@redhat.com>, Mark Wielaard <mjw@redhat.com>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
LKML <linux-kernel@vger.kernel.org>,
Naren A Devaiah <naren.devaiah@in.ibm.com>,
Jim Keniston <jkenisto@linux.vnet.ibm.com>,
Frederic Weisbecker <fweisbec@gmail.com>,
"Frank Ch. Eigler" <fche@redhat.com>,
Ananth N Mavinakayanahalli <ananth@in.ibm.com>,
Andrew Morton <akpm@linux-foundation.org>,
"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Subject: [PATCHv10 2.6.35-rc6-tip 14/14] [RFC] perf: show functions in a file without using pid
Date: Tue, 27 Jul 2010 16:41:48 +0530 [thread overview]
Message-ID: <20100727111148.24690.77378.sendpatchset@localhost6.localdomain6> (raw)
In-Reply-To: <20100727110855.24690.26901.sendpatchset@localhost6.localdomain6>
Lists function names in a dso. Dso needs to a filename.
However passing Dso short name will not work.
Signed-off-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
---
Changelog from V9: Filter labels, weak, and local binding functions
from listing as suggested by Christoph Hellwig.
Show last 10 functions in /bin/zsh.
# perf probe -S -D /bin/zsh | tail
zstrtol
ztrcmp
ztrdup
ztrduppfx
ztrftime
ztrlen
ztrncpy
ztrsub
zwarn
zwarnnam
Show first 10 functions in /lib/libc.so.6
# perf probe -S -D /lib/libc.so.6 | head
_IO_adjust_column
_IO_adjust_wcolumn
_IO_default_doallocate
_IO_default_finish
_IO_default_pbackfail
_IO_default_uflow
_IO_default_xsgetn
_IO_default_xsputn
_IO_do_write@@GLIBC_2.2.5
_IO_doallocbuf
tools/perf/util/probe-event.c | 75 ++++++++++++++++++++++-------------------
tools/perf/util/symbol.c | 8 ++++
tools/perf/util/symbol.h | 1 +
3 files changed, 50 insertions(+), 34 deletions(-)
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index d0636e1..a079ecc 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -2018,14 +2018,14 @@ static int print_list_available_symbols(struct map *map,
int show_possible_probes(struct strlist *limitlist, pid_t pid)
{
- struct perf_session *session;
- struct thread *thread;
+ struct perf_session *session = NULL;
+ struct thread *thread = NULL;
struct str_node *ent;
struct map *map = NULL;
char *name = NULL, *tmpname = NULL, *str;
int ret = -EINVAL;
- if (!pid) {
+ if (!pid && !limitlist) { /* Show functions in kernel */
ret = init_vmlinux();
if (ret < 0)
return ret;
@@ -2036,26 +2036,28 @@ int show_possible_probes(struct strlist *limitlist, pid_t pid)
if (ret < 0)
return ret;
}
- session = perf_session__new(NULL, O_WRONLY, false, false);
- if (!session) {
- ret = -ENOMEM;
- goto out_delete;
- }
- event__synthesize_thread(pid, event__process, session);
-
- thread = perf_session__findnew(session, pid);
- if (!thread)
- goto out_delete;
-
- if (!limitlist) {
- map_groups__for_each_map(map, MAP__FUNCTION, &thread->mg) {
- ret = print_list_available_symbols(map, NULL);
- if (ret)
- pr_warning("No Symbols in dso %s.\n",
+ if (pid) {
+ session = perf_session__new(NULL, O_WRONLY, false, false);
+ if (!session) {
+ ret = -ENOMEM;
+ goto out_delete;
+ }
+ event__synthesize_thread(pid, event__process, session);
+ thread = perf_session__findnew(session, pid);
+ if (!thread)
+ goto out_delete;
+ if (!limitlist) {
+ map_groups__for_each_map(map, MAP__FUNCTION,
+ &thread->mg) {
+ ret = print_list_available_symbols(map, NULL);
+ if (ret)
+ pr_warning("No Symbols in dso %s.\n",
map->dso->short_name);
+ }
+ goto out_delete;
}
- goto out_delete;
}
+
strlist__for_each(ent, limitlist) {
str = strdup(ent->s);
if (!str) {
@@ -2063,20 +2065,25 @@ int show_possible_probes(struct strlist *limitlist, pid_t pid)
goto out_delete;
}
- tmpname = realpath(str, NULL);
- if (tmpname)
- name = basename(tmpname);
- if (!name)
- name = str;
- map = map_groups__find_by_name(&thread->mg,
- MAP__FUNCTION, name);
- if (tmpname)
- free(tmpname);
- if (!map) {
- pr_warning("Skip probe listing in %s DSO.", str);
- free(str);
- continue;
- }
+ if (pid) {
+ tmpname = realpath(str, NULL);
+ if (tmpname)
+ name = basename(tmpname);
+ if (!name)
+ name = str;
+ map = map_groups__find_by_name(&thread->mg,
+ MAP__FUNCTION, name);
+ if (tmpname)
+ free(tmpname);
+ if (!map) {
+ pr_warning("Skip probe listing in %s DSO.\n",
+ str);
+ free(str);
+ continue;
+ }
+ } else
+ map = dso__new_map(str);
+
ret = print_list_available_symbols(map, NULL);
if (ret)
pr_warning("No Symbols in dso %s.\n", str);
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 674b95a..3ec57a8 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -2360,3 +2360,11 @@ int machine__load_vmlinux_path(struct machine *self, enum map_type type,
return ret;
}
+
+struct map *dso__new_map(char *name)
+{
+ struct dso *dso = dso__new(name);
+ struct map *map = map__new2(0, dso, MAP__FUNCTION);
+
+ return map;
+}
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
index 93f1058..b1f608e 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -196,6 +196,7 @@ char dso__symtab_origin(const struct dso *self);
void dso__set_long_name(struct dso *self, char *name);
void dso__set_build_id(struct dso *self, void *build_id);
void dso__read_running_kernel_build_id(struct dso *self, struct machine *machine);
+struct map *dso__new_map(char *name);
struct symbol *dso__find_symbol(struct dso *self, enum map_type type, u64 addr);
struct symbol *dso__find_symbol_by_name(struct dso *self, enum map_type type,
const char *name);
prev parent reply other threads:[~2010-07-27 11:13 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-27 11:08 [PATCHv10 2.6.35-rc6-tip 0/14] Uprobes Patches Srikar Dronamraju
2010-07-27 11:09 ` [PATCHv10 2.6.35-rc6-tip 1/14] mm: Move replace_page() / write_protect_page() to mm/memory.c Srikar Dronamraju
2010-07-27 11:09 ` [PATCHv10 2.6.35-rc6-tip 2/14] uprobes: Breakpoint insertion/removal in user space applications Srikar Dronamraju
2010-07-27 11:09 ` [PATCHv10 2.6.35-rc6-tip 3/14] uprobes: Slot allocation for Execution out of line(XOL) Srikar Dronamraju
2010-07-27 11:09 ` [PATCHv10 2.6.35-rc6-tip 4/14] uprobes: x86 specific functions for user space breakpointing Srikar Dronamraju
2010-07-27 11:09 ` [PATCHv10 2.6.35-rc6-tip 5/14] uprobes: Uprobes (un)registration and exception handling Srikar Dronamraju
2010-07-27 11:10 ` [PATCHv10 2.6.35-rc6-tip 6/14] uprobes: X86 support for Uprobes Srikar Dronamraju
2010-07-27 11:10 ` [PATCHv10 2.6.35-rc6-tip 7/14] uprobes: Uprobes Documentation Srikar Dronamraju
2010-07-27 11:10 ` [PATCHv10 2.6.35-rc6-tip 8/14] trace: Extract out common code for kprobes/uprobes traceevents Srikar Dronamraju
2010-07-27 13:22 ` Masami Hiramatsu
2010-07-27 14:03 ` Srikar Dronamraju
2010-07-28 7:56 ` Masami Hiramatsu
2010-07-29 14:16 ` Srikar Dronamraju
2010-07-27 11:10 ` [PATCHv10 2.6.35-rc6-tip 9/14] trace: uprobes trace_event interface Srikar Dronamraju
2010-07-29 5:04 ` Masami Hiramatsu
2010-08-02 2:20 ` Frederic Weisbecker
2010-08-02 3:45 ` Masami Hiramatsu
2010-08-02 6:46 ` Srikar Dronamraju
2010-08-02 7:58 ` Frederic Weisbecker
2010-08-02 7:46 ` Frederic Weisbecker
2010-08-02 7:56 ` Ingo Molnar
2010-08-02 8:00 ` Christoph Hellwig
2010-08-02 9:29 ` Masami Hiramatsu
2010-08-02 9:36 ` Christoph Hellwig
2010-07-29 5:04 ` Masami Hiramatsu
2010-07-29 5:20 ` Srikar Dronamraju
2010-07-29 14:15 ` Srikar Dronamraju
2010-08-02 2:28 ` Frederic Weisbecker
2010-07-27 11:10 ` [PATCHv10 2.6.35-rc6-tip 10/14] perf: rename common fields/functions from kprobe to probe Srikar Dronamraju
2010-07-29 11:51 ` Masami Hiramatsu
2010-07-29 14:13 ` Srikar Dronamraju
2010-07-29 19:42 ` Arnaldo Carvalho de Melo
2010-08-02 7:53 ` [tip:perf/core] perf probe: Rename " tip-bot for Srikar Dronamraju
2010-07-27 11:11 ` [PATCHv10 2.6.35-rc6-tip 11/14] perf: perf interface for uprobes Srikar Dronamraju
2010-07-29 12:01 ` Masami Hiramatsu
2010-07-29 14:11 ` Srikar Dronamraju
2010-07-30 19:19 ` Arnaldo Carvalho de Melo
2010-07-31 2:57 ` Srikar Dronamraju
2010-07-31 19:30 ` Arnaldo Carvalho de Melo
2010-08-02 1:51 ` Masami Hiramatsu
2010-08-02 12:27 ` Srikar Dronamraju
2010-08-02 14:56 ` Arnaldo Carvalho de Melo
2010-08-02 12:38 ` [PATCH] perf: expose event__process function Srikar Dronamraju
2010-08-05 8:01 ` [tip:perf/core] " tip-bot for Srikar Dronamraju
2010-08-02 12:41 ` [PATCHv10 2.6.35-rc6-tip 11/14] perf: perf interface for uprobes Srikar Dronamraju
2010-07-27 11:11 ` [PATCHv10 2.6.35-rc6-tip 12/14] perf: Add third parameter to symbol_filter_t Srikar Dronamraju
2010-08-05 15:19 ` Arnaldo Carvalho de Melo
2010-08-05 15:20 ` Arnaldo Carvalho de Melo
2010-08-05 15:23 ` Srikar Dronamraju
2010-07-27 11:11 ` [PATCHv10 2.6.35-rc6-tip 13/14] [RFC] perf: Show Potential probe points Srikar Dronamraju
2010-07-27 11:11 ` Srikar Dronamraju [this message]
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=20100727111148.24690.77378.sendpatchset@localhost6.localdomain6 \
--to=srikar@linux.vnet.ibm.com \
--cc=acme@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=ananth@in.ibm.com \
--cc=fche@redhat.com \
--cc=fweisbec@gmail.com \
--cc=hch@infradead.org \
--cc=jkenisto@linux.vnet.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=masami.hiramatsu.pt@hitachi.com \
--cc=mathieu.desnoyers@efficios.com \
--cc=mingo@elte.hu \
--cc=mjw@redhat.com \
--cc=naren.devaiah@in.ibm.com \
--cc=oleg@redhat.com \
--cc=paulmck@linux.vnet.ibm.com \
--cc=peterz@infradead.org \
--cc=rdunlap@xenotime.net \
--cc=rostedt@goodmis.org \
--cc=torvalds@linux-foundation.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.