From: tip-bot for Arnaldo Carvalho de Melo <acme@redhat.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, eranian@google.com,
paulus@samba.org, acme@redhat.com, hpa@zytor.com,
mingo@kernel.org, torvalds@linux-foundation.org,
peterz@infradead.org, efault@gmx.de, namhyung@gmail.com,
fweisbec@gmail.com, dsahern@gmail.com, tglx@linutronix.de
Subject: [tip:perf/core] perf ui annotate browser: Allow toggling addr offset view
Date: Fri, 13 Apr 2012 11:07:34 -0700 [thread overview]
Message-ID: <tip-4zpgimmz8xv7b5c920el7s45@git.kernel.org> (raw)
Commit-ID: e235f3f3bf238eb092ad2fe7c35c6d7fd5dc2aeb
Gitweb: http://git.kernel.org/tip/e235f3f3bf238eb092ad2fe7c35c6d7fd5dc2aeb
Author: Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Mon, 2 Apr 2012 13:21:55 -0300
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Sat, 7 Apr 2012 16:10:19 -0300
perf ui annotate browser: Allow toggling addr offset view
The lines in objdump have this format:
ffffffff8126543f: jne ffffffff81265494 <__list_del_entry+0x84>
<SNIP>
ffffffff81265494: mov %rdi,%rcx
Since we now have objdump_line allowing tools to print the offset
independently from the rest of the line, allow toggling a view where
just offsets from the start of the function are shown:
2f: jne ffffffff81265494 <__list_del_entry+0x84>
<SNIP>
84: mov %rdi,%rcx
The offset view will be the default as soon as operations that deal with
offsets in a function are handled accodringly, i.e. in offset view the
above will become:
2f: jne __list_del_entry+0x84
<SNIP>
84: mov %rdi,%rcx
And then a follow up patch will allow navigating thru jumps, just like
we handle callq instructions.
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-4zpgimmz8xv7b5c920el7s45@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/ui/browsers/annotate.c | 15 ++++++++++++---
1 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/tools/perf/util/ui/browsers/annotate.c b/tools/perf/util/ui/browsers/annotate.c
index 7ac7dd0..5cf9b78 100644
--- a/tools/perf/util/ui/browsers/annotate.c
+++ b/tools/perf/util/ui/browsers/annotate.c
@@ -20,6 +20,7 @@ struct annotate_browser {
int nr_asm_entries;
int nr_entries;
bool hide_src_code;
+ bool use_offset;
};
struct objdump_line_rb_node {
@@ -82,10 +83,13 @@ static void annotate_browser__write(struct ui_browser *self, void *entry, int ro
slsmg_write_nstring(ol->line, width - 18);
else {
char bf[64];
- u64 addr = ab->start + ol->offset;
- int printed = scnprintf(bf, sizeof(bf), " %" PRIx64 ":", addr);
- int color = -1;
+ u64 addr = ol->offset;
+ int printed, color = -1;
+ if (!ab->use_offset)
+ addr += ab->start;
+
+ printed = scnprintf(bf, sizeof(bf), " %" PRIx64 ":", addr);
if (change_color)
color = ui_browser__set_color(self, HE_COLORSET_ADDR);
slsmg_write_nstring(bf, printed);
@@ -250,6 +254,7 @@ static int annotate_browser__run(struct annotate_browser *self, int evidx,
struct symbol *sym = ms->sym;
const char *help = "<-/ESC: Exit, TAB/shift+TAB: Cycle hot lines, "
"H: Go to hottest line, ->/ENTER: Line action, "
+ "O: Toggle offset view, "
"S: Toggle source code view";
int key;
@@ -310,6 +315,10 @@ static int annotate_browser__run(struct annotate_browser *self, int evidx,
if (annotate_browser__toggle_source(self))
ui_helpline__puts(help);
continue;
+ case 'O':
+ case 'o':
+ self->use_offset = !self->use_offset;
+ continue;
case K_ENTER:
case K_RIGHT:
if (self->selection == NULL) {
next reply other threads:[~2012-04-13 18:08 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-13 18:07 tip-bot for Arnaldo Carvalho de Melo [this message]
2012-04-13 18:25 ` [tip:perf/core] perf ui annotate browser: Allow toggling addr offset view Linus Torvalds
2012-04-13 18:30 ` Linus Torvalds
2012-04-14 1:04 ` Arnaldo Carvalho de Melo
2012-04-14 8:55 ` Ingo Molnar
2012-04-14 16:28 ` Arnaldo Carvalho de Melo
2012-04-16 6:25 ` Masami Hiramatsu
2012-04-16 15:02 ` Linus Torvalds
2012-04-16 15:21 ` Peter Zijlstra
2012-04-18 0:43 ` Masami Hiramatsu
2012-04-15 10:56 ` Peter Zijlstra
2012-04-14 0:59 ` Arnaldo Carvalho de Melo
2012-04-14 8:46 ` Ingo Molnar
2012-04-14 16:26 ` Arnaldo Carvalho de Melo
2012-04-15 5:29 ` Mike Galbraith
2012-04-15 6:57 ` Ingo Molnar
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=tip-4zpgimmz8xv7b5c920el7s45@git.kernel.org \
--to=acme@redhat.com \
--cc=dsahern@gmail.com \
--cc=efault@gmx.de \
--cc=eranian@google.com \
--cc=fweisbec@gmail.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@gmail.com \
--cc=paulus@samba.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox