Lines Matching defs: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)
64 struct hists *hists = browser->hists;
68 (nd = hists__filter_entries(nd, browser->min_pcnt)) != NULL;
81 struct ui_browser *browser = &hb->b;
85 browser->extra_title_lines = hb->show_headers ? hpp_list->nr_header_lines : 0;
105 struct ui_browser *browser = &hb->b;
111 browser->rows += browser->extra_title_lines;
112 browser->extra_title_lines = 0;
116 browser->extra_title_lines = hpp_list->nr_header_lines;
117 browser->rows -= browser->extra_title_lines;
122 index_row = browser->index - browser->top_idx;
123 if (index_row >= browser->rows)
124 browser->index -= index_row - browser->rows + 1;
127 static void hist_browser__refresh_dimensions(struct ui_browser *browser)
129 struct hist_browser *hb = container_of(browser, struct hist_browser, b);
132 browser->width = 3 + (hists__sort_list_width(hb->hists) + sizeof("[k]"));
135 * before updating browser->width, as it will invalidate the
139 ui_browser__refresh_dimensions(browser);
142 static void hist_browser__reset(struct hist_browser *browser)
148 browser->nr_callchain_rows = 0;
150 hist_browser__update_nr_entries(browser);
151 browser->b.nr_entries = hist_browser__nr_entries(browser);
152 hist_browser__refresh_dimensions(&browser->b);
153 ui_browser__reset_index(&browser->b);
396 static bool hist_browser__selection_has_children(struct hist_browser *browser)
398 struct hist_entry *he = browser->he_selection;
399 struct map_symbol *ms = browser->selection;
410 static bool hist_browser__selection_unfolded(struct hist_browser *browser)
412 struct hist_entry *he = browser->he_selection;
413 struct map_symbol *ms = browser->selection;
424 static char *hist_browser__selection_sym_name(struct hist_browser *browser, char *bf, size_t size)
426 struct hist_entry *he = browser->he_selection;
427 struct map_symbol *ms = browser->selection;
439 return callchain_list__sym_name(callchain_entry, bf, size, browser->show_dso);
442 static bool hist_browser__toggle_fold(struct hist_browser *browser)
444 struct hist_entry *he = browser->he_selection;
445 struct map_symbol *ms = browser->selection;
461 browser->b.nr_entries -= he->nr_rows;
464 browser->nr_callchain_rows -= he->nr_rows;
466 browser->nr_hierarchy_entries -= he->nr_rows;
469 child_rows = hierarchy_count_rows(browser, he, true);
476 he->nr_rows = hierarchy_count_rows(browser, he, false);
480 browser->b.nr_entries += child_rows - he->nr_rows;
488 browser->b.nr_entries -= child_rows - he->nr_rows;
496 browser->b.nr_entries += he->nr_rows;
499 browser->nr_callchain_rows += he->nr_rows;
501 browser->nr_hierarchy_entries += he->nr_rows;
602 __hist_browser__set_folding(struct hist_browser *browser, bool unfold)
608 nd = rb_first_cached(&browser->hists->entries);
615 hist_entry__set_folding(he, browser, unfold);
618 if (he->filtered || percent < browser->min_pcnt)
622 browser->nr_hierarchy_entries++;
624 browser->nr_callchain_rows += he->nr_rows;
625 else if (unfold && !hist_entry__has_hierarchy_children(he, browser->min_pcnt)) {
626 browser->nr_hierarchy_entries++;
634 static void hist_browser__set_folding(struct hist_browser *browser, bool unfold)
636 browser->nr_hierarchy_entries = 0;
637 browser->nr_callchain_rows = 0;
638 __hist_browser__set_folding(browser, unfold);
640 browser->b.nr_entries = hist_browser__nr_entries(browser);
642 ui_browser__reset_index(&browser->b);
645 static void hist_browser__set_folding_selected(struct hist_browser *browser, bool unfold)
647 if (!browser->he_selection)
650 if (unfold == browser->he_selection->unfolded)
653 hist_browser__toggle_fold(browser);
656 static void ui_browser__warn_lost_events(struct ui_browser *browser)
658 ui_browser__warning(browser, 4,
665 static int hist_browser__title(struct hist_browser *browser, char *bf, size_t size)
667 return browser->title ? browser->title(browser, bf, size) : 0;
670 static int hist_browser__handle_hotkey(struct hist_browser *browser, bool warn_lost_event, char *title, size_t size, int key)
674 struct hist_browser_timer *hbt = browser->hbt;
682 if (hist_browser__has_filter(browser) || symbol_conf.report_hierarchy)
683 hist_browser__update_nr_entries(browser);
685 nr_entries = hist_browser__nr_entries(browser);
686 ui_browser__update_nr_entries(&browser->b, nr_entries);
689 (browser->hists->stats.nr_lost_warned !=
690 browser->hists->stats.nr_events[PERF_RECORD_LOST])) {
691 browser->hists->stats.nr_lost_warned =
692 browser->hists->stats.nr_events[PERF_RECORD_LOST];
693 ui_browser__warn_lost_events(&browser->b);
696 hist_browser__title(browser, title, size);
697 ui_browser__show_title(&browser->b, title);
701 struct hist_entry *h = rb_entry(browser->b.top, struct hist_entry, rb_node);
706 seq++, browser->b.nr_entries, browser->hists->nr_entries,
707 browser->b.extra_title_lines, browser->b.rows,
708 browser->b.index, browser->b.top_idx, h->row_offset, h->nr_rows);
713 hist_browser__set_folding(browser, false);
717 hist_browser__set_folding_selected(browser, false);
721 hist_browser__set_folding(browser, true);
725 hist_browser__toggle_fold(browser);
728 browser->show_headers = !browser->show_headers;
729 hist_browser__update_rows(browser);
732 if (hist_browser__toggle_fold(browser))
742 int hist_browser__run(struct hist_browser *browser, const char *help,
746 struct hist_browser_timer *hbt = browser->hbt;
749 browser->b.entries = &browser->hists->entries;
750 browser->b.nr_entries = hist_browser__nr_entries(browser);
752 hist_browser__title(browser, title, sizeof(title));
754 if (ui_browser__show(&browser->b, title, "%s", help) < 0)
757 if (key && hist_browser__handle_hotkey(browser, warn_lost_event, title, sizeof(title), key))
761 key = ui_browser__run(&browser->b, delay_secs);
763 if (hist_browser__handle_hotkey(browser, warn_lost_event, title, sizeof(title), key))
767 ui_browser__hide(&browser->b);
772 /* for hists browser */
781 typedef void (*print_callchain_entry_fn)(struct hist_browser *browser,
787 static void hist_browser__show_callchain_entry(struct hist_browser *browser,
795 bool show_annotated = browser->show_dso && chain->ms.sym && symbol__annotation(chain->ms.sym)->src;
798 width = browser->b.width - (offset + 2);
799 if (ui_browser__is_current_entry(&browser->b, row)) {
800 browser->selection = &chain->ms;
805 ui_browser__set_color(&browser->b, color);
806 ui_browser__gotorc(&browser->b, row, 0);
807 ui_browser__write_nstring(&browser->b, " ", offset);
808 ui_browser__printf(&browser->b, "%c", folded_sign);
809 ui_browser__write_graph(&browser->b, show_annotated ? SLSMG_RARROW_CHAR : ' ');
810 ui_browser__write_nstring(&browser->b, str, width);
825 typedef bool (*check_output_full_fn)(struct hist_browser *browser,
828 static bool hist_browser__check_output_full(struct hist_browser *browser,
831 return browser->b.rows == row;
834 static bool hist_browser__check_dump_full(struct hist_browser *browser __maybe_unused,
842 static int hist_browser__show_callchain_list(struct hist_browser *browser,
864 browser->show_dso);
886 print(browser, chain, str, offset, row, arg);
907 static int hist_browser__show_callchain_flat(struct hist_browser *browser,
940 row += hist_browser__show_callchain_list(browser, child,
946 if (is_output_full(browser, row))
963 row += hist_browser__show_callchain_list(browser, child,
969 if (is_output_full(browser, row))
977 if (is_output_full(browser, row))
985 static char *hist_browser__folded_callchain_str(struct hist_browser *browser,
994 browser->show_dso);
1011 static int hist_browser__show_callchain_folded(struct hist_browser *browser,
1051 chain_str = hist_browser__folded_callchain_str(browser,
1067 chain_str = hist_browser__folded_callchain_str(browser,
1083 print(browser, first_chain, chain_str, offset, row++, arg);
1088 if (is_output_full(browser, row))
1096 static int hist_browser__show_callchain_graph(struct hist_browser *browser,
1133 row += hist_browser__show_callchain_list(browser, child,
1139 if (is_output_full(browser, row))
1149 row += hist_browser__show_callchain_graph(browser, &child->rb_root,
1154 if (is_output_full(browser, row))
1162 static int hist_browser__show_callchain(struct hist_browser *browser,
1179 printed = hist_browser__show_callchain_flat(browser,
1184 printed = hist_browser__show_callchain_folded(browser,
1189 printed = hist_browser__show_callchain_graph(browser,
1196 browser->he_selection = entry;
1294 static int hist_browser__show_entry(struct hist_browser *browser,
1299 int width = browser->b.width;
1301 bool current_entry = ui_browser__is_current_entry(&browser->b, row);
1308 browser->he_selection = entry;
1309 browser->selection = &entry->ms;
1319 .b = &browser->b,
1325 ui_browser__gotorc(&browser->b, row, 0);
1327 hists__for_each_format(browser->hists, fmt) {
1336 column++ < browser->b.horiz_scroll)
1339 if (current_entry && browser->b.navkeypressed) {
1340 ui_browser__set_color(&browser->b,
1343 ui_browser__set_color(&browser->b,
1349 ui_browser__printf(&browser->b, "%c ", folded_sign);
1354 ui_browser__printf(&browser->b, " ");
1365 ui_browser__printf(&browser->b, "%s", s + ret);
1368 ui_browser__printf(&browser->b, "%s", s);
1374 if (!browser->b.navkeypressed)
1377 ui_browser__write_nstring(&browser->b, "", width);
1384 if (folded_sign == '-' && row != browser->b.rows) {
1390 printed += hist_browser__show_callchain(browser,
1400 static int hist_browser__show_hierarchy_entry(struct hist_browser *browser,
1406 int width = browser->b.width;
1408 bool current_entry = ui_browser__is_current_entry(&browser->b, row);
1414 .b = &browser->b,
1421 browser->he_selection = entry;
1422 browser->selection = &entry->ms;
1434 ui_browser__gotorc(&browser->b, row, 0);
1436 if (current_entry && browser->b.navkeypressed)
1437 ui_browser__set_color(&browser->b, HE_COLORSET_SELECTED);
1439 ui_browser__set_color(&browser->b, HE_COLORSET_NORMAL);
1441 ui_browser__write_nstring(&browser->b, "", level * HIERARCHY_INDENT);
1456 column++ < browser->b.horiz_scroll)
1459 if (current_entry && browser->b.navkeypressed) {
1460 ui_browser__set_color(&browser->b,
1463 ui_browser__set_color(&browser->b,
1468 ui_browser__printf(&browser->b, "%c ", folded_sign);
1472 ui_browser__printf(&browser->b, " ");
1483 ui_browser__printf(&browser->b, "%s", s + ret);
1487 ui_browser__printf(&browser->b, "%s", s);
1493 ui_browser__write_nstring(&browser->b, "", hierarchy_indent);
1497 if (column >= browser->b.horiz_scroll) {
1505 if (current_entry && browser->b.navkeypressed) {
1506 ui_browser__set_color(&browser->b,
1509 ui_browser__set_color(&browser->b,
1515 ui_browser__printf(&browser->b, "%c ", folded_sign);
1518 ui_browser__write_nstring(&browser->b, "", 2);
1534 ui_browser__printf(&browser->b, "%s", skip_spaces(s));
1543 if (!browser->b.navkeypressed)
1546 ui_browser__write_nstring(&browser->b, "", width);
1552 if (entry->leaf && folded_sign == '-' && row != browser->b.rows) {
1557 printed += hist_browser__show_callchain(browser, entry,
1566 static int hist_browser__show_no_entry(struct hist_browser *browser,
1569 int width = browser->b.width;
1570 bool current_entry = ui_browser__is_current_entry(&browser->b, row);
1576 int indent = browser->hists->nr_hpp_node - 2;
1579 browser->he_selection = NULL;
1580 browser->selection = NULL;
1583 ui_browser__gotorc(&browser->b, row, 0);
1585 if (current_entry && browser->b.navkeypressed)
1586 ui_browser__set_color(&browser->b, HE_COLORSET_SELECTED);
1588 ui_browser__set_color(&browser->b, HE_COLORSET_NORMAL);
1590 ui_browser__write_nstring(&browser->b, "", level * HIERARCHY_INDENT);
1594 fmt_node = list_first_entry(&browser->hists->hpp_formats,
1597 if (perf_hpp__should_skip(fmt, browser->hists) ||
1598 column++ < browser->b.horiz_scroll)
1601 ret = fmt->width(fmt, NULL, browser->hists);
1612 ui_browser__write_nstring(&browser->b, "", ret);
1616 ui_browser__write_nstring(&browser->b, "", indent * HIERARCHY_INDENT);
1619 if (column >= browser->b.horiz_scroll) {
1622 ret = snprintf(buf, sizeof(buf), "no entry >= %.2f%%", browser->min_pcnt);
1623 ui_browser__printf(&browser->b, " %s", buf);
1628 if (!browser->b.navkeypressed)
1631 ui_browser__write_nstring(&browser->b, "", width);
1642 hists_browser__scnprintf_headers(struct hist_browser *browser, char *buf,
1645 struct hists *hists = browser->hists;
1661 hists__for_each_format(browser->hists, fmt) {
1662 if (perf_hpp__should_skip(fmt, hists) || column++ < browser->b.horiz_scroll)
1680 static int hists_browser__scnprintf_hierarchy_headers(struct hist_browser *browser, char *buf, size_t size)
1682 struct hists *hists = browser->hists;
1703 if (column++ < browser->b.horiz_scroll)
1764 static void hists_browser__hierarchy_headers(struct hist_browser *browser)
1768 hists_browser__scnprintf_hierarchy_headers(browser, headers,
1771 ui_browser__gotorc_title(&browser->b, 0, 0);
1772 ui_browser__set_color(&browser->b, HE_COLORSET_ROOT);
1773 ui_browser__write_nstring(&browser->b, headers, browser->b.width + 1);
1776 static void hists_browser__headers(struct hist_browser *browser)
1778 struct hists *hists = browser->hists;
1786 hists_browser__scnprintf_headers(browser, headers,
1789 ui_browser__gotorc_title(&browser->b, line, 0);
1790 ui_browser__set_color(&browser->b, HE_COLORSET_ROOT);
1791 ui_browser__write_nstring(&browser->b, headers, browser->b.width + 1);
1795 static void hist_browser__show_headers(struct hist_browser *browser)
1798 hists_browser__hierarchy_headers(browser);
1800 hists_browser__headers(browser);
1803 static void ui_browser__hists_init_top(struct ui_browser *browser)
1805 if (browser->top == NULL) {
1808 hb = container_of(browser, struct hist_browser, b);
1809 browser->top = rb_first_cached(&hb->hists->entries);
1813 static unsigned int hist_browser__refresh(struct ui_browser *browser)
1817 struct hist_browser *hb = container_of(browser, struct hist_browser, b);
1822 ui_browser__hists_init_top(browser);
1826 for (nd = browser->top; nd; nd = rb_hierarchy_next(nd)) {
1847 if (row == browser->rows)
1858 if (row == browser->rows)
1904 static void ui_browser__hists_seek(struct ui_browser *browser,
1912 hb = container_of(browser, struct hist_browser, b);
1914 if (browser->nr_entries == 0)
1917 ui_browser__hists_init_top(browser);
1921 nd = hists__filter_entries(rb_first(browser->entries),
1925 nd = browser->top;
1928 nd = rb_hierarchy_last(rb_last(browser->entries));
1940 h = rb_entry(browser->top, struct hist_entry, rb_node);
1971 browser->top = nd;
1980 browser->top = nd;
1993 browser->top = nd;
2003 browser->top = nd;
2014 browser->top = nd;
2029 browser->top = nd;
2035 static int hist_browser__fprintf_callchain(struct hist_browser *browser,
2043 hist_browser__show_callchain(browser, he, level, 0,
2049 static int hist_browser__fprintf_entry(struct hist_browser *browser,
2068 hists__for_each_format(browser->hists, fmt) {
2085 printed += hist_browser__fprintf_callchain(browser, he, fp, 1);
2091 static int hist_browser__fprintf_hierarchy_entry(struct hist_browser *browser,
2142 printed += hist_browser__fprintf_callchain(browser, he, fp,
2149 static int hist_browser__fprintf(struct hist_browser *browser, FILE *fp)
2151 struct rb_node *nd = hists__filter_entries(rb_first(browser->b.entries),
2152 browser->min_pcnt);
2159 printed += hist_browser__fprintf_hierarchy_entry(browser,
2163 printed += hist_browser__fprintf_entry(browser, h, fp);
2167 browser->min_pcnt);
2173 static int hist_browser__dump(struct hist_browser *browser)
2179 scnprintf(filename, sizeof(filename), "perf.hist.%d", browser->print_seq);
2185 if (++browser->print_seq == 8192) {
2199 ++browser->print_seq;
2200 hist_browser__fprintf(browser, fp);
2207 void hist_browser__init(struct hist_browser *browser,
2212 browser->hists = hists;
2213 browser->b.refresh = hist_browser__refresh;
2214 browser->b.refresh_dimensions = hist_browser__refresh_dimensions;
2215 browser->b.seek = ui_browser__hists_seek;
2216 browser->b.use_navkeypressed = true;
2217 browser->show_headers = symbol_conf.show_hist_headers;
2218 hist_browser__set_title_space(browser);
2227 ++browser->b.columns;
2230 ++browser->b.columns;
2233 ++browser->b.columns;
2241 struct hist_browser *browser = zalloc(sizeof(*browser));
2243 if (browser)
2244 hist_browser__init(browser, hists);
2246 return browser;
2255 struct hist_browser *browser = hist_browser__new(evsel__hists(evsel));
2257 if (browser) {
2258 browser->hbt = hbt;
2259 browser->env = env;
2260 browser->title = hists_browser__scnprintf_title;
2261 browser->annotation_opts = annotation_opts;
2263 return browser;
2266 void hist_browser__delete(struct hist_browser *browser)
2268 free(browser);
2271 static struct hist_entry *hist_browser__selected_entry(struct hist_browser *browser)
2273 return browser->he_selection;
2276 static struct thread *hist_browser__selected_thread(struct hist_browser *browser)
2278 return browser->he_selection->thread;
2281 static struct res_sample *hist_browser__selected_res_sample(struct hist_browser *browser)
2283 return browser->he_selection ? browser->he_selection->res_samples : NULL;
2286 /* Check whether the browser is for 'top' or 'report' */
2292 static int hists_browser__scnprintf_title(struct hist_browser *browser, char *bf, size_t size)
2294 struct hist_browser_timer *hbt = browser->hbt;
2295 int printed = __hists__scnprintf_title(browser->hists, bf, size, !is_report_browser(hbt));
2423 int (*fn)(struct hist_browser *browser, struct popup_action *act);
2427 do_annotate(struct hist_browser *browser, struct popup_action *act)
2434 if (!browser->annotation_opts->objdump_path &&
2435 perf_env__lookup_objdump(browser->env, &browser->annotation_opts->objdump_path))
2442 if (browser->block_evsel)
2443 evsel = browser->block_evsel;
2445 evsel = hists_to_evsel(browser->hists);
2447 err = map_symbol__tui_annotate(&act->ms, evsel, browser->hbt,
2448 browser->annotation_opts);
2449 he = hist_browser__selected_entry(browser);
2457 ui_browser__update_nr_entries(&browser->b, browser->hists->nr_entries);
2459 ui_browser__handle_resize(&browser->b);
2486 add_annotate_opt(struct hist_browser *browser __maybe_unused,
2509 do_zoom_thread(struct hist_browser *browser, struct popup_action *act)
2513 if ((!hists__has(browser->hists, thread) &&
2514 !hists__has(browser->hists, comm)) || thread == NULL)
2517 if (browser->hists->thread_filter) {
2518 pstack__remove(browser->pstack, &browser->hists->thread_filter);
2520 thread__zput(browser->hists->thread_filter);
2523 if (hists__has(browser->hists, thread)) {
2532 browser->hists->thread_filter = thread__get(thread);
2534 pstack__push(browser->pstack, &browser->hists->thread_filter);
2537 hists__filter_by_thread(browser->hists);
2538 hist_browser__reset(browser);
2543 add_thread_opt(struct hist_browser *browser, struct popup_action *act,
2548 if ((!hists__has(browser->hists, thread) &&
2549 !hists__has(browser->hists, comm)) || thread == NULL)
2552 if (hists__has(browser->hists, thread)) {
2554 browser->hists->thread_filter ? "out of" : "into",
2559 browser->hists->thread_filter ? "out of" : "into",
2570 static int hists_browser__zoom_map(struct hist_browser *browser, struct map *map)
2572 if (!hists__has(browser->hists, dso) || map == NULL)
2575 if (browser->hists->dso_filter) {
2576 pstack__remove(browser->pstack, &browser->hists->dso_filter);
2578 browser->hists->dso_filter = NULL;
2583 browser->hists->dso_filter = map->dso;
2585 pstack__push(browser->pstack, &browser->hists->dso_filter);
2588 hists__filter_by_dso(browser->hists);
2589 hist_browser__reset(browser);
2594 do_zoom_dso(struct hist_browser *browser, struct popup_action *act)
2596 return hists_browser__zoom_map(browser, act->ms.map);
2600 add_dso_opt(struct hist_browser *browser, struct popup_action *act,
2603 if (!hists__has(browser->hists, dso) || map == NULL)
2607 browser->hists->dso_filter ? "out of" : "into",
2616 static int do_toggle_callchain(struct hist_browser *browser, struct popup_action *act __maybe_unused)
2618 hist_browser__toggle_fold(browser);
2622 static int add_callchain_toggle_opt(struct hist_browser *browser, struct popup_action *act, char **optstr)
2626 if (!hist_browser__selection_has_children(browser))
2630 hist_browser__selection_unfolded(browser) ? "Collapse" : "Expand",
2631 hist_browser__selection_sym_name(browser, sym_name, sizeof(sym_name))) < 0)
2639 do_browse_map(struct hist_browser *browser __maybe_unused,
2647 add_map_opt(struct hist_browser *browser,
2650 if (!hists__has(browser->hists, dso) || map == NULL)
2662 do_run_script(struct hist_browser *browser __maybe_unused,
2707 do_res_sample_script(struct hist_browser *browser __maybe_unused,
2712 he = hist_browser__selected_entry(browser);
2718 add_script_opt_2(struct hist_browser *browser __maybe_unused,
2745 add_script_opt(struct hist_browser *browser,
2753 n = add_script_opt_2(browser, act, optstr, thread, sym, evsel, "");
2755 he = hist_browser__selected_entry(browser);
2767 n += add_script_opt_2(browser, act, optstr, thread, sym,
2775 add_res_sample_opt(struct hist_browser *browser __maybe_unused,
2796 do_switch_data(struct hist_browser *browser __maybe_unused,
2809 add_switch_opt(struct hist_browser *browser,
2812 if (!is_report_browser(browser->hbt))
2823 do_exit_browser(struct hist_browser *browser __maybe_unused,
2830 add_exit_opt(struct hist_browser *browser __maybe_unused,
2841 do_zoom_socket(struct hist_browser *browser, struct popup_action *act)
2843 if (!hists__has(browser->hists, socket) || act->socket < 0)
2846 if (browser->hists->socket_filter > -1) {
2847 pstack__remove(browser->pstack, &browser->hists->socket_filter);
2848 browser->hists->socket_filter = -1;
2851 browser->hists->socket_filter = act->socket;
2853 pstack__push(browser->pstack, &browser->hists->socket_filter);
2856 hists__filter_by_socket(browser->hists);
2857 hist_browser__reset(browser);
2862 add_socket_opt(struct hist_browser *browser, struct popup_action *act,
2865 if (!hists__has(browser->hists, socket) || socket_id < 0)
2869 (browser->hists->socket_filter > -1) ? "out of" : "into",
2949 struct hist_browser *browser = perf_evsel_browser__new(evsel, hbt, env, annotation_opts);
2963 "q/ESC/CTRL+C Exit browser or go back to previous screen\n\n" \
3000 if (browser == NULL)
3008 browser->min_pcnt = min_pcnt;
3009 hist_browser__update_nr_entries(browser);
3011 browser->pstack = pstack__new(3);
3012 if (browser->pstack == NULL)
3024 browser->b.no_samples_msg = "Collecting samples...";
3035 key = hist_browser__run(browser, helpline, warn_lost_event, key);
3037 if (browser->he_selection != NULL) {
3038 thread = hist_browser__selected_thread(browser);
3039 map = browser->selection->map;
3040 socked_id = browser->he_selection->socket;
3048 * Exit the browser, let hists__browser_tree
3079 ui_browser__warning(&browser->b, delay_secs * 2,
3085 if (!browser->selection ||
3086 !browser->selection->map ||
3087 !browser->selection->map->dso ||
3088 browser->selection->map->dso->annotate_warned) {
3092 if (!browser->selection->sym) {
3093 if (!browser->he_selection)
3097 bi = browser->he_selection->branch_info;
3104 actions->ms.sym = symbol__new_unresolved(browser->he_selection->ip,
3105 browser->selection->map);
3106 actions->ms.map = browser->selection->map;
3112 if (symbol__annotation(browser->selection->sym)->src == NULL) {
3113 ui_browser__warning(&browser->b, delay_secs * 2,
3116 browser->selection->sym->name);
3120 actions->ms.map = browser->selection->map;
3121 actions->ms.sym = browser->selection->sym;
3124 do_annotate(browser, actions);
3127 hist_browser__dump(browser);
3131 do_zoom_dso(browser, actions);
3134 if (browser->selection != NULL)
3135 hists_browser__zoom_map(browser, browser->selection->maps->machine->vmlinux_map);
3139 browser->show_dso = verbose > 0;
3145 do_zoom_thread(browser, actions);
3149 do_zoom_socket(browser, actions);
3159 hist_browser__reset(browser);
3166 do_run_script(browser, actions);
3171 key = do_switch_data(browser, actions);
3200 ui_browser__warning(&browser->b, delay_secs * 2,
3205 hist_browser__update_percent_limit(browser, new_percent);
3206 hist_browser__reset(browser);
3212 ui_browser__help_window(&browser->b,
3224 if (pstack__empty(browser->pstack)) {
3232 ui_browser__dialog_yesno(&browser->b,
3239 top = pstack__peek(browser->pstack);
3240 if (top == &browser->hists->dso_filter) {
3246 do_zoom_dso(browser, actions);
3247 } else if (top == &browser->hists->thread_filter) {
3248 do_zoom_thread(browser, actions);
3249 } else if (top == &browser->hists->socket_filter) {
3250 do_zoom_socket(browser, actions);
3281 if (!hists__has(hists, sym) || browser->selection == NULL)
3286 if (browser->he_selection)
3287 bi = browser->he_selection->branch_info;
3292 nr_options += add_annotate_opt(browser,
3298 nr_options += add_annotate_opt(browser,
3304 nr_options += add_annotate_opt(browser,
3307 browser->selection,
3308 browser->he_selection->ip);
3311 nr_options += add_thread_opt(browser, &actions[nr_options],
3313 nr_options += add_dso_opt(browser, &actions[nr_options],
3315 nr_options += add_callchain_toggle_opt(browser, &actions[nr_options], &options[nr_options]);
3316 nr_options += add_map_opt(browser, &actions[nr_options],
3318 browser->selection ?
3319 browser->selection->map : NULL);
3320 nr_options += add_socket_opt(browser, &actions[nr_options],
3327 if (browser->he_selection) {
3329 nr_options += add_script_opt(browser,
3335 * Note that browser->selection != NULL
3336 * when browser->he_selection is not NULL,
3337 * so we don't need to check browser->selection
3338 * before fetching browser->selection->sym like what
3339 * we do before fetching browser->selection->map.
3343 if (hists__has(hists, sym) && browser->selection->sym) {
3344 nr_options += add_script_opt(browser,
3347 NULL, browser->selection->sym,
3351 nr_options += add_script_opt(browser, &actions[nr_options],
3353 nr_options += add_res_sample_opt(browser, &actions[nr_options],
3355 hist_browser__selected_res_sample(browser),
3357 nr_options += add_res_sample_opt(browser, &actions[nr_options],
3359 hist_browser__selected_res_sample(browser),
3361 nr_options += add_res_sample_opt(browser, &actions[nr_options],
3363 hist_browser__selected_res_sample(browser),
3365 nr_options += add_switch_opt(browser, &actions[nr_options],
3368 nr_options += add_exit_opt(browser, &actions[nr_options],
3382 key = act->fn(browser, act);
3389 pstack__delete(browser->pstack);
3391 hist_browser__delete(browser);
3405 static void perf_evsel_menu__write(struct ui_browser *browser,
3408 struct evsel_menu *menu = container_of(browser,
3412 bool current_entry = ui_browser__is_current_entry(browser, row);
3419 ui_browser__set_color(browser, current_entry ? HE_COLORSET_SELECTED :
3436 ui_browser__printf(browser, "%s", bf);
3442 ui_browser__set_color(browser, HE_COLORSET_TOP);
3449 ui_browser__write_nstring(browser, warn, browser->width - printed);
3547 static bool filter_group_entries(struct ui_browser *browser __maybe_unused,
3652 static int block_hists_browser__title(struct hist_browser *browser, char *bf,
3655 struct hists *hists = evsel__hists(browser->block_evsel);
3656 const char *evname = evsel__name(browser->block_evsel);
3672 struct hist_browser *browser;
3678 browser = hist_browser__new(hists);
3679 if (!browser)
3682 browser->block_evsel = evsel;
3683 browser->title = block_hists_browser__title;
3684 browser->min_pcnt = min_percent;
3685 browser->env = env;
3686 browser->annotation_opts = annotation_opts;
3695 key = hist_browser__run(browser, "? - help", true, 0);
3701 ui_browser__help_window(&browser->b, help);
3705 if (!browser->selection ||
3706 !browser->selection->sym) {
3710 action.ms.map = browser->selection->map;
3711 action.ms.sym = browser->selection->sym;
3712 do_annotate(browser, &action);
3720 hist_browser__delete(browser);