Lines Matching +full:long +full:- +full:press +full:- +full:ms
1 // SPDX-License-Identifier: GPL-2.0
31 #include "../../util/block-info.h"
44 #include "time-utils.h"
58 return hists__has_filter(hb->hists) || hb->min_pcnt || symbol_conf.has_filter || hb->c2c_filter; in hist_browser__has_filter()
64 struct hists *hists = browser->hists; in hist_browser__get_folding()
67 for (nd = rb_first_cached(&hists->entries); in hist_browser__get_folding()
68 (nd = hists__filter_entries(nd, browser->min_pcnt)) != NULL; in hist_browser__get_folding()
73 if (he->leaf && he->unfolded) in hist_browser__get_folding()
74 unfolded_rows += he->nr_rows; in hist_browser__get_folding()
81 struct ui_browser *browser = &hb->b; in hist_browser__set_title_space()
82 struct hists *hists = hb->hists; in hist_browser__set_title_space()
83 struct perf_hpp_list *hpp_list = hists->hpp_list; in hist_browser__set_title_space()
85 browser->extra_title_lines = hb->show_headers ? hpp_list->nr_header_lines : 0; in hist_browser__set_title_space()
93 nr_entries = hb->nr_hierarchy_entries; in hist_browser__nr_entries()
95 nr_entries = hb->nr_non_filtered_entries; in hist_browser__nr_entries()
97 nr_entries = hb->hists->nr_entries; in hist_browser__nr_entries()
99 hb->nr_callchain_rows = hist_browser__get_folding(hb); in hist_browser__nr_entries()
100 return nr_entries + hb->nr_callchain_rows; in hist_browser__nr_entries()
105 struct ui_browser *browser = &hb->b; in hist_browser__update_rows()
106 struct hists *hists = hb->hists; in hist_browser__update_rows()
107 struct perf_hpp_list *hpp_list = hists->hpp_list; in hist_browser__update_rows()
110 if (!hb->show_headers) { in hist_browser__update_rows()
111 browser->rows += browser->extra_title_lines; in hist_browser__update_rows()
112 browser->extra_title_lines = 0; in hist_browser__update_rows()
116 browser->extra_title_lines = hpp_list->nr_header_lines; in hist_browser__update_rows()
117 browser->rows -= browser->extra_title_lines; in hist_browser__update_rows()
122 index_row = browser->index - browser->top_idx; in hist_browser__update_rows()
123 if (index_row >= browser->rows) in hist_browser__update_rows()
124 browser->index -= index_row - browser->rows + 1; in hist_browser__update_rows()
131 /* 3 == +/- toggle symbol before actual hist_entry rendering */ in hist_browser__refresh_dimensions()
132 browser->width = 3 + (hists__sort_list_width(hb->hists) + sizeof("[k]")); in hist_browser__refresh_dimensions()
135 * before updating browser->width, as it will invalidate the in hist_browser__refresh_dimensions()
145 * The hists__remove_entry_filter() already folds non-filtered in hist_browser__reset()
148 browser->nr_callchain_rows = 0; in hist_browser__reset()
151 browser->b.nr_entries = hist_browser__nr_entries(browser); in hist_browser__reset()
152 hist_browser__refresh_dimensions(&browser->b); in hist_browser__reset()
153 ui_browser__reset_index(&browser->b); in hist_browser__reset()
158 return unfolded ? '-' : '+'; in tree__folded_sign()
163 return he->has_children ? tree__folded_sign(he->unfolded) : ' '; in hist_entry__folded()
168 return cl->has_children ? tree__folded_sign(cl->unfolded) : ' '; in callchain_list__folded()
173 cl->unfolded = unfold ? cl->has_children : false; in callchain_list__set_folding()
181 for (nd = rb_first(&node->rb_root); nd; nd = rb_next(nd)) { in callchain_node__count_rows_rb_tree()
186 list_for_each_entry(chain, &child->val, list) { in callchain_node__count_rows_rb_tree()
195 if (folded_sign == '-') /* Have children and they're unfolded */ in callchain_node__count_rows_rb_tree()
208 list_for_each_entry(chain, &node->parent_val, list) { in callchain_node__count_flat_rows()
218 list_for_each_entry(chain, &node->val, list) { in callchain_node__count_flat_rows()
220 /* node->parent_val list might be empty */ in callchain_node__count_flat_rows()
247 list_for_each_entry(chain, &node->val, list) { in callchain_node__count_rows()
250 unfolded = chain->unfolded; in callchain_node__count_rows()
279 if (he->leaf) in hierarchy_count_rows()
280 return callchain__count_rows(&he->sorted_chain); in hierarchy_count_rows()
282 if (he->has_no_entry) in hierarchy_count_rows()
285 node = rb_first_cached(&he->hroot_out); in hierarchy_count_rows()
292 if (!child->filtered && percent >= hb->min_pcnt) { in hierarchy_count_rows()
295 if (include_children && child->unfolded) in hierarchy_count_rows()
309 if (!he->has_children) in hist_entry__toggle_fold()
312 he->unfolded = !he->unfolded; in hist_entry__toggle_fold()
321 if (!cl->has_children) in callchain_list__toggle_fold()
324 cl->unfolded = !cl->unfolded; in callchain_list__toggle_fold()
330 struct rb_node *nd = rb_first(&node->rb_root); in callchain_node__init_have_children_rb_tree()
332 for (nd = rb_first(&node->rb_root); nd; nd = rb_next(nd)) { in callchain_node__init_have_children_rb_tree()
337 list_for_each_entry(chain, &child->val, list) { in callchain_node__init_have_children_rb_tree()
340 chain->has_children = chain->list.next != &child->val || in callchain_node__init_have_children_rb_tree()
341 !RB_EMPTY_ROOT(&child->rb_root); in callchain_node__init_have_children_rb_tree()
343 chain->has_children = chain->list.next == &child->val && in callchain_node__init_have_children_rb_tree()
344 !RB_EMPTY_ROOT(&child->rb_root); in callchain_node__init_have_children_rb_tree()
356 chain = list_entry(node->val.next, struct callchain_list, list); in callchain_node__init_have_children()
357 chain->has_children = has_sibling; in callchain_node__init_have_children()
359 if (!list_empty(&node->val)) { in callchain_node__init_have_children()
360 chain = list_entry(node->val.prev, struct callchain_list, list); in callchain_node__init_have_children()
361 chain->has_children = !RB_EMPTY_ROOT(&node->rb_root); in callchain_node__init_have_children()
383 if (he->init_have_children) in hist_entry__init_have_children()
386 if (he->leaf) { in hist_entry__init_have_children()
387 he->has_children = !RB_EMPTY_ROOT(&he->sorted_chain); in hist_entry__init_have_children()
388 callchain__init_have_children(&he->sorted_chain); in hist_entry__init_have_children()
390 he->has_children = !RB_EMPTY_ROOT(&he->hroot_out.rb_root); in hist_entry__init_have_children()
393 he->init_have_children = true; in hist_entry__init_have_children()
398 struct hist_entry *he = browser->he_selection; in hist_browser__selection_has_children()
399 struct map_symbol *ms = browser->selection; in hist_browser__selection_has_children() local
401 if (!he || !ms) in hist_browser__selection_has_children()
404 if (ms == &he->ms) in hist_browser__selection_has_children()
405 return he->has_children; in hist_browser__selection_has_children()
407 return container_of(ms, struct callchain_list, ms)->has_children; in hist_browser__selection_has_children()
412 return browser->he_selection ? browser->he_selection->unfolded : false; in hist_browser__he_selection_unfolded()
417 struct hist_entry *he = browser->he_selection; in hist_browser__selection_unfolded()
418 struct map_symbol *ms = browser->selection; in hist_browser__selection_unfolded() local
420 if (!he || !ms) in hist_browser__selection_unfolded()
423 if (ms == &he->ms) in hist_browser__selection_unfolded()
424 return he->unfolded; in hist_browser__selection_unfolded()
426 return container_of(ms, struct callchain_list, ms)->unfolded; in hist_browser__selection_unfolded()
431 struct hist_entry *he = browser->he_selection; in hist_browser__selection_sym_name()
432 struct map_symbol *ms = browser->selection; in hist_browser__selection_sym_name() local
435 if (!he || !ms) in hist_browser__selection_sym_name()
438 if (ms == &he->ms) { in hist_browser__selection_sym_name()
443 callchain_entry = container_of(ms, struct callchain_list, ms); in hist_browser__selection_sym_name()
444 return callchain_list__sym_name(callchain_entry, bf, size, browser->show_dso); in hist_browser__selection_sym_name()
449 struct hist_entry *he = browser->he_selection; in hist_browser__toggle_fold()
450 struct map_symbol *ms = browser->selection; in hist_browser__toggle_fold() local
451 struct callchain_list *cl = container_of(ms, struct callchain_list, ms); in hist_browser__toggle_fold()
454 if (!he || !ms) in hist_browser__toggle_fold()
457 if (ms == &he->ms) in hist_browser__toggle_fold()
466 browser->b.nr_entries -= he->nr_rows; in hist_browser__toggle_fold()
468 if (he->leaf) in hist_browser__toggle_fold()
469 browser->nr_callchain_rows -= he->nr_rows; in hist_browser__toggle_fold()
471 browser->nr_hierarchy_entries -= he->nr_rows; in hist_browser__toggle_fold()
476 if (he->unfolded) { in hist_browser__toggle_fold()
477 if (he->leaf) in hist_browser__toggle_fold()
478 he->nr_rows = callchain__count_rows( in hist_browser__toggle_fold()
479 &he->sorted_chain); in hist_browser__toggle_fold()
481 he->nr_rows = hierarchy_count_rows(browser, he, false); in hist_browser__toggle_fold()
485 browser->b.nr_entries += child_rows - he->nr_rows; in hist_browser__toggle_fold()
487 if (!he->leaf && he->nr_rows == 0) { in hist_browser__toggle_fold()
488 he->has_no_entry = true; in hist_browser__toggle_fold()
489 he->nr_rows = 1; in hist_browser__toggle_fold()
493 browser->b.nr_entries -= child_rows - he->nr_rows; in hist_browser__toggle_fold()
495 if (he->has_no_entry) in hist_browser__toggle_fold()
496 he->has_no_entry = false; in hist_browser__toggle_fold()
498 he->nr_rows = 0; in hist_browser__toggle_fold()
501 browser->b.nr_entries += he->nr_rows; in hist_browser__toggle_fold()
503 if (he->leaf) in hist_browser__toggle_fold()
504 browser->nr_callchain_rows += he->nr_rows; in hist_browser__toggle_fold()
506 browser->nr_hierarchy_entries += he->nr_rows; in hist_browser__toggle_fold()
520 for (nd = rb_first(&node->rb_root); nd; nd = rb_next(nd)) { in callchain_node__set_folding_rb_tree()
525 list_for_each_entry(chain, &child->val, list) { in callchain_node__set_folding_rb_tree()
528 has_children = chain->has_children; in callchain_node__set_folding_rb_tree()
544 list_for_each_entry(chain, &node->val, list) { in callchain_node__set_folding()
547 has_children = chain->has_children; in callchain_node__set_folding()
577 for (nd = rb_first_cached(&he->hroot_out); nd; nd = rb_next(nd)) { in hierarchy_set_folding()
580 if (!child->filtered && percent >= hb->min_pcnt) in hierarchy_set_folding()
591 he->unfolded = unfold ? he->has_children : false; in __hist_entry__set_folding()
593 if (he->has_children) { in __hist_entry__set_folding()
596 if (he->leaf) in __hist_entry__set_folding()
597 n = callchain__set_folding(&he->sorted_chain, unfold); in __hist_entry__set_folding()
601 he->nr_rows = unfold ? n : 0; in __hist_entry__set_folding()
603 he->nr_rows = 0; in __hist_entry__set_folding()
612 if (he->filtered || percent < browser->min_pcnt) in hist_entry__set_folding()
617 if (!he->depth || unfold) in hist_entry__set_folding()
618 browser->nr_hierarchy_entries++; in hist_entry__set_folding()
619 if (he->leaf) in hist_entry__set_folding()
620 browser->nr_callchain_rows += he->nr_rows; in hist_entry__set_folding()
621 else if (unfold && !hist_entry__has_hierarchy_children(he, browser->min_pcnt)) { in hist_entry__set_folding()
622 browser->nr_hierarchy_entries++; in hist_entry__set_folding()
623 he->has_no_entry = true; in hist_entry__set_folding()
624 he->nr_rows = 1; in hist_entry__set_folding()
626 he->has_no_entry = false; in hist_entry__set_folding()
635 nd = rb_first_cached(&browser->hists->entries); in __hist_browser__set_folding()
648 browser->nr_hierarchy_entries = 0; in hist_browser__set_folding()
649 browser->nr_callchain_rows = 0; in hist_browser__set_folding()
652 browser->b.nr_entries = hist_browser__nr_entries(browser); in hist_browser__set_folding()
654 ui_browser__reset_index(&browser->b); in hist_browser__set_folding()
659 if (!browser->he_selection) in hist_browser__set_folding_selected()
662 hist_entry__set_folding(browser->he_selection, browser, unfold); in hist_browser__set_folding_selected()
663 browser->b.nr_entries = hist_browser__nr_entries(browser); in hist_browser__set_folding_selected()
671 " perf top -r 80\n\n" in ui_browser__warn_lost_events()
677 return browser->title ? browser->title(browser, bf, size) : 0; in hist_browser__title()
684 struct hist_browser_timer *hbt = browser->hbt; in hist_browser__handle_hotkey()
685 struct evsel *evsel = hists_to_evsel(browser->hists); in hist_browser__handle_hotkey()
691 hbt->timer(hbt->arg); in hist_browser__handle_hotkey()
697 ui_browser__update_nr_entries(&browser->b, nr_entries); in hist_browser__handle_hotkey()
700 (evsel->evlist->stats.nr_lost_warned != in hist_browser__handle_hotkey()
701 evsel->evlist->stats.nr_events[PERF_RECORD_LOST])) { in hist_browser__handle_hotkey()
702 evsel->evlist->stats.nr_lost_warned = in hist_browser__handle_hotkey()
703 evsel->evlist->stats.nr_events[PERF_RECORD_LOST]; in hist_browser__handle_hotkey()
704 ui_browser__warn_lost_events(&browser->b); in hist_browser__handle_hotkey()
708 ui_browser__show_title(&browser->b, title); in hist_browser__handle_hotkey()
712 struct hist_entry *h = rb_entry(browser->b.top, struct hist_entry, rb_node); in hist_browser__handle_hotkey()
717 seq++, browser->b.nr_entries, browser->hists->nr_entries, in hist_browser__handle_hotkey()
718 browser->b.extra_title_lines, browser->b.rows, in hist_browser__handle_hotkey()
719 browser->b.index, browser->b.top_idx, h->row_offset, h->nr_rows); in hist_browser__handle_hotkey()
739 browser->show_headers = !browser->show_headers; in hist_browser__handle_hotkey()
747 return -1; in hist_browser__handle_hotkey()
757 struct hist_browser_timer *hbt = browser->hbt; in hist_browser__run()
758 int delay_secs = hbt ? hbt->refresh : 0; in hist_browser__run()
760 browser->b.entries = &browser->hists->entries; in hist_browser__run()
761 browser->b.nr_entries = hist_browser__nr_entries(browser); in hist_browser__run()
765 if (ui_browser__show(&browser->b, title, "%s", help) < 0) in hist_browser__run()
766 return -1; in hist_browser__run()
772 key = ui_browser__run(&browser->b, delay_secs); in hist_browser__run()
778 ui_browser__hide(&browser->b); in hist_browser__run()
806 bool show_annotated = browser->show_dso && chain->ms.sym && symbol__annotation(chain->ms.sym)->src; in hist_browser__show_callchain_entry()
809 width = browser->b.width - (offset + 2); in hist_browser__show_callchain_entry()
810 if (ui_browser__is_current_entry(&browser->b, row)) { in hist_browser__show_callchain_entry()
811 browser->selection = &chain->ms; in hist_browser__show_callchain_entry()
813 arg->is_current_entry = true; in hist_browser__show_callchain_entry()
816 ui_browser__set_color(&browser->b, color); in hist_browser__show_callchain_entry()
817 ui_browser__gotorc(&browser->b, row, 0); in hist_browser__show_callchain_entry()
818 ui_browser__write_nstring(&browser->b, " ", offset); in hist_browser__show_callchain_entry()
819 ui_browser__printf(&browser->b, "%c", folded_sign); in hist_browser__show_callchain_entry()
820 ui_browser__write_graph(&browser->b, show_annotated ? SLSMG_RARROW_CHAR : ' '); in hist_browser__show_callchain_entry()
821 ui_browser__write_nstring(&browser->b, str, width); in hist_browser__show_callchain_entry()
832 arg->printed += fprintf(arg->fp, "%*s%c %s\n", offset, " ", in hist_browser__fprintf_callchain_entry()
842 return browser->b.rows == row; in hist_browser__check_output_full()
866 if (arg->row_offset != 0) { in hist_browser__show_callchain_list()
867 arg->row_offset--; in hist_browser__show_callchain_list()
875 browser->show_dso); in hist_browser__show_callchain_list()
941 list_for_each_entry(chain, &child->parent_val, list) { in hist_browser__show_callchain_flat()
964 list_for_each_entry(chain, &child->val, list) { in hist_browser__show_callchain_flat()
993 return row - first_row; in hist_browser__show_callchain_flat()
1005 browser->show_dso); in hist_browser__folded_callchain_str()
1045 if (arg->row_offset != 0) { in hist_browser__show_callchain_folded()
1046 arg->row_offset--; in hist_browser__show_callchain_folded()
1061 list_for_each_entry(chain, &child->parent_val, list) { in hist_browser__show_callchain_folded()
1077 list_for_each_entry(chain, &child->val, list) { in hist_browser__show_callchain_folded()
1104 return row - first_row; in hist_browser__show_callchain_folded()
1134 list_for_each_entry(chain, &child->val, list) { in hist_browser__show_callchain_graph()
1157 if (folded_sign == '-') { in hist_browser__show_callchain_graph()
1160 row += hist_browser__show_callchain_graph(browser, &child->rb_root, in hist_browser__show_callchain_graph()
1162 child->children_hit, in hist_browser__show_callchain_graph()
1170 return row - first_row; in hist_browser__show_callchain_graph()
1180 u64 total = hists__total_period(entry->hists); in hist_browser__show_callchain()
1185 parent_total = entry->stat_acc->period; in hist_browser__show_callchain()
1187 parent_total = entry->stat.period; in hist_browser__show_callchain()
1191 &entry->sorted_chain, row, in hist_browser__show_callchain()
1196 &entry->sorted_chain, row, in hist_browser__show_callchain()
1201 &entry->sorted_chain, level, row, in hist_browser__show_callchain()
1206 if (arg->is_current_entry) in hist_browser__show_callchain()
1207 browser->he_selection = entry; in hist_browser__show_callchain()
1220 struct hpp_arg *arg = hpp->ptr; in __hpp__slsmg_color_printf()
1230 ui_browser__set_percent_color(arg->b, percent, arg->current_entry); in __hpp__slsmg_color_printf()
1232 ret = scnprintf(hpp->buf, hpp->size, fmt, len, percent); in __hpp__slsmg_color_printf()
1233 ui_browser__printf(arg->b, "%s", hpp->buf); in __hpp__slsmg_color_printf()
1241 return he->stat._field; \
1256 return he->stat_acc->_field; \
1265 struct hpp_arg *arg = hpp->ptr; \
1266 int len = fmt->user_len ?: fmt->len; \
1267 int ret = scnprintf(hpp->buf, hpp->size, \
1269 ui_browser__printf(arg->b, "%s", hpp->buf); \
1310 int width = browser->b.width; in hist_browser__show_entry()
1312 bool current_entry = ui_browser__is_current_entry(&browser->b, row); in hist_browser__show_entry()
1314 off_t row_offset = entry->row_offset; in hist_browser__show_entry()
1319 browser->he_selection = entry; in hist_browser__show_entry()
1320 browser->selection = &entry->ms; in hist_browser__show_entry()
1330 .b = &browser->b, in hist_browser__show_entry()
1336 ui_browser__gotorc(&browser->b, row, 0); in hist_browser__show_entry()
1338 hists__for_each_format(browser->hists, fmt) { in hist_browser__show_entry()
1346 if (perf_hpp__should_skip(fmt, entry->hists) || in hist_browser__show_entry()
1347 column++ < browser->b.horiz_scroll) in hist_browser__show_entry()
1350 if (current_entry && browser->b.navkeypressed) { in hist_browser__show_entry()
1351 ui_browser__set_color(&browser->b, in hist_browser__show_entry()
1354 ui_browser__set_color(&browser->b, in hist_browser__show_entry()
1360 ui_browser__printf(&browser->b, "%c ", folded_sign); in hist_browser__show_entry()
1361 width -= 2; in hist_browser__show_entry()
1365 ui_browser__printf(&browser->b, " "); in hist_browser__show_entry()
1366 width -= 2; in hist_browser__show_entry()
1369 if (fmt->color) { in hist_browser__show_entry()
1370 int ret = fmt->color(fmt, &hpp, entry); in hist_browser__show_entry()
1373 * fmt->color() already used ui_browser to in hist_browser__show_entry()
1376 ui_browser__printf(&browser->b, "%s", s + ret); in hist_browser__show_entry()
1378 hist_entry__snprintf_alignment(entry, &hpp, fmt, fmt->entry(fmt, &hpp, entry)); in hist_browser__show_entry()
1379 ui_browser__printf(&browser->b, "%s", s); in hist_browser__show_entry()
1381 width -= hpp.buf - s; in hist_browser__show_entry()
1385 if (!browser->b.navkeypressed) in hist_browser__show_entry()
1388 ui_browser__write_nstring(&browser->b, "", width); in hist_browser__show_entry()
1393 --row_offset; in hist_browser__show_entry()
1395 if (folded_sign == '-' && row != browser->b.rows) { in hist_browser__show_entry()
1417 int width = browser->b.width; in hist_browser__show_hierarchy_entry()
1419 bool current_entry = ui_browser__is_current_entry(&browser->b, row); in hist_browser__show_hierarchy_entry()
1420 off_t row_offset = entry->row_offset; in hist_browser__show_hierarchy_entry()
1425 .b = &browser->b, in hist_browser__show_hierarchy_entry()
1429 int hierarchy_indent = (entry->hists->nr_hpp_node - 2) * HIERARCHY_INDENT; in hist_browser__show_hierarchy_entry()
1432 browser->he_selection = entry; in hist_browser__show_hierarchy_entry()
1433 browser->selection = &entry->ms; in hist_browser__show_hierarchy_entry()
1440 if (entry->leaf && row_offset) { in hist_browser__show_hierarchy_entry()
1441 row_offset--; in hist_browser__show_hierarchy_entry()
1445 ui_browser__gotorc(&browser->b, row, 0); in hist_browser__show_hierarchy_entry()
1447 if (current_entry && browser->b.navkeypressed) in hist_browser__show_hierarchy_entry()
1448 ui_browser__set_color(&browser->b, HE_COLORSET_SELECTED); in hist_browser__show_hierarchy_entry()
1450 ui_browser__set_color(&browser->b, HE_COLORSET_NORMAL); in hist_browser__show_hierarchy_entry()
1452 ui_browser__write_nstring(&browser->b, "", level * HIERARCHY_INDENT); in hist_browser__show_hierarchy_entry()
1453 width -= level * HIERARCHY_INDENT; in hist_browser__show_hierarchy_entry()
1456 fmt_node = list_first_entry(&entry->hists->hpp_formats, in hist_browser__show_hierarchy_entry()
1458 perf_hpp_list__for_each_format(&fmt_node->hpp, fmt) { in hist_browser__show_hierarchy_entry()
1466 if (perf_hpp__should_skip(fmt, entry->hists) || in hist_browser__show_hierarchy_entry()
1467 column++ < browser->b.horiz_scroll) in hist_browser__show_hierarchy_entry()
1470 if (current_entry && browser->b.navkeypressed) { in hist_browser__show_hierarchy_entry()
1471 ui_browser__set_color(&browser->b, in hist_browser__show_hierarchy_entry()
1474 ui_browser__set_color(&browser->b, in hist_browser__show_hierarchy_entry()
1479 ui_browser__printf(&browser->b, "%c ", folded_sign); in hist_browser__show_hierarchy_entry()
1480 width -= 2; in hist_browser__show_hierarchy_entry()
1483 ui_browser__printf(&browser->b, " "); in hist_browser__show_hierarchy_entry()
1484 width -= 2; in hist_browser__show_hierarchy_entry()
1487 if (fmt->color) { in hist_browser__show_hierarchy_entry()
1488 int ret = fmt->color(fmt, &hpp, entry); in hist_browser__show_hierarchy_entry()
1491 * fmt->color() already used ui_browser to in hist_browser__show_hierarchy_entry()
1494 ui_browser__printf(&browser->b, "%s", s + ret); in hist_browser__show_hierarchy_entry()
1496 int ret = fmt->entry(fmt, &hpp, entry); in hist_browser__show_hierarchy_entry()
1498 ui_browser__printf(&browser->b, "%s", s); in hist_browser__show_hierarchy_entry()
1500 width -= hpp.buf - s; in hist_browser__show_hierarchy_entry()
1504 ui_browser__write_nstring(&browser->b, "", hierarchy_indent); in hist_browser__show_hierarchy_entry()
1505 width -= hierarchy_indent; in hist_browser__show_hierarchy_entry()
1508 if (column >= browser->b.horiz_scroll) { in hist_browser__show_hierarchy_entry()
1516 if (current_entry && browser->b.navkeypressed) { in hist_browser__show_hierarchy_entry()
1517 ui_browser__set_color(&browser->b, in hist_browser__show_hierarchy_entry()
1520 ui_browser__set_color(&browser->b, in hist_browser__show_hierarchy_entry()
1524 perf_hpp_list__for_each_format(entry->hpp_list, fmt) { in hist_browser__show_hierarchy_entry()
1526 ui_browser__printf(&browser->b, "%c ", folded_sign); in hist_browser__show_hierarchy_entry()
1529 ui_browser__write_nstring(&browser->b, "", 2); in hist_browser__show_hierarchy_entry()
1532 width -= 2; in hist_browser__show_hierarchy_entry()
1539 if (fmt->color) { in hist_browser__show_hierarchy_entry()
1540 width -= fmt->color(fmt, &hpp, entry); in hist_browser__show_hierarchy_entry()
1544 width -= fmt->entry(fmt, &hpp, entry); in hist_browser__show_hierarchy_entry()
1545 ui_browser__printf(&browser->b, "%s", skip_spaces(s)); in hist_browser__show_hierarchy_entry()
1554 if (!browser->b.navkeypressed) in hist_browser__show_hierarchy_entry()
1557 ui_browser__write_nstring(&browser->b, "", width); in hist_browser__show_hierarchy_entry()
1563 if (entry->leaf && folded_sign == '-' && row != browser->b.rows) { in hist_browser__show_hierarchy_entry()
1580 int width = browser->b.width; in hist_browser__show_no_entry()
1581 bool current_entry = ui_browser__is_current_entry(&browser->b, row); in hist_browser__show_no_entry()
1587 int indent = browser->hists->nr_hpp_node - 2; in hist_browser__show_no_entry()
1590 browser->he_selection = NULL; in hist_browser__show_no_entry()
1591 browser->selection = NULL; in hist_browser__show_no_entry()
1594 ui_browser__gotorc(&browser->b, row, 0); in hist_browser__show_no_entry()
1596 if (current_entry && browser->b.navkeypressed) in hist_browser__show_no_entry()
1597 ui_browser__set_color(&browser->b, HE_COLORSET_SELECTED); in hist_browser__show_no_entry()
1599 ui_browser__set_color(&browser->b, HE_COLORSET_NORMAL); in hist_browser__show_no_entry()
1601 ui_browser__write_nstring(&browser->b, "", level * HIERARCHY_INDENT); in hist_browser__show_no_entry()
1602 width -= level * HIERARCHY_INDENT; in hist_browser__show_no_entry()
1605 fmt_node = list_first_entry(&browser->hists->hpp_formats, in hist_browser__show_no_entry()
1607 perf_hpp_list__for_each_format(&fmt_node->hpp, fmt) { in hist_browser__show_no_entry()
1608 if (perf_hpp__should_skip(fmt, browser->hists) || in hist_browser__show_no_entry()
1609 column++ < browser->b.horiz_scroll) in hist_browser__show_no_entry()
1612 ret = fmt->width(fmt, NULL, browser->hists); in hist_browser__show_no_entry()
1623 ui_browser__write_nstring(&browser->b, "", ret); in hist_browser__show_no_entry()
1624 width -= ret; in hist_browser__show_no_entry()
1627 ui_browser__write_nstring(&browser->b, "", indent * HIERARCHY_INDENT); in hist_browser__show_no_entry()
1628 width -= indent * HIERARCHY_INDENT; in hist_browser__show_no_entry()
1630 if (column >= browser->b.horiz_scroll) { in hist_browser__show_no_entry()
1633 ret = snprintf(buf, sizeof(buf), "no entry >= %.2f%%", browser->min_pcnt); in hist_browser__show_no_entry()
1634 ui_browser__printf(&browser->b, " %s", buf); in hist_browser__show_no_entry()
1635 width -= ret + 2; in hist_browser__show_no_entry()
1639 if (!browser->b.navkeypressed) in hist_browser__show_no_entry()
1642 ui_browser__write_nstring(&browser->b, "", width); in hist_browser__show_no_entry()
1649 return hpp->size <= 0; in advance_hpp_check()
1656 struct hists *hists = browser->hists; in hists_browser__scnprintf_headers()
1672 hists__for_each_format(browser->hists, fmt) { in hists_browser__scnprintf_headers()
1673 if (perf_hpp__should_skip(fmt, hists) || column++ < browser->b.horiz_scroll) in hists_browser__scnprintf_headers()
1676 ret = fmt->header(fmt, &dummy_hpp, hists, line, &span); in hists_browser__scnprintf_headers()
1693 struct hists *hists = browser->hists; in hists_browser__scnprintf_hierarchy_headers()
1702 int indent = hists->nr_hpp_node - 2; in hists_browser__scnprintf_hierarchy_headers()
1711 fmt_node = list_first_entry(&hists->hpp_formats, in hists_browser__scnprintf_hierarchy_headers()
1713 perf_hpp_list__for_each_format(&fmt_node->hpp, fmt) { in hists_browser__scnprintf_hierarchy_headers()
1714 if (column++ < browser->b.horiz_scroll) in hists_browser__scnprintf_hierarchy_headers()
1717 ret = fmt->header(fmt, &dummy_hpp, hists, 0, NULL); in hists_browser__scnprintf_hierarchy_headers()
1736 list_for_each_entry_continue(fmt_node, &hists->hpp_formats, list) { in hists_browser__scnprintf_hierarchy_headers()
1745 perf_hpp_list__for_each_format(&fmt_node->hpp, fmt) { in hists_browser__scnprintf_hierarchy_headers()
1758 ret = fmt->header(fmt, &dummy_hpp, hists, 0, NULL); in hists_browser__scnprintf_hierarchy_headers()
1782 ui_browser__gotorc(&browser->b, 0, 0); in hists_browser__hierarchy_headers()
1783 ui_browser__set_color(&browser->b, HE_COLORSET_ROOT); in hists_browser__hierarchy_headers()
1784 ui_browser__write_nstring(&browser->b, headers, browser->b.width + 1); in hists_browser__hierarchy_headers()
1789 struct hists *hists = browser->hists; in hists_browser__headers()
1790 struct perf_hpp_list *hpp_list = hists->hpp_list; in hists_browser__headers()
1794 for (line = 0; line < hpp_list->nr_header_lines; line++) { in hists_browser__headers()
1800 ui_browser__gotorc_title(&browser->b, line, 0); in hists_browser__headers()
1801 ui_browser__set_color(&browser->b, HE_COLORSET_ROOT); in hists_browser__headers()
1802 ui_browser__write_nstring(&browser->b, headers, browser->b.width + 1); in hists_browser__headers()
1816 if (browser->top == NULL) { in ui_browser__hists_init_top()
1820 browser->top = rb_first_cached(&hb->hists->entries); in ui_browser__hists_init_top()
1830 if (hb->show_headers) in hist_browser__refresh()
1834 hb->he_selection = NULL; in hist_browser__refresh()
1835 hb->selection = NULL; in hist_browser__refresh()
1837 for (nd = browser->top; nd; nd = rb_hierarchy_next(nd)) { in hist_browser__refresh()
1841 if (h->filtered) { in hist_browser__refresh()
1843 h->unfolded = false; in hist_browser__refresh()
1852 if (percent < hb->min_pcnt) in hist_browser__refresh()
1857 h->depth); in hist_browser__refresh()
1858 if (row == browser->rows) in hist_browser__refresh()
1861 if (h->has_no_entry) { in hist_browser__refresh()
1862 hist_browser__show_no_entry(hb, row, h->depth + 1); in hist_browser__refresh()
1869 if (row == browser->rows) in hist_browser__refresh()
1883 if (!h->filtered && percent >= min_pcnt) in hists__filter_entries()
1906 if (!h->filtered && percent >= min_pcnt) in hists__filter_prev_entries()
1925 if (browser->nr_entries == 0) in ui_browser__hists_seek()
1932 nd = hists__filter_entries(rb_first(browser->entries), in ui_browser__hists_seek()
1933 hb->min_pcnt); in ui_browser__hists_seek()
1936 nd = browser->top; in ui_browser__hists_seek()
1939 nd = rb_hierarchy_last(rb_last(browser->entries)); in ui_browser__hists_seek()
1940 nd = hists__filter_prev_entries(nd, hb->min_pcnt); in ui_browser__hists_seek()
1951 h = rb_entry(browser->top, struct hist_entry, rb_node); in ui_browser__hists_seek()
1952 h->row_offset = 0; in ui_browser__hists_seek()
1974 if (h->unfolded && h->leaf) { in ui_browser__hists_seek()
1975 u16 remaining = h->nr_rows - h->row_offset; in ui_browser__hists_seek()
1977 offset -= remaining; in ui_browser__hists_seek()
1978 h->row_offset = 0; in ui_browser__hists_seek()
1980 h->row_offset += offset; in ui_browser__hists_seek()
1982 browser->top = nd; in ui_browser__hists_seek()
1987 hb->min_pcnt); in ui_browser__hists_seek()
1990 --offset; in ui_browser__hists_seek()
1991 browser->top = nd; in ui_browser__hists_seek()
1996 if (h->unfolded && h->leaf) { in ui_browser__hists_seek()
1998 if (-offset > h->row_offset) { in ui_browser__hists_seek()
1999 offset += h->row_offset; in ui_browser__hists_seek()
2000 h->row_offset = 0; in ui_browser__hists_seek()
2002 h->row_offset += offset; in ui_browser__hists_seek()
2004 browser->top = nd; in ui_browser__hists_seek()
2008 if (-offset > h->nr_rows) { in ui_browser__hists_seek()
2009 offset += h->nr_rows; in ui_browser__hists_seek()
2010 h->row_offset = 0; in ui_browser__hists_seek()
2012 h->row_offset = h->nr_rows + offset; in ui_browser__hists_seek()
2014 browser->top = nd; in ui_browser__hists_seek()
2021 hb->min_pcnt); in ui_browser__hists_seek()
2025 browser->top = nd; in ui_browser__hists_seek()
2033 if (h->unfolded && h->leaf) in ui_browser__hists_seek()
2034 h->row_offset = h->nr_rows; in ui_browser__hists_seek()
2040 browser->top = nd; in ui_browser__hists_seek()
2042 h->row_offset = 0; in ui_browser__hists_seek()
2079 hists__for_each_format(browser->hists, fmt) { in hist_browser__fprintf_entry()
2080 if (perf_hpp__should_skip(fmt, he->hists)) in hist_browser__fprintf_entry()
2089 ret = fmt->entry(fmt, &hpp, he); in hist_browser__fprintf_entry()
2095 if (folded_sign == '-') in hist_browser__fprintf_entry()
2117 int hierarchy_indent = (he->hists->nr_hpp_node - 2) * HIERARCHY_INDENT; in hist_browser__fprintf_hierarchy_entry()
2125 fmt_node = list_first_entry(&he->hists->hpp_formats, in hist_browser__fprintf_hierarchy_entry()
2127 perf_hpp_list__for_each_format(&fmt_node->hpp, fmt) { in hist_browser__fprintf_hierarchy_entry()
2134 ret = fmt->entry(fmt, &hpp, he); in hist_browser__fprintf_hierarchy_entry()
2141 perf_hpp_list__for_each_format(he->hpp_list, fmt) { in hist_browser__fprintf_hierarchy_entry()
2145 ret = fmt->entry(fmt, &hpp, he); in hist_browser__fprintf_hierarchy_entry()
2152 if (he->leaf && folded_sign == '-') { in hist_browser__fprintf_hierarchy_entry()
2154 he->depth + 1); in hist_browser__fprintf_hierarchy_entry()
2162 struct rb_node *nd = hists__filter_entries(rb_first(browser->b.entries), in hist_browser__fprintf()
2163 browser->min_pcnt); in hist_browser__fprintf()
2172 h->depth); in hist_browser__fprintf()
2178 browser->min_pcnt); in hist_browser__fprintf()
2190 scnprintf(filename, sizeof(filename), "perf.hist.%d", browser->print_seq); in hist_browser__dump()
2196 if (++browser->print_seq == 8192) { in hist_browser__dump()
2198 return -1; in hist_browser__dump()
2207 return -1; in hist_browser__dump()
2210 ++browser->print_seq; in hist_browser__dump()
2223 browser->hists = hists; in hist_browser__init()
2224 browser->b.refresh = hist_browser__refresh; in hist_browser__init()
2225 browser->b.refresh_dimensions = hist_browser__refresh_dimensions; in hist_browser__init()
2226 browser->b.seek = ui_browser__hists_seek; in hist_browser__init()
2227 browser->b.use_navkeypressed = true; in hist_browser__init()
2228 browser->show_headers = symbol_conf.show_hist_headers; in hist_browser__init()
2235 fmt_node = list_first_entry(&hists->hpp_formats, in hist_browser__init()
2237 perf_hpp_list__for_each_format(&fmt_node->hpp, fmt) in hist_browser__init()
2238 ++browser->b.columns; in hist_browser__init()
2241 ++browser->b.columns; in hist_browser__init()
2244 ++browser->b.columns; in hist_browser__init()
2269 browser->hbt = hbt; in perf_evsel_browser__new()
2270 browser->env = env; in perf_evsel_browser__new()
2271 browser->title = hists_browser__scnprintf_title; in perf_evsel_browser__new()
2272 browser->annotation_opts = annotation_opts; in perf_evsel_browser__new()
2284 return browser->he_selection; in hist_browser__selected_entry()
2289 return browser->he_selection->thread; in hist_browser__selected_thread()
2294 return browser->he_selection ? browser->he_selection->res_samples : NULL; in hist_browser__selected_res_sample()
2305 struct hist_browser_timer *hbt = browser->hbt; in hists_browser__scnprintf_title()
2306 int printed = __hists__scnprintf_title(browser->hists, bf, size, !is_report_browser(hbt)); in hists_browser__scnprintf_title()
2309 struct perf_top *top = hbt->arg; in hists_browser__scnprintf_title()
2311 printed += scnprintf(bf + printed, size - printed, in hists_browser__scnprintf_title()
2313 top->lost, top->lost_total); in hists_browser__scnprintf_title()
2315 printed += scnprintf(bf + printed, size - printed, in hists_browser__scnprintf_title()
2317 top->drop, top->drop_total); in hists_browser__scnprintf_title()
2319 if (top->zero) in hists_browser__scnprintf_title()
2320 printed += scnprintf(bf + printed, size - printed, " [z]"); in hists_browser__scnprintf_title()
2348 int nr_options = 0, choice = -1, ret = -1; in switch_data_file()
2365 char *name = dent->d_name; in switch_data_file()
2368 if (!(dent->d_type == DT_REG)) in switch_data_file()
2427 unsigned long time;
2429 struct map_symbol ms; member
2445 if (!browser->annotation_opts->objdump_path && in do_annotate()
2446 perf_env__lookup_objdump(browser->env, &browser->annotation_opts->objdump_path)) in do_annotate()
2449 notes = symbol__annotation(act->ms.sym); in do_annotate()
2450 if (!notes->src) in do_annotate()
2453 if (browser->block_evsel) in do_annotate()
2454 evsel = browser->block_evsel; in do_annotate()
2456 evsel = hists_to_evsel(browser->hists); in do_annotate()
2458 err = map_symbol__tui_annotate(&act->ms, evsel, browser->hbt, in do_annotate()
2459 browser->annotation_opts); in do_annotate()
2465 if ((err == 'q' || err == CTRL('c')) && he->branch_info) in do_annotate()
2468 ui_browser__update_nr_entries(&browser->b, browser->hists->nr_entries); in do_annotate()
2470 ui_browser__handle_resize(&browser->b); in do_annotate()
2490 dso__insert_symbol(map->dso, sym); in symbol__new_unresolved()
2499 struct map_symbol *ms, in add_annotate_opt() argument
2502 if (!ms->map || !ms->map->dso || ms->map->dso->annotate_warned) in add_annotate_opt()
2505 if (!ms->sym) in add_annotate_opt()
2506 ms->sym = symbol__new_unresolved(addr, ms->map); in add_annotate_opt()
2508 if (ms->sym == NULL || symbol__annotation(ms->sym)->src == NULL) in add_annotate_opt()
2511 if (asprintf(optstr, "Annotate %s", ms->sym->name) < 0) in add_annotate_opt()
2514 act->ms = *ms; in add_annotate_opt()
2515 act->fn = do_annotate; in add_annotate_opt()
2522 struct thread *thread = act->thread; in do_zoom_thread()
2524 if ((!hists__has(browser->hists, thread) && in do_zoom_thread()
2525 !hists__has(browser->hists, comm)) || thread == NULL) in do_zoom_thread()
2528 if (browser->hists->thread_filter) { in do_zoom_thread()
2529 pstack__remove(browser->pstack, &browser->hists->thread_filter); in do_zoom_thread()
2531 thread__zput(browser->hists->thread_filter); in do_zoom_thread()
2534 if (hists__has(browser->hists, thread)) { in do_zoom_thread()
2535 ui_helpline__fpush("To zoom out press ESC or ENTER + \"Zoom out of %s(%d) thread\"", in do_zoom_thread()
2536 thread->comm_set ? thread__comm_str(thread) : "", in do_zoom_thread()
2537 thread->tid); in do_zoom_thread()
2539 ui_helpline__fpush("To zoom out press ESC or ENTER + \"Zoom out of %s thread\"", in do_zoom_thread()
2540 thread->comm_set ? thread__comm_str(thread) : ""); in do_zoom_thread()
2543 browser->hists->thread_filter = thread__get(thread); in do_zoom_thread()
2545 pstack__push(browser->pstack, &browser->hists->thread_filter); in do_zoom_thread()
2548 hists__filter_by_thread(browser->hists); in do_zoom_thread()
2559 if ((!hists__has(browser->hists, thread) && in add_thread_opt()
2560 !hists__has(browser->hists, comm)) || thread == NULL) in add_thread_opt()
2563 if (hists__has(browser->hists, thread)) { in add_thread_opt()
2565 browser->hists->thread_filter ? "out of" : "into", in add_thread_opt()
2566 thread->comm_set ? thread__comm_str(thread) : "", in add_thread_opt()
2567 thread->tid); in add_thread_opt()
2570 browser->hists->thread_filter ? "out of" : "into", in add_thread_opt()
2571 thread->comm_set ? thread__comm_str(thread) : ""); in add_thread_opt()
2576 act->thread = thread; in add_thread_opt()
2577 act->fn = do_zoom_thread; in add_thread_opt()
2583 if (!hists__has(browser->hists, dso) || map == NULL) in hists_browser__zoom_map()
2586 if (browser->hists->dso_filter) { in hists_browser__zoom_map()
2587 pstack__remove(browser->pstack, &browser->hists->dso_filter); in hists_browser__zoom_map()
2589 browser->hists->dso_filter = NULL; in hists_browser__zoom_map()
2592 ui_helpline__fpush("To zoom out press ESC or ENTER + \"Zoom out of %s DSO\"", in hists_browser__zoom_map()
2593 __map__is_kernel(map) ? "the Kernel" : map->dso->short_name); in hists_browser__zoom_map()
2594 browser->hists->dso_filter = map->dso; in hists_browser__zoom_map()
2596 pstack__push(browser->pstack, &browser->hists->dso_filter); in hists_browser__zoom_map()
2599 hists__filter_by_dso(browser->hists); in hists_browser__zoom_map()
2607 return hists_browser__zoom_map(browser, act->ms.map); in do_zoom_dso()
2614 if (!hists__has(browser->hists, dso) || map == NULL) in add_dso_opt()
2618 browser->hists->dso_filter ? "out of" : "into", in add_dso_opt()
2619 __map__is_kernel(map) ? "the Kernel" : map->dso->short_name) < 0) in add_dso_opt()
2622 act->ms.map = map; in add_dso_opt()
2623 act->fn = do_zoom_dso; in add_dso_opt()
2645 act->fn = do_toggle_callchain; in add_callchain_toggle_opt()
2653 map__browse(act->ms.map); in do_browse_map()
2661 if (!hists__has(browser->hists, dso) || map == NULL) in add_map_opt()
2667 act->ms.map = map; in add_map_opt()
2668 act->fn = do_browse_map; in add_map_opt()
2681 if (act->thread) in do_run_script()
2682 len += strlen(thread__comm_str(act->thread)); in do_run_script()
2683 else if (act->ms.sym) in do_run_script()
2684 len += strlen(act->ms.sym->name); in do_run_script()
2687 return -1; in do_run_script()
2690 if (act->thread) { in do_run_script()
2691 n = scnprintf(script_opt, len, " -c %s ", in do_run_script()
2692 thread__comm_str(act->thread)); in do_run_script()
2693 } else if (act->ms.sym) { in do_run_script()
2694 n = scnprintf(script_opt, len, " -S %s ", in do_run_script()
2695 act->ms.sym->name); in do_run_script()
2698 if (act->time) { in do_run_script()
2700 unsigned long starttime = act->time; in do_run_script()
2701 unsigned long endtime = act->time + symbol_conf.time_quantum; in do_run_script()
2703 if (starttime == endtime) { /* Display 1ms as fallback */ in do_run_script()
2704 starttime -= 1*NSEC_PER_MSEC; in do_run_script()
2709 n += snprintf(script_opt + n, len - n, " --time %s,%s", start, end); in do_run_script()
2712 script_browse(script_opt, act->evsel); in do_run_script()
2724 res_sample_browse(he->res_samples, he->num_res, act->evsel, act->rstype); in do_res_sample_script()
2741 sym->name, tstr) < 0) in add_script_opt_2()
2748 act->thread = thread; in add_script_opt_2()
2749 act->ms.sym = sym; in add_script_opt_2()
2750 act->evsel = evsel; in add_script_opt_2()
2751 act->fn = do_run_script; in add_script_opt_2()
2773 j += timestamp__scnprintf_usec(he->time, tstr + j, in add_script_opt()
2774 sizeof tstr - j); in add_script_opt()
2775 j += sprintf(tstr + j, "-"); in add_script_opt()
2776 timestamp__scnprintf_usec(he->time + symbol_conf.time_quantum, in add_script_opt()
2777 tstr + j, sizeof tstr - j); in add_script_opt()
2780 act->time = he->time; in add_script_opt()
2800 act->fn = do_res_sample_script; in add_res_sample_opt()
2801 act->evsel = evsel; in add_res_sample_opt()
2802 act->rstype = type; in add_res_sample_opt()
2823 if (!is_report_browser(browser->hbt)) in add_switch_opt()
2829 act->fn = do_switch_data; in add_switch_opt()
2847 act->fn = do_exit_browser; in add_exit_opt()
2854 if (!hists__has(browser->hists, socket) || act->socket < 0) in do_zoom_socket()
2857 if (browser->hists->socket_filter > -1) { in do_zoom_socket()
2858 pstack__remove(browser->pstack, &browser->hists->socket_filter); in do_zoom_socket()
2859 browser->hists->socket_filter = -1; in do_zoom_socket()
2862 browser->hists->socket_filter = act->socket; in do_zoom_socket()
2864 pstack__push(browser->pstack, &browser->hists->socket_filter); in do_zoom_socket()
2867 hists__filter_by_socket(browser->hists); in do_zoom_socket()
2876 if (!hists__has(browser->hists, socket) || socket_id < 0) in add_socket_opt()
2880 (browser->hists->socket_filter > -1) ? "out of" : "into", in add_socket_opt()
2884 act->socket = socket_id; in add_socket_opt()
2885 act->fn = do_zoom_socket; in add_socket_opt()
2892 struct rb_node *nd = rb_first_cached(&hb->hists->entries); in hist_browser__update_nr_entries()
2894 if (hb->min_pcnt == 0 && !symbol_conf.report_hierarchy) { in hist_browser__update_nr_entries()
2895 hb->nr_non_filtered_entries = hb->hists->nr_non_filtered_entries; in hist_browser__update_nr_entries()
2899 while ((nd = hists__filter_entries(nd, hb->min_pcnt)) != NULL) { in hist_browser__update_nr_entries()
2904 hb->nr_non_filtered_entries = nr_entries; in hist_browser__update_nr_entries()
2905 hb->nr_hierarchy_entries = nr_entries; in hist_browser__update_nr_entries()
2912 struct rb_node *nd = rb_first_cached(&hb->hists->entries); in hist_browser__update_percent_limit()
2913 u64 total = hists__total_period(hb->hists); in hist_browser__update_percent_limit()
2916 hb->min_pcnt = callchain_param.min_percent = percent; in hist_browser__update_percent_limit()
2918 while ((nd = hists__filter_entries(nd, hb->min_pcnt)) != NULL) { in hist_browser__update_percent_limit()
2921 if (he->has_no_entry) { in hist_browser__update_percent_limit()
2922 he->has_no_entry = false; in hist_browser__update_percent_limit()
2923 he->nr_rows = 0; in hist_browser__update_percent_limit()
2926 if (!he->leaf || !hist_entry__has_callchains(he) || !symbol_conf.use_callchain) in hist_browser__update_percent_limit()
2930 total = he->stat.period; in hist_browser__update_percent_limit()
2933 total = he->stat_acc->period; in hist_browser__update_percent_limit()
2938 callchain_param.sort(&he->sorted_chain, he->callchain, in hist_browser__update_percent_limit()
2944 /* force to re-evaluate folding state of callchains */ in hist_browser__update_percent_limit()
2945 he->init_have_children = false; in hist_browser__update_percent_limit()
2962 int key = -1; in evsel__hists_browse()
2964 int delay_secs = hbt ? hbt->refresh : 0; in evsel__hists_browse()
2973 "For symbolic views (--sort has sym):\n\n" \ in evsel__hists_browse()
2998 "0-9 Sort by event n in group"; in evsel__hists_browse()
3008 return -1; in evsel__hists_browse()
3010 /* reset abort key so that it can get Ctrl-C as a key */ in evsel__hists_browse()
3015 browser->min_pcnt = min_pcnt; in evsel__hists_browse()
3018 browser->pstack = pstack__new(3); in evsel__hists_browse()
3019 if (browser->pstack == NULL) in evsel__hists_browse()
3031 browser->b.no_samples_msg = "Collecting samples..."; in evsel__hists_browse()
3037 int socked_id = -1; in evsel__hists_browse()
3044 if (browser->he_selection != NULL) { in evsel__hists_browse()
3046 map = browser->selection->map; in evsel__hists_browse()
3047 socked_id = browser->he_selection->socket; in evsel__hists_browse()
3061 evsel->core.nr_members < 2) { in evsel__hists_browse()
3068 if (key - '0' == symbol_conf.group_sort_idx) in evsel__hists_browse()
3071 symbol_conf.group_sort_idx = key - '0'; in evsel__hists_browse()
3073 if (symbol_conf.group_sort_idx >= evsel->core.nr_members) { in evsel__hists_browse()
3076 evsel->core.nr_members - 1, in evsel__hists_browse()
3077 evsel->core.nr_members - 1); in evsel__hists_browse()
3086 ui_browser__warning(&browser->b, delay_secs * 2, in evsel__hists_browse()
3088 "include \"sym*\" in --sort to use it."); in evsel__hists_browse()
3092 if (!browser->selection || in evsel__hists_browse()
3093 !browser->selection->map || in evsel__hists_browse()
3094 !browser->selection->map->dso || in evsel__hists_browse()
3095 browser->selection->map->dso->annotate_warned) { in evsel__hists_browse()
3099 if (!browser->selection->sym) { in evsel__hists_browse()
3100 if (!browser->he_selection) in evsel__hists_browse()
3104 bi = browser->he_selection->branch_info; in evsel__hists_browse()
3105 if (!bi || !bi->to.ms.map) in evsel__hists_browse()
3108 actions->ms.sym = symbol__new_unresolved(bi->to.al_addr, bi->to.ms.map); in evsel__hists_browse()
3109 actions->ms.map = bi->to.ms.map; in evsel__hists_browse()
3111 actions->ms.sym = symbol__new_unresolved(browser->he_selection->ip, in evsel__hists_browse()
3112 browser->selection->map); in evsel__hists_browse()
3113 actions->ms.map = browser->selection->map; in evsel__hists_browse()
3116 if (!actions->ms.sym) in evsel__hists_browse()
3119 if (symbol__annotation(browser->selection->sym)->src == NULL) { in evsel__hists_browse()
3120 ui_browser__warning(&browser->b, delay_secs * 2, in evsel__hists_browse()
3123 browser->selection->sym->name); in evsel__hists_browse()
3127 actions->ms.map = browser->selection->map; in evsel__hists_browse()
3128 actions->ms.sym = browser->selection->sym; in evsel__hists_browse()
3137 actions->ms.map = map; in evsel__hists_browse()
3141 if (browser->selection != NULL) in evsel__hists_browse()
3142 hists_browser__zoom_map(browser, browser->selection->maps->machine->vmlinux_map); in evsel__hists_browse()
3146 browser->show_dso = verbose > 0; in evsel__hists_browse()
3151 actions->thread = thread; in evsel__hists_browse()
3155 actions->socket = socked_id; in evsel__hists_browse()
3161 "To remove the filter later, press / + ENTER.", in evsel__hists_browse()
3164 hists->symbol_filter_str = *buf ? buf : NULL; in evsel__hists_browse()
3171 actions->thread = NULL; in evsel__hists_browse()
3172 actions->ms.sym = NULL; in evsel__hists_browse()
3184 /* env->arch is NULL for live-mode (i.e. perf top) */ in evsel__hists_browse()
3185 if (env->arch) in evsel__hists_browse()
3193 struct perf_top *top = hbt->arg; in evsel__hists_browse()
3195 top->zero = !top->zero; in evsel__hists_browse()
3207 ui_browser__warning(&browser->b, delay_secs * 2, in evsel__hists_browse()
3219 ui_browser__help_window(&browser->b, in evsel__hists_browse()
3231 if (pstack__empty(browser->pstack)) { in evsel__hists_browse()
3239 ui_browser__dialog_yesno(&browser->b, in evsel__hists_browse()
3245 actions->ms.map = map; in evsel__hists_browse()
3246 top = pstack__peek(browser->pstack); in evsel__hists_browse()
3247 if (top == &browser->hists->dso_filter) { in evsel__hists_browse()
3249 * No need to set actions->dso here since in evsel__hists_browse()
3254 } else if (top == &browser->hists->thread_filter) { in evsel__hists_browse()
3256 } else if (top == &browser->hists->socket_filter) { in evsel__hists_browse()
3266 struct perf_top *top = hbt->arg; in evsel__hists_browse()
3268 evlist__toggle_enable(top->evlist); in evsel__hists_browse()
3273 if (top->evlist->enabled) { in evsel__hists_browse()
3274 helpline = "Press 'f' to disable the events or 'h' to see other hotkeys"; in evsel__hists_browse()
3275 hbt->refresh = delay_secs; in evsel__hists_browse()
3277 helpline = "Press 'f' again to re-enable the events"; in evsel__hists_browse()
3278 hbt->refresh = 0; in evsel__hists_browse()
3284 helpline = "Press '?' for help on key bindings"; in evsel__hists_browse()
3288 if (!hists__has(hists, sym) || browser->selection == NULL) in evsel__hists_browse()
3293 if (browser->he_selection) in evsel__hists_browse()
3294 bi = browser->he_selection->branch_info; in evsel__hists_browse()
3302 &bi->from.ms, in evsel__hists_browse()
3303 bi->from.al_addr); in evsel__hists_browse()
3304 if (bi->to.ms.sym != bi->from.ms.sym) in evsel__hists_browse()
3308 &bi->to.ms, in evsel__hists_browse()
3309 bi->to.al_addr); in evsel__hists_browse()
3314 browser->selection, in evsel__hists_browse()
3315 browser->he_selection->ip); in evsel__hists_browse()
3325 browser->selection ? in evsel__hists_browse()
3326 browser->selection->map : NULL); in evsel__hists_browse()
3334 if (browser->he_selection) { in evsel__hists_browse()
3342 * Note that browser->selection != NULL in evsel__hists_browse()
3343 * when browser->he_selection is not NULL, in evsel__hists_browse()
3344 * so we don't need to check browser->selection in evsel__hists_browse()
3345 * before fetching browser->selection->sym like what in evsel__hists_browse()
3346 * we do before fetching browser->selection->map. in evsel__hists_browse()
3350 if (hists__has(hists, sym) && browser->selection->sym) { in evsel__hists_browse()
3354 NULL, browser->selection->sym, in evsel__hists_browse()
3382 if (choice == -1) in evsel__hists_browse()
3389 key = act->fn(browser, act); in evsel__hists_browse()
3396 pstack__delete(browser->pstack); in evsel__hists_browse()
3420 unsigned long nr_events = hists->stats.nr_samples; in perf_evsel_menu__write()
3436 nr_events += pos_hists->stats.nr_samples; in perf_evsel_menu__write()
3445 nr_events = evsel->evlist->stats.nr_events[PERF_RECORD_LOST]; in perf_evsel_menu__write()
3447 menu->lost_events = true; in perf_evsel_menu__write()
3456 ui_browser__write_nstring(browser, warn, browser->width - printed); in perf_evsel_menu__write()
3459 menu->selection = evsel; in perf_evsel_menu__write()
3467 struct evlist *evlist = menu->b.priv; in perf_evsel_menu__run()
3470 int delay_secs = hbt ? hbt->refresh : 0; in perf_evsel_menu__run()
3473 if (ui_browser__show(&menu->b, title, in perf_evsel_menu__run()
3474 "ESC: exit, ENTER|->: Browse histograms") < 0) in perf_evsel_menu__run()
3475 return -1; in perf_evsel_menu__run()
3478 key = ui_browser__run(&menu->b, delay_secs); in perf_evsel_menu__run()
3483 hbt->timer(hbt->arg); in perf_evsel_menu__run()
3485 if (!menu->lost_events_warned && in perf_evsel_menu__run()
3486 menu->lost_events && in perf_evsel_menu__run()
3488 ui_browser__warn_lost_events(&menu->b); in perf_evsel_menu__run()
3489 menu->lost_events_warned = true; in perf_evsel_menu__run()
3494 if (!menu->selection) in perf_evsel_menu__run()
3496 pos = menu->selection; in perf_evsel_menu__run()
3504 hbt->timer(hbt->arg); in perf_evsel_menu__run()
3506 menu->min_pcnt, menu->env, in perf_evsel_menu__run()
3508 menu->annotation_opts); in perf_evsel_menu__run()
3509 ui_browser__show_title(&menu->b, title); in perf_evsel_menu__run()
3512 if (pos->core.node.next == &evlist->core.entries) in perf_evsel_menu__run()
3518 if (pos->core.node.prev == &evlist->core.entries) in perf_evsel_menu__run()
3535 if (!ui_browser__dialog_yesno(&menu->b, in perf_evsel_menu__run()
3548 ui_browser__hide(&menu->b); in perf_evsel_menu__run()
3570 .entries = &evlist->core.entries, in __evlist__tui_browse_hists()
3583 ui_helpline__push("Press ESC to exit"); in __evlist__tui_browse_hists()
3599 int nr_entries = evlist->core.nr_entries; in evlist__single_entry()
3618 int nr_entries = evlist->core.nr_entries; in evlist__tui_browse_hists()
3649 struct hists *hists = evsel__hists(browser->block_evsel); in block_hists_browser__title()
3650 const char *evname = evsel__name(browser->block_evsel); in block_hists_browser__title()
3651 unsigned long nr_samples = hists->stats.nr_samples; in block_hists_browser__title()
3656 scnprintf(bf + ret, size - ret, " of event '%s'", evname); in block_hists_browser__title()
3665 struct hists *hists = &bh->block_hists; in block_hists_tui_browse()
3667 int key = -1; in block_hists_tui_browse()
3674 return -1; in block_hists_tui_browse()
3676 browser->block_evsel = evsel; in block_hists_tui_browse()
3677 browser->title = block_hists_browser__title; in block_hists_tui_browse()
3678 browser->min_pcnt = min_percent; in block_hists_tui_browse()
3679 browser->env = env; in block_hists_tui_browse()
3680 browser->annotation_opts = annotation_opts; in block_hists_tui_browse()
3682 /* reset abort key so that it can get Ctrl-C as a key */ in block_hists_tui_browse()
3689 key = hist_browser__run(browser, "? - help", true, 0); in block_hists_tui_browse()
3695 ui_browser__help_window(&browser->b, help); in block_hists_tui_browse()
3699 if (!browser->selection || in block_hists_tui_browse()
3700 !browser->selection->sym) { in block_hists_tui_browse()
3704 action.ms.map = browser->selection->map; in block_hists_tui_browse()
3705 action.ms.sym = browser->selection->sym; in block_hists_tui_browse()