diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-04-19 12:15:24 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-04-19 12:15:24 -0400 |
commit | 61e04b332e9417720c331eb39c96a4ccb1aa0460 (patch) | |
tree | b9968045de00bef1a6e8770a1d2053e1509a42be /tools/perf/ui/browsers | |
parent | b793a40185b246c2690e06c6d86d12c35f24ab4c (diff) |
perf annotate browser: Align jump labels
Find out at browser startup the max width and use it when rendering jump
labels on the screen.
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-7dxjiwqb77wz6f5lc05e0i0x@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/ui/browsers')
-rw-r--r-- | tools/perf/ui/browsers/annotate.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/tools/perf/ui/browsers/annotate.c b/tools/perf/ui/browsers/annotate.c index a1e942bb903b..c5ab21c50a74 100644 --- a/tools/perf/ui/browsers/annotate.c +++ b/tools/perf/ui/browsers/annotate.c | |||
@@ -31,6 +31,7 @@ struct annotate_browser { | |||
31 | bool hide_src_code; | 31 | bool hide_src_code; |
32 | bool use_offset; | 32 | bool use_offset; |
33 | bool searching_backwards; | 33 | bool searching_backwards; |
34 | u8 offset_width; | ||
34 | char search_bf[128]; | 35 | char search_bf[128]; |
35 | }; | 36 | }; |
36 | 37 | ||
@@ -92,10 +93,17 @@ static void annotate_browser__write(struct ui_browser *self, void *entry, int ro | |||
92 | if (!ab->use_offset) | 93 | if (!ab->use_offset) |
93 | addr += ab->start; | 94 | addr += ab->start; |
94 | 95 | ||
95 | if (bdl->jump_target || !ab->use_offset) | 96 | if (!ab->use_offset) { |
96 | printed = scnprintf(bf, sizeof(bf), " %" PRIx64 ":", addr); | 97 | printed = scnprintf(bf, sizeof(bf), "%" PRIx64 ":", addr); |
97 | else | 98 | } else { |
98 | printed = scnprintf(bf, sizeof(bf), " "); | 99 | if (bdl->jump_target) { |
100 | printed = scnprintf(bf, sizeof(bf), "%*" PRIx64 ":", | ||
101 | ab->offset_width, addr); | ||
102 | } else { | ||
103 | printed = scnprintf(bf, sizeof(bf), "%*s ", | ||
104 | ab->offset_width, " "); | ||
105 | } | ||
106 | } | ||
99 | 107 | ||
100 | if (change_color) | 108 | if (change_color) |
101 | color = ui_browser__set_color(self, HE_COLORSET_ADDR); | 109 | color = ui_browser__set_color(self, HE_COLORSET_ADDR); |
@@ -687,6 +695,7 @@ int symbol__tui_annotate(struct symbol *sym, struct map *map, int evidx, | |||
687 | 695 | ||
688 | annotate_browser__mark_jump_targets(&browser, size); | 696 | annotate_browser__mark_jump_targets(&browser, size); |
689 | 697 | ||
698 | browser.offset_width = hex_width(size); | ||
690 | browser.b.nr_entries = browser.nr_entries; | 699 | browser.b.nr_entries = browser.nr_entries; |
691 | browser.b.entries = ¬es->src->source, | 700 | browser.b.entries = ¬es->src->source, |
692 | browser.b.width += 18; /* Percentage */ | 701 | browser.b.width += 18; /* Percentage */ |