diff options
Diffstat (limited to 'tools/perf/ui/browser.c')
| -rw-r--r-- | tools/perf/ui/browser.c | 54 | 
1 files changed, 52 insertions, 2 deletions
diff --git a/tools/perf/ui/browser.c b/tools/perf/ui/browser.c index 32ac1165100..f4b2530ae1d 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)  	SLsmg_set_char_set(0);  } -void __ui_browser__line_arrow_up(struct ui_browser *browser, unsigned int column, -				 u64 start, u64 end, int start_width) +static void __ui_browser__line_arrow_up(struct ui_browser *browser, +					unsigned int column, +					u64 start, u64 end, int start_width)  {  	unsigned int row, end_row; @@ -639,6 +640,55 @@ out:  	SLsmg_set_char_set(0);  } +static void __ui_browser__line_arrow_down(struct ui_browser *browser, +					  unsigned int column, +					  u64 start, u64 end, int start_width) +{ +	unsigned int row, end_row; + +	SLsmg_set_char_set(1); + +	if (start >= browser->top_idx) { +		row = start - browser->top_idx; +		ui_browser__gotorc(browser, row, column); +		SLsmg_write_char(SLSMG_ULCORN_CHAR); +		ui_browser__gotorc(browser, row, column + 1); +		SLsmg_draw_hline(start_width); + +		if (row++ == 0) +			goto out; +	} else +		row = 0; + +	if (end >= browser->top_idx + browser->height) +		end_row = browser->height - 1; +	else +		end_row = end - browser->top_idx;; + +	ui_browser__gotorc(browser, row, column); +	SLsmg_draw_vline(end_row - row + 1); + +	ui_browser__gotorc(browser, end_row, column); +	if (end < browser->top_idx + browser->height) { +		SLsmg_write_char(SLSMG_LLCORN_CHAR); +		ui_browser__gotorc(browser, end_row, column + 1); +		SLsmg_write_char(SLSMG_HLINE_CHAR); +		ui_browser__gotorc(browser, end_row, column + 2); +		SLsmg_write_char(SLSMG_RARROW_CHAR); +	} +out: +	SLsmg_set_char_set(0); +} + +void __ui_browser__line_arrow(struct ui_browser *browser, unsigned int column, +			      u64 start, u64 end, int start_width) +{ +	if (start > end) +		__ui_browser__line_arrow_up(browser, column, start, end, start_width); +	else +		__ui_browser__line_arrow_down(browser, column, start, end, start_width); +} +  void ui_browser__init(void)  {  	int i = 0;  |