Lines Matching +full:long +full:- +full:press +full:- +full:ms
1 // SPDX-License-Identifier: GPL-2.0
31 #include "../../util/block-info.h"
41 #include "annotate-data.h"
45 #include "time-utils.h"
59 return hists__has_filter(hb->hists) || hb->min_pcnt || symbol_conf.has_filter || hb->c2c_filter; in hist_browser__has_filter()
65 struct hists *hists = browser->hists; in hist_browser__get_folding()
68 for (nd = rb_first_cached(&hists->entries); in hist_browser__get_folding()
69 (nd = hists__filter_entries(nd, browser->min_pcnt)) != NULL; in hist_browser__get_folding()
74 if (he->leaf && he->unfolded) in hist_browser__get_folding()
75 unfolded_rows += he->nr_rows; in hist_browser__get_folding()
82 struct ui_browser *browser = &hb->b; in hist_browser__set_title_space()
83 struct hists *hists = hb->hists; in hist_browser__set_title_space()
84 struct perf_hpp_list *hpp_list = hists->hpp_list; in hist_browser__set_title_space()
86 browser->extra_title_lines = hb->show_headers ? hpp_list->nr_header_lines : 0; in hist_browser__set_title_space()
94 nr_entries = hb->nr_hierarchy_entries; in hist_browser__nr_entries()
96 nr_entries = hb->nr_non_filtered_entries; in hist_browser__nr_entries()
98 nr_entries = hb->hists->nr_entries; in hist_browser__nr_entries()
100 hb->nr_callchain_rows = hist_browser__get_folding(hb); in hist_browser__nr_entries()
101 return nr_entries + hb->nr_callchain_rows; in hist_browser__nr_entries()
106 struct ui_browser *browser = &hb->b; in hist_browser__update_rows()
107 struct hists *hists = hb->hists; in hist_browser__update_rows()
108 struct perf_hpp_list *hpp_list = hists->hpp_list; in hist_browser__update_rows()
111 if (!hb->show_headers) { in hist_browser__update_rows()
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()
132 /* 3 == +/- toggle symbol before actual hist_entry rendering */ in hist_browser__refresh_dimensions()
133 browser->width = 3 + (hists__sort_list_width(hb->hists) + sizeof("[k]")); in hist_browser__refresh_dimensions()
136 * before updating browser->width, as it will invalidate the in hist_browser__refresh_dimensions()
146 * The hists__remove_entry_filter() already folds non-filtered in hist_browser__reset()
149 browser->nr_callchain_rows = 0; 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()
159 return unfolded ? '-' : '+'; in tree__folded_sign()
164 return he->has_children ? tree__folded_sign(he->unfolded) : ' '; in hist_entry__folded()
169 return cl->has_children ? tree__folded_sign(cl->unfolded) : ' '; in callchain_list__folded()
174 cl->unfolded = unfold ? cl->has_children : false; in callchain_list__set_folding()
182 for (nd = rb_first(&node->rb_root); nd; nd = rb_next(nd)) { in callchain_node__count_rows_rb_tree()
187 list_for_each_entry(chain, &child->val, list) { in callchain_node__count_rows_rb_tree()
196 if (folded_sign == '-') /* Have children and they're unfolded */ in callchain_node__count_rows_rb_tree()
209 list_for_each_entry(chain, &node->parent_val, list) { in callchain_node__count_flat_rows()
219 list_for_each_entry(chain, &node->val, list) { in callchain_node__count_flat_rows()
221 /* node->parent_val list might be empty */ in callchain_node__count_flat_rows()
248 list_for_each_entry(chain, &node->val, list) { in callchain_node__count_rows()
251 unfolded = chain->unfolded; in callchain_node__count_rows()
280 if (he->leaf) in hierarchy_count_rows()
281 return callchain__count_rows(&he->sorted_chain); in hierarchy_count_rows()
283 if (he->has_no_entry) in hierarchy_count_rows()
286 node = rb_first_cached(&he->hroot_out); in hierarchy_count_rows()
293 if (!child->filtered && percent >= hb->min_pcnt) { in hierarchy_count_rows()
296 if (include_children && child->unfolded) in hierarchy_count_rows()
310 if (!he->has_children) in hist_entry__toggle_fold()
313 he->unfolded = !he->unfolded; in hist_entry__toggle_fold()
322 if (!cl->has_children) in callchain_list__toggle_fold()
325 cl->unfolded = !cl->unfolded; in callchain_list__toggle_fold()
331 struct rb_node *nd = rb_first(&node->rb_root); in callchain_node__init_have_children_rb_tree()
333 for (nd = rb_first(&node->rb_root); nd; nd = rb_next(nd)) { in callchain_node__init_have_children_rb_tree()
338 list_for_each_entry(chain, &child->val, list) { in callchain_node__init_have_children_rb_tree()
341 chain->has_children = chain->list.next != &child->val || in callchain_node__init_have_children_rb_tree()
342 !RB_EMPTY_ROOT(&child->rb_root); in callchain_node__init_have_children_rb_tree()
344 chain->has_children = chain->list.next == &child->val && in callchain_node__init_have_children_rb_tree()
345 !RB_EMPTY_ROOT(&child->rb_root); in callchain_node__init_have_children_rb_tree()
357 chain = list_entry(node->val.next, struct callchain_list, list); in callchain_node__init_have_children()
358 chain->has_children = has_sibling; in callchain_node__init_have_children()
360 if (!list_empty(&node->val)) { in callchain_node__init_have_children()
361 chain = list_entry(node->val.prev, struct callchain_list, list); in callchain_node__init_have_children()
362 chain->has_children = !RB_EMPTY_ROOT(&node->rb_root); in callchain_node__init_have_children()
384 if (he->init_have_children) in hist_entry__init_have_children()
387 if (he->leaf) { in hist_entry__init_have_children()
388 he->has_children = !RB_EMPTY_ROOT(&he->sorted_chain); in hist_entry__init_have_children()
389 callchain__init_have_children(&he->sorted_chain); in hist_entry__init_have_children()
391 he->has_children = !RB_EMPTY_ROOT(&he->hroot_out.rb_root); in hist_entry__init_have_children()
394 he->init_have_children = true; in hist_entry__init_have_children()
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() local
402 if (!he || !ms) in hist_browser__selection_has_children()
405 if (ms == &he->ms) in hist_browser__selection_has_children()
406 return he->has_children; in hist_browser__selection_has_children()
408 return container_of(ms, struct callchain_list, ms)->has_children; in hist_browser__selection_has_children()
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() local
416 if (!he || !ms) in hist_browser__selection_unfolded()
419 if (ms == &he->ms) in hist_browser__selection_unfolded()
420 return he->unfolded; in hist_browser__selection_unfolded()
422 return container_of(ms, struct callchain_list, ms)->unfolded; in hist_browser__selection_unfolded()
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() local
431 if (!he || !ms) in hist_browser__selection_sym_name()
434 if (ms == &he->ms) { in hist_browser__selection_sym_name()
439 callchain_entry = container_of(ms, struct callchain_list, ms); 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()
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() local
447 struct callchain_list *cl = container_of(ms, struct callchain_list, ms); in hist_browser__toggle_fold()
450 if (!he || !ms) in hist_browser__toggle_fold()
453 if (ms == &he->ms) in hist_browser__toggle_fold()
462 browser->b.nr_entries -= he->nr_rows; in hist_browser__toggle_fold()
464 if (he->leaf) 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()
472 if (he->unfolded) { in hist_browser__toggle_fold()
473 if (he->leaf) in hist_browser__toggle_fold()
474 he->nr_rows = callchain__count_rows( in hist_browser__toggle_fold()
475 &he->sorted_chain); 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()
483 if (!he->leaf && he->nr_rows == 0) { in hist_browser__toggle_fold()
484 he->has_no_entry = true; in hist_browser__toggle_fold()
485 he->nr_rows = 1; in hist_browser__toggle_fold()
489 browser->b.nr_entries -= child_rows - he->nr_rows; in hist_browser__toggle_fold()
491 if (he->has_no_entry) in hist_browser__toggle_fold()
492 he->has_no_entry = false; in hist_browser__toggle_fold()
494 he->nr_rows = 0; in hist_browser__toggle_fold()
497 browser->b.nr_entries += he->nr_rows; in hist_browser__toggle_fold()
499 if (he->leaf) 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()
516 for (nd = rb_first(&node->rb_root); nd; nd = rb_next(nd)) { in callchain_node__set_folding_rb_tree()
521 list_for_each_entry(chain, &child->val, list) { in callchain_node__set_folding_rb_tree()
524 has_children = chain->has_children; in callchain_node__set_folding_rb_tree()
540 list_for_each_entry(chain, &node->val, list) { in callchain_node__set_folding()
543 has_children = chain->has_children; in callchain_node__set_folding()
573 for (nd = rb_first_cached(&he->hroot_out); nd; nd = rb_next(nd)) { in hierarchy_set_folding()
576 if (!child->filtered && percent >= hb->min_pcnt) in hierarchy_set_folding()
587 he->unfolded = unfold ? he->has_children : false; in hist_entry__set_folding()
589 if (he->has_children) { in hist_entry__set_folding()
592 if (he->leaf) in hist_entry__set_folding()
593 n = callchain__set_folding(&he->sorted_chain, unfold); in hist_entry__set_folding()
597 he->nr_rows = unfold ? n : 0; in hist_entry__set_folding()
599 he->nr_rows = 0; in hist_entry__set_folding()
609 nd = rb_first_cached(&browser->hists->entries); in __hist_browser__set_folding()
619 if (he->filtered || percent < browser->min_pcnt) in __hist_browser__set_folding()
622 if (!he->depth || unfold) in __hist_browser__set_folding()
623 browser->nr_hierarchy_entries++; in __hist_browser__set_folding()
624 if (he->leaf) 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()
628 he->has_no_entry = true; in __hist_browser__set_folding()
629 he->nr_rows = 1; in __hist_browser__set_folding()
631 he->has_no_entry = false; in __hist_browser__set_folding()
637 browser->nr_hierarchy_entries = 0; in hist_browser__set_folding()
638 browser->nr_callchain_rows = 0; 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()
648 if (!browser->he_selection) in hist_browser__set_folding_selected()
651 if (unfold == browser->he_selection->unfolded) in hist_browser__set_folding_selected()
662 " perf top -r 80\n\n" in ui_browser__warn_lost_events()
668 return browser->title ? browser->title(browser, bf, size) : 0; in hist_browser__title()
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()
682 hbt->timer(hbt->arg); in hist_browser__handle_hotkey()
688 ui_browser__update_nr_entries(&browser->b, nr_entries); in hist_browser__handle_hotkey()
691 (evsel->evlist->stats.nr_lost_warned != in hist_browser__handle_hotkey()
692 evsel->evlist->stats.nr_events[PERF_RECORD_LOST])) { in hist_browser__handle_hotkey()
693 evsel->evlist->stats.nr_lost_warned = in hist_browser__handle_hotkey()
694 evsel->evlist->stats.nr_events[PERF_RECORD_LOST]; in hist_browser__handle_hotkey()
695 ui_browser__warn_lost_events(&browser->b); 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()
730 browser->show_headers = !browser->show_headers; in hist_browser__handle_hotkey()
738 return -1; in hist_browser__handle_hotkey()
748 struct hist_browser_timer *hbt = browser->hbt; in hist_browser__run()
749 int delay_secs = hbt ? hbt->refresh : 0; 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()
756 if (ui_browser__show(&browser->b, title, "%s", help) < 0) in hist_browser__run()
757 return -1; in hist_browser__run()
763 key = ui_browser__run(&browser->b, delay_secs); in hist_browser__run()
769 ui_browser__hide(&browser->b); in hist_browser__run()
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()
804 arg->is_current_entry = true; 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()
823 arg->printed += fprintf(arg->fp, "%*s%c %s\n", offset, " ", in hist_browser__fprintf_callchain_entry()
833 return browser->b.rows == row; in hist_browser__check_output_full()
857 if (arg->row_offset != 0) { in hist_browser__show_callchain_list()
858 arg->row_offset--; in hist_browser__show_callchain_list()
866 browser->show_dso); in hist_browser__show_callchain_list()
932 list_for_each_entry(chain, &child->parent_val, list) { in hist_browser__show_callchain_flat()
955 list_for_each_entry(chain, &child->val, list) { in hist_browser__show_callchain_flat()
984 return row - first_row; in hist_browser__show_callchain_flat()
996 browser->show_dso); in hist_browser__folded_callchain_str()
1036 if (arg->row_offset != 0) { in hist_browser__show_callchain_folded()
1037 arg->row_offset--; in hist_browser__show_callchain_folded()
1052 list_for_each_entry(chain, &child->parent_val, list) { in hist_browser__show_callchain_folded()
1068 list_for_each_entry(chain, &child->val, list) { in hist_browser__show_callchain_folded()
1095 return row - first_row; in hist_browser__show_callchain_folded()
1125 list_for_each_entry(chain, &child->val, list) { in hist_browser__show_callchain_graph()
1148 if (folded_sign == '-') { in hist_browser__show_callchain_graph()
1151 row += hist_browser__show_callchain_graph(browser, &child->rb_root, in hist_browser__show_callchain_graph()
1153 child->children_hit, in hist_browser__show_callchain_graph()
1161 return row - first_row; in hist_browser__show_callchain_graph()
1171 u64 total = hists__total_period(entry->hists); in hist_browser__show_callchain()
1176 parent_total = entry->stat_acc->period; in hist_browser__show_callchain()
1178 parent_total = entry->stat.period; in hist_browser__show_callchain()
1182 &entry->sorted_chain, row, in hist_browser__show_callchain()
1187 &entry->sorted_chain, row, in hist_browser__show_callchain()
1192 &entry->sorted_chain, level, row, in hist_browser__show_callchain()
1197 if (arg->is_current_entry) in hist_browser__show_callchain()
1198 browser->he_selection = entry; in hist_browser__show_callchain()
1211 struct hpp_arg *arg = hpp->ptr; in __hpp__slsmg_color_printf()
1221 ui_browser__set_percent_color(arg->b, percent, arg->current_entry); in __hpp__slsmg_color_printf()
1223 ret = scnprintf(hpp->buf, hpp->size, fmt, len, percent); in __hpp__slsmg_color_printf()
1224 ui_browser__printf(arg->b, "%s", hpp->buf); in __hpp__slsmg_color_printf()
1232 return he->stat._field; \
1247 return he->stat_acc->_field; \
1256 struct hpp_arg *arg = hpp->ptr; \
1257 int len = fmt->user_len ?: fmt->len; \
1258 int ret = scnprintf(hpp->buf, hpp->size, \
1260 ui_browser__printf(arg->b, "%s", hpp->buf); \
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()
1305 off_t row_offset = entry->row_offset; 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()
1337 if (perf_hpp__should_skip(fmt, entry->hists) || 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()
1352 width -= 2; in hist_browser__show_entry()
1356 ui_browser__printf(&browser->b, " "); in hist_browser__show_entry()
1357 width -= 2; in hist_browser__show_entry()
1360 if (fmt->color) { in hist_browser__show_entry()
1361 int ret = fmt->color(fmt, &hpp, entry); in hist_browser__show_entry()
1364 * fmt->color() already used ui_browser to in hist_browser__show_entry()
1367 ui_browser__printf(&browser->b, "%s", s + ret); in hist_browser__show_entry()
1369 hist_entry__snprintf_alignment(entry, &hpp, fmt, fmt->entry(fmt, &hpp, entry)); in hist_browser__show_entry()
1370 ui_browser__printf(&browser->b, "%s", s); in hist_browser__show_entry()
1372 width -= hpp.buf - 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()
1384 --row_offset; in hist_browser__show_entry()
1386 if (folded_sign == '-' && row != browser->b.rows) { in hist_browser__show_entry()
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()
1411 off_t row_offset = entry->row_offset; in hist_browser__show_hierarchy_entry()
1416 .b = &browser->b, in hist_browser__show_hierarchy_entry()
1420 int hierarchy_indent = (entry->hists->nr_hpp_node - 2) * HIERARCHY_INDENT; 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()
1431 if (entry->leaf && row_offset) { in hist_browser__show_hierarchy_entry()
1432 row_offset--; 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()
1444 width -= level * HIERARCHY_INDENT; in hist_browser__show_hierarchy_entry()
1447 fmt_node = list_first_entry(&entry->hists->hpp_formats, in hist_browser__show_hierarchy_entry()
1449 perf_hpp_list__for_each_format(&fmt_node->hpp, fmt) { in hist_browser__show_hierarchy_entry()
1457 if (perf_hpp__should_skip(fmt, entry->hists) || 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()
1471 width -= 2; in hist_browser__show_hierarchy_entry()
1474 ui_browser__printf(&browser->b, " "); in hist_browser__show_hierarchy_entry()
1475 width -= 2; in hist_browser__show_hierarchy_entry()
1478 if (fmt->color) { in hist_browser__show_hierarchy_entry()
1479 int ret = fmt->color(fmt, &hpp, entry); in hist_browser__show_hierarchy_entry()
1482 * fmt->color() already used ui_browser to in hist_browser__show_hierarchy_entry()
1485 ui_browser__printf(&browser->b, "%s", s + ret); in hist_browser__show_hierarchy_entry()
1487 int ret = fmt->entry(fmt, &hpp, entry); in hist_browser__show_hierarchy_entry()
1489 ui_browser__printf(&browser->b, "%s", s); in hist_browser__show_hierarchy_entry()
1491 width -= hpp.buf - s; in hist_browser__show_hierarchy_entry()
1495 ui_browser__write_nstring(&browser->b, "", hierarchy_indent); in hist_browser__show_hierarchy_entry()
1496 width -= 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()
1515 perf_hpp_list__for_each_format(entry->hpp_list, fmt) { 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()
1523 width -= 2; in hist_browser__show_hierarchy_entry()
1530 if (fmt->color) { in hist_browser__show_hierarchy_entry()
1531 width -= fmt->color(fmt, &hpp, entry); in hist_browser__show_hierarchy_entry()
1535 width -= fmt->entry(fmt, &hpp, entry); 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()
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()
1593 width -= 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()
1598 perf_hpp_list__for_each_format(&fmt_node->hpp, fmt) { 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()
1615 width -= ret; in hist_browser__show_no_entry()
1618 ui_browser__write_nstring(&browser->b, "", indent * HIERARCHY_INDENT); in hist_browser__show_no_entry()
1619 width -= 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()
1626 width -= ret + 2; 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()
1640 return hpp->size <= 0; in advance_hpp_check()
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()
1667 ret = fmt->header(fmt, &dummy_hpp, hists, line, &span); in hists_browser__scnprintf_headers()
1684 struct hists *hists = browser->hists; in hists_browser__scnprintf_hierarchy_headers()
1693 int indent = hists->nr_hpp_node - 2; in hists_browser__scnprintf_hierarchy_headers()
1702 fmt_node = list_first_entry(&hists->hpp_formats, in hists_browser__scnprintf_hierarchy_headers()
1704 perf_hpp_list__for_each_format(&fmt_node->hpp, fmt) { in hists_browser__scnprintf_hierarchy_headers()
1705 if (column++ < browser->b.horiz_scroll) in hists_browser__scnprintf_hierarchy_headers()
1708 ret = fmt->header(fmt, &dummy_hpp, hists, 0, NULL); in hists_browser__scnprintf_hierarchy_headers()
1727 list_for_each_entry_continue(fmt_node, &hists->hpp_formats, list) { in hists_browser__scnprintf_hierarchy_headers()
1736 perf_hpp_list__for_each_format(&fmt_node->hpp, fmt) { in hists_browser__scnprintf_hierarchy_headers()
1749 ret = fmt->header(fmt, &dummy_hpp, hists, 0, NULL); in hists_browser__scnprintf_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()
1780 struct hists *hists = browser->hists; in hists_browser__headers()
1781 struct perf_hpp_list *hpp_list = hists->hpp_list; in hists_browser__headers()
1785 for (line = 0; line < hpp_list->nr_header_lines; line++) { 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()
1807 if (browser->top == NULL) { in ui_browser__hists_init_top()
1811 browser->top = rb_first_cached(&hb->hists->entries); in ui_browser__hists_init_top()
1821 if (hb->show_headers) in hist_browser__refresh()
1825 hb->he_selection = NULL; in hist_browser__refresh()
1826 hb->selection = NULL; in hist_browser__refresh()
1828 for (nd = browser->top; nd; nd = rb_hierarchy_next(nd)) { in hist_browser__refresh()
1832 if (h->filtered) { in hist_browser__refresh()
1834 h->unfolded = false; in hist_browser__refresh()
1843 if (percent < hb->min_pcnt) in hist_browser__refresh()
1848 h->depth); in hist_browser__refresh()
1849 if (row == browser->rows) in hist_browser__refresh()
1852 if (h->has_no_entry) { in hist_browser__refresh()
1853 hist_browser__show_no_entry(hb, row, h->depth + 1); in hist_browser__refresh()
1860 if (row == browser->rows) in hist_browser__refresh()
1874 if (!h->filtered && percent >= min_pcnt) in hists__filter_entries()
1897 if (!h->filtered && percent >= min_pcnt) in hists__filter_prev_entries()
1916 if (browser->nr_entries == 0) in ui_browser__hists_seek()
1923 nd = hists__filter_entries(rb_first(browser->entries), in ui_browser__hists_seek()
1924 hb->min_pcnt); 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()
1931 nd = hists__filter_prev_entries(nd, hb->min_pcnt); in ui_browser__hists_seek()
1942 h = rb_entry(browser->top, struct hist_entry, rb_node); in ui_browser__hists_seek()
1943 h->row_offset = 0; in ui_browser__hists_seek()
1965 if (h->unfolded && h->leaf) { in ui_browser__hists_seek()
1966 u16 remaining = h->nr_rows - h->row_offset; in ui_browser__hists_seek()
1968 offset -= remaining; in ui_browser__hists_seek()
1969 h->row_offset = 0; in ui_browser__hists_seek()
1971 h->row_offset += offset; in ui_browser__hists_seek()
1973 browser->top = nd; in ui_browser__hists_seek()
1978 hb->min_pcnt); in ui_browser__hists_seek()
1981 --offset; in ui_browser__hists_seek()
1982 browser->top = nd; in ui_browser__hists_seek()
1987 if (h->unfolded && h->leaf) { in ui_browser__hists_seek()
1989 if (-offset > h->row_offset) { in ui_browser__hists_seek()
1990 offset += h->row_offset; in ui_browser__hists_seek()
1991 h->row_offset = 0; in ui_browser__hists_seek()
1993 h->row_offset += offset; in ui_browser__hists_seek()
1995 browser->top = nd; in ui_browser__hists_seek()
1999 if (-offset > h->nr_rows) { in ui_browser__hists_seek()
2000 offset += h->nr_rows; in ui_browser__hists_seek()
2001 h->row_offset = 0; in ui_browser__hists_seek()
2003 h->row_offset = h->nr_rows + offset; in ui_browser__hists_seek()
2005 browser->top = nd; in ui_browser__hists_seek()
2012 hb->min_pcnt); in ui_browser__hists_seek()
2016 browser->top = nd; in ui_browser__hists_seek()
2024 if (h->unfolded && h->leaf) in ui_browser__hists_seek()
2025 h->row_offset = h->nr_rows; in ui_browser__hists_seek()
2031 browser->top = nd; in ui_browser__hists_seek()
2033 h->row_offset = 0; in ui_browser__hists_seek()
2070 hists__for_each_format(browser->hists, fmt) { in hist_browser__fprintf_entry()
2071 if (perf_hpp__should_skip(fmt, he->hists)) in hist_browser__fprintf_entry()
2080 ret = fmt->entry(fmt, &hpp, he); in hist_browser__fprintf_entry()
2086 if (folded_sign == '-') in hist_browser__fprintf_entry()
2108 int hierarchy_indent = (he->hists->nr_hpp_node - 2) * HIERARCHY_INDENT; in hist_browser__fprintf_hierarchy_entry()
2116 fmt_node = list_first_entry(&he->hists->hpp_formats, in hist_browser__fprintf_hierarchy_entry()
2118 perf_hpp_list__for_each_format(&fmt_node->hpp, fmt) { in hist_browser__fprintf_hierarchy_entry()
2125 ret = fmt->entry(fmt, &hpp, he); in hist_browser__fprintf_hierarchy_entry()
2132 perf_hpp_list__for_each_format(he->hpp_list, fmt) { in hist_browser__fprintf_hierarchy_entry()
2136 ret = fmt->entry(fmt, &hpp, he); in hist_browser__fprintf_hierarchy_entry()
2143 if (he->leaf && folded_sign == '-') { in hist_browser__fprintf_hierarchy_entry()
2145 he->depth + 1); in hist_browser__fprintf_hierarchy_entry()
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()
2163 h->depth); in hist_browser__fprintf()
2169 browser->min_pcnt); in hist_browser__fprintf()
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()
2189 return -1; in hist_browser__dump()
2198 return -1; in hist_browser__dump()
2201 ++browser->print_seq; in hist_browser__dump()
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()
2226 fmt_node = list_first_entry(&hists->hpp_formats, in hist_browser__init()
2228 perf_hpp_list__for_each_format(&fmt_node->hpp, fmt) 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()
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()
2273 return browser->he_selection; in hist_browser__selected_entry()
2278 return browser->he_selection->thread; in hist_browser__selected_thread()
2283 return browser->he_selection ? browser->he_selection->res_samples : NULL; in hist_browser__selected_res_sample()
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()
2298 struct perf_top *top = hbt->arg; in hists_browser__scnprintf_title()
2300 printed += scnprintf(bf + printed, size - printed, in hists_browser__scnprintf_title()
2302 top->lost, top->lost_total); in hists_browser__scnprintf_title()
2304 printed += scnprintf(bf + printed, size - printed, in hists_browser__scnprintf_title()
2306 top->drop, top->drop_total); in hists_browser__scnprintf_title()
2308 if (top->zero) in hists_browser__scnprintf_title()
2309 printed += scnprintf(bf + printed, size - printed, " [z]"); in hists_browser__scnprintf_title()
2337 int nr_options = 0, choice = -1, ret = -1; in switch_data_file()
2354 char *name = dent->d_name; in switch_data_file()
2357 if (!(dent->d_type == DT_REG)) in switch_data_file()
2416 unsigned long time;
2420 struct map_symbol ms; member
2435 perf_env__lookup_objdump(browser->env, &annotate_opts.objdump_path)) in do_annotate()
2438 notes = symbol__annotation(act->ms.sym); in do_annotate()
2439 if (!notes->src) 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()
2453 if ((err == 'q' || err == CTRL('c')) && he->branch_info) 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()
2487 struct map_symbol *ms, in add_annotate_opt() argument
2492 if (!ms->map || (dso = map__dso(ms->map)) == NULL || dso__annotate_warned(dso)) in add_annotate_opt()
2495 if (!ms->sym) in add_annotate_opt()
2496 ms->sym = symbol__new_unresolved(addr, ms->map); in add_annotate_opt()
2498 if (ms->sym == NULL || symbol__annotation(ms->sym)->src == NULL) in add_annotate_opt()
2501 if (asprintf(optstr, "Annotate %s", ms->sym->name) < 0) in add_annotate_opt()
2504 act->ms = *ms; in add_annotate_opt()
2505 act->fn = do_annotate; in add_annotate_opt()
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()
2524 if (he == NULL || he->mem_type == NULL || he->mem_type->histograms == NULL) in add_annotate_type_opt()
2527 if (asprintf(optstr, "Annotate type %s", he->mem_type->self.type_name) < 0) in add_annotate_type_opt()
2530 act->evsel = hists_to_evsel(browser->hists); in add_annotate_type_opt()
2531 act->fn = do_annotate_type; in add_annotate_type_opt()
2538 struct thread *thread = act->thread; in do_zoom_thread()
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()
2554 ui_helpline__fpush("To zoom out press ESC or ENTER + \"Zoom out of %s(%d) thread\"", in do_zoom_thread()
2557 ui_helpline__fpush("To zoom out press ESC or ENTER + \"Zoom out of %s 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()
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()
2593 act->thread = thread; in add_thread_opt()
2594 act->fn = do_zoom_thread; in add_thread_opt()
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()
2610 ui_helpline__fpush("To zoom out press ESC or ENTER + \"Zoom out of %s DSO\"", 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()
2625 return hists_browser__zoom_map(browser, act->ms.map); in do_zoom_dso()
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()
2640 act->ms.map = map; in add_dso_opt()
2641 act->fn = do_zoom_dso; in add_dso_opt()
2663 act->fn = do_toggle_callchain; in add_callchain_toggle_opt()
2671 map__browse(act->ms.map); in do_browse_map()
2679 if (!hists__has(browser->hists, dso) || map == NULL) in add_map_opt()
2685 act->ms.map = map; in add_map_opt()
2686 act->fn = do_browse_map; in add_map_opt()
2699 if (act->thread) in do_run_script()
2700 len += strlen(thread__comm_str(act->thread)); in do_run_script()
2701 else if (act->ms.sym) in do_run_script()
2702 len += strlen(act->ms.sym->name); in do_run_script()
2705 return -1; in do_run_script()
2708 if (act->thread) { in do_run_script()
2709 n = scnprintf(script_opt, len, " -c %s ", in do_run_script()
2710 thread__comm_str(act->thread)); in do_run_script()
2711 } else if (act->ms.sym) { in do_run_script()
2712 n = scnprintf(script_opt, len, " -S %s ", in do_run_script()
2713 act->ms.sym->name); in do_run_script()
2716 if (act->time) { in do_run_script()
2718 unsigned long starttime = act->time; in do_run_script()
2719 unsigned long endtime = act->time + symbol_conf.time_quantum; in do_run_script()
2721 if (starttime == endtime) { /* Display 1ms as fallback */ in do_run_script()
2722 starttime -= 1*NSEC_PER_MSEC; in do_run_script()
2727 n += snprintf(script_opt + n, len - n, " --time %s,%s", start, end); in do_run_script()
2730 script_browse(script_opt, act->evsel); in do_run_script()
2742 res_sample_browse(he->res_samples, he->num_res, act->evsel, act->rstype); in do_res_sample_script()
2759 sym->name, tstr) < 0) in add_script_opt_2()
2766 act->thread = thread; in add_script_opt_2()
2767 act->ms.sym = sym; in add_script_opt_2()
2768 act->evsel = evsel; in add_script_opt_2()
2769 act->fn = do_run_script; in add_script_opt_2()
2791 j += timestamp__scnprintf_usec(he->time, tstr + j, in add_script_opt()
2792 sizeof tstr - j); in add_script_opt()
2793 j += sprintf(tstr + j, "-"); in add_script_opt()
2794 timestamp__scnprintf_usec(he->time + symbol_conf.time_quantum, in add_script_opt()
2795 tstr + j, sizeof tstr - j); in add_script_opt()
2798 act->time = he->time; in add_script_opt()
2818 act->fn = do_res_sample_script; in add_res_sample_opt()
2819 act->evsel = evsel; in add_res_sample_opt()
2820 act->rstype = type; in add_res_sample_opt()
2841 if (!is_report_browser(browser->hbt)) in add_switch_opt()
2847 act->fn = do_switch_data; in add_switch_opt()
2865 act->fn = do_exit_browser; in add_exit_opt()
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()
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()
2902 act->socket = socket_id; in add_socket_opt()
2903 act->fn = do_zoom_socket; in add_socket_opt()
2910 struct rb_node *nd = rb_first_cached(&hb->hists->entries); in hist_browser__update_nr_entries()
2912 if (hb->min_pcnt == 0 && !symbol_conf.report_hierarchy) { in hist_browser__update_nr_entries()
2913 hb->nr_non_filtered_entries = hb->hists->nr_non_filtered_entries; in hist_browser__update_nr_entries()
2917 while ((nd = hists__filter_entries(nd, hb->min_pcnt)) != NULL) { in hist_browser__update_nr_entries()
2922 hb->nr_non_filtered_entries = nr_entries; in hist_browser__update_nr_entries()
2923 hb->nr_hierarchy_entries = nr_entries; in hist_browser__update_nr_entries()
2930 struct rb_node *nd = rb_first_cached(&hb->hists->entries); in hist_browser__update_percent_limit()
2931 u64 total = hists__total_period(hb->hists); in hist_browser__update_percent_limit()
2934 hb->min_pcnt = callchain_param.min_percent = percent; in hist_browser__update_percent_limit()
2936 while ((nd = hists__filter_entries(nd, hb->min_pcnt)) != NULL) { in hist_browser__update_percent_limit()
2939 if (he->has_no_entry) { in hist_browser__update_percent_limit()
2940 he->has_no_entry = false; in hist_browser__update_percent_limit()
2941 he->nr_rows = 0; in hist_browser__update_percent_limit()
2944 if (!he->leaf || !hist_entry__has_callchains(he) || !symbol_conf.use_callchain) in hist_browser__update_percent_limit()
2948 total = he->stat.period; in hist_browser__update_percent_limit()
2951 total = he->stat_acc->period; in hist_browser__update_percent_limit()
2956 callchain_param.sort(&he->sorted_chain, he->callchain, in hist_browser__update_percent_limit()
2962 /* force to re-evaluate folding state of callchains */ in hist_browser__update_percent_limit()
2963 he->init_have_children = false; in hist_browser__update_percent_limit()
2979 int key = -1; in evsel__hists_browse()
2981 int delay_secs = hbt ? hbt->refresh : 0; in evsel__hists_browse()
2990 "For symbolic views (--sort has sym):\n\n" \ in evsel__hists_browse()
3015 "0-9 Sort by event n in group"; in evsel__hists_browse()
3025 return -1; in evsel__hists_browse()
3027 /* reset abort key so that it can get Ctrl-C as a key */ in evsel__hists_browse()
3033 browser->min_pcnt = min_pcnt; 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()
3055 int socked_id = -1; in evsel__hists_browse()
3062 if (browser->he_selection != NULL) { in evsel__hists_browse()
3064 map = browser->selection->map; in evsel__hists_browse()
3065 socked_id = browser->he_selection->socket; in evsel__hists_browse()
3079 evsel->core.nr_members < 2) { in evsel__hists_browse()
3086 if (key - '0' == symbol_conf.group_sort_idx) in evsel__hists_browse()
3089 symbol_conf.group_sort_idx = key - '0'; in evsel__hists_browse()
3091 if (symbol_conf.group_sort_idx >= evsel->core.nr_members) { in evsel__hists_browse()
3094 evsel->core.nr_members - 1, in evsel__hists_browse()
3095 evsel->core.nr_members - 1); in evsel__hists_browse()
3104 ui_browser__warning(&browser->b, delay_secs * 2, in evsel__hists_browse()
3106 "include \"sym*\" in --sort to use it."); 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()
3123 if (!bi || !bi->to.ms.map) in evsel__hists_browse()
3126 actions->ms.sym = symbol__new_unresolved(bi->to.al_addr, bi->to.ms.map); in evsel__hists_browse()
3127 actions->ms.map = bi->to.ms.map; 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()
3134 if (!actions->ms.sym) 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()
3155 actions->ms.map = map; in evsel__hists_browse()
3159 if (browser->selection != NULL) 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()
3170 actions->thread = thread; in evsel__hists_browse()
3174 actions->socket = socked_id; in evsel__hists_browse()
3180 "To remove the filter later, press / + ENTER.", in evsel__hists_browse()
3183 hists->symbol_filter_str = *buf ? buf : NULL; in evsel__hists_browse()
3190 actions->thread = NULL; in evsel__hists_browse()
3191 actions->ms.sym = NULL; in evsel__hists_browse()
3203 /* env->arch is NULL for live-mode (i.e. perf top) */ in evsel__hists_browse()
3204 if (env->arch) in evsel__hists_browse()
3212 struct perf_top *top = hbt->arg; in evsel__hists_browse()
3214 top->zero = !top->zero; in evsel__hists_browse()
3226 ui_browser__warning(&browser->b, delay_secs * 2, 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()
3264 actions->ms.map = map; 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()
3268 * No need to set actions->dso here since in evsel__hists_browse()
3273 } else if (top == &browser->hists->thread_filter) { in evsel__hists_browse()
3275 } else if (top == &browser->hists->socket_filter) { in evsel__hists_browse()
3285 struct perf_top *top = hbt->arg; in evsel__hists_browse()
3287 evlist__toggle_enable(top->evlist); in evsel__hists_browse()
3292 if (top->evlist->enabled) { in evsel__hists_browse()
3293 helpline = "Press 'f' to disable the events or 'h' to see other hotkeys"; in evsel__hists_browse()
3294 hbt->refresh = delay_secs; in evsel__hists_browse()
3296 helpline = "Press 'f' again to re-enable the events"; in evsel__hists_browse()
3297 hbt->refresh = 0; in evsel__hists_browse()
3303 helpline = "Press '?' for help on key bindings"; 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()
3321 &bi->from.ms, in evsel__hists_browse()
3322 bi->from.al_addr); in evsel__hists_browse()
3323 if (bi->to.ms.sym != bi->from.ms.sym) in evsel__hists_browse()
3327 &bi->to.ms, in evsel__hists_browse()
3328 bi->to.al_addr); in evsel__hists_browse()
3329 } else if (browser->he_selection) { in evsel__hists_browse()
3333 browser->selection, in evsel__hists_browse()
3334 browser->he_selection->ip); in evsel__hists_browse()
3340 browser->he_selection); in evsel__hists_browse()
3348 browser->selection ? in evsel__hists_browse()
3349 browser->selection->map : NULL); in evsel__hists_browse()
3357 if (browser->he_selection) { in evsel__hists_browse()
3365 * Note that browser->selection != NULL in evsel__hists_browse()
3366 * when browser->he_selection is not NULL, in evsel__hists_browse()
3367 * so we don't need to check browser->selection in evsel__hists_browse()
3368 * before fetching browser->selection->sym like what in evsel__hists_browse()
3369 * we do before fetching browser->selection->map. in evsel__hists_browse()
3373 if (hists__has(hists, sym) && browser->selection->sym) { in evsel__hists_browse()
3377 NULL, browser->selection->sym, in evsel__hists_browse()
3405 if (choice == -1) in evsel__hists_browse()
3412 key = act->fn(browser, act); in evsel__hists_browse()
3419 pstack__delete(browser->pstack); in evsel__hists_browse()
3442 unsigned long nr_events = hists->stats.nr_samples; in perf_evsel_menu__write()
3458 nr_events += pos_hists->stats.nr_samples; in perf_evsel_menu__write()
3467 nr_events = evsel->evlist->stats.nr_events[PERF_RECORD_LOST]; in perf_evsel_menu__write()
3469 menu->lost_events = true; in perf_evsel_menu__write()
3478 ui_browser__write_nstring(browser, warn, browser->width - printed); in perf_evsel_menu__write()
3481 menu->selection = evsel; in perf_evsel_menu__write()
3489 struct evlist *evlist = menu->b.priv; in perf_evsel_menu__run()
3492 int delay_secs = hbt ? hbt->refresh : 0; in perf_evsel_menu__run()
3495 if (ui_browser__show(&menu->b, title, in perf_evsel_menu__run()
3496 "ESC: exit, ENTER|->: Browse histograms") < 0) in perf_evsel_menu__run()
3497 return -1; in perf_evsel_menu__run()
3500 key = ui_browser__run(&menu->b, delay_secs); in perf_evsel_menu__run()
3505 hbt->timer(hbt->arg); in perf_evsel_menu__run()
3507 if (!menu->lost_events_warned && in perf_evsel_menu__run()
3508 menu->lost_events && in perf_evsel_menu__run()
3510 ui_browser__warn_lost_events(&menu->b); in perf_evsel_menu__run()
3511 menu->lost_events_warned = true; in perf_evsel_menu__run()
3516 if (!menu->selection) in perf_evsel_menu__run()
3518 pos = menu->selection; in perf_evsel_menu__run()
3526 hbt->timer(hbt->arg); in perf_evsel_menu__run()
3528 menu->min_pcnt, menu->env, in perf_evsel_menu__run()
3530 ui_browser__show_title(&menu->b, title); in perf_evsel_menu__run()
3533 if (pos->core.node.next == &evlist->core.entries) in perf_evsel_menu__run()
3539 if (pos->core.node.prev == &evlist->core.entries) in perf_evsel_menu__run()
3556 if (!ui_browser__dialog_yesno(&menu->b, in perf_evsel_menu__run()
3569 ui_browser__hide(&menu->b); in perf_evsel_menu__run()
3591 .entries = &evlist->core.entries, in __evlist__tui_browse_hists()
3603 ui_helpline__push("Press ESC to exit"); in __evlist__tui_browse_hists()
3619 int nr_entries = evlist->core.nr_entries; in evlist__single_entry()
3637 int nr_entries = evlist->core.nr_entries; in evlist__tui_browse_hists()
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()
3670 unsigned long nr_samples = hists->stats.nr_samples; in block_hists_browser__title()
3675 scnprintf(bf + ret, size - ret, " of event '%s'", evname); in block_hists_browser__title()
3683 struct hists *hists = &bh->block_hists; in block_hists_tui_browse()
3685 int key = -1; in block_hists_tui_browse()
3694 return -1; 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()
3701 /* reset abort key so that it can get Ctrl-C as a key */ 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()
3734 br_cntr_text, "Press any key...", 0); in block_hists_tui_browse()
3738 "Press any key...", 0); in block_hists_tui_browse()