Lines Matching refs:browser
40 static inline struct annotation *browser__annotation(struct ui_browser *browser) in browser__annotation() argument
42 struct map_symbol *ms = browser->priv; in browser__annotation()
46 static bool disasm_line__filter(struct ui_browser *browser, void *entry) in disasm_line__filter() argument
48 struct annotation *notes = browser__annotation(browser); in disasm_line__filter()
53 static int ui_browser__jumps_percent_color(struct ui_browser *browser, int nr, bool current) in ui_browser__jumps_percent_color() argument
55 struct annotation *notes = browser__annotation(browser); in ui_browser__jumps_percent_color()
57 if (current && (!browser->use_navkeypressed || browser->navkeypressed)) in ui_browser__jumps_percent_color()
66 static int ui_browser__set_jumps_percent_color(void *browser, int nr, bool current) in ui_browser__set_jumps_percent_color() argument
68 int color = ui_browser__jumps_percent_color(browser, nr, current); in ui_browser__set_jumps_percent_color()
69 return ui_browser__set_color(browser, color); in ui_browser__set_jumps_percent_color()
72 static int annotate_browser__set_color(void *browser, int color) in annotate_browser__set_color() argument
74 return ui_browser__set_color(browser, color); in annotate_browser__set_color()
77 static void annotate_browser__write_graph(void *browser, int graph) in annotate_browser__write_graph() argument
79 ui_browser__write_graph(browser, graph); in annotate_browser__write_graph()
82 static void annotate_browser__set_percent_color(void *browser, double percent, bool current) in annotate_browser__set_percent_color() argument
84 ui_browser__set_percent_color(browser, percent, current); in annotate_browser__set_percent_color()
87 static void annotate_browser__printf(void *browser, const char *fmt, ...) in annotate_browser__printf() argument
92 ui_browser__vprintf(browser, fmt, args); in annotate_browser__printf()
96 static void annotate_browser__write(struct ui_browser *browser, void *entry, int row) in annotate_browser__write() argument
98 struct annotate_browser *ab = container_of(browser, struct annotate_browser, b); in annotate_browser__write()
99 struct annotation *notes = browser__annotation(browser); in annotate_browser__write()
101 const bool is_current_entry = ui_browser__is_current_entry(browser, row); in annotate_browser__write()
107 (browser->use_navkeypressed && in annotate_browser__write()
108 !browser->navkeypressed))), in annotate_browser__write()
109 .width = browser->width, in annotate_browser__write()
110 .obj = browser, in annotate_browser__write()
119 if (!browser->navkeypressed) in annotate_browser__write()
147 static void annotate_browser__draw_current_jump(struct ui_browser *browser) in annotate_browser__draw_current_jump() argument
149 struct annotate_browser *ab = container_of(browser, struct annotate_browser, b); in annotate_browser__draw_current_jump()
203 ui_browser__set_color(browser, HE_COLORSET_JUMP_ARROWS); in annotate_browser__draw_current_jump()
204 __ui_browser__line_arrow(browser, in annotate_browser__draw_current_jump()
209 ui_browser__mark_fused(browser, in annotate_browser__draw_current_jump()
216 static unsigned int annotate_browser__refresh(struct ui_browser *browser) in annotate_browser__refresh() argument
218 struct annotation *notes = browser__annotation(browser); in annotate_browser__refresh()
219 int ret = ui_browser__list_head_refresh(browser); in annotate_browser__refresh()
223 annotate_browser__draw_current_jump(browser); in annotate_browser__refresh()
225 ui_browser__set_color(browser, HE_COLORSET_NORMAL); in annotate_browser__refresh()
226 __ui_browser__vline(browser, pcnt_width, 0, browser->rows - 1); in annotate_browser__refresh()
244 static void disasm_rb_tree__insert(struct annotate_browser *browser, in disasm_rb_tree__insert() argument
247 struct rb_root *root = &browser->entries; in disasm_rb_tree__insert()
256 if (disasm__cmp(al, l, browser->opts->percent_type) < 0) in disasm_rb_tree__insert()
265 static void annotate_browser__set_top(struct annotate_browser *browser, in annotate_browser__set_top() argument
268 struct annotation *notes = browser__annotation(&browser->b); in annotate_browser__set_top()
271 ui_browser__refresh_dimensions(&browser->b); in annotate_browser__set_top()
272 back = browser->b.height / 2; in annotate_browser__set_top()
273 browser->b.top_idx = browser->b.index = idx; in annotate_browser__set_top()
275 while (browser->b.top_idx != 0 && back != 0) { in annotate_browser__set_top()
281 --browser->b.top_idx; in annotate_browser__set_top()
285 browser->b.top = pos; in annotate_browser__set_top()
286 browser->b.navkeypressed = true; in annotate_browser__set_top()
289 static void annotate_browser__set_rb_top(struct annotate_browser *browser, in annotate_browser__set_rb_top() argument
292 struct annotation *notes = browser__annotation(&browser->b); in annotate_browser__set_rb_top()
298 annotate_browser__set_top(browser, pos, idx); in annotate_browser__set_rb_top()
299 browser->curr_hot = nd; in annotate_browser__set_rb_top()
302 static void annotate_browser__calc_percent(struct annotate_browser *browser, in annotate_browser__calc_percent() argument
305 struct map_symbol *ms = browser->b.priv; in annotate_browser__calc_percent()
310 browser->entries = RB_ROOT; in annotate_browser__calc_percent()
329 browser->opts->percent_type); in annotate_browser__calc_percent()
339 disasm_rb_tree__insert(browser, &pos->al); in annotate_browser__calc_percent()
343 browser->curr_hot = rb_last(&browser->entries); in annotate_browser__calc_percent()
346 static bool annotate_browser__toggle_source(struct annotate_browser *browser) in annotate_browser__toggle_source() argument
348 struct annotation *notes = browser__annotation(&browser->b); in annotate_browser__toggle_source()
350 off_t offset = browser->b.index - browser->b.top_idx; in annotate_browser__toggle_source()
352 browser->b.seek(&browser->b, offset, SEEK_CUR); in annotate_browser__toggle_source()
353 al = list_entry(browser->b.top, struct annotation_line, node); in annotate_browser__toggle_source()
359 browser->b.nr_entries = notes->nr_entries; in annotate_browser__toggle_source()
361 browser->b.seek(&browser->b, -offset, SEEK_CUR); in annotate_browser__toggle_source()
362 browser->b.top_idx = al->idx - offset; in annotate_browser__toggle_source()
363 browser->b.index = al->idx; in annotate_browser__toggle_source()
367 browser->b.seek(&browser->b, -offset, SEEK_CUR); in annotate_browser__toggle_source()
374 browser->b.nr_entries = notes->nr_asm_entries; in annotate_browser__toggle_source()
376 browser->b.seek(&browser->b, -offset, SEEK_CUR); in annotate_browser__toggle_source()
377 browser->b.top_idx = al->idx_asm - offset; in annotate_browser__toggle_source()
378 browser->b.index = al->idx_asm; in annotate_browser__toggle_source()
384 static void ui_browser__init_asm_mode(struct ui_browser *browser) in ui_browser__init_asm_mode() argument
386 struct annotation *notes = browser__annotation(browser); in ui_browser__init_asm_mode()
387 ui_browser__reset_index(browser); in ui_browser__init_asm_mode()
388 browser->nr_entries = notes->nr_asm_entries; in ui_browser__init_asm_mode()
409 static bool annotate_browser__callq(struct annotate_browser *browser, in annotate_browser__callq() argument
413 struct map_symbol *ms = browser->b.priv, target_ms; in annotate_browser__callq()
414 struct disasm_line *dl = disasm_line(browser->selection); in annotate_browser__callq()
437 symbol__tui_annotate(&target_ms, evsel, hbt, browser->opts); in annotate_browser__callq()
438 sym_title(ms->sym, ms->map, title, sizeof(title), browser->opts->percent_type); in annotate_browser__callq()
439 ui_browser__show_title(&browser->b, title); in annotate_browser__callq()
444 struct disasm_line *annotate_browser__find_offset(struct annotate_browser *browser, in annotate_browser__find_offset() argument
447 struct annotation *notes = browser__annotation(&browser->b); in annotate_browser__find_offset()
461 static bool annotate_browser__jump(struct annotate_browser *browser, in annotate_browser__jump() argument
465 struct disasm_line *dl = disasm_line(browser->selection); in annotate_browser__jump()
473 annotate_browser__callq(browser, evsel, hbt); in annotate_browser__jump()
478 dl = annotate_browser__find_offset(browser, offset, &idx); in annotate_browser__jump()
484 annotate_browser__set_top(browser, &dl->al, idx); in annotate_browser__jump()
490 struct annotation_line *annotate_browser__find_string(struct annotate_browser *browser, in annotate_browser__find_string() argument
493 struct annotation *notes = browser__annotation(&browser->b); in annotate_browser__find_string()
494 struct annotation_line *al = browser->selection; in annotate_browser__find_string()
496 *idx = browser->b.index; in annotate_browser__find_string()
510 static bool __annotate_browser__search(struct annotate_browser *browser) in __annotate_browser__search() argument
515 al = annotate_browser__find_string(browser, browser->search_bf, &idx); in __annotate_browser__search()
521 annotate_browser__set_top(browser, al, idx); in __annotate_browser__search()
522 browser->searching_backwards = false; in __annotate_browser__search()
527 struct annotation_line *annotate_browser__find_string_reverse(struct annotate_browser *browser, in annotate_browser__find_string_reverse() argument
530 struct annotation *notes = browser__annotation(&browser->b); in annotate_browser__find_string_reverse()
531 struct annotation_line *al = browser->selection; in annotate_browser__find_string_reverse()
533 *idx = browser->b.index; in annotate_browser__find_string_reverse()
547 static bool __annotate_browser__search_reverse(struct annotate_browser *browser) in __annotate_browser__search_reverse() argument
552 al = annotate_browser__find_string_reverse(browser, browser->search_bf, &idx); in __annotate_browser__search_reverse()
558 annotate_browser__set_top(browser, al, idx); in __annotate_browser__search_reverse()
559 browser->searching_backwards = true; in __annotate_browser__search_reverse()
563 static bool annotate_browser__search_window(struct annotate_browser *browser, in annotate_browser__search_window() argument
566 if (ui_browser__input_window("Search", "String: ", browser->search_bf, in annotate_browser__search_window()
569 !*browser->search_bf) in annotate_browser__search_window()
575 static bool annotate_browser__search(struct annotate_browser *browser, int delay_secs) in annotate_browser__search() argument
577 if (annotate_browser__search_window(browser, delay_secs)) in annotate_browser__search()
578 return __annotate_browser__search(browser); in annotate_browser__search()
583 static bool annotate_browser__continue_search(struct annotate_browser *browser, in annotate_browser__continue_search() argument
586 if (!*browser->search_bf) in annotate_browser__continue_search()
587 return annotate_browser__search(browser, delay_secs); in annotate_browser__continue_search()
589 return __annotate_browser__search(browser); in annotate_browser__continue_search()
592 static bool annotate_browser__search_reverse(struct annotate_browser *browser, in annotate_browser__search_reverse() argument
595 if (annotate_browser__search_window(browser, delay_secs)) in annotate_browser__search_reverse()
596 return __annotate_browser__search_reverse(browser); in annotate_browser__search_reverse()
602 bool annotate_browser__continue_search_reverse(struct annotate_browser *browser, in annotate_browser__continue_search_reverse() argument
605 if (!*browser->search_bf) in annotate_browser__continue_search_reverse()
606 return annotate_browser__search_reverse(browser, delay_secs); in annotate_browser__continue_search_reverse()
608 return __annotate_browser__search_reverse(browser); in annotate_browser__continue_search_reverse()
611 static int annotate_browser__show(struct ui_browser *browser, char *title, const char *help) in annotate_browser__show() argument
613 struct annotate_browser *ab = container_of(browser, struct annotate_browser, b); in annotate_browser__show()
614 struct map_symbol *ms = browser->priv; in annotate_browser__show()
618 if (ui_browser__show(browser, title, help) < 0) in annotate_browser__show()
623 ui_browser__gotorc_title(browser, 0, 0); in annotate_browser__show()
624 ui_browser__set_color(browser, HE_COLORSET_ROOT); in annotate_browser__show()
625 ui_browser__write_nstring(browser, symbol_dso, browser->width + 1); in annotate_browser__show()
662 static int annotate_browser__run(struct annotate_browser *browser, in annotate_browser__run() argument
668 struct map_symbol *ms = browser->b.priv; in annotate_browser__run()
677 if (annotate_browser__show(&browser->b, title, help) < 0) in annotate_browser__run()
680 annotate_browser__calc_percent(browser, evsel); in annotate_browser__run()
682 if (browser->curr_hot) { in annotate_browser__run()
683 annotate_browser__set_rb_top(browser, browser->curr_hot); in annotate_browser__run()
684 browser->b.navkeypressed = false; in annotate_browser__run()
687 nd = browser->curr_hot; in annotate_browser__run()
690 key = ui_browser__run(&browser->b, delay_secs); in annotate_browser__run()
693 annotate_browser__calc_percent(browser, evsel); in annotate_browser__run()
711 annotate_browser__show(&browser->b, title, help); in annotate_browser__run()
718 nd = rb_last(&browser->entries); in annotate_browser__run()
720 nd = browser->curr_hot; in annotate_browser__run()
726 nd = rb_first(&browser->entries); in annotate_browser__run()
728 nd = browser->curr_hot; in annotate_browser__run()
732 ui_browser__help_window(&browser->b, in annotate_browser__run()
758 annotate_browser__show(&browser->b, title, help); in annotate_browser__run()
764 nd = browser->curr_hot; in annotate_browser__run()
767 if (annotate_browser__toggle_source(browser)) in annotate_browser__run()
786 if (annotate_browser__search(browser, delay_secs)) { in annotate_browser__run()
792 if (browser->searching_backwards ? in annotate_browser__run()
793 annotate_browser__continue_search_reverse(browser, delay_secs) : in annotate_browser__run()
794 annotate_browser__continue_search(browser, delay_secs)) in annotate_browser__run()
798 if (annotate_browser__search_reverse(browser, delay_secs)) in annotate_browser__run()
805 seq++, browser->b.nr_entries, in annotate_browser__run()
806 browser->b.height, in annotate_browser__run()
807 browser->b.index, in annotate_browser__run()
808 browser->b.top_idx, in annotate_browser__run()
815 struct disasm_line *dl = disasm_line(browser->selection); in annotate_browser__run()
817 if (browser->selection == NULL) in annotate_browser__run()
819 else if (browser->selection->offset == -1) in annotate_browser__run()
825 else if (!(annotate_browser__jump(browser, evsel, hbt) || in annotate_browser__run()
826 annotate_browser__callq(browser, evsel, hbt))) { in annotate_browser__run()
833 map_symbol__annotation_dump(ms, evsel, browser->opts); in annotate_browser__run()
854 switch_percent_type(browser->opts, key == 'b'); in annotate_browser__run()
856 annotate_browser__show(&browser->b, title, help); in annotate_browser__run()
868 annotate_browser__set_rb_top(browser, nd); in annotate_browser__run()
871 ui_browser__hide(&browser->b); in annotate_browser__run()
899 struct annotate_browser browser = { in symbol__tui_annotate() local
919 err = symbol__annotate2(ms, evsel, opts, &browser.arch); in symbol__tui_annotate()
929 browser.b.width = notes->max_line_len; in symbol__tui_annotate()
930 browser.b.nr_entries = notes->nr_entries; in symbol__tui_annotate()
931 browser.b.entries = ¬es->src->source, in symbol__tui_annotate()
932 browser.b.width += 18; /* Percentage */ in symbol__tui_annotate()
935 ui_browser__init_asm_mode(&browser.b); in symbol__tui_annotate()
937 ret = annotate_browser__run(&browser, evsel, hbt); in symbol__tui_annotate()