diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-04-02 12:21:55 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-04-07 15:10:19 -0400 |
commit | e235f3f3bf238eb092ad2fe7c35c6d7fd5dc2aeb (patch) | |
tree | 544aabce86fcf6e39cce1e9c2227d5a03b97d9af | |
parent | 058b4cc9af574c072988a38a7a5ee93df881e5aa (diff) |
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>
-rw-r--r-- | 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 7ac7dd04d5c6..5cf9b78682aa 100644 --- a/tools/perf/util/ui/browsers/annotate.c +++ b/tools/perf/util/ui/browsers/annotate.c | |||
@@ -20,6 +20,7 @@ struct annotate_browser { | |||
20 | int nr_asm_entries; | 20 | int nr_asm_entries; |
21 | int nr_entries; | 21 | int nr_entries; |
22 | bool hide_src_code; | 22 | bool hide_src_code; |
23 | bool use_offset; | ||
23 | }; | 24 | }; |
24 | 25 | ||
25 | struct objdump_line_rb_node { | 26 | struct objdump_line_rb_node { |
@@ -82,10 +83,13 @@ static void annotate_browser__write(struct ui_browser *self, void *entry, int ro | |||
82 | slsmg_write_nstring(ol->line, width - 18); | 83 | slsmg_write_nstring(ol->line, width - 18); |
83 | else { | 84 | else { |
84 | char bf[64]; | 85 | char bf[64]; |
85 | u64 addr = ab->start + ol->offset; | 86 | u64 addr = ol->offset; |
86 | int printed = scnprintf(bf, sizeof(bf), " %" PRIx64 ":", addr); | 87 | int printed, color = -1; |
87 | int color = -1; | ||
88 | 88 | ||
89 | if (!ab->use_offset) | ||
90 | addr += ab->start; | ||
91 | |||
92 | printed = scnprintf(bf, sizeof(bf), " %" PRIx64 ":", addr); | ||
89 | if (change_color) | 93 | if (change_color) |
90 | color = ui_browser__set_color(self, HE_COLORSET_ADDR); | 94 | color = ui_browser__set_color(self, HE_COLORSET_ADDR); |
91 | slsmg_write_nstring(bf, printed); | 95 | slsmg_write_nstring(bf, printed); |
@@ -250,6 +254,7 @@ static int annotate_browser__run(struct annotate_browser *self, int evidx, | |||
250 | struct symbol *sym = ms->sym; | 254 | struct symbol *sym = ms->sym; |
251 | const char *help = "<-/ESC: Exit, TAB/shift+TAB: Cycle hot lines, " | 255 | const char *help = "<-/ESC: Exit, TAB/shift+TAB: Cycle hot lines, " |
252 | "H: Go to hottest line, ->/ENTER: Line action, " | 256 | "H: Go to hottest line, ->/ENTER: Line action, " |
257 | "O: Toggle offset view, " | ||
253 | "S: Toggle source code view"; | 258 | "S: Toggle source code view"; |
254 | int key; | 259 | int key; |
255 | 260 | ||
@@ -310,6 +315,10 @@ static int annotate_browser__run(struct annotate_browser *self, int evidx, | |||
310 | if (annotate_browser__toggle_source(self)) | 315 | if (annotate_browser__toggle_source(self)) |
311 | ui_helpline__puts(help); | 316 | ui_helpline__puts(help); |
312 | continue; | 317 | continue; |
318 | case 'O': | ||
319 | case 'o': | ||
320 | self->use_offset = !self->use_offset; | ||
321 | continue; | ||
313 | case K_ENTER: | 322 | case K_ENTER: |
314 | case K_RIGHT: | 323 | case K_RIGHT: |
315 | if (self->selection == NULL) { | 324 | if (self->selection == NULL) { |