Lines Matching refs:browser

51 static int hists_browser__scnprintf_title(struct hist_browser *browser, char *bf, size_t size);
62 static int hist_browser__get_folding(struct hist_browser *browser) in hist_browser__get_folding() argument
65 struct hists *hists = browser->hists; in hist_browser__get_folding()
69 (nd = hists__filter_entries(nd, browser->min_pcnt)) != NULL; in hist_browser__get_folding()
82 struct ui_browser *browser = &hb->b; in hist_browser__set_title_space() local
86 browser->extra_title_lines = hb->show_headers ? hpp_list->nr_header_lines : 0; in hist_browser__set_title_space()
106 struct ui_browser *browser = &hb->b; in hist_browser__update_rows() local
112 browser->rows += browser->extra_title_lines; in hist_browser__update_rows()
113 browser->extra_title_lines = 0; in hist_browser__update_rows()
117 browser->extra_title_lines = hpp_list->nr_header_lines; in hist_browser__update_rows()
118 browser->rows -= browser->extra_title_lines; in hist_browser__update_rows()
123 index_row = browser->index - browser->top_idx; in hist_browser__update_rows()
124 if (index_row >= browser->rows) in hist_browser__update_rows()
125 browser->index -= index_row - browser->rows + 1; in hist_browser__update_rows()
128 static void hist_browser__refresh_dimensions(struct ui_browser *browser) in hist_browser__refresh_dimensions() argument
130 struct hist_browser *hb = container_of(browser, struct hist_browser, b); in hist_browser__refresh_dimensions()
133 browser->width = 3 + (hists__sort_list_width(hb->hists) + sizeof("[k]")); in hist_browser__refresh_dimensions()
140 ui_browser__refresh_dimensions(browser); in hist_browser__refresh_dimensions()
143 static void hist_browser__reset(struct hist_browser *browser) in hist_browser__reset() argument
149 browser->nr_callchain_rows = 0; in hist_browser__reset()
151 hist_browser__update_nr_entries(browser); in hist_browser__reset()
152 browser->b.nr_entries = hist_browser__nr_entries(browser); in hist_browser__reset()
153 hist_browser__refresh_dimensions(&browser->b); in hist_browser__reset()
154 ui_browser__reset_index(&browser->b); in hist_browser__reset()
397 static bool hist_browser__selection_has_children(struct hist_browser *browser) in hist_browser__selection_has_children() argument
399 struct hist_entry *he = browser->he_selection; in hist_browser__selection_has_children()
400 struct map_symbol *ms = browser->selection; in hist_browser__selection_has_children()
411 static bool hist_browser__selection_unfolded(struct hist_browser *browser) in hist_browser__selection_unfolded() argument
413 struct hist_entry *he = browser->he_selection; in hist_browser__selection_unfolded()
414 struct map_symbol *ms = browser->selection; in hist_browser__selection_unfolded()
425 static char *hist_browser__selection_sym_name(struct hist_browser *browser, char *bf, size_t size) in hist_browser__selection_sym_name() argument
427 struct hist_entry *he = browser->he_selection; in hist_browser__selection_sym_name()
428 struct map_symbol *ms = browser->selection; in hist_browser__selection_sym_name()
440 return callchain_list__sym_name(callchain_entry, bf, size, browser->show_dso); in hist_browser__selection_sym_name()
443 static bool hist_browser__toggle_fold(struct hist_browser *browser) in hist_browser__toggle_fold() argument
445 struct hist_entry *he = browser->he_selection; in hist_browser__toggle_fold()
446 struct map_symbol *ms = browser->selection; in hist_browser__toggle_fold()
462 browser->b.nr_entries -= he->nr_rows; in hist_browser__toggle_fold()
465 browser->nr_callchain_rows -= he->nr_rows; in hist_browser__toggle_fold()
467 browser->nr_hierarchy_entries -= he->nr_rows; in hist_browser__toggle_fold()
470 child_rows = hierarchy_count_rows(browser, he, true); in hist_browser__toggle_fold()
477 he->nr_rows = hierarchy_count_rows(browser, he, false); in hist_browser__toggle_fold()
481 browser->b.nr_entries += child_rows - he->nr_rows; in hist_browser__toggle_fold()
489 browser->b.nr_entries -= child_rows - he->nr_rows; in hist_browser__toggle_fold()
497 browser->b.nr_entries += he->nr_rows; in hist_browser__toggle_fold()
500 browser->nr_callchain_rows += he->nr_rows; in hist_browser__toggle_fold()
502 browser->nr_hierarchy_entries += he->nr_rows; in hist_browser__toggle_fold()
603 __hist_browser__set_folding(struct hist_browser *browser, bool unfold) in __hist_browser__set_folding() argument
609 nd = rb_first_cached(&browser->hists->entries); in __hist_browser__set_folding()
616 hist_entry__set_folding(he, browser, unfold); in __hist_browser__set_folding()
619 if (he->filtered || percent < browser->min_pcnt) in __hist_browser__set_folding()
623 browser->nr_hierarchy_entries++; in __hist_browser__set_folding()
625 browser->nr_callchain_rows += he->nr_rows; in __hist_browser__set_folding()
626 else if (unfold && !hist_entry__has_hierarchy_children(he, browser->min_pcnt)) { in __hist_browser__set_folding()
627 browser->nr_hierarchy_entries++; in __hist_browser__set_folding()
635 static void hist_browser__set_folding(struct hist_browser *browser, bool unfold) in hist_browser__set_folding() argument
637 browser->nr_hierarchy_entries = 0; in hist_browser__set_folding()
638 browser->nr_callchain_rows = 0; in hist_browser__set_folding()
639 __hist_browser__set_folding(browser, unfold); in hist_browser__set_folding()
641 browser->b.nr_entries = hist_browser__nr_entries(browser); in hist_browser__set_folding()
643 ui_browser__reset_index(&browser->b); in hist_browser__set_folding()
646 static void hist_browser__set_folding_selected(struct hist_browser *browser, bool unfold) in hist_browser__set_folding_selected() argument
648 if (!browser->he_selection) in hist_browser__set_folding_selected()
651 if (unfold == browser->he_selection->unfolded) in hist_browser__set_folding_selected()
654 hist_browser__toggle_fold(browser); in hist_browser__set_folding_selected()
657 static void ui_browser__warn_lost_events(struct ui_browser *browser) in ui_browser__warn_lost_events() argument
659 ui_browser__warning(browser, 4, in ui_browser__warn_lost_events()
666 static int hist_browser__title(struct hist_browser *browser, char *bf, size_t size) in hist_browser__title() argument
668 return browser->title ? browser->title(browser, bf, size) : 0; in hist_browser__title()
671 static int hist_browser__handle_hotkey(struct hist_browser *browser, bool warn_lost_event, char *ti… in hist_browser__handle_hotkey() argument
675 struct hist_browser_timer *hbt = browser->hbt; in hist_browser__handle_hotkey()
676 struct evsel *evsel = hists_to_evsel(browser->hists); in hist_browser__handle_hotkey()
684 if (hist_browser__has_filter(browser) || symbol_conf.report_hierarchy) in hist_browser__handle_hotkey()
685 hist_browser__update_nr_entries(browser); in hist_browser__handle_hotkey()
687 nr_entries = hist_browser__nr_entries(browser); in hist_browser__handle_hotkey()
688 ui_browser__update_nr_entries(&browser->b, nr_entries); in hist_browser__handle_hotkey()
695 ui_browser__warn_lost_events(&browser->b); in hist_browser__handle_hotkey()
698 hist_browser__title(browser, title, size); in hist_browser__handle_hotkey()
699 ui_browser__show_title(&browser->b, title); in hist_browser__handle_hotkey()
703 struct hist_entry *h = rb_entry(browser->b.top, struct hist_entry, rb_node); in hist_browser__handle_hotkey()
708 seq++, browser->b.nr_entries, browser->hists->nr_entries, in hist_browser__handle_hotkey()
709 browser->b.extra_title_lines, browser->b.rows, in hist_browser__handle_hotkey()
710 browser->b.index, browser->b.top_idx, h->row_offset, h->nr_rows); in hist_browser__handle_hotkey()
715 hist_browser__set_folding(browser, false); in hist_browser__handle_hotkey()
719 hist_browser__set_folding_selected(browser, false); in hist_browser__handle_hotkey()
723 hist_browser__set_folding(browser, true); in hist_browser__handle_hotkey()
727 hist_browser__toggle_fold(browser); in hist_browser__handle_hotkey()
730 browser->show_headers = !browser->show_headers; in hist_browser__handle_hotkey()
731 hist_browser__update_rows(browser); in hist_browser__handle_hotkey()
734 if (hist_browser__toggle_fold(browser)) in hist_browser__handle_hotkey()
744 int hist_browser__run(struct hist_browser *browser, const char *help, in hist_browser__run() argument
748 struct hist_browser_timer *hbt = browser->hbt; in hist_browser__run()
751 browser->b.entries = &browser->hists->entries; in hist_browser__run()
752 browser->b.nr_entries = hist_browser__nr_entries(browser); in hist_browser__run()
754 hist_browser__title(browser, title, sizeof(title)); in hist_browser__run()
756 if (ui_browser__show(&browser->b, title, "%s", help) < 0) in hist_browser__run()
759 if (key && hist_browser__handle_hotkey(browser, warn_lost_event, title, sizeof(title), key)) in hist_browser__run()
763 key = ui_browser__run(&browser->b, delay_secs); in hist_browser__run()
765 if (hist_browser__handle_hotkey(browser, warn_lost_event, title, sizeof(title), key)) in hist_browser__run()
769 ui_browser__hide(&browser->b); in hist_browser__run()
783 typedef void (*print_callchain_entry_fn)(struct hist_browser *browser,
789 static void hist_browser__show_callchain_entry(struct hist_browser *browser, in hist_browser__show_callchain_entry() argument
797 bool show_annotated = browser->show_dso && chain->ms.sym && symbol__annotation(chain->ms.sym)->src; in hist_browser__show_callchain_entry()
800 width = browser->b.width - (offset + 2); in hist_browser__show_callchain_entry()
801 if (ui_browser__is_current_entry(&browser->b, row)) { in hist_browser__show_callchain_entry()
802 browser->selection = &chain->ms; in hist_browser__show_callchain_entry()
807 ui_browser__set_color(&browser->b, color); in hist_browser__show_callchain_entry()
808 ui_browser__gotorc(&browser->b, row, 0); in hist_browser__show_callchain_entry()
809 ui_browser__write_nstring(&browser->b, " ", offset); in hist_browser__show_callchain_entry()
810 ui_browser__printf(&browser->b, "%c", folded_sign); in hist_browser__show_callchain_entry()
811 ui_browser__write_graph(&browser->b, show_annotated ? SLSMG_RARROW_CHAR : ' '); in hist_browser__show_callchain_entry()
812 ui_browser__write_nstring(&browser->b, str, width); in hist_browser__show_callchain_entry()
827 typedef bool (*check_output_full_fn)(struct hist_browser *browser,
830 static bool hist_browser__check_output_full(struct hist_browser *browser, in hist_browser__check_output_full() argument
833 return browser->b.rows == row; in hist_browser__check_output_full()
836 static bool hist_browser__check_dump_full(struct hist_browser *browser __maybe_unused, in hist_browser__check_dump_full()
844 static int hist_browser__show_callchain_list(struct hist_browser *browser, in hist_browser__show_callchain_list() argument
866 browser->show_dso); in hist_browser__show_callchain_list()
888 print(browser, chain, str, offset, row, arg); in hist_browser__show_callchain_list()
909 static int hist_browser__show_callchain_flat(struct hist_browser *browser, in hist_browser__show_callchain_flat() argument
942 row += hist_browser__show_callchain_list(browser, child, in hist_browser__show_callchain_flat()
948 if (is_output_full(browser, row)) in hist_browser__show_callchain_flat()
965 row += hist_browser__show_callchain_list(browser, child, in hist_browser__show_callchain_flat()
971 if (is_output_full(browser, row)) in hist_browser__show_callchain_flat()
979 if (is_output_full(browser, row)) in hist_browser__show_callchain_flat()
987 static char *hist_browser__folded_callchain_str(struct hist_browser *browser, in hist_browser__folded_callchain_str() argument
996 browser->show_dso); in hist_browser__folded_callchain_str()
1013 static int hist_browser__show_callchain_folded(struct hist_browser *browser, in hist_browser__show_callchain_folded() argument
1053 chain_str = hist_browser__folded_callchain_str(browser, in hist_browser__show_callchain_folded()
1069 chain_str = hist_browser__folded_callchain_str(browser, in hist_browser__show_callchain_folded()
1085 print(browser, first_chain, chain_str, offset, row++, arg); in hist_browser__show_callchain_folded()
1090 if (is_output_full(browser, row)) in hist_browser__show_callchain_folded()
1098 static int hist_browser__show_callchain_graph(struct hist_browser *browser, in hist_browser__show_callchain_graph() argument
1135 row += hist_browser__show_callchain_list(browser, child, in hist_browser__show_callchain_graph()
1141 if (is_output_full(browser, row)) in hist_browser__show_callchain_graph()
1151 row += hist_browser__show_callchain_graph(browser, &child->rb_root, in hist_browser__show_callchain_graph()
1156 if (is_output_full(browser, row)) in hist_browser__show_callchain_graph()
1164 static int hist_browser__show_callchain(struct hist_browser *browser, in hist_browser__show_callchain() argument
1181 printed = hist_browser__show_callchain_flat(browser, in hist_browser__show_callchain()
1186 printed = hist_browser__show_callchain_folded(browser, in hist_browser__show_callchain()
1191 printed = hist_browser__show_callchain_graph(browser, in hist_browser__show_callchain()
1198 browser->he_selection = entry; in hist_browser__show_callchain()
1296 static int hist_browser__show_entry(struct hist_browser *browser, in hist_browser__show_entry() argument
1301 int width = browser->b.width; in hist_browser__show_entry()
1303 bool current_entry = ui_browser__is_current_entry(&browser->b, row); in hist_browser__show_entry()
1310 browser->he_selection = entry; in hist_browser__show_entry()
1311 browser->selection = &entry->ms; in hist_browser__show_entry()
1321 .b = &browser->b, in hist_browser__show_entry()
1327 ui_browser__gotorc(&browser->b, row, 0); in hist_browser__show_entry()
1329 hists__for_each_format(browser->hists, fmt) { in hist_browser__show_entry()
1338 column++ < browser->b.horiz_scroll) in hist_browser__show_entry()
1341 if (current_entry && browser->b.navkeypressed) { in hist_browser__show_entry()
1342 ui_browser__set_color(&browser->b, in hist_browser__show_entry()
1345 ui_browser__set_color(&browser->b, in hist_browser__show_entry()
1351 ui_browser__printf(&browser->b, "%c ", folded_sign); in hist_browser__show_entry()
1356 ui_browser__printf(&browser->b, " "); in hist_browser__show_entry()
1367 ui_browser__printf(&browser->b, "%s", s + ret); in hist_browser__show_entry()
1370 ui_browser__printf(&browser->b, "%s", s); in hist_browser__show_entry()
1376 if (!browser->b.navkeypressed) in hist_browser__show_entry()
1379 ui_browser__write_nstring(&browser->b, "", width); in hist_browser__show_entry()
1386 if (folded_sign == '-' && row != browser->b.rows) { in hist_browser__show_entry()
1392 printed += hist_browser__show_callchain(browser, in hist_browser__show_entry()
1402 static int hist_browser__show_hierarchy_entry(struct hist_browser *browser, in hist_browser__show_hierarchy_entry() argument
1408 int width = browser->b.width; in hist_browser__show_hierarchy_entry()
1410 bool current_entry = ui_browser__is_current_entry(&browser->b, row); in hist_browser__show_hierarchy_entry()
1416 .b = &browser->b, in hist_browser__show_hierarchy_entry()
1423 browser->he_selection = entry; in hist_browser__show_hierarchy_entry()
1424 browser->selection = &entry->ms; in hist_browser__show_hierarchy_entry()
1436 ui_browser__gotorc(&browser->b, row, 0); in hist_browser__show_hierarchy_entry()
1438 if (current_entry && browser->b.navkeypressed) in hist_browser__show_hierarchy_entry()
1439 ui_browser__set_color(&browser->b, HE_COLORSET_SELECTED); in hist_browser__show_hierarchy_entry()
1441 ui_browser__set_color(&browser->b, HE_COLORSET_NORMAL); in hist_browser__show_hierarchy_entry()
1443 ui_browser__write_nstring(&browser->b, "", level * HIERARCHY_INDENT); in hist_browser__show_hierarchy_entry()
1458 column++ < browser->b.horiz_scroll) in hist_browser__show_hierarchy_entry()
1461 if (current_entry && browser->b.navkeypressed) { in hist_browser__show_hierarchy_entry()
1462 ui_browser__set_color(&browser->b, in hist_browser__show_hierarchy_entry()
1465 ui_browser__set_color(&browser->b, in hist_browser__show_hierarchy_entry()
1470 ui_browser__printf(&browser->b, "%c ", folded_sign); in hist_browser__show_hierarchy_entry()
1474 ui_browser__printf(&browser->b, " "); in hist_browser__show_hierarchy_entry()
1485 ui_browser__printf(&browser->b, "%s", s + ret); in hist_browser__show_hierarchy_entry()
1489 ui_browser__printf(&browser->b, "%s", s); in hist_browser__show_hierarchy_entry()
1495 ui_browser__write_nstring(&browser->b, "", hierarchy_indent); in hist_browser__show_hierarchy_entry()
1499 if (column >= browser->b.horiz_scroll) { in hist_browser__show_hierarchy_entry()
1507 if (current_entry && browser->b.navkeypressed) { in hist_browser__show_hierarchy_entry()
1508 ui_browser__set_color(&browser->b, in hist_browser__show_hierarchy_entry()
1511 ui_browser__set_color(&browser->b, in hist_browser__show_hierarchy_entry()
1517 ui_browser__printf(&browser->b, "%c ", folded_sign); in hist_browser__show_hierarchy_entry()
1520 ui_browser__write_nstring(&browser->b, "", 2); in hist_browser__show_hierarchy_entry()
1536 ui_browser__printf(&browser->b, "%s", skip_spaces(s)); in hist_browser__show_hierarchy_entry()
1545 if (!browser->b.navkeypressed) in hist_browser__show_hierarchy_entry()
1548 ui_browser__write_nstring(&browser->b, "", width); in hist_browser__show_hierarchy_entry()
1554 if (entry->leaf && folded_sign == '-' && row != browser->b.rows) { in hist_browser__show_hierarchy_entry()
1559 printed += hist_browser__show_callchain(browser, entry, in hist_browser__show_hierarchy_entry()
1568 static int hist_browser__show_no_entry(struct hist_browser *browser, in hist_browser__show_no_entry() argument
1571 int width = browser->b.width; in hist_browser__show_no_entry()
1572 bool current_entry = ui_browser__is_current_entry(&browser->b, row); in hist_browser__show_no_entry()
1578 int indent = browser->hists->nr_hpp_node - 2; in hist_browser__show_no_entry()
1581 browser->he_selection = NULL; in hist_browser__show_no_entry()
1582 browser->selection = NULL; in hist_browser__show_no_entry()
1585 ui_browser__gotorc(&browser->b, row, 0); in hist_browser__show_no_entry()
1587 if (current_entry && browser->b.navkeypressed) in hist_browser__show_no_entry()
1588 ui_browser__set_color(&browser->b, HE_COLORSET_SELECTED); in hist_browser__show_no_entry()
1590 ui_browser__set_color(&browser->b, HE_COLORSET_NORMAL); in hist_browser__show_no_entry()
1592 ui_browser__write_nstring(&browser->b, "", level * HIERARCHY_INDENT); in hist_browser__show_no_entry()
1596 fmt_node = list_first_entry(&browser->hists->hpp_formats, in hist_browser__show_no_entry()
1599 if (perf_hpp__should_skip(fmt, browser->hists) || in hist_browser__show_no_entry()
1600 column++ < browser->b.horiz_scroll) in hist_browser__show_no_entry()
1603 ret = fmt->width(fmt, NULL, browser->hists); in hist_browser__show_no_entry()
1614 ui_browser__write_nstring(&browser->b, "", ret); in hist_browser__show_no_entry()
1618 ui_browser__write_nstring(&browser->b, "", indent * HIERARCHY_INDENT); in hist_browser__show_no_entry()
1621 if (column >= browser->b.horiz_scroll) { in hist_browser__show_no_entry()
1624 ret = snprintf(buf, sizeof(buf), "no entry >= %.2f%%", browser->min_pcnt); in hist_browser__show_no_entry()
1625 ui_browser__printf(&browser->b, " %s", buf); in hist_browser__show_no_entry()
1630 if (!browser->b.navkeypressed) in hist_browser__show_no_entry()
1633 ui_browser__write_nstring(&browser->b, "", width); in hist_browser__show_no_entry()
1644 hists_browser__scnprintf_headers(struct hist_browser *browser, char *buf, in hists_browser__scnprintf_headers() argument
1647 struct hists *hists = browser->hists; in hists_browser__scnprintf_headers()
1663 hists__for_each_format(browser->hists, fmt) { in hists_browser__scnprintf_headers()
1664 if (perf_hpp__should_skip(fmt, hists) || column++ < browser->b.horiz_scroll) in hists_browser__scnprintf_headers()
1682 static int hists_browser__scnprintf_hierarchy_headers(struct hist_browser *browser, char *buf, size… in hists_browser__scnprintf_hierarchy_headers() argument
1684 struct hists *hists = browser->hists; in hists_browser__scnprintf_hierarchy_headers()
1705 if (column++ < browser->b.horiz_scroll) in hists_browser__scnprintf_hierarchy_headers()
1766 static void hists_browser__hierarchy_headers(struct hist_browser *browser) in hists_browser__hierarchy_headers() argument
1770 hists_browser__scnprintf_hierarchy_headers(browser, headers, in hists_browser__hierarchy_headers()
1773 ui_browser__gotorc_title(&browser->b, 0, 0); in hists_browser__hierarchy_headers()
1774 ui_browser__set_color(&browser->b, HE_COLORSET_ROOT); in hists_browser__hierarchy_headers()
1775 ui_browser__write_nstring(&browser->b, headers, browser->b.width + 1); in hists_browser__hierarchy_headers()
1778 static void hists_browser__headers(struct hist_browser *browser) in hists_browser__headers() argument
1780 struct hists *hists = browser->hists; in hists_browser__headers()
1788 hists_browser__scnprintf_headers(browser, headers, in hists_browser__headers()
1791 ui_browser__gotorc_title(&browser->b, line, 0); in hists_browser__headers()
1792 ui_browser__set_color(&browser->b, HE_COLORSET_ROOT); in hists_browser__headers()
1793 ui_browser__write_nstring(&browser->b, headers, browser->b.width + 1); in hists_browser__headers()
1797 static void hist_browser__show_headers(struct hist_browser *browser) in hist_browser__show_headers() argument
1800 hists_browser__hierarchy_headers(browser); in hist_browser__show_headers()
1802 hists_browser__headers(browser); in hist_browser__show_headers()
1805 static void ui_browser__hists_init_top(struct ui_browser *browser) in ui_browser__hists_init_top() argument
1807 if (browser->top == NULL) { in ui_browser__hists_init_top()
1810 hb = container_of(browser, struct hist_browser, b); in ui_browser__hists_init_top()
1811 browser->top = rb_first_cached(&hb->hists->entries); in ui_browser__hists_init_top()
1815 static unsigned int hist_browser__refresh(struct ui_browser *browser) in hist_browser__refresh() argument
1819 struct hist_browser *hb = container_of(browser, struct hist_browser, b); in hist_browser__refresh()
1824 ui_browser__hists_init_top(browser); in hist_browser__refresh()
1828 for (nd = browser->top; nd; nd = rb_hierarchy_next(nd)) { in hist_browser__refresh()
1849 if (row == browser->rows) in hist_browser__refresh()
1860 if (row == browser->rows) in hist_browser__refresh()
1906 static void ui_browser__hists_seek(struct ui_browser *browser, in ui_browser__hists_seek() argument
1914 hb = container_of(browser, struct hist_browser, b); in ui_browser__hists_seek()
1916 if (browser->nr_entries == 0) in ui_browser__hists_seek()
1919 ui_browser__hists_init_top(browser); in ui_browser__hists_seek()
1923 nd = hists__filter_entries(rb_first(browser->entries), in ui_browser__hists_seek()
1927 nd = browser->top; in ui_browser__hists_seek()
1930 nd = rb_hierarchy_last(rb_last(browser->entries)); in ui_browser__hists_seek()
1942 h = rb_entry(browser->top, struct hist_entry, rb_node); in ui_browser__hists_seek()
1973 browser->top = nd; in ui_browser__hists_seek()
1982 browser->top = nd; in ui_browser__hists_seek()
1995 browser->top = nd; in ui_browser__hists_seek()
2005 browser->top = nd; in ui_browser__hists_seek()
2016 browser->top = nd; in ui_browser__hists_seek()
2031 browser->top = nd; in ui_browser__hists_seek()
2037 static int hist_browser__fprintf_callchain(struct hist_browser *browser, in hist_browser__fprintf_callchain() argument
2045 hist_browser__show_callchain(browser, he, level, 0, in hist_browser__fprintf_callchain()
2051 static int hist_browser__fprintf_entry(struct hist_browser *browser, in hist_browser__fprintf_entry() argument
2070 hists__for_each_format(browser->hists, fmt) { in hist_browser__fprintf_entry()
2087 printed += hist_browser__fprintf_callchain(browser, he, fp, 1); in hist_browser__fprintf_entry()
2093 static int hist_browser__fprintf_hierarchy_entry(struct hist_browser *browser, in hist_browser__fprintf_hierarchy_entry() argument
2144 printed += hist_browser__fprintf_callchain(browser, he, fp, in hist_browser__fprintf_hierarchy_entry()
2151 static int hist_browser__fprintf(struct hist_browser *browser, FILE *fp) in hist_browser__fprintf() argument
2153 struct rb_node *nd = hists__filter_entries(rb_first(browser->b.entries), in hist_browser__fprintf()
2154 browser->min_pcnt); in hist_browser__fprintf()
2161 printed += hist_browser__fprintf_hierarchy_entry(browser, in hist_browser__fprintf()
2165 printed += hist_browser__fprintf_entry(browser, h, fp); in hist_browser__fprintf()
2169 browser->min_pcnt); in hist_browser__fprintf()
2175 static int hist_browser__dump(struct hist_browser *browser) in hist_browser__dump() argument
2181 scnprintf(filename, sizeof(filename), "perf.hist.%d", browser->print_seq); in hist_browser__dump()
2187 if (++browser->print_seq == 8192) { in hist_browser__dump()
2201 ++browser->print_seq; in hist_browser__dump()
2202 hist_browser__fprintf(browser, fp); in hist_browser__dump()
2209 void hist_browser__init(struct hist_browser *browser, in hist_browser__init() argument
2214 browser->hists = hists; in hist_browser__init()
2215 browser->b.refresh = hist_browser__refresh; in hist_browser__init()
2216 browser->b.refresh_dimensions = hist_browser__refresh_dimensions; in hist_browser__init()
2217 browser->b.seek = ui_browser__hists_seek; in hist_browser__init()
2218 browser->b.use_navkeypressed = true; in hist_browser__init()
2219 browser->show_headers = symbol_conf.show_hist_headers; in hist_browser__init()
2220 hist_browser__set_title_space(browser); in hist_browser__init()
2229 ++browser->b.columns; in hist_browser__init()
2232 ++browser->b.columns; in hist_browser__init()
2235 ++browser->b.columns; in hist_browser__init()
2243 struct hist_browser *browser = zalloc(sizeof(*browser)); in hist_browser__new() local
2245 if (browser) in hist_browser__new()
2246 hist_browser__init(browser, hists); in hist_browser__new()
2248 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()
2263 return browser; in perf_evsel_browser__new()
2266 void hist_browser__delete(struct hist_browser *browser) in hist_browser__delete() argument
2268 free(browser); in hist_browser__delete()
2271 static struct hist_entry *hist_browser__selected_entry(struct hist_browser *browser) in hist_browser__selected_entry() argument
2273 return browser->he_selection; in hist_browser__selected_entry()
2276 static struct thread *hist_browser__selected_thread(struct hist_browser *browser) in hist_browser__selected_thread() argument
2278 return browser->he_selection->thread; in hist_browser__selected_thread()
2281 static struct res_sample *hist_browser__selected_res_sample(struct hist_browser *browser) in hist_browser__selected_res_sample() argument
2283 return browser->he_selection ? browser->he_selection->res_samples : NULL; in hist_browser__selected_res_sample()
2292 static int hists_browser__scnprintf_title(struct hist_browser *browser, char *bf, size_t size) in hists_browser__scnprintf_title() argument
2294 struct hist_browser_timer *hbt = browser->hbt; in hists_browser__scnprintf_title()
2295 int printed = __hists__scnprintf_title(browser->hists, bf, size, !is_report_browser(hbt)); in hists_browser__scnprintf_title()
2419 int (*fn)(struct hist_browser *browser, struct popup_action *act);
2427 do_annotate(struct hist_browser *browser, struct popup_action *act) in do_annotate() argument
2435 perf_env__lookup_objdump(browser->env, &annotate_opts.objdump_path)) in do_annotate()
2442 if (browser->block_evsel) in do_annotate()
2443 evsel = browser->block_evsel; in do_annotate()
2445 evsel = hists_to_evsel(browser->hists); in do_annotate()
2447 err = map_symbol__tui_annotate(&act->ms, evsel, browser->hbt); in do_annotate()
2448 he = hist_browser__selected_entry(browser); in do_annotate()
2456 ui_browser__update_nr_entries(&browser->b, browser->hists->nr_entries); in do_annotate()
2458 ui_browser__handle_resize(&browser->b); in do_annotate()
2485 add_annotate_opt(struct hist_browser *browser __maybe_unused, in add_annotate_opt()
2510 do_annotate_type(struct hist_browser *browser, struct popup_action *act) in do_annotate_type() argument
2512 struct hist_entry *he = browser->he_selection; in do_annotate_type()
2514 hist_entry__annotate_data_tui(he, act->evsel, browser->hbt); in do_annotate_type()
2515 ui_browser__handle_resize(&browser->b); in do_annotate_type()
2520 add_annotate_type_opt(struct hist_browser *browser, in add_annotate_type_opt() argument
2530 act->evsel = hists_to_evsel(browser->hists); in add_annotate_type_opt()
2536 do_zoom_thread(struct hist_browser *browser, struct popup_action *act) in do_zoom_thread() argument
2540 if ((!hists__has(browser->hists, thread) && in do_zoom_thread()
2541 !hists__has(browser->hists, comm)) || thread == NULL) in do_zoom_thread()
2544 if (browser->hists->thread_filter) { in do_zoom_thread()
2545 pstack__remove(browser->pstack, &browser->hists->thread_filter); in do_zoom_thread()
2547 thread__zput(browser->hists->thread_filter); in do_zoom_thread()
2553 if (hists__has(browser->hists, thread)) { in do_zoom_thread()
2561 browser->hists->thread_filter = thread__get(thread); in do_zoom_thread()
2563 pstack__push(browser->pstack, &browser->hists->thread_filter); in do_zoom_thread()
2566 hists__filter_by_thread(browser->hists); in do_zoom_thread()
2567 hist_browser__reset(browser); in do_zoom_thread()
2572 add_thread_opt(struct hist_browser *browser, struct popup_action *act, in add_thread_opt() argument
2578 if ((!hists__has(browser->hists, thread) && in add_thread_opt()
2579 !hists__has(browser->hists, comm)) || thread == NULL) in add_thread_opt()
2582 in_out = browser->hists->thread_filter ? "out of" : "into"; in add_thread_opt()
2584 if (hists__has(browser->hists, thread)) { in add_thread_opt()
2598 static int hists_browser__zoom_map(struct hist_browser *browser, struct map *map) in hists_browser__zoom_map() argument
2600 if (!hists__has(browser->hists, dso) || map == NULL) in hists_browser__zoom_map()
2603 if (browser->hists->dso_filter) { in hists_browser__zoom_map()
2604 pstack__remove(browser->pstack, &browser->hists->dso_filter); in hists_browser__zoom_map()
2606 browser->hists->dso_filter = NULL; in hists_browser__zoom_map()
2612 browser->hists->dso_filter = dso; in hists_browser__zoom_map()
2614 pstack__push(browser->pstack, &browser->hists->dso_filter); in hists_browser__zoom_map()
2617 hists__filter_by_dso(browser->hists); in hists_browser__zoom_map()
2618 hist_browser__reset(browser); in hists_browser__zoom_map()
2623 do_zoom_dso(struct hist_browser *browser, struct popup_action *act) in do_zoom_dso() argument
2625 return hists_browser__zoom_map(browser, act->ms.map); in do_zoom_dso()
2629 add_dso_opt(struct hist_browser *browser, struct popup_action *act, in add_dso_opt() argument
2632 if (!hists__has(browser->hists, dso) || map == NULL) in add_dso_opt()
2636 browser->hists->dso_filter ? "out of" : "into", in add_dso_opt()
2645 static int do_toggle_callchain(struct hist_browser *browser, struct popup_action *act __maybe_unuse… in do_toggle_callchain() argument
2647 hist_browser__toggle_fold(browser); in do_toggle_callchain()
2651 static int add_callchain_toggle_opt(struct hist_browser *browser, struct popup_action *act, char **… in add_callchain_toggle_opt() argument
2655 if (!hist_browser__selection_has_children(browser)) in add_callchain_toggle_opt()
2659 hist_browser__selection_unfolded(browser) ? "Collapse" : "Expand", in add_callchain_toggle_opt()
2660 hist_browser__selection_sym_name(browser, sym_name, sizeof(sym_name))) < 0) in add_callchain_toggle_opt()
2668 do_browse_map(struct hist_browser *browser __maybe_unused, in do_browse_map()
2676 add_map_opt(struct hist_browser *browser, in add_map_opt() argument
2679 if (!hists__has(browser->hists, dso) || map == NULL) in add_map_opt()
2691 do_run_script(struct hist_browser *browser __maybe_unused, in do_run_script()
2736 do_res_sample_script(struct hist_browser *browser __maybe_unused, in do_res_sample_script()
2741 he = hist_browser__selected_entry(browser); in do_res_sample_script()
2747 add_script_opt_2(struct hist_browser *browser __maybe_unused, in add_script_opt_2()
2774 add_script_opt(struct hist_browser *browser, in add_script_opt() argument
2782 n = add_script_opt_2(browser, act, optstr, thread, sym, evsel, ""); in add_script_opt()
2784 he = hist_browser__selected_entry(browser); in add_script_opt()
2796 n += add_script_opt_2(browser, act, optstr, thread, sym, in add_script_opt()
2804 add_res_sample_opt(struct hist_browser *browser __maybe_unused, in add_res_sample_opt()
2825 do_switch_data(struct hist_browser *browser __maybe_unused, in do_switch_data()
2838 add_switch_opt(struct hist_browser *browser, in add_switch_opt() argument
2841 if (!is_report_browser(browser->hbt)) in add_switch_opt()
2852 do_exit_browser(struct hist_browser *browser __maybe_unused, in do_exit_browser()
2859 add_exit_opt(struct hist_browser *browser __maybe_unused, in add_exit_opt()
2870 do_zoom_socket(struct hist_browser *browser, struct popup_action *act) in do_zoom_socket() argument
2872 if (!hists__has(browser->hists, socket) || act->socket < 0) in do_zoom_socket()
2875 if (browser->hists->socket_filter > -1) { in do_zoom_socket()
2876 pstack__remove(browser->pstack, &browser->hists->socket_filter); in do_zoom_socket()
2877 browser->hists->socket_filter = -1; in do_zoom_socket()
2880 browser->hists->socket_filter = act->socket; in do_zoom_socket()
2882 pstack__push(browser->pstack, &browser->hists->socket_filter); in do_zoom_socket()
2885 hists__filter_by_socket(browser->hists); in do_zoom_socket()
2886 hist_browser__reset(browser); in do_zoom_socket()
2891 add_socket_opt(struct hist_browser *browser, struct popup_action *act, in add_socket_opt() argument
2894 if (!hists__has(browser->hists, socket) || socket_id < 0) in add_socket_opt()
2898 (browser->hists->socket_filter > -1) ? "out of" : "into", in add_socket_opt()
2973 struct hist_browser *browser = perf_evsel_browser__new(evsel, hbt, env); in evsel__hists_browse() local
3024 if (browser == NULL) in evsel__hists_browse()
3033 browser->min_pcnt = min_pcnt; in evsel__hists_browse()
3034 hist_browser__update_nr_entries(browser); in evsel__hists_browse()
3036 browser->pstack = pstack__new(3); in evsel__hists_browse()
3037 if (browser->pstack == NULL) in evsel__hists_browse()
3049 browser->b.no_samples_msg = "Collecting samples..."; in evsel__hists_browse()
3060 key = hist_browser__run(browser, helpline, warn_lost_event, key); in evsel__hists_browse()
3062 if (browser->he_selection != NULL) { in evsel__hists_browse()
3063 thread = hist_browser__selected_thread(browser); in evsel__hists_browse()
3064 map = browser->selection->map; in evsel__hists_browse()
3065 socked_id = browser->he_selection->socket; in evsel__hists_browse()
3104 ui_browser__warning(&browser->b, delay_secs * 2, in evsel__hists_browse()
3110 if (!browser->selection || in evsel__hists_browse()
3111 !browser->selection->map || in evsel__hists_browse()
3112 !map__dso(browser->selection->map) || in evsel__hists_browse()
3113 dso__annotate_warned(map__dso(browser->selection->map))) { in evsel__hists_browse()
3117 if (!browser->selection->sym) { in evsel__hists_browse()
3118 if (!browser->he_selection) in evsel__hists_browse()
3122 bi = browser->he_selection->branch_info; in evsel__hists_browse()
3129 actions->ms.sym = symbol__new_unresolved(browser->he_selection->ip, in evsel__hists_browse()
3130 browser->selection->map); in evsel__hists_browse()
3131 actions->ms.map = browser->selection->map; in evsel__hists_browse()
3137 if (symbol__annotation(browser->selection->sym)->src == NULL) { in evsel__hists_browse()
3138 ui_browser__warning(&browser->b, delay_secs * 2, in evsel__hists_browse()
3141 browser->selection->sym->name); in evsel__hists_browse()
3145 actions->ms.map = browser->selection->map; in evsel__hists_browse()
3146 actions->ms.sym = browser->selection->sym; in evsel__hists_browse()
3149 do_annotate(browser, actions); in evsel__hists_browse()
3152 hist_browser__dump(browser); in evsel__hists_browse()
3156 do_zoom_dso(browser, actions); in evsel__hists_browse()
3159 if (browser->selection != NULL) in evsel__hists_browse()
3160 hists_browser__zoom_map(browser, in evsel__hists_browse()
3161 maps__machine(browser->selection->maps)->vmlinux_map); in evsel__hists_browse()
3165 browser->show_dso = verbose > 0; in evsel__hists_browse()
3171 do_zoom_thread(browser, actions); in evsel__hists_browse()
3175 do_zoom_socket(browser, actions); in evsel__hists_browse()
3185 hist_browser__reset(browser); in evsel__hists_browse()
3192 do_run_script(browser, actions); in evsel__hists_browse()
3197 key = do_switch_data(browser, actions); in evsel__hists_browse()
3226 ui_browser__warning(&browser->b, delay_secs * 2, in evsel__hists_browse()
3231 hist_browser__update_percent_limit(browser, new_percent); in evsel__hists_browse()
3232 hist_browser__reset(browser); in evsel__hists_browse()
3238 ui_browser__help_window(&browser->b, in evsel__hists_browse()
3250 if (pstack__empty(browser->pstack)) { in evsel__hists_browse()
3258 ui_browser__dialog_yesno(&browser->b, in evsel__hists_browse()
3265 top = pstack__peek(browser->pstack); in evsel__hists_browse()
3266 if (top == &browser->hists->dso_filter) { in evsel__hists_browse()
3272 do_zoom_dso(browser, actions); in evsel__hists_browse()
3273 } else if (top == &browser->hists->thread_filter) { in evsel__hists_browse()
3274 do_zoom_thread(browser, actions); in evsel__hists_browse()
3275 } else if (top == &browser->hists->socket_filter) { in evsel__hists_browse()
3276 do_zoom_socket(browser, actions); in evsel__hists_browse()
3307 if (!hists__has(hists, sym) || browser->selection == NULL) in evsel__hists_browse()
3312 if (browser->he_selection) in evsel__hists_browse()
3313 bi = browser->he_selection->branch_info; in evsel__hists_browse()
3318 nr_options += add_annotate_opt(browser, in evsel__hists_browse()
3324 nr_options += add_annotate_opt(browser, in evsel__hists_browse()
3329 } else if (browser->he_selection) { in evsel__hists_browse()
3330 nr_options += add_annotate_opt(browser, in evsel__hists_browse()
3333 browser->selection, in evsel__hists_browse()
3334 browser->he_selection->ip); in evsel__hists_browse()
3337 nr_options += add_annotate_type_opt(browser, in evsel__hists_browse()
3340 browser->he_selection); in evsel__hists_browse()
3341 nr_options += add_thread_opt(browser, &actions[nr_options], in evsel__hists_browse()
3343 nr_options += add_dso_opt(browser, &actions[nr_options], in evsel__hists_browse()
3345 nr_options += add_callchain_toggle_opt(browser, &actions[nr_options], &options[nr_options]); in evsel__hists_browse()
3346 nr_options += add_map_opt(browser, &actions[nr_options], in evsel__hists_browse()
3348 browser->selection ? in evsel__hists_browse()
3349 browser->selection->map : NULL); in evsel__hists_browse()
3350 nr_options += add_socket_opt(browser, &actions[nr_options], in evsel__hists_browse()
3357 if (browser->he_selection) { in evsel__hists_browse()
3359 nr_options += add_script_opt(browser, in evsel__hists_browse()
3373 if (hists__has(hists, sym) && browser->selection->sym) { in evsel__hists_browse()
3374 nr_options += add_script_opt(browser, in evsel__hists_browse()
3377 NULL, browser->selection->sym, in evsel__hists_browse()
3381 nr_options += add_script_opt(browser, &actions[nr_options], in evsel__hists_browse()
3383 nr_options += add_res_sample_opt(browser, &actions[nr_options], in evsel__hists_browse()
3385 hist_browser__selected_res_sample(browser), in evsel__hists_browse()
3387 nr_options += add_res_sample_opt(browser, &actions[nr_options], in evsel__hists_browse()
3389 hist_browser__selected_res_sample(browser), in evsel__hists_browse()
3391 nr_options += add_res_sample_opt(browser, &actions[nr_options], in evsel__hists_browse()
3393 hist_browser__selected_res_sample(browser), in evsel__hists_browse()
3395 nr_options += add_switch_opt(browser, &actions[nr_options], in evsel__hists_browse()
3398 nr_options += add_exit_opt(browser, &actions[nr_options], in evsel__hists_browse()
3412 key = act->fn(browser, act); in evsel__hists_browse()
3419 pstack__delete(browser->pstack); in evsel__hists_browse()
3421 hist_browser__delete(browser); in evsel__hists_browse()
3434 static void perf_evsel_menu__write(struct ui_browser *browser, in perf_evsel_menu__write() argument
3437 struct evsel_menu *menu = container_of(browser, in perf_evsel_menu__write()
3441 bool current_entry = ui_browser__is_current_entry(browser, row); in perf_evsel_menu__write()
3448 ui_browser__set_color(browser, current_entry ? HE_COLORSET_SELECTED : in perf_evsel_menu__write()
3465 ui_browser__printf(browser, "%s", bf); in perf_evsel_menu__write()
3471 ui_browser__set_color(browser, HE_COLORSET_TOP); in perf_evsel_menu__write()
3478 ui_browser__write_nstring(browser, warn, browser->width - printed); in perf_evsel_menu__write()
3573 static bool filter_group_entries(struct ui_browser *browser __maybe_unused, in filter_group_entries()
3665 static int block_hists_browser__title(struct hist_browser *browser, char *bf, in block_hists_browser__title() argument
3668 struct hists *hists = evsel__hists(browser->block_evsel); in block_hists_browser__title()
3669 const char *evname = evsel__name(browser->block_evsel); in block_hists_browser__title()
3684 struct hist_browser *browser; in block_hists_tui_browse() local
3692 browser = hist_browser__new(hists); in block_hists_tui_browse()
3693 if (!browser) in block_hists_tui_browse()
3696 browser->block_evsel = evsel; in block_hists_tui_browse()
3697 browser->title = block_hists_browser__title; in block_hists_tui_browse()
3698 browser->min_pcnt = min_percent; in block_hists_tui_browse()
3699 browser->env = env; in block_hists_tui_browse()
3712 key = hist_browser__run(browser, "? - help", true, 0); in block_hists_tui_browse()
3718 ui_browser__help_window(&browser->b, help); in block_hists_tui_browse()
3722 if (!browser->selection || in block_hists_tui_browse()
3723 !browser->selection->sym) { in block_hists_tui_browse()
3727 action.ms.map = browser->selection->map; in block_hists_tui_browse()
3728 action.ms.sym = browser->selection->sym; in block_hists_tui_browse()
3729 do_annotate(browser, &action); in block_hists_tui_browse()
3747 hist_browser__delete(browser); in block_hists_tui_browse()