aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/ui
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2012-04-20 15:26:14 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-04-20 15:26:14 -0400
commit59d038d591f7f00e6752cbfadbbc1c0ca318c5c0 (patch)
treea2147a6e3567a0dcf659ec9a7386fe81f4b748e7 /tools/perf/ui
parentc4cceae3ba786c136b0cf568359863d74897a48a (diff)
ui browser: Add method to write graphical characters
To save typing on the switch char set slang stuff. It also helps in removing more slang direct calls, wrapping them at the ui_browser level, where at some point I'll try to implement those in terms of GTK+. 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-63yhb2htv9g3g1olmojzptkd@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.c7
-rw-r--r--tools/perf/ui/browser.h1
-rw-r--r--tools/perf/ui/browsers/annotate.c14
3 files changed, 12 insertions, 10 deletions
diff --git a/tools/perf/ui/browser.c b/tools/perf/ui/browser.c
index a1b140cf75ac..973ff74e3640 100644
--- a/tools/perf/ui/browser.c
+++ b/tools/perf/ui/browser.c
@@ -593,6 +593,13 @@ unsigned int ui_browser__argv_refresh(struct ui_browser *browser)
593 return row; 593 return row;
594} 594}
595 595
596void ui_browser__write_graph(struct ui_browser *browser __used, int graph)
597{
598 SLsmg_set_char_set(1);
599 SLsmg_write_char(graph);
600 SLsmg_set_char_set(0);
601}
602
596void ui_browser__init(void) 603void ui_browser__init(void)
597{ 604{
598 int i = 0; 605 int i = 0;
diff --git a/tools/perf/ui/browser.h b/tools/perf/ui/browser.h
index 2550277db9f9..ce20975419d2 100644
--- a/tools/perf/ui/browser.h
+++ b/tools/perf/ui/browser.h
@@ -37,6 +37,7 @@ void ui_browser__refresh_dimensions(struct ui_browser *self);
37void ui_browser__reset_index(struct ui_browser *self); 37void ui_browser__reset_index(struct ui_browser *self);
38 38
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__show_title(struct ui_browser *browser, const char *title); 41void __ui_browser__show_title(struct ui_browser *browser, const char *title);
41void ui_browser__show_title(struct ui_browser *browser, const char *title); 42void ui_browser__show_title(struct ui_browser *browser, const char *title);
42int ui_browser__show(struct ui_browser *self, const char *title, 43int 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 38f4c6f821c2..c3fc6f39f901 100644
--- a/tools/perf/ui/browsers/annotate.c
+++ b/tools/perf/ui/browsers/annotate.c
@@ -71,9 +71,7 @@ static void annotate_browser__write(struct ui_browser *self, void *entry, int ro
71 slsmg_write_nstring(" ", 9); 71 slsmg_write_nstring(" ", 9);
72 } 72 }
73 73
74 SLsmg_set_char_set(1); 74 ui_browser__write_graph(self, SLSMG_VLINE_CHAR);
75 SLsmg_write_char(SLSMG_VLINE_CHAR);
76 SLsmg_set_char_set(0);
77 SLsmg_write_char(' '); 75 SLsmg_write_char(' ');
78 76
79 /* The scroll bar isn't being used */ 77 /* The scroll bar isn't being used */
@@ -116,10 +114,8 @@ static void annotate_browser__write(struct ui_browser *self, void *entry, int ro
116 if (ins__is_jump(dl->ins)) { 114 if (ins__is_jump(dl->ins)) {
117 bool fwd = dl->ops.target > (u64)dl->offset; 115 bool fwd = dl->ops.target > (u64)dl->offset;
118 116
119 SLsmg_set_char_set(1); 117 ui_browser__write_graph(self, fwd ? SLSMG_DARROW_CHAR :
120 SLsmg_write_char(fwd ? SLSMG_DARROW_CHAR : 118 SLSMG_UARROW_CHAR);
121 SLSMG_UARROW_CHAR);
122 SLsmg_set_char_set(0);
123 SLsmg_write_char(' '); 119 SLsmg_write_char(' ');
124 } else { 120 } else {
125 slsmg_write_nstring(" ", 2); 121 slsmg_write_nstring(" ", 2);
@@ -131,9 +127,7 @@ static void annotate_browser__write(struct ui_browser *self, void *entry, int ro
131 if (strcmp(dl->name, "retq")) { 127 if (strcmp(dl->name, "retq")) {
132 slsmg_write_nstring(" ", 2); 128 slsmg_write_nstring(" ", 2);
133 } else { 129 } else {
134 SLsmg_set_char_set(1); 130 ui_browser__write_graph(self, SLSMG_LARROW_CHAR);
135 SLsmg_write_char(SLSMG_LARROW_CHAR);
136 SLsmg_set_char_set(0);
137 SLsmg_write_char(' '); 131 SLsmg_write_char(' ');
138 } 132 }
139 133