Lines Matching refs:browser
50 static int hists_browser__scnprintf_title(struct hist_browser *browser, char *bf, size_t size);
61 static int hist_browser__get_folding(struct hist_browser *browser) in hist_browser__get_folding() argument
64 struct hists *hists = browser->hists; in hist_browser__get_folding()
68 (nd = hists__filter_entries(nd, browser->min_pcnt)) != NULL; in hist_browser__get_folding()
81 struct ui_browser *browser = &hb->b; in hist_browser__set_title_space() local
85 browser->extra_title_lines = hb->show_headers ? hpp_list->nr_header_lines : 0; in hist_browser__set_title_space()
105 struct ui_browser *browser = &hb->b; in hist_browser__update_rows() local
111 browser->rows += browser->extra_title_lines; in hist_browser__update_rows()
112 browser->extra_title_lines = 0; in hist_browser__update_rows()
116 browser->extra_title_lines = hpp_list->nr_header_lines; in hist_browser__update_rows()
117 browser->rows -= browser->extra_title_lines; in hist_browser__update_rows()
122 index_row = browser->index - browser->top_idx; in hist_browser__update_rows()
123 if (index_row >= browser->rows) in hist_browser__update_rows()
124 browser->index -= index_row - browser->rows + 1; in hist_browser__update_rows()
127 static void hist_browser__refresh_dimensions(struct ui_browser *browser) in hist_browser__refresh_dimensions() argument
129 struct hist_browser *hb = container_of(browser, struct hist_browser, b); in hist_browser__refresh_dimensions()
132 browser->width = 3 + (hists__sort_list_width(hb->hists) + sizeof("[k]")); in hist_browser__refresh_dimensions()
139 ui_browser__refresh_dimensions(browser); in hist_browser__refresh_dimensions()
142 static void hist_browser__reset(struct hist_browser *browser) in hist_browser__reset() argument
148 browser->nr_callchain_rows = 0; in hist_browser__reset()
150 hist_browser__update_nr_entries(browser); in hist_browser__reset()
151 browser->b.nr_entries = hist_browser__nr_entries(browser); in hist_browser__reset()
152 hist_browser__refresh_dimensions(&browser->b); in hist_browser__reset()
153 ui_browser__reset_index(&browser->b); in hist_browser__reset()
396 static bool hist_browser__selection_has_children(struct hist_browser *browser) in hist_browser__selection_has_children() argument
398 struct hist_entry *he = browser->he_selection; in hist_browser__selection_has_children()
399 struct map_symbol *ms = browser->selection; in hist_browser__selection_has_children()
410 static bool hist_browser__he_selection_unfolded(struct hist_browser *browser) in hist_browser__he_selection_unfolded() argument
412 return browser->he_selection ? browser->he_selection->unfolded : false; in hist_browser__he_selection_unfolded()
415 static bool hist_browser__selection_unfolded(struct hist_browser *browser) in hist_browser__selection_unfolded() argument
417 struct hist_entry *he = browser->he_selection; in hist_browser__selection_unfolded()
418 struct map_symbol *ms = browser->selection; in hist_browser__selection_unfolded()
429 static char *hist_browser__selection_sym_name(struct hist_browser *browser, char *bf, size_t size) in hist_browser__selection_sym_name() argument
431 struct hist_entry *he = browser->he_selection; in hist_browser__selection_sym_name()
432 struct map_symbol *ms = browser->selection; in hist_browser__selection_sym_name()
444 return callchain_list__sym_name(callchain_entry, bf, size, browser->show_dso); in hist_browser__selection_sym_name()
447 static bool hist_browser__toggle_fold(struct hist_browser *browser) in hist_browser__toggle_fold() argument
449 struct hist_entry *he = browser->he_selection; in hist_browser__toggle_fold()
450 struct map_symbol *ms = browser->selection; in hist_browser__toggle_fold()
466 browser->b.nr_entries -= he->nr_rows; in hist_browser__toggle_fold()
469 browser->nr_callchain_rows -= he->nr_rows; in hist_browser__toggle_fold()
471 browser->nr_hierarchy_entries -= he->nr_rows; in hist_browser__toggle_fold()
474 child_rows = hierarchy_count_rows(browser, he, true); in hist_browser__toggle_fold()
481 he->nr_rows = hierarchy_count_rows(browser, he, false); in hist_browser__toggle_fold()
485 browser->b.nr_entries += child_rows - he->nr_rows; in hist_browser__toggle_fold()
493 browser->b.nr_entries -= child_rows - he->nr_rows; in hist_browser__toggle_fold()
501 browser->b.nr_entries += he->nr_rows; in hist_browser__toggle_fold()
504 browser->nr_callchain_rows += he->nr_rows; in hist_browser__toggle_fold()
506 browser->nr_hierarchy_entries += he->nr_rows; in hist_browser__toggle_fold()
607 struct hist_browser *browser, bool unfold) in hist_entry__set_folding() argument
612 if (he->filtered || percent < browser->min_pcnt) in hist_entry__set_folding()
615 __hist_entry__set_folding(he, browser, unfold); in hist_entry__set_folding()
618 browser->nr_hierarchy_entries++; in hist_entry__set_folding()
620 browser->nr_callchain_rows += he->nr_rows; in hist_entry__set_folding()
621 else if (unfold && !hist_entry__has_hierarchy_children(he, browser->min_pcnt)) { in hist_entry__set_folding()
622 browser->nr_hierarchy_entries++; in hist_entry__set_folding()
630 __hist_browser__set_folding(struct hist_browser *browser, bool unfold) in __hist_browser__set_folding() argument
635 nd = rb_first_cached(&browser->hists->entries); in __hist_browser__set_folding()
642 hist_entry__set_folding(he, browser, unfold); in __hist_browser__set_folding()
646 static void hist_browser__set_folding(struct hist_browser *browser, bool unfold) in hist_browser__set_folding() argument
648 browser->nr_hierarchy_entries = 0; in hist_browser__set_folding()
649 browser->nr_callchain_rows = 0; in hist_browser__set_folding()
650 __hist_browser__set_folding(browser, unfold); in hist_browser__set_folding()
652 browser->b.nr_entries = hist_browser__nr_entries(browser); in hist_browser__set_folding()
654 ui_browser__reset_index(&browser->b); in hist_browser__set_folding()
657 static void hist_browser__set_folding_selected(struct hist_browser *browser, bool unfold) in hist_browser__set_folding_selected() argument
659 if (!browser->he_selection) in hist_browser__set_folding_selected()
662 hist_entry__set_folding(browser->he_selection, browser, unfold); in hist_browser__set_folding_selected()
663 browser->b.nr_entries = hist_browser__nr_entries(browser); in hist_browser__set_folding_selected()
666 static void ui_browser__warn_lost_events(struct ui_browser *browser) in ui_browser__warn_lost_events() argument
668 ui_browser__warning(browser, 4, in ui_browser__warn_lost_events()
675 static int hist_browser__title(struct hist_browser *browser, char *bf, size_t size) in hist_browser__title() argument
677 return browser->title ? browser->title(browser, bf, size) : 0; in hist_browser__title()
680 static int hist_browser__handle_hotkey(struct hist_browser *browser, bool warn_lost_event, char *ti… in hist_browser__handle_hotkey() argument
684 struct hist_browser_timer *hbt = browser->hbt; in hist_browser__handle_hotkey()
692 if (hist_browser__has_filter(browser) || symbol_conf.report_hierarchy) in hist_browser__handle_hotkey()
693 hist_browser__update_nr_entries(browser); in hist_browser__handle_hotkey()
695 nr_entries = hist_browser__nr_entries(browser); in hist_browser__handle_hotkey()
696 ui_browser__update_nr_entries(&browser->b, nr_entries); in hist_browser__handle_hotkey()
699 (browser->hists->stats.nr_lost_warned != in hist_browser__handle_hotkey()
700 browser->hists->stats.nr_events[PERF_RECORD_LOST])) { in hist_browser__handle_hotkey()
701 browser->hists->stats.nr_lost_warned = in hist_browser__handle_hotkey()
702 browser->hists->stats.nr_events[PERF_RECORD_LOST]; in hist_browser__handle_hotkey()
703 ui_browser__warn_lost_events(&browser->b); in hist_browser__handle_hotkey()
706 hist_browser__title(browser, title, size); in hist_browser__handle_hotkey()
707 ui_browser__show_title(&browser->b, title); in hist_browser__handle_hotkey()
711 struct hist_entry *h = rb_entry(browser->b.top, struct hist_entry, rb_node); in hist_browser__handle_hotkey()
716 seq++, browser->b.nr_entries, browser->hists->nr_entries, in hist_browser__handle_hotkey()
717 browser->b.extra_title_lines, browser->b.rows, in hist_browser__handle_hotkey()
718 browser->b.index, browser->b.top_idx, h->row_offset, h->nr_rows); in hist_browser__handle_hotkey()
723 hist_browser__set_folding(browser, false); in hist_browser__handle_hotkey()
727 hist_browser__set_folding_selected(browser, false); in hist_browser__handle_hotkey()
731 hist_browser__set_folding(browser, true); in hist_browser__handle_hotkey()
735 hist_browser__set_folding_selected(browser, !hist_browser__he_selection_unfolded(browser)); in hist_browser__handle_hotkey()
738 browser->show_headers = !browser->show_headers; in hist_browser__handle_hotkey()
739 hist_browser__update_rows(browser); in hist_browser__handle_hotkey()
742 if (hist_browser__toggle_fold(browser)) in hist_browser__handle_hotkey()
752 int hist_browser__run(struct hist_browser *browser, const char *help, in hist_browser__run() argument
756 struct hist_browser_timer *hbt = browser->hbt; in hist_browser__run()
759 browser->b.entries = &browser->hists->entries; in hist_browser__run()
760 browser->b.nr_entries = hist_browser__nr_entries(browser); in hist_browser__run()
762 hist_browser__title(browser, title, sizeof(title)); in hist_browser__run()
764 if (ui_browser__show(&browser->b, title, "%s", help) < 0) in hist_browser__run()
767 if (key && hist_browser__handle_hotkey(browser, warn_lost_event, title, sizeof(title), key)) in hist_browser__run()
771 key = ui_browser__run(&browser->b, delay_secs); in hist_browser__run()
773 if (hist_browser__handle_hotkey(browser, warn_lost_event, title, sizeof(title), key)) in hist_browser__run()
777 ui_browser__hide(&browser->b); in hist_browser__run()
791 typedef void (*print_callchain_entry_fn)(struct hist_browser *browser,
797 static void hist_browser__show_callchain_entry(struct hist_browser *browser, in hist_browser__show_callchain_entry() argument
805 bool show_annotated = browser->show_dso && chain->ms.sym && symbol__annotation(chain->ms.sym)->src; in hist_browser__show_callchain_entry()
808 width = browser->b.width - (offset + 2); in hist_browser__show_callchain_entry()
809 if (ui_browser__is_current_entry(&browser->b, row)) { in hist_browser__show_callchain_entry()
810 browser->selection = &chain->ms; in hist_browser__show_callchain_entry()
815 ui_browser__set_color(&browser->b, color); in hist_browser__show_callchain_entry()
816 ui_browser__gotorc(&browser->b, row, 0); in hist_browser__show_callchain_entry()
817 ui_browser__write_nstring(&browser->b, " ", offset); in hist_browser__show_callchain_entry()
818 ui_browser__printf(&browser->b, "%c", folded_sign); in hist_browser__show_callchain_entry()
819 ui_browser__write_graph(&browser->b, show_annotated ? SLSMG_RARROW_CHAR : ' '); in hist_browser__show_callchain_entry()
820 ui_browser__write_nstring(&browser->b, str, width); in hist_browser__show_callchain_entry()
835 typedef bool (*check_output_full_fn)(struct hist_browser *browser,
838 static bool hist_browser__check_output_full(struct hist_browser *browser, in hist_browser__check_output_full() argument
841 return browser->b.rows == row; in hist_browser__check_output_full()
844 static bool hist_browser__check_dump_full(struct hist_browser *browser __maybe_unused, in hist_browser__check_dump_full()
852 static int hist_browser__show_callchain_list(struct hist_browser *browser, in hist_browser__show_callchain_list() argument
874 browser->show_dso); in hist_browser__show_callchain_list()
896 print(browser, chain, str, offset, row, arg); in hist_browser__show_callchain_list()
917 static int hist_browser__show_callchain_flat(struct hist_browser *browser, in hist_browser__show_callchain_flat() argument
950 row += hist_browser__show_callchain_list(browser, child, in hist_browser__show_callchain_flat()
956 if (is_output_full(browser, row)) in hist_browser__show_callchain_flat()
973 row += hist_browser__show_callchain_list(browser, child, in hist_browser__show_callchain_flat()
979 if (is_output_full(browser, row)) in hist_browser__show_callchain_flat()
987 if (is_output_full(browser, row)) in hist_browser__show_callchain_flat()
995 static char *hist_browser__folded_callchain_str(struct hist_browser *browser, in hist_browser__folded_callchain_str() argument
1004 browser->show_dso); in hist_browser__folded_callchain_str()
1021 static int hist_browser__show_callchain_folded(struct hist_browser *browser, in hist_browser__show_callchain_folded() argument
1061 chain_str = hist_browser__folded_callchain_str(browser, in hist_browser__show_callchain_folded()
1077 chain_str = hist_browser__folded_callchain_str(browser, in hist_browser__show_callchain_folded()
1093 print(browser, first_chain, chain_str, offset, row++, arg); in hist_browser__show_callchain_folded()
1098 if (is_output_full(browser, row)) in hist_browser__show_callchain_folded()
1106 static int hist_browser__show_callchain_graph(struct hist_browser *browser, in hist_browser__show_callchain_graph() argument
1143 row += hist_browser__show_callchain_list(browser, child, in hist_browser__show_callchain_graph()
1149 if (is_output_full(browser, row)) in hist_browser__show_callchain_graph()
1159 row += hist_browser__show_callchain_graph(browser, &child->rb_root, in hist_browser__show_callchain_graph()
1164 if (is_output_full(browser, row)) in hist_browser__show_callchain_graph()
1172 static int hist_browser__show_callchain(struct hist_browser *browser, in hist_browser__show_callchain() argument
1189 printed = hist_browser__show_callchain_flat(browser, in hist_browser__show_callchain()
1194 printed = hist_browser__show_callchain_folded(browser, in hist_browser__show_callchain()
1199 printed = hist_browser__show_callchain_graph(browser, in hist_browser__show_callchain()
1206 browser->he_selection = entry; in hist_browser__show_callchain()
1304 static int hist_browser__show_entry(struct hist_browser *browser, in hist_browser__show_entry() argument
1309 int width = browser->b.width; in hist_browser__show_entry()
1311 bool current_entry = ui_browser__is_current_entry(&browser->b, row); in hist_browser__show_entry()
1318 browser->he_selection = entry; in hist_browser__show_entry()
1319 browser->selection = &entry->ms; in hist_browser__show_entry()
1329 .b = &browser->b, in hist_browser__show_entry()
1335 ui_browser__gotorc(&browser->b, row, 0); in hist_browser__show_entry()
1337 hists__for_each_format(browser->hists, fmt) { in hist_browser__show_entry()
1346 column++ < browser->b.horiz_scroll) in hist_browser__show_entry()
1349 if (current_entry && browser->b.navkeypressed) { in hist_browser__show_entry()
1350 ui_browser__set_color(&browser->b, in hist_browser__show_entry()
1353 ui_browser__set_color(&browser->b, in hist_browser__show_entry()
1359 ui_browser__printf(&browser->b, "%c ", folded_sign); in hist_browser__show_entry()
1364 ui_browser__printf(&browser->b, " "); in hist_browser__show_entry()
1375 ui_browser__printf(&browser->b, "%s", s + ret); in hist_browser__show_entry()
1378 ui_browser__printf(&browser->b, "%s", s); in hist_browser__show_entry()
1384 if (!browser->b.navkeypressed) in hist_browser__show_entry()
1387 ui_browser__write_nstring(&browser->b, "", width); in hist_browser__show_entry()
1394 if (folded_sign == '-' && row != browser->b.rows) { in hist_browser__show_entry()
1400 printed += hist_browser__show_callchain(browser, in hist_browser__show_entry()
1410 static int hist_browser__show_hierarchy_entry(struct hist_browser *browser, in hist_browser__show_hierarchy_entry() argument
1416 int width = browser->b.width; in hist_browser__show_hierarchy_entry()
1418 bool current_entry = ui_browser__is_current_entry(&browser->b, row); in hist_browser__show_hierarchy_entry()
1424 .b = &browser->b, in hist_browser__show_hierarchy_entry()
1431 browser->he_selection = entry; in hist_browser__show_hierarchy_entry()
1432 browser->selection = &entry->ms; in hist_browser__show_hierarchy_entry()
1444 ui_browser__gotorc(&browser->b, row, 0); in hist_browser__show_hierarchy_entry()
1446 if (current_entry && browser->b.navkeypressed) in hist_browser__show_hierarchy_entry()
1447 ui_browser__set_color(&browser->b, HE_COLORSET_SELECTED); in hist_browser__show_hierarchy_entry()
1449 ui_browser__set_color(&browser->b, HE_COLORSET_NORMAL); in hist_browser__show_hierarchy_entry()
1451 ui_browser__write_nstring(&browser->b, "", level * HIERARCHY_INDENT); in hist_browser__show_hierarchy_entry()
1466 column++ < browser->b.horiz_scroll) in hist_browser__show_hierarchy_entry()
1469 if (current_entry && browser->b.navkeypressed) { in hist_browser__show_hierarchy_entry()
1470 ui_browser__set_color(&browser->b, in hist_browser__show_hierarchy_entry()
1473 ui_browser__set_color(&browser->b, in hist_browser__show_hierarchy_entry()
1478 ui_browser__printf(&browser->b, "%c ", folded_sign); in hist_browser__show_hierarchy_entry()
1482 ui_browser__printf(&browser->b, " "); in hist_browser__show_hierarchy_entry()
1493 ui_browser__printf(&browser->b, "%s", s + ret); in hist_browser__show_hierarchy_entry()
1497 ui_browser__printf(&browser->b, "%s", s); in hist_browser__show_hierarchy_entry()
1503 ui_browser__write_nstring(&browser->b, "", hierarchy_indent); in hist_browser__show_hierarchy_entry()
1507 if (column >= browser->b.horiz_scroll) { in hist_browser__show_hierarchy_entry()
1515 if (current_entry && browser->b.navkeypressed) { in hist_browser__show_hierarchy_entry()
1516 ui_browser__set_color(&browser->b, in hist_browser__show_hierarchy_entry()
1519 ui_browser__set_color(&browser->b, in hist_browser__show_hierarchy_entry()
1525 ui_browser__printf(&browser->b, "%c ", folded_sign); in hist_browser__show_hierarchy_entry()
1528 ui_browser__write_nstring(&browser->b, "", 2); in hist_browser__show_hierarchy_entry()
1544 ui_browser__printf(&browser->b, "%s", skip_spaces(s)); in hist_browser__show_hierarchy_entry()
1553 if (!browser->b.navkeypressed) in hist_browser__show_hierarchy_entry()
1556 ui_browser__write_nstring(&browser->b, "", width); in hist_browser__show_hierarchy_entry()
1562 if (entry->leaf && folded_sign == '-' && row != browser->b.rows) { in hist_browser__show_hierarchy_entry()
1567 printed += hist_browser__show_callchain(browser, entry, in hist_browser__show_hierarchy_entry()
1576 static int hist_browser__show_no_entry(struct hist_browser *browser, in hist_browser__show_no_entry() argument
1579 int width = browser->b.width; in hist_browser__show_no_entry()
1580 bool current_entry = ui_browser__is_current_entry(&browser->b, row); in hist_browser__show_no_entry()
1586 int indent = browser->hists->nr_hpp_node - 2; in hist_browser__show_no_entry()
1589 browser->he_selection = NULL; in hist_browser__show_no_entry()
1590 browser->selection = NULL; in hist_browser__show_no_entry()
1593 ui_browser__gotorc(&browser->b, row, 0); in hist_browser__show_no_entry()
1595 if (current_entry && browser->b.navkeypressed) in hist_browser__show_no_entry()
1596 ui_browser__set_color(&browser->b, HE_COLORSET_SELECTED); in hist_browser__show_no_entry()
1598 ui_browser__set_color(&browser->b, HE_COLORSET_NORMAL); in hist_browser__show_no_entry()
1600 ui_browser__write_nstring(&browser->b, "", level * HIERARCHY_INDENT); in hist_browser__show_no_entry()
1604 fmt_node = list_first_entry(&browser->hists->hpp_formats, in hist_browser__show_no_entry()
1607 if (perf_hpp__should_skip(fmt, browser->hists) || in hist_browser__show_no_entry()
1608 column++ < browser->b.horiz_scroll) in hist_browser__show_no_entry()
1611 ret = fmt->width(fmt, NULL, browser->hists); in hist_browser__show_no_entry()
1622 ui_browser__write_nstring(&browser->b, "", ret); in hist_browser__show_no_entry()
1626 ui_browser__write_nstring(&browser->b, "", indent * HIERARCHY_INDENT); in hist_browser__show_no_entry()
1629 if (column >= browser->b.horiz_scroll) { in hist_browser__show_no_entry()
1632 ret = snprintf(buf, sizeof(buf), "no entry >= %.2f%%", browser->min_pcnt); in hist_browser__show_no_entry()
1633 ui_browser__printf(&browser->b, " %s", buf); in hist_browser__show_no_entry()
1638 if (!browser->b.navkeypressed) in hist_browser__show_no_entry()
1641 ui_browser__write_nstring(&browser->b, "", width); in hist_browser__show_no_entry()
1652 hists_browser__scnprintf_headers(struct hist_browser *browser, char *buf, in hists_browser__scnprintf_headers() argument
1655 struct hists *hists = browser->hists; in hists_browser__scnprintf_headers()
1671 hists__for_each_format(browser->hists, fmt) { in hists_browser__scnprintf_headers()
1672 if (perf_hpp__should_skip(fmt, hists) || column++ < browser->b.horiz_scroll) in hists_browser__scnprintf_headers()
1690 static int hists_browser__scnprintf_hierarchy_headers(struct hist_browser *browser, char *buf, size… in hists_browser__scnprintf_hierarchy_headers() argument
1692 struct hists *hists = browser->hists; in hists_browser__scnprintf_hierarchy_headers()
1713 if (column++ < browser->b.horiz_scroll) in hists_browser__scnprintf_hierarchy_headers()
1774 static void hists_browser__hierarchy_headers(struct hist_browser *browser) in hists_browser__hierarchy_headers() argument
1778 hists_browser__scnprintf_hierarchy_headers(browser, headers, in hists_browser__hierarchy_headers()
1781 ui_browser__gotorc(&browser->b, 0, 0); in hists_browser__hierarchy_headers()
1782 ui_browser__set_color(&browser->b, HE_COLORSET_ROOT); in hists_browser__hierarchy_headers()
1783 ui_browser__write_nstring(&browser->b, headers, browser->b.width + 1); in hists_browser__hierarchy_headers()
1786 static void hists_browser__headers(struct hist_browser *browser) in hists_browser__headers() argument
1788 struct hists *hists = browser->hists; in hists_browser__headers()
1796 hists_browser__scnprintf_headers(browser, headers, in hists_browser__headers()
1799 ui_browser__gotorc_title(&browser->b, line, 0); in hists_browser__headers()
1800 ui_browser__set_color(&browser->b, HE_COLORSET_ROOT); in hists_browser__headers()
1801 ui_browser__write_nstring(&browser->b, headers, browser->b.width + 1); in hists_browser__headers()
1805 static void hist_browser__show_headers(struct hist_browser *browser) in hist_browser__show_headers() argument
1808 hists_browser__hierarchy_headers(browser); in hist_browser__show_headers()
1810 hists_browser__headers(browser); in hist_browser__show_headers()
1813 static void ui_browser__hists_init_top(struct ui_browser *browser) in ui_browser__hists_init_top() argument
1815 if (browser->top == NULL) { in ui_browser__hists_init_top()
1818 hb = container_of(browser, struct hist_browser, b); in ui_browser__hists_init_top()
1819 browser->top = rb_first_cached(&hb->hists->entries); in ui_browser__hists_init_top()
1823 static unsigned int hist_browser__refresh(struct ui_browser *browser) in hist_browser__refresh() argument
1827 struct hist_browser *hb = container_of(browser, struct hist_browser, b); in hist_browser__refresh()
1832 ui_browser__hists_init_top(browser); in hist_browser__refresh()
1836 for (nd = browser->top; nd; nd = rb_hierarchy_next(nd)) { in hist_browser__refresh()
1857 if (row == browser->rows) in hist_browser__refresh()
1868 if (row == browser->rows) in hist_browser__refresh()
1914 static void ui_browser__hists_seek(struct ui_browser *browser, in ui_browser__hists_seek() argument
1922 hb = container_of(browser, struct hist_browser, b); in ui_browser__hists_seek()
1924 if (browser->nr_entries == 0) in ui_browser__hists_seek()
1927 ui_browser__hists_init_top(browser); in ui_browser__hists_seek()
1931 nd = hists__filter_entries(rb_first(browser->entries), in ui_browser__hists_seek()
1935 nd = browser->top; in ui_browser__hists_seek()
1938 nd = rb_hierarchy_last(rb_last(browser->entries)); in ui_browser__hists_seek()
1950 h = rb_entry(browser->top, struct hist_entry, rb_node); in ui_browser__hists_seek()
1981 browser->top = nd; in ui_browser__hists_seek()
1990 browser->top = nd; in ui_browser__hists_seek()
2003 browser->top = nd; in ui_browser__hists_seek()
2013 browser->top = nd; in ui_browser__hists_seek()
2024 browser->top = nd; in ui_browser__hists_seek()
2039 browser->top = nd; in ui_browser__hists_seek()
2045 static int hist_browser__fprintf_callchain(struct hist_browser *browser, in hist_browser__fprintf_callchain() argument
2053 hist_browser__show_callchain(browser, he, level, 0, in hist_browser__fprintf_callchain()
2059 static int hist_browser__fprintf_entry(struct hist_browser *browser, in hist_browser__fprintf_entry() argument
2078 hists__for_each_format(browser->hists, fmt) { in hist_browser__fprintf_entry()
2095 printed += hist_browser__fprintf_callchain(browser, he, fp, 1); in hist_browser__fprintf_entry()
2101 static int hist_browser__fprintf_hierarchy_entry(struct hist_browser *browser, in hist_browser__fprintf_hierarchy_entry() argument
2152 printed += hist_browser__fprintf_callchain(browser, he, fp, in hist_browser__fprintf_hierarchy_entry()
2159 static int hist_browser__fprintf(struct hist_browser *browser, FILE *fp) in hist_browser__fprintf() argument
2161 struct rb_node *nd = hists__filter_entries(rb_first(browser->b.entries), in hist_browser__fprintf()
2162 browser->min_pcnt); in hist_browser__fprintf()
2169 printed += hist_browser__fprintf_hierarchy_entry(browser, in hist_browser__fprintf()
2173 printed += hist_browser__fprintf_entry(browser, h, fp); in hist_browser__fprintf()
2177 browser->min_pcnt); in hist_browser__fprintf()
2183 static int hist_browser__dump(struct hist_browser *browser) in hist_browser__dump() argument
2189 scnprintf(filename, sizeof(filename), "perf.hist.%d", browser->print_seq); in hist_browser__dump()
2195 if (++browser->print_seq == 8192) { in hist_browser__dump()
2209 ++browser->print_seq; in hist_browser__dump()
2210 hist_browser__fprintf(browser, fp); in hist_browser__dump()
2217 void hist_browser__init(struct hist_browser *browser, in hist_browser__init() argument
2222 browser->hists = hists; in hist_browser__init()
2223 browser->b.refresh = hist_browser__refresh; in hist_browser__init()
2224 browser->b.refresh_dimensions = hist_browser__refresh_dimensions; in hist_browser__init()
2225 browser->b.seek = ui_browser__hists_seek; in hist_browser__init()
2226 browser->b.use_navkeypressed = true; in hist_browser__init()
2227 browser->show_headers = symbol_conf.show_hist_headers; in hist_browser__init()
2228 hist_browser__set_title_space(browser); in hist_browser__init()
2237 ++browser->b.columns; in hist_browser__init()
2240 ++browser->b.columns; in hist_browser__init()
2243 ++browser->b.columns; in hist_browser__init()
2251 struct hist_browser *browser = zalloc(sizeof(*browser)); in hist_browser__new() local
2253 if (browser) in hist_browser__new()
2254 hist_browser__init(browser, hists); in hist_browser__new()
2256 return browser; in hist_browser__new()
2265 struct hist_browser *browser = hist_browser__new(evsel__hists(evsel)); in perf_evsel_browser__new() local
2267 if (browser) { in perf_evsel_browser__new()
2268 browser->hbt = hbt; in perf_evsel_browser__new()
2269 browser->env = env; in perf_evsel_browser__new()
2270 browser->title = hists_browser__scnprintf_title; in perf_evsel_browser__new()
2271 browser->annotation_opts = annotation_opts; in perf_evsel_browser__new()
2273 return browser; in perf_evsel_browser__new()
2276 void hist_browser__delete(struct hist_browser *browser) in hist_browser__delete() argument
2278 free(browser); in hist_browser__delete()
2281 static struct hist_entry *hist_browser__selected_entry(struct hist_browser *browser) in hist_browser__selected_entry() argument
2283 return browser->he_selection; in hist_browser__selected_entry()
2286 static struct thread *hist_browser__selected_thread(struct hist_browser *browser) in hist_browser__selected_thread() argument
2288 return browser->he_selection->thread; in hist_browser__selected_thread()
2291 static struct res_sample *hist_browser__selected_res_sample(struct hist_browser *browser) in hist_browser__selected_res_sample() argument
2293 return browser->he_selection ? browser->he_selection->res_samples : NULL; in hist_browser__selected_res_sample()
2302 static int hists_browser__scnprintf_title(struct hist_browser *browser, char *bf, size_t size) in hists_browser__scnprintf_title() argument
2304 struct hist_browser_timer *hbt = browser->hbt; in hists_browser__scnprintf_title()
2305 int printed = __hists__scnprintf_title(browser->hists, bf, size, !is_report_browser(hbt)); in hists_browser__scnprintf_title()
2433 int (*fn)(struct hist_browser *browser, struct popup_action *act);
2437 do_annotate(struct hist_browser *browser, struct popup_action *act) in do_annotate() argument
2444 if (!browser->annotation_opts->objdump_path && in do_annotate()
2445 perf_env__lookup_objdump(browser->env, &browser->annotation_opts->objdump_path)) in do_annotate()
2452 if (browser->block_evsel) in do_annotate()
2453 evsel = browser->block_evsel; in do_annotate()
2455 evsel = hists_to_evsel(browser->hists); in do_annotate()
2457 err = map_symbol__tui_annotate(&act->ms, evsel, browser->hbt, in do_annotate()
2458 browser->annotation_opts); in do_annotate()
2459 he = hist_browser__selected_entry(browser); in do_annotate()
2467 ui_browser__update_nr_entries(&browser->b, browser->hists->nr_entries); in do_annotate()
2469 ui_browser__handle_resize(&browser->b); in do_annotate()
2496 add_annotate_opt(struct hist_browser *browser __maybe_unused, in add_annotate_opt()
2519 do_zoom_thread(struct hist_browser *browser, struct popup_action *act) in do_zoom_thread() argument
2523 if ((!hists__has(browser->hists, thread) && in do_zoom_thread()
2524 !hists__has(browser->hists, comm)) || thread == NULL) in do_zoom_thread()
2527 if (browser->hists->thread_filter) { in do_zoom_thread()
2528 pstack__remove(browser->pstack, &browser->hists->thread_filter); in do_zoom_thread()
2530 thread__zput(browser->hists->thread_filter); in do_zoom_thread()
2533 if (hists__has(browser->hists, thread)) { in do_zoom_thread()
2542 browser->hists->thread_filter = thread__get(thread); in do_zoom_thread()
2544 pstack__push(browser->pstack, &browser->hists->thread_filter); in do_zoom_thread()
2547 hists__filter_by_thread(browser->hists); in do_zoom_thread()
2548 hist_browser__reset(browser); in do_zoom_thread()
2553 add_thread_opt(struct hist_browser *browser, struct popup_action *act, in add_thread_opt() argument
2558 if ((!hists__has(browser->hists, thread) && in add_thread_opt()
2559 !hists__has(browser->hists, comm)) || thread == NULL) in add_thread_opt()
2562 if (hists__has(browser->hists, thread)) { in add_thread_opt()
2564 browser->hists->thread_filter ? "out of" : "into", in add_thread_opt()
2569 browser->hists->thread_filter ? "out of" : "into", in add_thread_opt()
2580 static int hists_browser__zoom_map(struct hist_browser *browser, struct map *map) in hists_browser__zoom_map() argument
2582 if (!hists__has(browser->hists, dso) || map == NULL) in hists_browser__zoom_map()
2585 if (browser->hists->dso_filter) { in hists_browser__zoom_map()
2586 pstack__remove(browser->pstack, &browser->hists->dso_filter); in hists_browser__zoom_map()
2588 browser->hists->dso_filter = NULL; in hists_browser__zoom_map()
2593 browser->hists->dso_filter = map->dso; in hists_browser__zoom_map()
2595 pstack__push(browser->pstack, &browser->hists->dso_filter); in hists_browser__zoom_map()
2598 hists__filter_by_dso(browser->hists); in hists_browser__zoom_map()
2599 hist_browser__reset(browser); in hists_browser__zoom_map()
2604 do_zoom_dso(struct hist_browser *browser, struct popup_action *act) in do_zoom_dso() argument
2606 return hists_browser__zoom_map(browser, act->ms.map); in do_zoom_dso()
2610 add_dso_opt(struct hist_browser *browser, struct popup_action *act, in add_dso_opt() argument
2613 if (!hists__has(browser->hists, dso) || map == NULL) in add_dso_opt()
2617 browser->hists->dso_filter ? "out of" : "into", in add_dso_opt()
2626 static int do_toggle_callchain(struct hist_browser *browser, struct popup_action *act __maybe_unuse… in do_toggle_callchain() argument
2628 hist_browser__toggle_fold(browser); in do_toggle_callchain()
2632 static int add_callchain_toggle_opt(struct hist_browser *browser, struct popup_action *act, char **… in add_callchain_toggle_opt() argument
2636 if (!hist_browser__selection_has_children(browser)) in add_callchain_toggle_opt()
2640 hist_browser__selection_unfolded(browser) ? "Collapse" : "Expand", in add_callchain_toggle_opt()
2641 hist_browser__selection_sym_name(browser, sym_name, sizeof(sym_name))) < 0) in add_callchain_toggle_opt()
2649 do_browse_map(struct hist_browser *browser __maybe_unused, in do_browse_map()
2657 add_map_opt(struct hist_browser *browser, in add_map_opt() argument
2660 if (!hists__has(browser->hists, dso) || map == NULL) in add_map_opt()
2672 do_run_script(struct hist_browser *browser __maybe_unused, in do_run_script()
2717 do_res_sample_script(struct hist_browser *browser __maybe_unused, in do_res_sample_script()
2722 he = hist_browser__selected_entry(browser); in do_res_sample_script()
2728 add_script_opt_2(struct hist_browser *browser __maybe_unused, in add_script_opt_2()
2755 add_script_opt(struct hist_browser *browser, in add_script_opt() argument
2763 n = add_script_opt_2(browser, act, optstr, thread, sym, evsel, ""); in add_script_opt()
2765 he = hist_browser__selected_entry(browser); in add_script_opt()
2777 n += add_script_opt_2(browser, act, optstr, thread, sym, in add_script_opt()
2785 add_res_sample_opt(struct hist_browser *browser __maybe_unused, in add_res_sample_opt()
2806 do_switch_data(struct hist_browser *browser __maybe_unused, in do_switch_data()
2819 add_switch_opt(struct hist_browser *browser, in add_switch_opt() argument
2822 if (!is_report_browser(browser->hbt)) in add_switch_opt()
2833 do_exit_browser(struct hist_browser *browser __maybe_unused, in do_exit_browser()
2840 add_exit_opt(struct hist_browser *browser __maybe_unused, in add_exit_opt()
2851 do_zoom_socket(struct hist_browser *browser, struct popup_action *act) in do_zoom_socket() argument
2853 if (!hists__has(browser->hists, socket) || act->socket < 0) in do_zoom_socket()
2856 if (browser->hists->socket_filter > -1) { in do_zoom_socket()
2857 pstack__remove(browser->pstack, &browser->hists->socket_filter); in do_zoom_socket()
2858 browser->hists->socket_filter = -1; in do_zoom_socket()
2861 browser->hists->socket_filter = act->socket; in do_zoom_socket()
2863 pstack__push(browser->pstack, &browser->hists->socket_filter); in do_zoom_socket()
2866 hists__filter_by_socket(browser->hists); in do_zoom_socket()
2867 hist_browser__reset(browser); in do_zoom_socket()
2872 add_socket_opt(struct hist_browser *browser, struct popup_action *act, in add_socket_opt() argument
2875 if (!hists__has(browser->hists, socket) || socket_id < 0) in add_socket_opt()
2879 (browser->hists->socket_filter > -1) ? "out of" : "into", in add_socket_opt()
2959 struct hist_browser *browser = perf_evsel_browser__new(evsel, hbt, env, annotation_opts); in perf_evsel__hists_browse() local
3010 if (browser == NULL) in perf_evsel__hists_browse()
3018 browser->min_pcnt = min_pcnt; in perf_evsel__hists_browse()
3019 hist_browser__update_nr_entries(browser); in perf_evsel__hists_browse()
3021 browser->pstack = pstack__new(3); in perf_evsel__hists_browse()
3022 if (browser->pstack == NULL) in perf_evsel__hists_browse()
3034 browser->b.no_samples_msg = "Collecting samples..."; in perf_evsel__hists_browse()
3045 key = hist_browser__run(browser, helpline, warn_lost_event, key); in perf_evsel__hists_browse()
3047 if (browser->he_selection != NULL) { in perf_evsel__hists_browse()
3048 thread = hist_browser__selected_thread(browser); in perf_evsel__hists_browse()
3049 map = browser->selection->map; in perf_evsel__hists_browse()
3050 socked_id = browser->he_selection->socket; in perf_evsel__hists_browse()
3089 ui_browser__warning(&browser->b, delay_secs * 2, in perf_evsel__hists_browse()
3095 if (!browser->selection || in perf_evsel__hists_browse()
3096 !browser->selection->map || in perf_evsel__hists_browse()
3097 !browser->selection->map->dso || in perf_evsel__hists_browse()
3098 browser->selection->map->dso->annotate_warned) { in perf_evsel__hists_browse()
3102 if (!browser->selection->sym) { in perf_evsel__hists_browse()
3103 if (!browser->he_selection) in perf_evsel__hists_browse()
3107 bi = browser->he_selection->branch_info; in perf_evsel__hists_browse()
3114 actions->ms.sym = symbol__new_unresolved(browser->he_selection->ip, in perf_evsel__hists_browse()
3115 browser->selection->map); in perf_evsel__hists_browse()
3116 actions->ms.map = browser->selection->map; in perf_evsel__hists_browse()
3122 if (symbol__annotation(browser->selection->sym)->src == NULL) { in perf_evsel__hists_browse()
3123 ui_browser__warning(&browser->b, delay_secs * 2, in perf_evsel__hists_browse()
3126 browser->selection->sym->name); in perf_evsel__hists_browse()
3130 actions->ms.map = browser->selection->map; in perf_evsel__hists_browse()
3131 actions->ms.sym = browser->selection->sym; in perf_evsel__hists_browse()
3134 do_annotate(browser, actions); in perf_evsel__hists_browse()
3137 hist_browser__dump(browser); in perf_evsel__hists_browse()
3141 do_zoom_dso(browser, actions); in perf_evsel__hists_browse()
3144 if (browser->selection != NULL) in perf_evsel__hists_browse()
3145 hists_browser__zoom_map(browser, browser->selection->maps->machine->vmlinux_map); in perf_evsel__hists_browse()
3149 browser->show_dso = verbose > 0; in perf_evsel__hists_browse()
3155 do_zoom_thread(browser, actions); in perf_evsel__hists_browse()
3159 do_zoom_socket(browser, actions); in perf_evsel__hists_browse()
3169 hist_browser__reset(browser); in perf_evsel__hists_browse()
3176 do_run_script(browser, actions); in perf_evsel__hists_browse()
3181 key = do_switch_data(browser, actions); in perf_evsel__hists_browse()
3210 ui_browser__warning(&browser->b, delay_secs * 2, in perf_evsel__hists_browse()
3215 hist_browser__update_percent_limit(browser, new_percent); in perf_evsel__hists_browse()
3216 hist_browser__reset(browser); in perf_evsel__hists_browse()
3222 ui_browser__help_window(&browser->b, in perf_evsel__hists_browse()
3234 if (pstack__empty(browser->pstack)) { in perf_evsel__hists_browse()
3242 ui_browser__dialog_yesno(&browser->b, in perf_evsel__hists_browse()
3249 top = pstack__peek(browser->pstack); in perf_evsel__hists_browse()
3250 if (top == &browser->hists->dso_filter) { in perf_evsel__hists_browse()
3256 do_zoom_dso(browser, actions); in perf_evsel__hists_browse()
3257 } else if (top == &browser->hists->thread_filter) { in perf_evsel__hists_browse()
3258 do_zoom_thread(browser, actions); in perf_evsel__hists_browse()
3259 } else if (top == &browser->hists->socket_filter) { in perf_evsel__hists_browse()
3260 do_zoom_socket(browser, actions); in perf_evsel__hists_browse()
3291 if (!hists__has(hists, sym) || browser->selection == NULL) in perf_evsel__hists_browse()
3296 if (browser->he_selection) in perf_evsel__hists_browse()
3297 bi = browser->he_selection->branch_info; in perf_evsel__hists_browse()
3302 nr_options += add_annotate_opt(browser, in perf_evsel__hists_browse()
3308 nr_options += add_annotate_opt(browser, in perf_evsel__hists_browse()
3314 nr_options += add_annotate_opt(browser, in perf_evsel__hists_browse()
3317 browser->selection, in perf_evsel__hists_browse()
3318 browser->he_selection->ip); in perf_evsel__hists_browse()
3321 nr_options += add_thread_opt(browser, &actions[nr_options], in perf_evsel__hists_browse()
3323 nr_options += add_dso_opt(browser, &actions[nr_options], in perf_evsel__hists_browse()
3325 nr_options += add_callchain_toggle_opt(browser, &actions[nr_options], &options[nr_options]); in perf_evsel__hists_browse()
3326 nr_options += add_map_opt(browser, &actions[nr_options], in perf_evsel__hists_browse()
3328 browser->selection ? in perf_evsel__hists_browse()
3329 browser->selection->map : NULL); in perf_evsel__hists_browse()
3330 nr_options += add_socket_opt(browser, &actions[nr_options], in perf_evsel__hists_browse()
3337 if (browser->he_selection) { in perf_evsel__hists_browse()
3339 nr_options += add_script_opt(browser, in perf_evsel__hists_browse()
3353 if (hists__has(hists, sym) && browser->selection->sym) { in perf_evsel__hists_browse()
3354 nr_options += add_script_opt(browser, in perf_evsel__hists_browse()
3357 NULL, browser->selection->sym, in perf_evsel__hists_browse()
3361 nr_options += add_script_opt(browser, &actions[nr_options], in perf_evsel__hists_browse()
3363 nr_options += add_res_sample_opt(browser, &actions[nr_options], in perf_evsel__hists_browse()
3365 hist_browser__selected_res_sample(browser), in perf_evsel__hists_browse()
3367 nr_options += add_res_sample_opt(browser, &actions[nr_options], in perf_evsel__hists_browse()
3369 hist_browser__selected_res_sample(browser), in perf_evsel__hists_browse()
3371 nr_options += add_res_sample_opt(browser, &actions[nr_options], in perf_evsel__hists_browse()
3373 hist_browser__selected_res_sample(browser), in perf_evsel__hists_browse()
3375 nr_options += add_switch_opt(browser, &actions[nr_options], in perf_evsel__hists_browse()
3378 nr_options += add_exit_opt(browser, &actions[nr_options], in perf_evsel__hists_browse()
3392 key = act->fn(browser, act); in perf_evsel__hists_browse()
3399 pstack__delete(browser->pstack); in perf_evsel__hists_browse()
3401 hist_browser__delete(browser); in perf_evsel__hists_browse()
3415 static void perf_evsel_menu__write(struct ui_browser *browser, in perf_evsel_menu__write() argument
3418 struct evsel_menu *menu = container_of(browser, in perf_evsel_menu__write()
3422 bool current_entry = ui_browser__is_current_entry(browser, row); in perf_evsel_menu__write()
3429 ui_browser__set_color(browser, current_entry ? HE_COLORSET_SELECTED : in perf_evsel_menu__write()
3446 ui_browser__printf(browser, "%s", bf); in perf_evsel_menu__write()
3452 ui_browser__set_color(browser, HE_COLORSET_TOP); in perf_evsel_menu__write()
3459 ui_browser__write_nstring(browser, warn, browser->width - printed); in perf_evsel_menu__write()
3557 static bool filter_group_entries(struct ui_browser *browser __maybe_unused, in filter_group_entries()
3662 static int block_hists_browser__title(struct hist_browser *browser, char *bf, in block_hists_browser__title() argument
3665 struct hists *hists = evsel__hists(browser->block_evsel); in block_hists_browser__title()
3666 const char *evname = evsel__name(browser->block_evsel); in block_hists_browser__title()
3682 struct hist_browser *browser; in block_hists_tui_browse() local
3688 browser = hist_browser__new(hists); in block_hists_tui_browse()
3689 if (!browser) in block_hists_tui_browse()
3692 browser->block_evsel = evsel; in block_hists_tui_browse()
3693 browser->title = block_hists_browser__title; in block_hists_tui_browse()
3694 browser->min_pcnt = min_percent; in block_hists_tui_browse()
3695 browser->env = env; in block_hists_tui_browse()
3696 browser->annotation_opts = annotation_opts; in block_hists_tui_browse()
3705 key = hist_browser__run(browser, "? - help", true, 0); in block_hists_tui_browse()
3711 ui_browser__help_window(&browser->b, help); in block_hists_tui_browse()
3715 if (!browser->selection || in block_hists_tui_browse()
3716 !browser->selection->sym) { in block_hists_tui_browse()
3720 action.ms.map = browser->selection->map; in block_hists_tui_browse()
3721 action.ms.sym = browser->selection->sym; in block_hists_tui_browse()
3722 do_annotate(browser, &action); in block_hists_tui_browse()
3730 hist_browser__delete(browser); in block_hists_tui_browse()