Lines Matching refs:browser
38 static inline struct annotation *browser__annotation(struct ui_browser *browser) in browser__annotation() argument
40 struct map_symbol *ms = browser->priv; in browser__annotation()
44 static bool disasm_line__filter(struct ui_browser *browser, void *entry) in disasm_line__filter() argument
46 struct annotation *notes = browser__annotation(browser); in disasm_line__filter()
51 static int ui_browser__jumps_percent_color(struct ui_browser *browser, int nr, bool current) in ui_browser__jumps_percent_color() argument
53 struct annotation *notes = browser__annotation(browser); in ui_browser__jumps_percent_color()
55 if (current && (!browser->use_navkeypressed || browser->navkeypressed)) in ui_browser__jumps_percent_color()
64 static int ui_browser__set_jumps_percent_color(void *browser, int nr, bool current) in ui_browser__set_jumps_percent_color() argument
66 int color = ui_browser__jumps_percent_color(browser, nr, current); in ui_browser__set_jumps_percent_color()
67 return ui_browser__set_color(browser, color); in ui_browser__set_jumps_percent_color()
70 static int annotate_browser__set_color(void *browser, int color) in annotate_browser__set_color() argument
72 return ui_browser__set_color(browser, color); in annotate_browser__set_color()
75 static void annotate_browser__write_graph(void *browser, int graph) in annotate_browser__write_graph() argument
77 ui_browser__write_graph(browser, graph); in annotate_browser__write_graph()
80 static void annotate_browser__set_percent_color(void *browser, double percent, bool current) in annotate_browser__set_percent_color() argument
82 ui_browser__set_percent_color(browser, percent, current); in annotate_browser__set_percent_color()
85 static void annotate_browser__printf(void *browser, const char *fmt, ...) in annotate_browser__printf() argument
90 ui_browser__vprintf(browser, fmt, args); in annotate_browser__printf()
94 static void annotate_browser__write(struct ui_browser *browser, void *entry, int row) in annotate_browser__write() argument
96 struct annotate_browser *ab = container_of(browser, struct annotate_browser, b); in annotate_browser__write()
97 struct annotation *notes = browser__annotation(browser); in annotate_browser__write()
101 .current_entry = ui_browser__is_current_entry(browser, row), in annotate_browser__write()
104 (browser->use_navkeypressed && in annotate_browser__write()
105 !browser->navkeypressed))), in annotate_browser__write()
106 .width = browser->width, in annotate_browser__write()
107 .obj = browser, in annotate_browser__write()
116 if (!browser->navkeypressed) in annotate_browser__write()
144 static void annotate_browser__draw_current_jump(struct ui_browser *browser) in annotate_browser__draw_current_jump() argument
146 struct annotate_browser *ab = container_of(browser, struct annotate_browser, b); in annotate_browser__draw_current_jump()
200 ui_browser__set_color(browser, HE_COLORSET_JUMP_ARROWS); in annotate_browser__draw_current_jump()
201 __ui_browser__line_arrow(browser, in annotate_browser__draw_current_jump()
206 ui_browser__mark_fused(browser, in annotate_browser__draw_current_jump()
213 static unsigned int annotate_browser__refresh(struct ui_browser *browser) in annotate_browser__refresh() argument
215 struct annotation *notes = browser__annotation(browser); in annotate_browser__refresh()
216 int ret = ui_browser__list_head_refresh(browser); in annotate_browser__refresh()
220 annotate_browser__draw_current_jump(browser); in annotate_browser__refresh()
222 ui_browser__set_color(browser, HE_COLORSET_NORMAL); in annotate_browser__refresh()
223 __ui_browser__vline(browser, pcnt_width, 0, browser->rows - 1); in annotate_browser__refresh()
258 static void annotate_browser__set_top(struct annotate_browser *browser, in annotate_browser__set_top() argument
261 struct annotation *notes = browser__annotation(&browser->b); in annotate_browser__set_top()
264 ui_browser__refresh_dimensions(&browser->b); in annotate_browser__set_top()
265 back = browser->b.height / 2; in annotate_browser__set_top()
266 browser->b.top_idx = browser->b.index = idx; in annotate_browser__set_top()
268 while (browser->b.top_idx != 0 && back != 0) { in annotate_browser__set_top()
274 --browser->b.top_idx; in annotate_browser__set_top()
278 browser->b.top = pos; in annotate_browser__set_top()
279 browser->b.navkeypressed = true; in annotate_browser__set_top()
282 static void annotate_browser__set_rb_top(struct annotate_browser *browser, in annotate_browser__set_rb_top() argument
285 struct annotation *notes = browser__annotation(&browser->b); in annotate_browser__set_rb_top()
291 annotate_browser__set_top(browser, pos, idx); in annotate_browser__set_rb_top()
292 browser->curr_hot = nd; in annotate_browser__set_rb_top()
295 static void annotate_browser__calc_percent(struct annotate_browser *browser, in annotate_browser__calc_percent() argument
298 struct map_symbol *ms = browser->b.priv; in annotate_browser__calc_percent()
303 browser->entries = RB_ROOT; in annotate_browser__calc_percent()
322 browser->opts->percent_type); in annotate_browser__calc_percent()
332 disasm_rb_tree__insert(&browser->entries, &pos->al); in annotate_browser__calc_percent()
336 browser->curr_hot = rb_last(&browser->entries); in annotate_browser__calc_percent()
339 static bool annotate_browser__toggle_source(struct annotate_browser *browser) in annotate_browser__toggle_source() argument
341 struct annotation *notes = browser__annotation(&browser->b); in annotate_browser__toggle_source()
343 off_t offset = browser->b.index - browser->b.top_idx; in annotate_browser__toggle_source()
345 browser->b.seek(&browser->b, offset, SEEK_CUR); in annotate_browser__toggle_source()
346 al = list_entry(browser->b.top, struct annotation_line, node); in annotate_browser__toggle_source()
352 browser->b.nr_entries = notes->nr_entries; in annotate_browser__toggle_source()
354 browser->b.seek(&browser->b, -offset, SEEK_CUR); in annotate_browser__toggle_source()
355 browser->b.top_idx = al->idx - offset; in annotate_browser__toggle_source()
356 browser->b.index = al->idx; in annotate_browser__toggle_source()
360 browser->b.seek(&browser->b, -offset, SEEK_CUR); in annotate_browser__toggle_source()
367 browser->b.nr_entries = notes->nr_asm_entries; in annotate_browser__toggle_source()
369 browser->b.seek(&browser->b, -offset, SEEK_CUR); in annotate_browser__toggle_source()
370 browser->b.top_idx = al->idx_asm - offset; in annotate_browser__toggle_source()
371 browser->b.index = al->idx_asm; in annotate_browser__toggle_source()
377 static void ui_browser__init_asm_mode(struct ui_browser *browser) in ui_browser__init_asm_mode() argument
379 struct annotation *notes = browser__annotation(browser); in ui_browser__init_asm_mode()
380 ui_browser__reset_index(browser); in ui_browser__init_asm_mode()
381 browser->nr_entries = notes->nr_asm_entries; in ui_browser__init_asm_mode()
402 static bool annotate_browser__callq(struct annotate_browser *browser, in annotate_browser__callq() argument
406 struct map_symbol *ms = browser->b.priv; in annotate_browser__callq()
407 struct disasm_line *dl = disasm_line(browser->selection); in annotate_browser__callq()
427 symbol__tui_annotate(dl->ops.target.sym, ms->map, evsel, hbt, browser->opts); in annotate_browser__callq()
428 sym_title(ms->sym, ms->map, title, sizeof(title), browser->opts->percent_type); in annotate_browser__callq()
429 ui_browser__show_title(&browser->b, title); in annotate_browser__callq()
434 struct disasm_line *annotate_browser__find_offset(struct annotate_browser *browser, in annotate_browser__find_offset() argument
437 struct annotation *notes = browser__annotation(&browser->b); in annotate_browser__find_offset()
451 static bool annotate_browser__jump(struct annotate_browser *browser, in annotate_browser__jump() argument
455 struct disasm_line *dl = disasm_line(browser->selection); in annotate_browser__jump()
463 annotate_browser__callq(browser, evsel, hbt); in annotate_browser__jump()
468 dl = annotate_browser__find_offset(browser, offset, &idx); in annotate_browser__jump()
474 annotate_browser__set_top(browser, &dl->al, idx); in annotate_browser__jump()
480 struct annotation_line *annotate_browser__find_string(struct annotate_browser *browser, in annotate_browser__find_string() argument
483 struct annotation *notes = browser__annotation(&browser->b); in annotate_browser__find_string()
484 struct annotation_line *al = browser->selection; in annotate_browser__find_string()
486 *idx = browser->b.index; in annotate_browser__find_string()
500 static bool __annotate_browser__search(struct annotate_browser *browser) in __annotate_browser__search() argument
505 al = annotate_browser__find_string(browser, browser->search_bf, &idx); in __annotate_browser__search()
511 annotate_browser__set_top(browser, al, idx); in __annotate_browser__search()
512 browser->searching_backwards = false; in __annotate_browser__search()
517 struct annotation_line *annotate_browser__find_string_reverse(struct annotate_browser *browser, in annotate_browser__find_string_reverse() argument
520 struct annotation *notes = browser__annotation(&browser->b); in annotate_browser__find_string_reverse()
521 struct annotation_line *al = browser->selection; in annotate_browser__find_string_reverse()
523 *idx = browser->b.index; in annotate_browser__find_string_reverse()
537 static bool __annotate_browser__search_reverse(struct annotate_browser *browser) in __annotate_browser__search_reverse() argument
542 al = annotate_browser__find_string_reverse(browser, browser->search_bf, &idx); in __annotate_browser__search_reverse()
548 annotate_browser__set_top(browser, al, idx); in __annotate_browser__search_reverse()
549 browser->searching_backwards = true; in __annotate_browser__search_reverse()
553 static bool annotate_browser__search_window(struct annotate_browser *browser, in annotate_browser__search_window() argument
556 if (ui_browser__input_window("Search", "String: ", browser->search_bf, in annotate_browser__search_window()
559 !*browser->search_bf) in annotate_browser__search_window()
565 static bool annotate_browser__search(struct annotate_browser *browser, int delay_secs) in annotate_browser__search() argument
567 if (annotate_browser__search_window(browser, delay_secs)) in annotate_browser__search()
568 return __annotate_browser__search(browser); in annotate_browser__search()
573 static bool annotate_browser__continue_search(struct annotate_browser *browser, in annotate_browser__continue_search() argument
576 if (!*browser->search_bf) in annotate_browser__continue_search()
577 return annotate_browser__search(browser, delay_secs); in annotate_browser__continue_search()
579 return __annotate_browser__search(browser); in annotate_browser__continue_search()
582 static bool annotate_browser__search_reverse(struct annotate_browser *browser, in annotate_browser__search_reverse() argument
585 if (annotate_browser__search_window(browser, delay_secs)) in annotate_browser__search_reverse()
586 return __annotate_browser__search_reverse(browser); in annotate_browser__search_reverse()
592 bool annotate_browser__continue_search_reverse(struct annotate_browser *browser, in annotate_browser__continue_search_reverse() argument
595 if (!*browser->search_bf) in annotate_browser__continue_search_reverse()
596 return annotate_browser__search_reverse(browser, delay_secs); in annotate_browser__continue_search_reverse()
598 return __annotate_browser__search_reverse(browser); in annotate_browser__continue_search_reverse()
601 static int annotate_browser__show(struct ui_browser *browser, char *title, const char *help) in annotate_browser__show() argument
603 struct annotate_browser *ab = container_of(browser, struct annotate_browser, b); in annotate_browser__show()
604 struct map_symbol *ms = browser->priv; in annotate_browser__show()
608 if (ui_browser__show(browser, title, help) < 0) in annotate_browser__show()
613 ui_browser__gotorc_title(browser, 0, 0); in annotate_browser__show()
614 ui_browser__set_color(browser, HE_COLORSET_ROOT); in annotate_browser__show()
615 ui_browser__write_nstring(browser, symbol_dso, browser->width + 1); in annotate_browser__show()
652 static int annotate_browser__run(struct annotate_browser *browser, in annotate_browser__run() argument
658 struct map_symbol *ms = browser->b.priv; in annotate_browser__run()
667 if (annotate_browser__show(&browser->b, title, help) < 0) in annotate_browser__run()
670 annotate_browser__calc_percent(browser, evsel); in annotate_browser__run()
672 if (browser->curr_hot) { in annotate_browser__run()
673 annotate_browser__set_rb_top(browser, browser->curr_hot); in annotate_browser__run()
674 browser->b.navkeypressed = false; in annotate_browser__run()
677 nd = browser->curr_hot; in annotate_browser__run()
680 key = ui_browser__run(&browser->b, delay_secs); in annotate_browser__run()
683 annotate_browser__calc_percent(browser, evsel); in annotate_browser__run()
701 annotate_browser__show(&browser->b, title, help); in annotate_browser__run()
708 nd = rb_last(&browser->entries); in annotate_browser__run()
710 nd = browser->curr_hot; in annotate_browser__run()
716 nd = rb_first(&browser->entries); in annotate_browser__run()
718 nd = browser->curr_hot; in annotate_browser__run()
722 ui_browser__help_window(&browser->b, in annotate_browser__run()
755 nd = browser->curr_hot; in annotate_browser__run()
758 if (annotate_browser__toggle_source(browser)) in annotate_browser__run()
777 if (annotate_browser__search(browser, delay_secs)) { in annotate_browser__run()
783 if (browser->searching_backwards ? in annotate_browser__run()
784 annotate_browser__continue_search_reverse(browser, delay_secs) : in annotate_browser__run()
785 annotate_browser__continue_search(browser, delay_secs)) in annotate_browser__run()
789 if (annotate_browser__search_reverse(browser, delay_secs)) in annotate_browser__run()
796 seq++, browser->b.nr_entries, in annotate_browser__run()
797 browser->b.height, in annotate_browser__run()
798 browser->b.index, in annotate_browser__run()
799 browser->b.top_idx, in annotate_browser__run()
806 struct disasm_line *dl = disasm_line(browser->selection); in annotate_browser__run()
808 if (browser->selection == NULL) in annotate_browser__run()
810 else if (browser->selection->offset == -1) in annotate_browser__run()
816 else if (!(annotate_browser__jump(browser, evsel, hbt) || in annotate_browser__run()
817 annotate_browser__callq(browser, evsel, hbt))) { in annotate_browser__run()
824 map_symbol__annotation_dump(ms, evsel, browser->opts); in annotate_browser__run()
845 switch_percent_type(browser->opts, key == 'b'); in annotate_browser__run()
847 annotate_browser__show(&browser->b, title, help); in annotate_browser__run()
859 annotate_browser__set_rb_top(browser, nd); in annotate_browser__run()
862 ui_browser__hide(&browser->b); in annotate_browser__run()
894 struct annotate_browser browser = { in symbol__tui_annotate() local
914 err = symbol__annotate2(sym, map, evsel, opts, &browser.arch); in symbol__tui_annotate()
924 browser.b.width = notes->max_line_len; in symbol__tui_annotate()
925 browser.b.nr_entries = notes->nr_entries; in symbol__tui_annotate()
926 browser.b.entries = ¬es->src->source, in symbol__tui_annotate()
927 browser.b.width += 18; /* Percentage */ in symbol__tui_annotate()
930 ui_browser__init_asm_mode(&browser.b); in symbol__tui_annotate()
932 ret = annotate_browser__run(&browser, evsel, hbt); in symbol__tui_annotate()