• Home
  • Raw
  • Download

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__selection_unfolded(struct hist_browser *browser) in hist_browser__selection_unfolded() argument
412 struct hist_entry *he = browser->he_selection; in hist_browser__selection_unfolded()
413 struct map_symbol *ms = browser->selection; in hist_browser__selection_unfolded()
424 static char *hist_browser__selection_sym_name(struct hist_browser *browser, char *bf, size_t size) in hist_browser__selection_sym_name() argument
426 struct hist_entry *he = browser->he_selection; in hist_browser__selection_sym_name()
427 struct map_symbol *ms = browser->selection; in hist_browser__selection_sym_name()
439 return callchain_list__sym_name(callchain_entry, bf, size, browser->show_dso); in hist_browser__selection_sym_name()
442 static bool hist_browser__toggle_fold(struct hist_browser *browser) in hist_browser__toggle_fold() argument
444 struct hist_entry *he = browser->he_selection; in hist_browser__toggle_fold()
445 struct map_symbol *ms = browser->selection; in hist_browser__toggle_fold()
461 browser->b.nr_entries -= he->nr_rows; in hist_browser__toggle_fold()
464 browser->nr_callchain_rows -= he->nr_rows; in hist_browser__toggle_fold()
466 browser->nr_hierarchy_entries -= he->nr_rows; in hist_browser__toggle_fold()
469 child_rows = hierarchy_count_rows(browser, he, true); in hist_browser__toggle_fold()
476 he->nr_rows = hierarchy_count_rows(browser, he, false); in hist_browser__toggle_fold()
480 browser->b.nr_entries += child_rows - he->nr_rows; in hist_browser__toggle_fold()
488 browser->b.nr_entries -= child_rows - he->nr_rows; in hist_browser__toggle_fold()
496 browser->b.nr_entries += he->nr_rows; in hist_browser__toggle_fold()
499 browser->nr_callchain_rows += he->nr_rows; in hist_browser__toggle_fold()
501 browser->nr_hierarchy_entries += he->nr_rows; in hist_browser__toggle_fold()
602 __hist_browser__set_folding(struct hist_browser *browser, bool unfold) in __hist_browser__set_folding() argument
608 nd = rb_first_cached(&browser->hists->entries); in __hist_browser__set_folding()
615 hist_entry__set_folding(he, browser, unfold); in __hist_browser__set_folding()
618 if (he->filtered || percent < browser->min_pcnt) in __hist_browser__set_folding()
622 browser->nr_hierarchy_entries++; in __hist_browser__set_folding()
624 browser->nr_callchain_rows += he->nr_rows; in __hist_browser__set_folding()
625 else if (unfold && !hist_entry__has_hierarchy_children(he, browser->min_pcnt)) { in __hist_browser__set_folding()
626 browser->nr_hierarchy_entries++; in __hist_browser__set_folding()
634 static void hist_browser__set_folding(struct hist_browser *browser, bool unfold) in hist_browser__set_folding() argument
636 browser->nr_hierarchy_entries = 0; in hist_browser__set_folding()
637 browser->nr_callchain_rows = 0; in hist_browser__set_folding()
638 __hist_browser__set_folding(browser, unfold); in hist_browser__set_folding()
640 browser->b.nr_entries = hist_browser__nr_entries(browser); in hist_browser__set_folding()
642 ui_browser__reset_index(&browser->b); in hist_browser__set_folding()
645 static void hist_browser__set_folding_selected(struct hist_browser *browser, bool unfold) in hist_browser__set_folding_selected() argument
647 if (!browser->he_selection) in hist_browser__set_folding_selected()
650 if (unfold == browser->he_selection->unfolded) in hist_browser__set_folding_selected()
653 hist_browser__toggle_fold(browser); in hist_browser__set_folding_selected()
656 static void ui_browser__warn_lost_events(struct ui_browser *browser) in ui_browser__warn_lost_events() argument
658 ui_browser__warning(browser, 4, in ui_browser__warn_lost_events()
665 static int hist_browser__title(struct hist_browser *browser, char *bf, size_t size) in hist_browser__title() argument
667 return browser->title ? browser->title(browser, bf, size) : 0; in hist_browser__title()
670 static int hist_browser__handle_hotkey(struct hist_browser *browser, bool warn_lost_event, char *ti… in hist_browser__handle_hotkey() argument
674 struct hist_browser_timer *hbt = browser->hbt; in hist_browser__handle_hotkey()
675 struct evsel *evsel = hists_to_evsel(browser->hists); in hist_browser__handle_hotkey()
683 if (hist_browser__has_filter(browser) || symbol_conf.report_hierarchy) in hist_browser__handle_hotkey()
684 hist_browser__update_nr_entries(browser); in hist_browser__handle_hotkey()
686 nr_entries = hist_browser__nr_entries(browser); in hist_browser__handle_hotkey()
687 ui_browser__update_nr_entries(&browser->b, nr_entries); in hist_browser__handle_hotkey()
694 ui_browser__warn_lost_events(&browser->b); in hist_browser__handle_hotkey()
697 hist_browser__title(browser, title, size); in hist_browser__handle_hotkey()
698 ui_browser__show_title(&browser->b, title); in hist_browser__handle_hotkey()
702 struct hist_entry *h = rb_entry(browser->b.top, struct hist_entry, rb_node); in hist_browser__handle_hotkey()
707 seq++, browser->b.nr_entries, browser->hists->nr_entries, in hist_browser__handle_hotkey()
708 browser->b.extra_title_lines, browser->b.rows, in hist_browser__handle_hotkey()
709 browser->b.index, browser->b.top_idx, h->row_offset, h->nr_rows); in hist_browser__handle_hotkey()
714 hist_browser__set_folding(browser, false); in hist_browser__handle_hotkey()
718 hist_browser__set_folding_selected(browser, false); in hist_browser__handle_hotkey()
722 hist_browser__set_folding(browser, true); in hist_browser__handle_hotkey()
726 hist_browser__toggle_fold(browser); in hist_browser__handle_hotkey()
729 browser->show_headers = !browser->show_headers; in hist_browser__handle_hotkey()
730 hist_browser__update_rows(browser); in hist_browser__handle_hotkey()
733 if (hist_browser__toggle_fold(browser)) in hist_browser__handle_hotkey()
743 int hist_browser__run(struct hist_browser *browser, const char *help, in hist_browser__run() argument
747 struct hist_browser_timer *hbt = browser->hbt; in hist_browser__run()
750 browser->b.entries = &browser->hists->entries; in hist_browser__run()
751 browser->b.nr_entries = hist_browser__nr_entries(browser); in hist_browser__run()
753 hist_browser__title(browser, title, sizeof(title)); in hist_browser__run()
755 if (ui_browser__show(&browser->b, title, "%s", help) < 0) in hist_browser__run()
758 if (key && hist_browser__handle_hotkey(browser, warn_lost_event, title, sizeof(title), key)) in hist_browser__run()
762 key = ui_browser__run(&browser->b, delay_secs); in hist_browser__run()
764 if (hist_browser__handle_hotkey(browser, warn_lost_event, title, sizeof(title), key)) in hist_browser__run()
768 ui_browser__hide(&browser->b); in hist_browser__run()
782 typedef void (*print_callchain_entry_fn)(struct hist_browser *browser,
788 static void hist_browser__show_callchain_entry(struct hist_browser *browser, in hist_browser__show_callchain_entry() argument
796 bool show_annotated = browser->show_dso && chain->ms.sym && symbol__annotation(chain->ms.sym)->src; in hist_browser__show_callchain_entry()
799 width = browser->b.width - (offset + 2); in hist_browser__show_callchain_entry()
800 if (ui_browser__is_current_entry(&browser->b, row)) { in hist_browser__show_callchain_entry()
801 browser->selection = &chain->ms; in hist_browser__show_callchain_entry()
806 ui_browser__set_color(&browser->b, color); in hist_browser__show_callchain_entry()
807 ui_browser__gotorc(&browser->b, row, 0); in hist_browser__show_callchain_entry()
808 ui_browser__write_nstring(&browser->b, " ", offset); in hist_browser__show_callchain_entry()
809 ui_browser__printf(&browser->b, "%c", folded_sign); in hist_browser__show_callchain_entry()
810 ui_browser__write_graph(&browser->b, show_annotated ? SLSMG_RARROW_CHAR : ' '); in hist_browser__show_callchain_entry()
811 ui_browser__write_nstring(&browser->b, str, width); in hist_browser__show_callchain_entry()
826 typedef bool (*check_output_full_fn)(struct hist_browser *browser,
829 static bool hist_browser__check_output_full(struct hist_browser *browser, in hist_browser__check_output_full() argument
832 return browser->b.rows == row; in hist_browser__check_output_full()
835 static bool hist_browser__check_dump_full(struct hist_browser *browser __maybe_unused, in hist_browser__check_dump_full()
843 static int hist_browser__show_callchain_list(struct hist_browser *browser, in hist_browser__show_callchain_list() argument
865 browser->show_dso); in hist_browser__show_callchain_list()
887 print(browser, chain, str, offset, row, arg); in hist_browser__show_callchain_list()
908 static int hist_browser__show_callchain_flat(struct hist_browser *browser, in hist_browser__show_callchain_flat() argument
941 row += hist_browser__show_callchain_list(browser, child, in hist_browser__show_callchain_flat()
947 if (is_output_full(browser, row)) in hist_browser__show_callchain_flat()
964 row += hist_browser__show_callchain_list(browser, child, in hist_browser__show_callchain_flat()
970 if (is_output_full(browser, row)) in hist_browser__show_callchain_flat()
978 if (is_output_full(browser, row)) in hist_browser__show_callchain_flat()
986 static char *hist_browser__folded_callchain_str(struct hist_browser *browser, in hist_browser__folded_callchain_str() argument
995 browser->show_dso); in hist_browser__folded_callchain_str()
1012 static int hist_browser__show_callchain_folded(struct hist_browser *browser, in hist_browser__show_callchain_folded() argument
1052 chain_str = hist_browser__folded_callchain_str(browser, in hist_browser__show_callchain_folded()
1068 chain_str = hist_browser__folded_callchain_str(browser, in hist_browser__show_callchain_folded()
1084 print(browser, first_chain, chain_str, offset, row++, arg); in hist_browser__show_callchain_folded()
1089 if (is_output_full(browser, row)) in hist_browser__show_callchain_folded()
1097 static int hist_browser__show_callchain_graph(struct hist_browser *browser, in hist_browser__show_callchain_graph() argument
1134 row += hist_browser__show_callchain_list(browser, child, in hist_browser__show_callchain_graph()
1140 if (is_output_full(browser, row)) in hist_browser__show_callchain_graph()
1150 row += hist_browser__show_callchain_graph(browser, &child->rb_root, in hist_browser__show_callchain_graph()
1155 if (is_output_full(browser, row)) in hist_browser__show_callchain_graph()
1163 static int hist_browser__show_callchain(struct hist_browser *browser, in hist_browser__show_callchain() argument
1180 printed = hist_browser__show_callchain_flat(browser, in hist_browser__show_callchain()
1185 printed = hist_browser__show_callchain_folded(browser, in hist_browser__show_callchain()
1190 printed = hist_browser__show_callchain_graph(browser, in hist_browser__show_callchain()
1197 browser->he_selection = entry; in hist_browser__show_callchain()
1295 static int hist_browser__show_entry(struct hist_browser *browser, in hist_browser__show_entry() argument
1300 int width = browser->b.width; in hist_browser__show_entry()
1302 bool current_entry = ui_browser__is_current_entry(&browser->b, row); in hist_browser__show_entry()
1309 browser->he_selection = entry; in hist_browser__show_entry()
1310 browser->selection = &entry->ms; in hist_browser__show_entry()
1320 .b = &browser->b, in hist_browser__show_entry()
1326 ui_browser__gotorc(&browser->b, row, 0); in hist_browser__show_entry()
1328 hists__for_each_format(browser->hists, fmt) { in hist_browser__show_entry()
1337 column++ < browser->b.horiz_scroll) in hist_browser__show_entry()
1340 if (current_entry && browser->b.navkeypressed) { in hist_browser__show_entry()
1341 ui_browser__set_color(&browser->b, in hist_browser__show_entry()
1344 ui_browser__set_color(&browser->b, in hist_browser__show_entry()
1350 ui_browser__printf(&browser->b, "%c ", folded_sign); in hist_browser__show_entry()
1355 ui_browser__printf(&browser->b, " "); in hist_browser__show_entry()
1366 ui_browser__printf(&browser->b, "%s", s + ret); in hist_browser__show_entry()
1369 ui_browser__printf(&browser->b, "%s", s); in hist_browser__show_entry()
1375 if (!browser->b.navkeypressed) in hist_browser__show_entry()
1378 ui_browser__write_nstring(&browser->b, "", width); in hist_browser__show_entry()
1385 if (folded_sign == '-' && row != browser->b.rows) { in hist_browser__show_entry()
1391 printed += hist_browser__show_callchain(browser, in hist_browser__show_entry()
1401 static int hist_browser__show_hierarchy_entry(struct hist_browser *browser, in hist_browser__show_hierarchy_entry() argument
1407 int width = browser->b.width; in hist_browser__show_hierarchy_entry()
1409 bool current_entry = ui_browser__is_current_entry(&browser->b, row); in hist_browser__show_hierarchy_entry()
1415 .b = &browser->b, in hist_browser__show_hierarchy_entry()
1422 browser->he_selection = entry; in hist_browser__show_hierarchy_entry()
1423 browser->selection = &entry->ms; in hist_browser__show_hierarchy_entry()
1435 ui_browser__gotorc(&browser->b, row, 0); in hist_browser__show_hierarchy_entry()
1437 if (current_entry && browser->b.navkeypressed) in hist_browser__show_hierarchy_entry()
1438 ui_browser__set_color(&browser->b, HE_COLORSET_SELECTED); in hist_browser__show_hierarchy_entry()
1440 ui_browser__set_color(&browser->b, HE_COLORSET_NORMAL); in hist_browser__show_hierarchy_entry()
1442 ui_browser__write_nstring(&browser->b, "", level * HIERARCHY_INDENT); in hist_browser__show_hierarchy_entry()
1457 column++ < browser->b.horiz_scroll) in hist_browser__show_hierarchy_entry()
1460 if (current_entry && browser->b.navkeypressed) { in hist_browser__show_hierarchy_entry()
1461 ui_browser__set_color(&browser->b, in hist_browser__show_hierarchy_entry()
1464 ui_browser__set_color(&browser->b, in hist_browser__show_hierarchy_entry()
1469 ui_browser__printf(&browser->b, "%c ", folded_sign); in hist_browser__show_hierarchy_entry()
1473 ui_browser__printf(&browser->b, " "); in hist_browser__show_hierarchy_entry()
1484 ui_browser__printf(&browser->b, "%s", s + ret); in hist_browser__show_hierarchy_entry()
1488 ui_browser__printf(&browser->b, "%s", s); in hist_browser__show_hierarchy_entry()
1494 ui_browser__write_nstring(&browser->b, "", hierarchy_indent); in hist_browser__show_hierarchy_entry()
1498 if (column >= browser->b.horiz_scroll) { in hist_browser__show_hierarchy_entry()
1506 if (current_entry && browser->b.navkeypressed) { in hist_browser__show_hierarchy_entry()
1507 ui_browser__set_color(&browser->b, in hist_browser__show_hierarchy_entry()
1510 ui_browser__set_color(&browser->b, in hist_browser__show_hierarchy_entry()
1516 ui_browser__printf(&browser->b, "%c ", folded_sign); in hist_browser__show_hierarchy_entry()
1519 ui_browser__write_nstring(&browser->b, "", 2); in hist_browser__show_hierarchy_entry()
1535 ui_browser__printf(&browser->b, "%s", skip_spaces(s)); in hist_browser__show_hierarchy_entry()
1544 if (!browser->b.navkeypressed) in hist_browser__show_hierarchy_entry()
1547 ui_browser__write_nstring(&browser->b, "", width); in hist_browser__show_hierarchy_entry()
1553 if (entry->leaf && folded_sign == '-' && row != browser->b.rows) { in hist_browser__show_hierarchy_entry()
1558 printed += hist_browser__show_callchain(browser, entry, in hist_browser__show_hierarchy_entry()
1567 static int hist_browser__show_no_entry(struct hist_browser *browser, in hist_browser__show_no_entry() argument
1570 int width = browser->b.width; in hist_browser__show_no_entry()
1571 bool current_entry = ui_browser__is_current_entry(&browser->b, row); in hist_browser__show_no_entry()
1577 int indent = browser->hists->nr_hpp_node - 2; in hist_browser__show_no_entry()
1580 browser->he_selection = NULL; in hist_browser__show_no_entry()
1581 browser->selection = NULL; in hist_browser__show_no_entry()
1584 ui_browser__gotorc(&browser->b, row, 0); in hist_browser__show_no_entry()
1586 if (current_entry && browser->b.navkeypressed) in hist_browser__show_no_entry()
1587 ui_browser__set_color(&browser->b, HE_COLORSET_SELECTED); in hist_browser__show_no_entry()
1589 ui_browser__set_color(&browser->b, HE_COLORSET_NORMAL); in hist_browser__show_no_entry()
1591 ui_browser__write_nstring(&browser->b, "", level * HIERARCHY_INDENT); in hist_browser__show_no_entry()
1595 fmt_node = list_first_entry(&browser->hists->hpp_formats, in hist_browser__show_no_entry()
1598 if (perf_hpp__should_skip(fmt, browser->hists) || in hist_browser__show_no_entry()
1599 column++ < browser->b.horiz_scroll) in hist_browser__show_no_entry()
1602 ret = fmt->width(fmt, NULL, browser->hists); in hist_browser__show_no_entry()
1613 ui_browser__write_nstring(&browser->b, "", ret); in hist_browser__show_no_entry()
1617 ui_browser__write_nstring(&browser->b, "", indent * HIERARCHY_INDENT); in hist_browser__show_no_entry()
1620 if (column >= browser->b.horiz_scroll) { in hist_browser__show_no_entry()
1623 ret = snprintf(buf, sizeof(buf), "no entry >= %.2f%%", browser->min_pcnt); in hist_browser__show_no_entry()
1624 ui_browser__printf(&browser->b, " %s", buf); in hist_browser__show_no_entry()
1629 if (!browser->b.navkeypressed) in hist_browser__show_no_entry()
1632 ui_browser__write_nstring(&browser->b, "", width); in hist_browser__show_no_entry()
1643 hists_browser__scnprintf_headers(struct hist_browser *browser, char *buf, in hists_browser__scnprintf_headers() argument
1646 struct hists *hists = browser->hists; in hists_browser__scnprintf_headers()
1662 hists__for_each_format(browser->hists, fmt) { in hists_browser__scnprintf_headers()
1663 if (perf_hpp__should_skip(fmt, hists) || column++ < browser->b.horiz_scroll) in hists_browser__scnprintf_headers()
1681 static int hists_browser__scnprintf_hierarchy_headers(struct hist_browser *browser, char *buf, size… in hists_browser__scnprintf_hierarchy_headers() argument
1683 struct hists *hists = browser->hists; in hists_browser__scnprintf_hierarchy_headers()
1704 if (column++ < browser->b.horiz_scroll) in hists_browser__scnprintf_hierarchy_headers()
1765 static void hists_browser__hierarchy_headers(struct hist_browser *browser) in hists_browser__hierarchy_headers() argument
1769 hists_browser__scnprintf_hierarchy_headers(browser, headers, in hists_browser__hierarchy_headers()
1772 ui_browser__gotorc_title(&browser->b, 0, 0); in hists_browser__hierarchy_headers()
1773 ui_browser__set_color(&browser->b, HE_COLORSET_ROOT); in hists_browser__hierarchy_headers()
1774 ui_browser__write_nstring(&browser->b, headers, browser->b.width + 1); in hists_browser__hierarchy_headers()
1777 static void hists_browser__headers(struct hist_browser *browser) in hists_browser__headers() argument
1779 struct hists *hists = browser->hists; in hists_browser__headers()
1787 hists_browser__scnprintf_headers(browser, headers, in hists_browser__headers()
1790 ui_browser__gotorc_title(&browser->b, line, 0); in hists_browser__headers()
1791 ui_browser__set_color(&browser->b, HE_COLORSET_ROOT); in hists_browser__headers()
1792 ui_browser__write_nstring(&browser->b, headers, browser->b.width + 1); in hists_browser__headers()
1796 static void hist_browser__show_headers(struct hist_browser *browser) in hist_browser__show_headers() argument
1799 hists_browser__hierarchy_headers(browser); in hist_browser__show_headers()
1801 hists_browser__headers(browser); in hist_browser__show_headers()
1804 static void ui_browser__hists_init_top(struct ui_browser *browser) in ui_browser__hists_init_top() argument
1806 if (browser->top == NULL) { in ui_browser__hists_init_top()
1809 hb = container_of(browser, struct hist_browser, b); in ui_browser__hists_init_top()
1810 browser->top = rb_first_cached(&hb->hists->entries); in ui_browser__hists_init_top()
1814 static unsigned int hist_browser__refresh(struct ui_browser *browser) in hist_browser__refresh() argument
1818 struct hist_browser *hb = container_of(browser, struct hist_browser, b); in hist_browser__refresh()
1823 ui_browser__hists_init_top(browser); in hist_browser__refresh()
1827 for (nd = browser->top; nd; nd = rb_hierarchy_next(nd)) { in hist_browser__refresh()
1848 if (row == browser->rows) in hist_browser__refresh()
1859 if (row == browser->rows) in hist_browser__refresh()
1905 static void ui_browser__hists_seek(struct ui_browser *browser, in ui_browser__hists_seek() argument
1913 hb = container_of(browser, struct hist_browser, b); in ui_browser__hists_seek()
1915 if (browser->nr_entries == 0) in ui_browser__hists_seek()
1918 ui_browser__hists_init_top(browser); in ui_browser__hists_seek()
1922 nd = hists__filter_entries(rb_first(browser->entries), in ui_browser__hists_seek()
1926 nd = browser->top; in ui_browser__hists_seek()
1929 nd = rb_hierarchy_last(rb_last(browser->entries)); in ui_browser__hists_seek()
1941 h = rb_entry(browser->top, struct hist_entry, rb_node); in ui_browser__hists_seek()
1972 browser->top = nd; in ui_browser__hists_seek()
1981 browser->top = nd; in ui_browser__hists_seek()
1994 browser->top = nd; in ui_browser__hists_seek()
2004 browser->top = nd; in ui_browser__hists_seek()
2015 browser->top = nd; in ui_browser__hists_seek()
2030 browser->top = nd; in ui_browser__hists_seek()
2036 static int hist_browser__fprintf_callchain(struct hist_browser *browser, in hist_browser__fprintf_callchain() argument
2044 hist_browser__show_callchain(browser, he, level, 0, in hist_browser__fprintf_callchain()
2050 static int hist_browser__fprintf_entry(struct hist_browser *browser, in hist_browser__fprintf_entry() argument
2069 hists__for_each_format(browser->hists, fmt) { in hist_browser__fprintf_entry()
2086 printed += hist_browser__fprintf_callchain(browser, he, fp, 1); in hist_browser__fprintf_entry()
2092 static int hist_browser__fprintf_hierarchy_entry(struct hist_browser *browser, in hist_browser__fprintf_hierarchy_entry() argument
2143 printed += hist_browser__fprintf_callchain(browser, he, fp, in hist_browser__fprintf_hierarchy_entry()
2150 static int hist_browser__fprintf(struct hist_browser *browser, FILE *fp) in hist_browser__fprintf() argument
2152 struct rb_node *nd = hists__filter_entries(rb_first(browser->b.entries), in hist_browser__fprintf()
2153 browser->min_pcnt); in hist_browser__fprintf()
2160 printed += hist_browser__fprintf_hierarchy_entry(browser, in hist_browser__fprintf()
2164 printed += hist_browser__fprintf_entry(browser, h, fp); in hist_browser__fprintf()
2168 browser->min_pcnt); in hist_browser__fprintf()
2174 static int hist_browser__dump(struct hist_browser *browser) in hist_browser__dump() argument
2180 scnprintf(filename, sizeof(filename), "perf.hist.%d", browser->print_seq); in hist_browser__dump()
2186 if (++browser->print_seq == 8192) { in hist_browser__dump()
2200 ++browser->print_seq; in hist_browser__dump()
2201 hist_browser__fprintf(browser, fp); in hist_browser__dump()
2208 void hist_browser__init(struct hist_browser *browser, in hist_browser__init() argument
2213 browser->hists = hists; in hist_browser__init()
2214 browser->b.refresh = hist_browser__refresh; in hist_browser__init()
2215 browser->b.refresh_dimensions = hist_browser__refresh_dimensions; in hist_browser__init()
2216 browser->b.seek = ui_browser__hists_seek; in hist_browser__init()
2217 browser->b.use_navkeypressed = true; in hist_browser__init()
2218 browser->show_headers = symbol_conf.show_hist_headers; in hist_browser__init()
2219 hist_browser__set_title_space(browser); in hist_browser__init()
2228 ++browser->b.columns; in hist_browser__init()
2231 ++browser->b.columns; in hist_browser__init()
2234 ++browser->b.columns; in hist_browser__init()
2242 struct hist_browser *browser = zalloc(sizeof(*browser)); in hist_browser__new() local
2244 if (browser) in hist_browser__new()
2245 hist_browser__init(browser, hists); in hist_browser__new()
2247 return browser; in hist_browser__new()
2256 struct hist_browser *browser = hist_browser__new(evsel__hists(evsel)); in perf_evsel_browser__new() local
2258 if (browser) { in perf_evsel_browser__new()
2259 browser->hbt = hbt; in perf_evsel_browser__new()
2260 browser->env = env; in perf_evsel_browser__new()
2261 browser->title = hists_browser__scnprintf_title; in perf_evsel_browser__new()
2262 browser->annotation_opts = annotation_opts; in perf_evsel_browser__new()
2264 return browser; in perf_evsel_browser__new()
2267 void hist_browser__delete(struct hist_browser *browser) in hist_browser__delete() argument
2269 free(browser); in hist_browser__delete()
2272 static struct hist_entry *hist_browser__selected_entry(struct hist_browser *browser) in hist_browser__selected_entry() argument
2274 return browser->he_selection; in hist_browser__selected_entry()
2277 static struct thread *hist_browser__selected_thread(struct hist_browser *browser) in hist_browser__selected_thread() argument
2279 return browser->he_selection->thread; in hist_browser__selected_thread()
2282 static struct res_sample *hist_browser__selected_res_sample(struct hist_browser *browser) in hist_browser__selected_res_sample() argument
2284 return browser->he_selection ? browser->he_selection->res_samples : NULL; in hist_browser__selected_res_sample()
2293 static int hists_browser__scnprintf_title(struct hist_browser *browser, char *bf, size_t size) in hists_browser__scnprintf_title() argument
2295 struct hist_browser_timer *hbt = browser->hbt; in hists_browser__scnprintf_title()
2296 int printed = __hists__scnprintf_title(browser->hists, bf, size, !is_report_browser(hbt)); in hists_browser__scnprintf_title()
2424 int (*fn)(struct hist_browser *browser, struct popup_action *act);
2428 do_annotate(struct hist_browser *browser, struct popup_action *act) in do_annotate() argument
2435 if (!browser->annotation_opts->objdump_path && in do_annotate()
2436 perf_env__lookup_objdump(browser->env, &browser->annotation_opts->objdump_path)) in do_annotate()
2443 if (browser->block_evsel) in do_annotate()
2444 evsel = browser->block_evsel; in do_annotate()
2446 evsel = hists_to_evsel(browser->hists); in do_annotate()
2448 err = map_symbol__tui_annotate(&act->ms, evsel, browser->hbt, in do_annotate()
2449 browser->annotation_opts); in do_annotate()
2450 he = hist_browser__selected_entry(browser); in do_annotate()
2458 ui_browser__update_nr_entries(&browser->b, browser->hists->nr_entries); in do_annotate()
2460 ui_browser__handle_resize(&browser->b); in do_annotate()
2487 add_annotate_opt(struct hist_browser *browser __maybe_unused, in add_annotate_opt()
2510 do_zoom_thread(struct hist_browser *browser, struct popup_action *act) in do_zoom_thread() argument
2514 if ((!hists__has(browser->hists, thread) && in do_zoom_thread()
2515 !hists__has(browser->hists, comm)) || thread == NULL) in do_zoom_thread()
2518 if (browser->hists->thread_filter) { in do_zoom_thread()
2519 pstack__remove(browser->pstack, &browser->hists->thread_filter); in do_zoom_thread()
2521 thread__zput(browser->hists->thread_filter); in do_zoom_thread()
2524 if (hists__has(browser->hists, thread)) { in do_zoom_thread()
2533 browser->hists->thread_filter = thread__get(thread); in do_zoom_thread()
2535 pstack__push(browser->pstack, &browser->hists->thread_filter); in do_zoom_thread()
2538 hists__filter_by_thread(browser->hists); in do_zoom_thread()
2539 hist_browser__reset(browser); in do_zoom_thread()
2544 add_thread_opt(struct hist_browser *browser, struct popup_action *act, in add_thread_opt() argument
2549 if ((!hists__has(browser->hists, thread) && in add_thread_opt()
2550 !hists__has(browser->hists, comm)) || thread == NULL) in add_thread_opt()
2553 if (hists__has(browser->hists, thread)) { in add_thread_opt()
2555 browser->hists->thread_filter ? "out of" : "into", in add_thread_opt()
2560 browser->hists->thread_filter ? "out of" : "into", in add_thread_opt()
2571 static int hists_browser__zoom_map(struct hist_browser *browser, struct map *map) in hists_browser__zoom_map() argument
2573 if (!hists__has(browser->hists, dso) || map == NULL) in hists_browser__zoom_map()
2576 if (browser->hists->dso_filter) { in hists_browser__zoom_map()
2577 pstack__remove(browser->pstack, &browser->hists->dso_filter); in hists_browser__zoom_map()
2579 browser->hists->dso_filter = NULL; in hists_browser__zoom_map()
2584 browser->hists->dso_filter = map->dso; in hists_browser__zoom_map()
2586 pstack__push(browser->pstack, &browser->hists->dso_filter); in hists_browser__zoom_map()
2589 hists__filter_by_dso(browser->hists); in hists_browser__zoom_map()
2590 hist_browser__reset(browser); in hists_browser__zoom_map()
2595 do_zoom_dso(struct hist_browser *browser, struct popup_action *act) in do_zoom_dso() argument
2597 return hists_browser__zoom_map(browser, act->ms.map); in do_zoom_dso()
2601 add_dso_opt(struct hist_browser *browser, struct popup_action *act, in add_dso_opt() argument
2604 if (!hists__has(browser->hists, dso) || map == NULL) in add_dso_opt()
2608 browser->hists->dso_filter ? "out of" : "into", in add_dso_opt()
2617 static int do_toggle_callchain(struct hist_browser *browser, struct popup_action *act __maybe_unuse… in do_toggle_callchain() argument
2619 hist_browser__toggle_fold(browser); in do_toggle_callchain()
2623 static int add_callchain_toggle_opt(struct hist_browser *browser, struct popup_action *act, char **… in add_callchain_toggle_opt() argument
2627 if (!hist_browser__selection_has_children(browser)) in add_callchain_toggle_opt()
2631 hist_browser__selection_unfolded(browser) ? "Collapse" : "Expand", in add_callchain_toggle_opt()
2632 hist_browser__selection_sym_name(browser, sym_name, sizeof(sym_name))) < 0) in add_callchain_toggle_opt()
2640 do_browse_map(struct hist_browser *browser __maybe_unused, in do_browse_map()
2648 add_map_opt(struct hist_browser *browser, in add_map_opt() argument
2651 if (!hists__has(browser->hists, dso) || map == NULL) in add_map_opt()
2663 do_run_script(struct hist_browser *browser __maybe_unused, in do_run_script()
2708 do_res_sample_script(struct hist_browser *browser __maybe_unused, in do_res_sample_script()
2713 he = hist_browser__selected_entry(browser); in do_res_sample_script()
2719 add_script_opt_2(struct hist_browser *browser __maybe_unused, in add_script_opt_2()
2746 add_script_opt(struct hist_browser *browser, in add_script_opt() argument
2754 n = add_script_opt_2(browser, act, optstr, thread, sym, evsel, ""); in add_script_opt()
2756 he = hist_browser__selected_entry(browser); in add_script_opt()
2768 n += add_script_opt_2(browser, act, optstr, thread, sym, in add_script_opt()
2776 add_res_sample_opt(struct hist_browser *browser __maybe_unused, in add_res_sample_opt()
2797 do_switch_data(struct hist_browser *browser __maybe_unused, in do_switch_data()
2810 add_switch_opt(struct hist_browser *browser, in add_switch_opt() argument
2813 if (!is_report_browser(browser->hbt)) in add_switch_opt()
2824 do_exit_browser(struct hist_browser *browser __maybe_unused, in do_exit_browser()
2831 add_exit_opt(struct hist_browser *browser __maybe_unused, in add_exit_opt()
2842 do_zoom_socket(struct hist_browser *browser, struct popup_action *act) in do_zoom_socket() argument
2844 if (!hists__has(browser->hists, socket) || act->socket < 0) in do_zoom_socket()
2847 if (browser->hists->socket_filter > -1) { in do_zoom_socket()
2848 pstack__remove(browser->pstack, &browser->hists->socket_filter); in do_zoom_socket()
2849 browser->hists->socket_filter = -1; in do_zoom_socket()
2852 browser->hists->socket_filter = act->socket; in do_zoom_socket()
2854 pstack__push(browser->pstack, &browser->hists->socket_filter); in do_zoom_socket()
2857 hists__filter_by_socket(browser->hists); in do_zoom_socket()
2858 hist_browser__reset(browser); in do_zoom_socket()
2863 add_socket_opt(struct hist_browser *browser, struct popup_action *act, in add_socket_opt() argument
2866 if (!hists__has(browser->hists, socket) || socket_id < 0) in add_socket_opt()
2870 (browser->hists->socket_filter > -1) ? "out of" : "into", in add_socket_opt()
2946 struct hist_browser *browser = perf_evsel_browser__new(evsel, hbt, env, annotation_opts); in evsel__hists_browse() local
2997 if (browser == NULL) in evsel__hists_browse()
3005 browser->min_pcnt = min_pcnt; in evsel__hists_browse()
3006 hist_browser__update_nr_entries(browser); in evsel__hists_browse()
3008 browser->pstack = pstack__new(3); in evsel__hists_browse()
3009 if (browser->pstack == NULL) in evsel__hists_browse()
3021 browser->b.no_samples_msg = "Collecting samples..."; in evsel__hists_browse()
3032 key = hist_browser__run(browser, helpline, warn_lost_event, key); in evsel__hists_browse()
3034 if (browser->he_selection != NULL) { in evsel__hists_browse()
3035 thread = hist_browser__selected_thread(browser); in evsel__hists_browse()
3036 map = browser->selection->map; in evsel__hists_browse()
3037 socked_id = browser->he_selection->socket; in evsel__hists_browse()
3076 ui_browser__warning(&browser->b, delay_secs * 2, in evsel__hists_browse()
3082 if (!browser->selection || in evsel__hists_browse()
3083 !browser->selection->map || in evsel__hists_browse()
3084 !browser->selection->map->dso || in evsel__hists_browse()
3085 browser->selection->map->dso->annotate_warned) { in evsel__hists_browse()
3089 if (!browser->selection->sym) { in evsel__hists_browse()
3090 if (!browser->he_selection) in evsel__hists_browse()
3094 bi = browser->he_selection->branch_info; in evsel__hists_browse()
3101 actions->ms.sym = symbol__new_unresolved(browser->he_selection->ip, in evsel__hists_browse()
3102 browser->selection->map); in evsel__hists_browse()
3103 actions->ms.map = browser->selection->map; in evsel__hists_browse()
3109 if (symbol__annotation(browser->selection->sym)->src == NULL) { in evsel__hists_browse()
3110 ui_browser__warning(&browser->b, delay_secs * 2, in evsel__hists_browse()
3113 browser->selection->sym->name); in evsel__hists_browse()
3117 actions->ms.map = browser->selection->map; in evsel__hists_browse()
3118 actions->ms.sym = browser->selection->sym; in evsel__hists_browse()
3121 do_annotate(browser, actions); in evsel__hists_browse()
3124 hist_browser__dump(browser); in evsel__hists_browse()
3128 do_zoom_dso(browser, actions); in evsel__hists_browse()
3131 if (browser->selection != NULL) in evsel__hists_browse()
3132 hists_browser__zoom_map(browser, browser->selection->maps->machine->vmlinux_map); in evsel__hists_browse()
3136 browser->show_dso = verbose > 0; in evsel__hists_browse()
3142 do_zoom_thread(browser, actions); in evsel__hists_browse()
3146 do_zoom_socket(browser, actions); in evsel__hists_browse()
3156 hist_browser__reset(browser); in evsel__hists_browse()
3163 do_run_script(browser, actions); in evsel__hists_browse()
3168 key = do_switch_data(browser, actions); in evsel__hists_browse()
3197 ui_browser__warning(&browser->b, delay_secs * 2, in evsel__hists_browse()
3202 hist_browser__update_percent_limit(browser, new_percent); in evsel__hists_browse()
3203 hist_browser__reset(browser); in evsel__hists_browse()
3209 ui_browser__help_window(&browser->b, in evsel__hists_browse()
3221 if (pstack__empty(browser->pstack)) { in evsel__hists_browse()
3229 ui_browser__dialog_yesno(&browser->b, in evsel__hists_browse()
3236 top = pstack__peek(browser->pstack); in evsel__hists_browse()
3237 if (top == &browser->hists->dso_filter) { in evsel__hists_browse()
3243 do_zoom_dso(browser, actions); in evsel__hists_browse()
3244 } else if (top == &browser->hists->thread_filter) { in evsel__hists_browse()
3245 do_zoom_thread(browser, actions); in evsel__hists_browse()
3246 } else if (top == &browser->hists->socket_filter) { in evsel__hists_browse()
3247 do_zoom_socket(browser, actions); in evsel__hists_browse()
3278 if (!hists__has(hists, sym) || browser->selection == NULL) in evsel__hists_browse()
3283 if (browser->he_selection) in evsel__hists_browse()
3284 bi = browser->he_selection->branch_info; in evsel__hists_browse()
3289 nr_options += add_annotate_opt(browser, in evsel__hists_browse()
3295 nr_options += add_annotate_opt(browser, in evsel__hists_browse()
3301 nr_options += add_annotate_opt(browser, in evsel__hists_browse()
3304 browser->selection, in evsel__hists_browse()
3305 browser->he_selection->ip); in evsel__hists_browse()
3308 nr_options += add_thread_opt(browser, &actions[nr_options], in evsel__hists_browse()
3310 nr_options += add_dso_opt(browser, &actions[nr_options], in evsel__hists_browse()
3312 nr_options += add_callchain_toggle_opt(browser, &actions[nr_options], &options[nr_options]); in evsel__hists_browse()
3313 nr_options += add_map_opt(browser, &actions[nr_options], in evsel__hists_browse()
3315 browser->selection ? in evsel__hists_browse()
3316 browser->selection->map : NULL); in evsel__hists_browse()
3317 nr_options += add_socket_opt(browser, &actions[nr_options], in evsel__hists_browse()
3324 if (browser->he_selection) { in evsel__hists_browse()
3326 nr_options += add_script_opt(browser, in evsel__hists_browse()
3340 if (hists__has(hists, sym) && browser->selection->sym) { in evsel__hists_browse()
3341 nr_options += add_script_opt(browser, in evsel__hists_browse()
3344 NULL, browser->selection->sym, in evsel__hists_browse()
3348 nr_options += add_script_opt(browser, &actions[nr_options], in evsel__hists_browse()
3350 nr_options += add_res_sample_opt(browser, &actions[nr_options], in evsel__hists_browse()
3352 hist_browser__selected_res_sample(browser), in evsel__hists_browse()
3354 nr_options += add_res_sample_opt(browser, &actions[nr_options], in evsel__hists_browse()
3356 hist_browser__selected_res_sample(browser), in evsel__hists_browse()
3358 nr_options += add_res_sample_opt(browser, &actions[nr_options], in evsel__hists_browse()
3360 hist_browser__selected_res_sample(browser), in evsel__hists_browse()
3362 nr_options += add_switch_opt(browser, &actions[nr_options], in evsel__hists_browse()
3365 nr_options += add_exit_opt(browser, &actions[nr_options], in evsel__hists_browse()
3379 key = act->fn(browser, act); in evsel__hists_browse()
3386 pstack__delete(browser->pstack); in evsel__hists_browse()
3388 hist_browser__delete(browser); in evsel__hists_browse()
3402 static void perf_evsel_menu__write(struct ui_browser *browser, in perf_evsel_menu__write() argument
3405 struct evsel_menu *menu = container_of(browser, in perf_evsel_menu__write()
3409 bool current_entry = ui_browser__is_current_entry(browser, row); in perf_evsel_menu__write()
3416 ui_browser__set_color(browser, current_entry ? HE_COLORSET_SELECTED : in perf_evsel_menu__write()
3433 ui_browser__printf(browser, "%s", bf); in perf_evsel_menu__write()
3439 ui_browser__set_color(browser, HE_COLORSET_TOP); in perf_evsel_menu__write()
3446 ui_browser__write_nstring(browser, warn, browser->width - printed); in perf_evsel_menu__write()
3542 static bool filter_group_entries(struct ui_browser *browser __maybe_unused, in filter_group_entries()
3636 static int block_hists_browser__title(struct hist_browser *browser, char *bf, in block_hists_browser__title() argument
3639 struct hists *hists = evsel__hists(browser->block_evsel); in block_hists_browser__title()
3640 const char *evname = evsel__name(browser->block_evsel); in block_hists_browser__title()
3656 struct hist_browser *browser; in block_hists_tui_browse() local
3662 browser = hist_browser__new(hists); in block_hists_tui_browse()
3663 if (!browser) in block_hists_tui_browse()
3666 browser->block_evsel = evsel; in block_hists_tui_browse()
3667 browser->title = block_hists_browser__title; in block_hists_tui_browse()
3668 browser->min_pcnt = min_percent; in block_hists_tui_browse()
3669 browser->env = env; in block_hists_tui_browse()
3670 browser->annotation_opts = annotation_opts; in block_hists_tui_browse()
3679 key = hist_browser__run(browser, "? - help", true, 0); in block_hists_tui_browse()
3685 ui_browser__help_window(&browser->b, help); in block_hists_tui_browse()
3689 if (!browser->selection || in block_hists_tui_browse()
3690 !browser->selection->sym) { in block_hists_tui_browse()
3694 action.ms.map = browser->selection->map; in block_hists_tui_browse()
3695 action.ms.sym = browser->selection->sym; in block_hists_tui_browse()
3696 do_annotate(browser, &action); in block_hists_tui_browse()
3704 hist_browser__delete(browser); in block_hists_tui_browse()