aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/ui
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2012-05-03 12:12:49 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-05-03 12:12:49 -0400
commit83b1f2aad46c4af7df5ba6071fbba2d5cb025985 (patch)
tree426fbdad6428787aaea05df9a27f542be8ae3600 /tools/perf/ui
parent4656cca11b07a13785aa8574ed4db6c540e48ed8 (diff)
perf annotate browser: More clearly separate columns
The first column (columns in the near future) are for the per line event overhead(s), that only appear when they are not zero. To clearly separate it, add back a solid vertical line, with just one colour, not influenced by the per line overheads. Then have the addr/offset column, then optionally the dynamic (static in the future) jump->target arrows, if 'j' enables it. Then the instructions. Requested-by: Peter Zijlstra <peterz@infradead.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-r415t4sps0oyr9y8kd9j7clz@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/ui')
-rw-r--r--tools/perf/ui/browser.c14
-rw-r--r--tools/perf/ui/browser.h2
-rw-r--r--tools/perf/ui/browsers/annotate.c48
3 files changed, 36 insertions, 28 deletions
diff --git a/tools/perf/ui/browser.c b/tools/perf/ui/browser.c
index b075e09bfb54..cde4d0f0ddb9 100644
--- a/tools/perf/ui/browser.c
+++ b/tools/perf/ui/browser.c
@@ -611,7 +611,7 @@ void ui_browser__write_graph(struct ui_browser *browser __used, int graph)
611 611
612static void __ui_browser__line_arrow_up(struct ui_browser *browser, 612static void __ui_browser__line_arrow_up(struct ui_browser *browser,
613 unsigned int column, 613 unsigned int column,
614 u64 start, u64 end, int start_width) 614 u64 start, u64 end)
615{ 615{
616 unsigned int row, end_row; 616 unsigned int row, end_row;
617 617
@@ -622,7 +622,7 @@ static void __ui_browser__line_arrow_up(struct ui_browser *browser,
622 ui_browser__gotorc(browser, row, column); 622 ui_browser__gotorc(browser, row, column);
623 SLsmg_write_char(SLSMG_LLCORN_CHAR); 623 SLsmg_write_char(SLSMG_LLCORN_CHAR);
624 ui_browser__gotorc(browser, row, column + 1); 624 ui_browser__gotorc(browser, row, column + 1);
625 SLsmg_draw_hline(start_width); 625 SLsmg_draw_hline(2);
626 626
627 if (row-- == 0) 627 if (row-- == 0)
628 goto out; 628 goto out;
@@ -651,7 +651,7 @@ out:
651 651
652static void __ui_browser__line_arrow_down(struct ui_browser *browser, 652static void __ui_browser__line_arrow_down(struct ui_browser *browser,
653 unsigned int column, 653 unsigned int column,
654 u64 start, u64 end, int start_width) 654 u64 start, u64 end)
655{ 655{
656 unsigned int row, end_row; 656 unsigned int row, end_row;
657 657
@@ -662,7 +662,7 @@ static void __ui_browser__line_arrow_down(struct ui_browser *browser,
662 ui_browser__gotorc(browser, row, column); 662 ui_browser__gotorc(browser, row, column);
663 SLsmg_write_char(SLSMG_ULCORN_CHAR); 663 SLsmg_write_char(SLSMG_ULCORN_CHAR);
664 ui_browser__gotorc(browser, row, column + 1); 664 ui_browser__gotorc(browser, row, column + 1);
665 SLsmg_draw_hline(start_width); 665 SLsmg_draw_hline(2);
666 666
667 if (row++ == 0) 667 if (row++ == 0)
668 goto out; 668 goto out;
@@ -690,12 +690,12 @@ out:
690} 690}
691 691
692void __ui_browser__line_arrow(struct ui_browser *browser, unsigned int column, 692void __ui_browser__line_arrow(struct ui_browser *browser, unsigned int column,
693 u64 start, u64 end, int start_width) 693 u64 start, u64 end)
694{ 694{
695 if (start > end) 695 if (start > end)
696 __ui_browser__line_arrow_up(browser, column, start, end, start_width); 696 __ui_browser__line_arrow_up(browser, column, start, end);
697 else 697 else
698 __ui_browser__line_arrow_down(browser, column, start, end, start_width); 698 __ui_browser__line_arrow_down(browser, column, start, end);
699} 699}
700 700
701void ui_browser__init(void) 701void ui_browser__init(void)
diff --git a/tools/perf/ui/browser.h b/tools/perf/ui/browser.h
index 511e24d08dfa..dd96d8229902 100644
--- a/tools/perf/ui/browser.h
+++ b/tools/perf/ui/browser.h
@@ -39,7 +39,7 @@ void ui_browser__reset_index(struct ui_browser *self);
39void ui_browser__gotorc(struct ui_browser *self, int y, int x); 39void ui_browser__gotorc(struct ui_browser *self, int y, int x);
40void ui_browser__write_graph(struct ui_browser *browser, int graph); 40void ui_browser__write_graph(struct ui_browser *browser, int graph);
41void __ui_browser__line_arrow(struct ui_browser *browser, unsigned int column, 41void __ui_browser__line_arrow(struct ui_browser *browser, unsigned int column,
42 u64 start, u64 end, int start_width); 42 u64 start, u64 end);
43void __ui_browser__show_title(struct ui_browser *browser, const char *title); 43void __ui_browser__show_title(struct ui_browser *browser, const char *title);
44void ui_browser__show_title(struct ui_browser *browser, const char *title); 44void ui_browser__show_title(struct ui_browser *browser, const char *title);
45int ui_browser__show(struct ui_browser *self, const char *title, 45int ui_browser__show(struct ui_browser *self, const char *title,
diff --git a/tools/perf/ui/browsers/annotate.c b/tools/perf/ui/browsers/annotate.c
index 44fb6a447d00..74104a403b5d 100644
--- a/tools/perf/ui/browsers/annotate.c
+++ b/tools/perf/ui/browsers/annotate.c
@@ -32,7 +32,9 @@ struct annotate_browser {
32 bool use_offset; 32 bool use_offset;
33 bool jump_arrows; 33 bool jump_arrows;
34 bool searching_backwards; 34 bool searching_backwards;
35 u8 offset_width; 35 u8 addr_width;
36 u8 min_addr_width;
37 u8 max_addr_width;
36 char search_bf[128]; 38 char search_bf[128];
37}; 39};
38 40
@@ -62,7 +64,8 @@ static void annotate_browser__write(struct ui_browser *self, void *entry, int ro
62 bool change_color = (!ab->hide_src_code && 64 bool change_color = (!ab->hide_src_code &&
63 (!current_entry || (self->use_navkeypressed && 65 (!current_entry || (self->use_navkeypressed &&
64 !self->navkeypressed))); 66 !self->navkeypressed)));
65 int width = self->width; 67 int width = self->width, printed;
68 char bf[256];
66 69
67 if (dl->offset != -1 && bdl->percent != 0.0) { 70 if (dl->offset != -1 && bdl->percent != 0.0) {
68 ui_browser__set_percent_color(self, bdl->percent, current_entry); 71 ui_browser__set_percent_color(self, bdl->percent, current_entry);
@@ -83,25 +86,27 @@ static void annotate_browser__write(struct ui_browser *self, void *entry, int ro
83 86
84 if (!*dl->line) 87 if (!*dl->line)
85 slsmg_write_nstring(" ", width - 7); 88 slsmg_write_nstring(" ", width - 7);
86 else if (dl->offset == -1) 89 else if (dl->offset == -1) {
87 slsmg_write_nstring(dl->line, width - 7); 90 printed = scnprintf(bf, sizeof(bf), "%*s ",
88 else { 91 ab->addr_width, " ");
89 char bf[256]; 92 slsmg_write_nstring(bf, printed);
93 slsmg_write_nstring(dl->line, width - printed - 6);
94 } else {
90 u64 addr = dl->offset; 95 u64 addr = dl->offset;
91 int printed, color = -1; 96 int color = -1;
92 97
93 if (!ab->use_offset) 98 if (!ab->use_offset)
94 addr += ab->start; 99 addr += ab->start;
95 100
96 if (!ab->use_offset) { 101 if (!ab->use_offset) {
97 printed = scnprintf(bf, sizeof(bf), " %" PRIx64 ":", addr); 102 printed = scnprintf(bf, sizeof(bf), "%" PRIx64 ": ", addr);
98 } else { 103 } else {
99 if (bdl->jump_target) { 104 if (bdl->jump_target) {
100 printed = scnprintf(bf, sizeof(bf), " %*" PRIx64 ":", 105 printed = scnprintf(bf, sizeof(bf), "%*" PRIx64 ": ",
101 ab->offset_width, addr); 106 ab->addr_width, addr);
102 } else { 107 } else {
103 printed = scnprintf(bf, sizeof(bf), " %*s ", 108 printed = scnprintf(bf, sizeof(bf), "%*s ",
104 ab->offset_width, " "); 109 ab->addr_width, " ");
105 } 110 }
106 } 111 }
107 112
@@ -137,7 +142,7 @@ static void annotate_browser__write(struct ui_browser *self, void *entry, int ro
137 scnprintf(bf, sizeof(bf), "%-6.6s %s", dl->name, dl->ops.raw); 142 scnprintf(bf, sizeof(bf), "%-6.6s %s", dl->name, dl->ops.raw);
138 } 143 }
139 144
140 slsmg_write_nstring(bf, width - 9 - printed); 145 slsmg_write_nstring(bf, width - 10 - printed);
141 } 146 }
142 147
143 if (current_entry) 148 if (current_entry)
@@ -149,7 +154,7 @@ static void annotate_browser__draw_current_jump(struct ui_browser *browser)
149 struct annotate_browser *ab = container_of(browser, struct annotate_browser, b); 154 struct annotate_browser *ab = container_of(browser, struct annotate_browser, b);
150 struct disasm_line *cursor = ab->selection, *target; 155 struct disasm_line *cursor = ab->selection, *target;
151 struct browser_disasm_line *btarget, *bcursor; 156 struct browser_disasm_line *btarget, *bcursor;
152 unsigned int from, to, start_width = 2; 157 unsigned int from, to;
153 158
154 if (!cursor->ins || !ins__is_jump(cursor->ins) || 159 if (!cursor->ins || !ins__is_jump(cursor->ins) ||
155 !disasm_line__has_offset(cursor)) 160 !disasm_line__has_offset(cursor))
@@ -171,11 +176,7 @@ static void annotate_browser__draw_current_jump(struct ui_browser *browser)
171 } 176 }
172 177
173 ui_browser__set_color(browser, HE_COLORSET_CODE); 178 ui_browser__set_color(browser, HE_COLORSET_CODE);
174 179 __ui_browser__line_arrow(browser, 9 + ab->addr_width, from, to);
175 if (!bcursor->jump_target)
176 start_width += ab->offset_width + 1;
177
178 __ui_browser__line_arrow(browser, 7, from, to, start_width);
179} 180}
180 181
181static unsigned int annotate_browser__refresh(struct ui_browser *browser) 182static unsigned int annotate_browser__refresh(struct ui_browser *browser)
@@ -186,6 +187,8 @@ static unsigned int annotate_browser__refresh(struct ui_browser *browser)
186 if (ab->jump_arrows) 187 if (ab->jump_arrows)
187 annotate_browser__draw_current_jump(browser); 188 annotate_browser__draw_current_jump(browser);
188 189
190 ui_browser__set_color(browser, HE_COLORSET_NORMAL);
191 __ui_browser__vline(browser, 7, 0, browser->height - 1);
189 return ret; 192 return ret;
190} 193}
191 194
@@ -618,6 +621,10 @@ static int annotate_browser__run(struct annotate_browser *self, int evidx,
618 case 'O': 621 case 'O':
619 case 'o': 622 case 'o':
620 self->use_offset = !self->use_offset; 623 self->use_offset = !self->use_offset;
624 if (self->use_offset)
625 self->addr_width = self->min_addr_width;
626 else
627 self->addr_width = self->max_addr_width;
621 continue; 628 continue;
622 case 'j': 629 case 'j':
623 self->jump_arrows = !self->jump_arrows; 630 self->jump_arrows = !self->jump_arrows;
@@ -784,7 +791,8 @@ int symbol__tui_annotate(struct symbol *sym, struct map *map, int evidx,
784 791
785 annotate_browser__mark_jump_targets(&browser, size); 792 annotate_browser__mark_jump_targets(&browser, size);
786 793
787 browser.offset_width = hex_width(size); 794 browser.addr_width = browser.min_addr_width = hex_width(size);
795 browser.max_addr_width = hex_width(sym->end);
788 browser.b.nr_entries = browser.nr_entries; 796 browser.b.nr_entries = browser.nr_entries;
789 browser.b.entries = &notes->src->source, 797 browser.b.entries = &notes->src->source,
790 browser.b.width += 18; /* Percentage */ 798 browser.b.width += 18; /* Percentage */