diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-04-27 15:27:52 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-04-27 15:27:52 -0400 |
commit | 944e1abed9e1c04e410ddfee849529eedd3e534a (patch) | |
tree | 685955ae00a9bfc31ebb4c103837c8f487685871 /tools/perf/ui | |
parent | 88298f5a52dad53a7a9433470925fa90702bb486 (diff) |
perf ui browser: Add method to draw up/down arrow line
It figures out the direction and draws downwards arrows too if that is
the case.
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-tg329nr7q4dg9d0tl3o0wywg@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.c | 54 | ||||
-rw-r--r-- | tools/perf/ui/browser.h | 4 |
2 files changed, 54 insertions, 4 deletions
diff --git a/tools/perf/ui/browser.c b/tools/perf/ui/browser.c index 32ac1165100d..f4b2530ae1d3 100644 --- a/tools/perf/ui/browser.c +++ b/tools/perf/ui/browser.c | |||
@@ -600,8 +600,9 @@ void ui_browser__write_graph(struct ui_browser *browser __used, int graph) | |||
600 | SLsmg_set_char_set(0); | 600 | SLsmg_set_char_set(0); |
601 | } | 601 | } |
602 | 602 | ||
603 | void __ui_browser__line_arrow_up(struct ui_browser *browser, unsigned int column, | 603 | static void __ui_browser__line_arrow_up(struct ui_browser *browser, |
604 | u64 start, u64 end, int start_width) | 604 | unsigned int column, |
605 | u64 start, u64 end, int start_width) | ||
605 | { | 606 | { |
606 | unsigned int row, end_row; | 607 | unsigned int row, end_row; |
607 | 608 | ||
@@ -639,6 +640,55 @@ out: | |||
639 | SLsmg_set_char_set(0); | 640 | SLsmg_set_char_set(0); |
640 | } | 641 | } |
641 | 642 | ||
643 | static void __ui_browser__line_arrow_down(struct ui_browser *browser, | ||
644 | unsigned int column, | ||
645 | u64 start, u64 end, int start_width) | ||
646 | { | ||
647 | unsigned int row, end_row; | ||
648 | |||
649 | SLsmg_set_char_set(1); | ||
650 | |||
651 | if (start >= browser->top_idx) { | ||
652 | row = start - browser->top_idx; | ||
653 | ui_browser__gotorc(browser, row, column); | ||
654 | SLsmg_write_char(SLSMG_ULCORN_CHAR); | ||
655 | ui_browser__gotorc(browser, row, column + 1); | ||
656 | SLsmg_draw_hline(start_width); | ||
657 | |||
658 | if (row++ == 0) | ||
659 | goto out; | ||
660 | } else | ||
661 | row = 0; | ||
662 | |||
663 | if (end >= browser->top_idx + browser->height) | ||
664 | end_row = browser->height - 1; | ||
665 | else | ||
666 | end_row = end - browser->top_idx;; | ||
667 | |||
668 | ui_browser__gotorc(browser, row, column); | ||
669 | SLsmg_draw_vline(end_row - row + 1); | ||
670 | |||
671 | ui_browser__gotorc(browser, end_row, column); | ||
672 | if (end < browser->top_idx + browser->height) { | ||
673 | SLsmg_write_char(SLSMG_LLCORN_CHAR); | ||
674 | ui_browser__gotorc(browser, end_row, column + 1); | ||
675 | SLsmg_write_char(SLSMG_HLINE_CHAR); | ||
676 | ui_browser__gotorc(browser, end_row, column + 2); | ||
677 | SLsmg_write_char(SLSMG_RARROW_CHAR); | ||
678 | } | ||
679 | out: | ||
680 | SLsmg_set_char_set(0); | ||
681 | } | ||
682 | |||
683 | void __ui_browser__line_arrow(struct ui_browser *browser, unsigned int column, | ||
684 | u64 start, u64 end, int start_width) | ||
685 | { | ||
686 | if (start > end) | ||
687 | __ui_browser__line_arrow_up(browser, column, start, end, start_width); | ||
688 | else | ||
689 | __ui_browser__line_arrow_down(browser, column, start, end, start_width); | ||
690 | } | ||
691 | |||
642 | void ui_browser__init(void) | 692 | void ui_browser__init(void) |
643 | { | 693 | { |
644 | int i = 0; | 694 | int i = 0; |
diff --git a/tools/perf/ui/browser.h b/tools/perf/ui/browser.h index 2f226cb79f6a..059764b29b2d 100644 --- a/tools/perf/ui/browser.h +++ b/tools/perf/ui/browser.h | |||
@@ -38,8 +38,8 @@ void ui_browser__reset_index(struct ui_browser *self); | |||
38 | 38 | ||
39 | void ui_browser__gotorc(struct ui_browser *self, int y, int x); | 39 | void ui_browser__gotorc(struct ui_browser *self, int y, int x); |
40 | void ui_browser__write_graph(struct ui_browser *browser, int graph); | 40 | void ui_browser__write_graph(struct ui_browser *browser, int graph); |
41 | void __ui_browser__line_arrow_up(struct ui_browser *browser, unsigned int column, | 41 | void __ui_browser__line_arrow(struct ui_browser *browser, unsigned int column, |
42 | u64 start, u64 end, int start_width); | 42 | u64 start, u64 end, int start_width); |
43 | void __ui_browser__show_title(struct ui_browser *browser, const char *title); | 43 | void __ui_browser__show_title(struct ui_browser *browser, const char *title); |
44 | void ui_browser__show_title(struct ui_browser *browser, const char *title); | 44 | void ui_browser__show_title(struct ui_browser *browser, const char *title); |
45 | int ui_browser__show(struct ui_browser *self, const char *title, | 45 | int ui_browser__show(struct ui_browser *self, const char *title, |