From: Arnaldo Carvalho de Melo <acme@infradead.org>
To: Ingo Molnar <mingo@elte.hu>
Cc: linux-kernel@vger.kernel.org,
"Arnaldo Carvalho de Melo" <acme@redhat.com>,
"Frédéric Weisbecker" <fweisbec@gmail.com>,
"Mike Galbraith" <efault@gmx.de>,
"Peter Zijlstra" <a.p.zijlstra@chello.nl>,
"Paul Mackerras" <paulus@samba.org>
Subject: [PATCH v2 6/6] perf report: Pass the DSO to 'perf annotate'
Date: Wed, 24 Mar 2010 16:40:19 -0300 [thread overview]
Message-ID: <1269459619-982-6-git-send-email-acme@infradead.org> (raw)
In-Reply-To: <1269459619-982-1-git-send-email-acme@infradead.org>
From: Arnaldo Carvalho de Melo <acme@redhat.com>
So that we ensure that the symbol asked for annotation really is in the
DSO we are interested in.
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/newt.c | 49 ++++++++++++++++++++++++++---------------------
1 files changed, 27 insertions(+), 22 deletions(-)
diff --git a/tools/perf/util/newt.c b/tools/perf/util/newt.c
index f6953ca..12572b5 100644
--- a/tools/perf/util/newt.c
+++ b/tools/perf/util/newt.c
@@ -157,7 +157,7 @@ static void __callchain__append_graph_browser(struct callchain_node *self,
indexes[depth + 2] = NEWT_ARG_LAST;
++chain_idx;
}
- newt_checkbox_tree__add(tree, str, chain->ms.sym, indexes);
+ newt_checkbox_tree__add(tree, str, &chain->ms, indexes);
free(alloc_str);
++printed;
}
@@ -193,7 +193,7 @@ static void callchain__append_graph_browser(struct callchain_node *self,
continue;
str = callchain_list__sym_name(chain, ipstr, sizeof(ipstr));
- newt_checkbox_tree__add(tree, str, chain->ms.sym, indexes);
+ newt_checkbox_tree__add(tree, str, &chain->ms, indexes);
}
indexes[1] = parent_idx;
@@ -287,14 +287,14 @@ static size_t hist_entry__append_browser(struct hist_entry *self,
indexes[0] = NEWT_ARG_APPEND;
indexes[1] = NEWT_ARG_LAST;
- newt_checkbox_tree__add(tree, s, self->ms.sym, indexes);
+ newt_checkbox_tree__add(tree, s, &self->ms, indexes);
} else
- newtListboxAppendEntry(tree, s, self->ms.sym);
+ newtListboxAppendEntry(tree, s, &self->ms);
return strlen(s);
}
-static void symbol__annotate_browser(const struct symbol *self)
+static void map_symbol__annotate_browser(const struct map_symbol *self)
{
FILE *fp;
int cols, rows;
@@ -305,10 +305,11 @@ static void symbol__annotate_browser(const struct symbol *self)
size_t max_usable_width;
char *line = NULL;
- if (self == NULL)
+ if (self->sym == NULL)
return;
- if (asprintf(&str, "perf annotate %s 2>&1 | expand", self->name) < 0)
+ if (asprintf(&str, "perf annotate -d \"%s\" %s 2>&1 | expand",
+ self->map->dso->name, self->sym->name) < 0)
return;
fp = popen(str, "r");
@@ -338,7 +339,7 @@ static void symbol__annotate_browser(const struct symbol *self)
newtListboxSetWidth(tree, max_line_len);
- newtCenteredWindow(max_line_len + 2, rows - 5, self->name);
+ newtCenteredWindow(max_line_len + 2, rows - 5, self->sym->name);
form = newt_form__new();
newtFormAddComponents(form, tree, NULL);
@@ -359,7 +360,7 @@ static const void *newt__symbol_tree_get_current(newtComponent self)
static void perf_session__selection(newtComponent self, void *data)
{
- const struct symbol **symbol_ptr = data;
+ const struct map_symbol **symbol_ptr = data;
*symbol_ptr = newt__symbol_tree_get_current(self);
}
@@ -376,7 +377,7 @@ void perf_session__browse_hists(struct rb_root *hists, u64 session_total,
char str[1024];
newtComponent form, tree;
struct newtExitStruct es;
- const struct symbol *selection;
+ const struct map_symbol *selection;
snprintf(str, sizeof(str), "Samples: %Ld", session_total);
newtDrawRootText(0, 0, str);
@@ -416,11 +417,8 @@ void perf_session__browse_hists(struct rb_root *hists, u64 session_total,
int len = hist_entry__append_browser(h, tree, session_total);
if (len > max_len)
max_len = len;
- if (symbol_conf.use_callchain) {
+ if (symbol_conf.use_callchain)
hist_entry__append_callchain_browser(h, tree, session_total, idx++);
- if (idx > 3300)
- break;
- }
}
if (max_len > cols)
@@ -445,10 +443,8 @@ void perf_session__browse_hists(struct rb_root *hists, u64 session_total,
newtFormRun(form, &es);
if (es.reason == NEWT_EXIT_HOTKEY) {
- if (toupper(es.u.key) == 'A') {
- symbol__annotate_browser(selection);
- continue;
- }
+ if (toupper(es.u.key) == 'A')
+ goto do_annotate;
if (es.u.key == NEWT_KEY_ESCAPE ||
toupper(es.u.key) == 'Q' ||
es.u.key == CTRL('c')) {
@@ -459,9 +455,9 @@ void perf_session__browse_hists(struct rb_root *hists, u64 session_total,
}
}
- if (selection != NULL) {
+ if (selection->sym != NULL) {
snprintf(annotate, sizeof(annotate),
- "Annotate %s", selection->name);
+ "Annotate %s", selection->sym->name);
options[nr_options++] = annotate;
}
@@ -469,8 +465,17 @@ void perf_session__browse_hists(struct rb_root *hists, u64 session_total,
choice = popup_menu(nr_options, options);
if (choice == nr_options - 1)
break;
- else if (selection != NULL && choice >= 0)
- symbol__annotate_browser(selection);
+do_annotate:
+ if (selection->sym != NULL && choice >= 0) {
+ if (selection->map->dso->origin == DSO__ORIG_KERNEL) {
+ newtPopHelpLine();
+ newtPushHelpLine("No vmlinux file found, can't "
+ "annotate with just a "
+ "kallsyms file");
+ continue;
+ }
+ map_symbol__annotate_browser(selection);
+ }
}
newtFormDestroy(form);
--
1.6.2.5
prev parent reply other threads:[~2010-03-24 19:40 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-24 19:40 [PATCH v2 1/6] perf report: Add a popup menu to ask what operation is to be performed Arnaldo Carvalho de Melo
2010-03-24 19:40 ` [PATCH v2 2/6] perf symbols: Avoid unnecessary symbol loading when dso list is specified Arnaldo Carvalho de Melo
2010-03-24 19:40 ` [PATCH v2 3/6] perf annotate: Allow specifying DSOs where to look for symbol Arnaldo Carvalho de Melo
2010-03-24 19:40 ` [PATCH v2 4/6] perf tools: Introduce struct map_symbol Arnaldo Carvalho de Melo
2010-03-24 19:40 ` [PATCH v2 5/6] perf callchains: Store the map together with the symbol Arnaldo Carvalho de Melo
2010-03-24 19:40 ` Arnaldo Carvalho de Melo [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=1269459619-982-6-git-send-email-acme@infradead.org \
--to=acme@infradead.org \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@redhat.com \
--cc=efault@gmx.de \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=paulus@samba.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 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®