8 #include <linux/rbtree.h> 9 #include <sys/ttydefaults.h> 11 #include "../../util/evsel.h" 12 #include "../../util/evlist.h" 13 #include "../../util/hist.h" 14 #include "../../util/pstack.h" 15 #include "../../util/sort.h" 16 #include "../../util/util.h" 17 #include "../../util/top.h" 18 #include "../../util/thread.h" 19 #include "../../arch/common.h" 21 #include "../browsers/hists.h" 22 #include "../helpline.h" 50 int unfolded_rows = 0;
52 for (nd = rb_first(&hists->
entries);
108 if (index_row >= browser->
rows)
109 browser->
index -= index_row - browser->
rows + 1;
143 return unfolded ?
'-' :
'+';
166 for (nd = rb_first(&node->
rb_root); nd; nd = rb_next(nd)) {
169 char folded_sign =
' ';
171 list_for_each_entry(chain, &child->
val,
list) {
176 if (folded_sign ==
'+')
180 if (folded_sign ==
'-')
190 char folded_sign = 0;
197 if (folded_sign ==
'+')
203 list_for_each_entry(chain, &node->
val,
list) {
207 if (folded_sign ==
'+')
232 list_for_each_entry(chain, &node->
val,
list) {
249 for (nd = rb_first(chain); nd; nd = rb_next(nd)) {
258 bool include_children)
261 struct rb_node *
node;
280 if (include_children && child->
unfolded)
284 node = rb_next(node);
315 struct rb_node *nd = rb_first(&node->
rb_root);
317 for (nd = rb_first(&node->
rb_root); nd; nd = rb_next(nd)) {
322 list_for_each_entry(chain, &child->
val,
list) {
326 !RB_EMPTY_ROOT(&child->
rb_root);
329 !RB_EMPTY_ROOT(&child->
rb_root);
344 if (!list_empty(&node->
val)) {
354 struct rb_node *nd = rb_first(root);
355 bool has_sibling = nd && rb_next(nd);
357 for (nd = rb_first(root); nd; nd = rb_next(nd)) {
454 for (nd = rb_first(&node->
rb_root); nd; nd = rb_next(nd)) {
459 list_for_each_entry(chain, &child->
val,
list) {
478 list_for_each_entry(chain, &node->
val,
list) {
495 for (nd = rb_first(chain); nd; nd = rb_next(nd)) {
504 bool unfold __maybe_unused)
511 for (nd = rb_first(&he->
hroot_out); nd; nd = rb_next(nd)) {
546 if (he->
filtered || percent < browser->min_pcnt)
551 if (!he->
depth || unfold)
603 "Events are being lost, check IO/CPU overload!\n\n" 604 "You may want to run 'perf' using a RT scheduler policy:\n\n" 605 " perf top -r 80\n\n" 606 "Or reduce the sampling frequency.");
611 return browser->
title ? browser->
title(browser, bf, size) : 0;
615 bool warn_lost_event)
620 int delay_secs = hbt ? hbt->
refresh : 0;
645 if (warn_lost_event &&
662 ui_helpline__fpush(
"%d: nr_ent=(%d,%d), etl: %d, rows=%d, idx=%d, fve: idx=%d, row_off=%d, nrows=%d",
717 const char *
str,
int offset,
723 const char *
str,
int offset,
732 width = browser->
b.
width - (offset + 2);
749 const char *
str,
int offset,
750 unsigned short row __maybe_unused,
755 arg->
printed += fprintf(arg->
fp,
"%*s%c %s\n", offset,
" ",
765 return browser->
b.
rows == row;
769 unsigned short row __maybe_unused)
774 #define LEVEL_OFFSET_STEP 3 779 unsigned short row, u64 total,
780 bool need_percent,
int offset,
784 char bf[1024], *alloc_str;
785 char buf[64], *alloc_str2;
804 if (asprintf(&alloc_str2,
"%s%s", str, buf) < 0)
805 str =
"Not enough memory!";
814 if (asprintf(&alloc_str,
"%s %s", buf, str) < 0)
815 str =
"Not enough memory!";
820 print(browser, chain, str, offset, row, arg);
843 unsigned short row, u64 total,
849 struct rb_node *
node;
853 node = rb_first(root);
858 struct rb_node *next = rb_next(node);
860 char folded_sign =
' ';
862 int extra_offset = 0;
865 bool was_first = first;
869 else if (need_percent)
876 was_first && need_percent,
877 offset + extra_offset,
880 if (is_output_full(browser, row))
883 if (folded_sign ==
'+')
887 list_for_each_entry(chain, &child->
val,
list) {
888 bool was_first = first;
892 else if (need_percent)
899 was_first && need_percent,
900 offset + extra_offset,
903 if (is_output_full(browser, row))
906 if (folded_sign ==
'+')
911 if (is_output_full(browser, row))
916 return row - first_row;
921 char *value_str,
char *old_str)
930 if (asprintf(&
new,
"%s%s%s", old_str,
935 if (asprintf(&
new,
"%s %s", value_str, str) < 0)
938 if (asprintf(&
new,
"%s", str) < 0)
946 struct rb_root *
root,
947 unsigned short row, u64 total,
953 struct rb_node *
node;
957 node = rb_first(root);
962 struct rb_node *next = rb_next(node);
965 char *value_str = NULL, *value_str_alloc = NULL;
966 char *chain_str = NULL, *chain_str_alloc = NULL;
977 if (asprintf(&value_str,
"%s", buf) < 0) {
978 value_str = (
char *)
"<...>";
981 value_str_alloc = value_str;
986 chain, value_str, chain_str);
992 if (chain_str == NULL) {
993 chain_str = (
char *)
"Not enough memory!";
997 chain_str_alloc = chain_str;
1000 list_for_each_entry(chain, &child->
val,
list) {
1002 chain, value_str, chain_str);
1005 first_chain = chain;
1008 if (chain_str == NULL) {
1009 chain_str = (
char *)
"Not enough memory!";
1013 chain_str_alloc = chain_str;
1017 print(browser, first_chain, chain_str, offset, row++, arg);
1018 free(value_str_alloc);
1019 free(chain_str_alloc);
1022 if (is_output_full(browser, row))
1027 return row - first_row;
1031 struct rb_root *
root,
int level,
1032 unsigned short row, u64 total,
1038 struct rb_node *
node;
1041 u64 percent_total = total;
1044 percent_total = parent_total;
1046 node = rb_first(root);
1051 struct rb_node *next = rb_next(node);
1053 char folded_sign =
' ';
1055 int extra_offset = 0;
1057 list_for_each_entry(chain, &child->
val,
list) {
1058 bool was_first = first;
1062 else if (need_percent)
1068 chain, row, percent_total,
1069 was_first && need_percent,
1070 offset + extra_offset,
1073 if (is_output_full(browser, row))
1076 if (folded_sign ==
'+')
1080 if (folded_sign ==
'-') {
1081 const int new_level = level + (extra_offset ? 2 : 1);
1084 new_level, row, total,
1086 print, arg, is_output_full);
1088 if (is_output_full(browser, row))
1093 return row - first_row;
1115 total, parent_total, print, arg,
1120 total, parent_total, print, arg,
1125 total, parent_total, print, arg,
1148 va_start(args, fmt);
1149 len = va_arg(args,
int);
1150 percent = va_arg(args,
double);
1155 ret = scnprintf(hpp->
buf, hpp->
size, fmt, len, percent);
1161 #define __HPP_COLOR_PERCENT_FN(_type, _field) \ 1162 static u64 __hpp_get_##_field(struct hist_entry *he) \ 1164 return he->stat._field; \ 1168 hist_browser__hpp_color_##_type(struct perf_hpp_fmt *fmt, \ 1169 struct perf_hpp *hpp, \ 1170 struct hist_entry *he) \ 1172 return hpp__fmt(fmt, hpp, he, __hpp_get_##_field, " %*.2f%%", \ 1173 __hpp__slsmg_color_printf, true); \ 1176 #define __HPP_COLOR_ACC_PERCENT_FN(_type, _field) \ 1177 static u64 __hpp_get_acc_##_field(struct hist_entry *he) \ 1179 return he->stat_acc->_field; \ 1183 hist_browser__hpp_color_##_type(struct perf_hpp_fmt *fmt, \ 1184 struct perf_hpp *hpp, \ 1185 struct hist_entry *he) \ 1187 if (!symbol_conf.cumulate_callchain) { \ 1188 struct hpp_arg *arg = hpp->ptr; \ 1189 int len = fmt->user_len ?: fmt->len; \ 1190 int ret = scnprintf(hpp->buf, hpp->size, \ 1191 "%*s", len, "N/A"); \ 1192 ui_browser__printf(arg->b, "%s", hpp->buf); \ 1196 return hpp__fmt(fmt, hpp, he, __hpp_get_acc_##_field, \ 1197 " %*.2f%%", __hpp__slsmg_color_printf, true); \ 1207 #undef __HPP_COLOR_PERCENT_FN 1208 #undef __HPP_COLOR_ACC_PERCENT_FN 1213 hist_browser__hpp_color_overhead;
1215 hist_browser__hpp_color_overhead_sys;
1217 hist_browser__hpp_color_overhead_us;
1219 hist_browser__hpp_color_overhead_guest_sys;
1221 hist_browser__hpp_color_overhead_guest_us;
1223 hist_browser__hpp_color_overhead_acc;
1231 int width = browser->
b.
width;
1239 if (current_entry) {
1244 if (use_callchain) {
1249 if (row_offset == 0) {
1280 if (use_callchain) {
1291 int ret = fmt->
color(fmt, &hpp, entry);
1302 width -= hpp.
buf - s;
1316 if (folded_sign ==
'-' && row != browser->
b.
rows) {
1319 .is_current_entry = current_entry,
1338 int width = browser->
b.
width;
1339 char folded_sign =
' ';
1352 if (current_entry) {
1361 if (entry->
leaf && row_offset) {
1363 goto show_callchain;
1409 int ret = fmt->
color(fmt, &hpp, entry);
1417 int ret = fmt->
entry(fmt, &hpp, entry);
1421 width -= hpp.
buf - s;
1426 width -= hierarchy_indent;
1461 width -= fmt->
color(fmt, &hpp, entry);
1465 width -= fmt->
entry(fmt, &hpp, entry);
1484 if (entry->
leaf && folded_sign ==
'-' && row != browser->
b.
rows) {
1499 unsigned short row,
int level)
1501 int width = browser->
b.
width;
1510 if (current_entry) {
1554 ret = snprintf(buf,
sizeof(buf),
"no entry >= %.2f%%", browser->
min_pcnt);
1570 return hpp->
size <= 0;
1575 size_t size,
int line)
1588 ret = scnprintf(buf, size,
" ");
1597 ret = fmt->
header(fmt, &dummy_hpp, hists, line, &span);
1604 ret = scnprintf(dummy_hpp.
buf, dummy_hpp.
size,
" ");
1624 bool first_node, first_col;
1626 ret = scnprintf(buf, size,
" ");
1638 ret = fmt->
header(fmt, &dummy_hpp, hists, 0, NULL);
1642 ret = scnprintf(dummy_hpp.
buf, dummy_hpp.
size,
" ");
1650 ret = scnprintf(dummy_hpp.
buf, dummy_hpp.
size,
"%*s",
1659 ret = scnprintf(dummy_hpp.
buf, dummy_hpp.
size,
" / ");
1673 ret = scnprintf(dummy_hpp.
buf, dummy_hpp.
size,
"+");
1679 ret = fmt->
header(fmt, &dummy_hpp, hists, 0, NULL);
1680 dummy_hpp.
buf[ret] =
'\0';
1683 ret = strlen(start);
1685 if (start != dummy_hpp.
buf)
1686 memmove(dummy_hpp.
buf, start, ret + 1);
1719 sizeof(headers), line);
1737 if (browser->
top == NULL) {
1769 if (percent < hb->min_pcnt)
1775 if (row == browser->
rows)
1786 if (row == browser->
rows)
1796 while (nd != NULL) {
1800 if (!h->
filtered && percent >= min_pcnt)
1819 while (nd != NULL) {
1823 if (!h->
filtered && percent >= min_pcnt)
1833 off_t offset,
int whence)
1890 h = rb_entry(nd,
struct hist_entry, rb_node);
1893 if (offset > remaining) {
1894 offset -= remaining;
1909 }
while (offset != 0);
1910 }
else if (offset < 0) {
1912 h = rb_entry(nd,
struct hist_entry, rb_node);
1949 h = rb_entry(nd,
struct hist_entry, rb_node);
1958 h = rb_entry(nd,
struct hist_entry, rb_node);
1982 char folded_sign =
' ';
1993 printed += fprintf(fp,
"%c ", folded_sign);
2001 ret = scnprintf(hpp.
buf, hpp.
size,
" ");
2006 ret = fmt->
entry(fmt, &hpp, he);
2010 printed += fprintf(fp,
"%s\n", s);
2012 if (folded_sign ==
'-')
2025 char folded_sign =
' ';
2039 printed += fprintf(fp,
"%c", folded_sign);
2046 ret = scnprintf(hpp.
buf, hpp.
size,
" ");
2051 ret = fmt->
entry(fmt, &hpp, he);
2055 ret = scnprintf(hpp.
buf, hpp.
size,
"%*s", hierarchy_indent,
"");
2059 ret = scnprintf(hpp.
buf, hpp.
size,
" ");
2062 ret = fmt->
entry(fmt, &hpp, he);
2066 printed += fprintf(fp,
"%s\n",
rtrim(s));
2068 if (he->
leaf && folded_sign ==
'-') {
2106 scnprintf(filename,
sizeof(filename),
"perf.hist.%d", browser->
print_seq);
2107 if (access(filename, F_OK))
2118 fp = fopen(filename,
"w");
2121 const char *
err = str_error_r(errno, bf,
sizeof(bf));
2139 browser->
hists = hists;
2211 return timer == NULL;
2223 printed += scnprintf(bf + printed, size - printed,
" [z]");
2233 for (i = 0; i < n; ++i)
2246 char *pwd, *
options[32], *abs_path[32], *tmp;
2248 int nr_options = 0, choice = -1, ret = -1;
2249 struct dirent *dent;
2251 pwd = getenv(
"PWD");
2255 pwd_dir = opendir(pwd);
2259 memset(options, 0,
sizeof(options));
2260 memset(abs_path, 0,
sizeof(abs_path));
2262 while ((dent = readdir(pwd_dir))) {
2265 char *
name = dent->d_name;
2268 if (!(dent->d_type == DT_REG))
2271 snprintf(path,
sizeof(path),
"%s/%s", pwd, name);
2273 file = fopen(path,
"r");
2277 if (fread(&magic, 1, 8, file) < 8)
2278 goto close_file_and_continue;
2281 options[nr_options] = strdup(name);
2282 if (!options[nr_options])
2283 goto close_file_and_continue;
2285 abs_path[nr_options] = strdup(path);
2286 if (!abs_path[nr_options]) {
2287 zfree(&options[nr_options]);
2288 ui__warning(
"Can't search all data files due to memory shortage.\n");
2296 close_file_and_continue:
2298 if (nr_options >= 32) {
2300 "Only the first 32 files will be listed.\n");
2308 if (choice < nr_options && choice >= 0) {
2309 tmp = strdup(abs_path[choice]);
2311 if (is_input_name_malloced)
2314 is_input_name_malloced =
true;
2317 ui__warning(
"Data switch failed due to memory shortage!\n");
2358 if ((err ==
'q' || err == CTRL(
'c')) && he->
branch_info)
2375 if (asprintf(optstr,
"Annotate %s", sym->
name) < 0)
2429 ret = asprintf(optstr,
"Zoom %s %s(%d) thread",
2434 ret = asprintf(optstr,
"Zoom %s %s thread",
2474 char **optstr,
struct map *
map)
2479 if (asprintf(optstr,
"Zoom %s %s DSO",
2504 if (asprintf(optstr,
"Browse map details") < 0)
2516 char script_opt[64];
2517 memset(script_opt, 0,
sizeof(script_opt));
2520 scnprintf(script_opt,
sizeof(script_opt),
" -c %s ",
2522 }
else if (act->
ms.
sym) {
2523 scnprintf(script_opt,
sizeof(script_opt),
" -S %s ",
2537 if (asprintf(optstr,
"Run scripts for samples of thread [%s]",
2541 if (asprintf(optstr,
"Run scripts for samples of symbol [%s]",
2545 if (asprintf(optstr,
"Run scripts for all samples") < 0)
2560 ui__warning(
"Won't switch the data files due to\n" 2561 "no valid data file get selected!\n");
2575 if (asprintf(optstr,
"Switch to another data file in PWD") < 0)
2593 if (asprintf(optstr,
"Exit") < 0)
2623 char **optstr,
int socket_id)
2628 if (asprintf(optstr,
"Zoom %s Processor Socket %d",
2663 u64 min_callchain_hits = total * (percent / 100);
2668 he = rb_entry(nd,
struct hist_entry, rb_node);
2684 min_callchain_hits = total * (percent / 100);
2700 const char *helpline,
2705 bool warn_lost_event,
2711 #define MAX_OPTIONS 16 2717 int delay_secs = hbt ? hbt->
refresh : 0;
2719 #define HIST_BROWSER_HELP_COMMON \ 2720 "h/?/F1 Show this window\n" \ 2722 "PGDN/SPACE Navigate\n" \ 2723 "q/ESC/CTRL+C Exit browser or go back to previous screen\n\n" \ 2724 "For multiple event sessions:\n\n" \ 2725 "TAB/UNTAB Switch events\n\n" \ 2726 "For symbolic views (--sort has sym):\n\n" \ 2727 "ENTER Zoom into DSO/Threads & Annotate current symbol\n" \ 2729 "a Annotate current symbol\n" \ 2730 "C Collapse all callchains\n" \ 2731 "d Zoom into current DSO\n" \ 2732 "E Expand all callchains\n" \ 2733 "F Toggle percentage of filtered entries\n" \ 2734 "H Display column headers\n" \ 2735 "L Change percent limit\n" \ 2736 "m Display context menu\n" \ 2737 "S Zoom into current Processor Socket\n" \ 2741 "i Show header information\n" 2742 "P Print histograms to perf.hist.N\n" 2743 "r Run available scripts\n" 2744 "s Switch to another data file in PWD\n" 2745 "t Zoom into current Thread\n" 2746 "V Verbose (DSO names in callchains, etc)\n" 2747 "/ Filter symbol by name";
2749 "P Print histograms to perf.hist.N\n" 2750 "t Zoom into current Thread\n" 2751 "V Verbose (DSO names in callchains, etc)\n" 2752 "z Toggle zeroing of samples\n" 2753 "f Enable/Disable events\n" 2754 "/ Filter symbol by name";
2756 if (browser == NULL)
2761 SLang_init_tty(0, 0, 0);
2768 if (browser->
pstack == NULL)
2773 memset(options, 0,
sizeof(options));
2774 memset(actions, 0,
sizeof(actions));
2804 goto out_free_stack;
2808 "Annotation is only available for symbolic views, " 2809 "include \"sym*\" in --sort to use it.");
2826 actions->
ms.
map = map;
2836 actions->
thread = thread;
2840 actions->
socket = socked_id;
2845 "Please enter the name of symbol you want to see.\n" 2846 "To remove the filter later, press / + ENTER.",
2847 buf,
"ENTER: OK, ESC: Cancel",
2857 actions->
ms.
sym = NULL;
2865 goto out_free_stack;
2885 "Please enter the value you want to hide entries under that percent.",
2886 buf,
"ENTER: OK, ESC: Cancel",
2889 double new_percent = strtod(buf, &end);
2891 if (new_percent < 0 || new_percent > 100) {
2893 "Invalid percent: %.2f", new_percent);
2921 goto out_free_stack;
2925 "Do you really want to exit?"))
2926 goto out_free_stack;
2947 goto out_free_stack;
2958 helpline =
"Press 'f' to disable the events or 'h' to see other hotkeys";
2961 helpline =
"Press 'f' again to re-enable the events";
2968 helpline =
"Press '?' for help on key bindings";
2973 goto skip_annotation;
2979 goto skip_annotation;
2982 &actions[nr_options],
2983 &options[nr_options],
2988 &actions[nr_options],
2989 &options[nr_options],
2994 &actions[nr_options],
2995 &options[nr_options],
3001 &options[nr_options], thread);
3002 nr_options +=
add_dso_opt(browser, &actions[nr_options],
3003 &options[nr_options], map);
3004 nr_options +=
add_map_opt(browser, &actions[nr_options],
3005 &options[nr_options],
3009 &options[nr_options],
3013 goto skip_scripting;
3018 &actions[nr_options],
3019 &options[nr_options],
3033 &actions[nr_options],
3034 &options[nr_options],
3039 &options[nr_options], NULL, NULL);
3041 &options[nr_options]);
3043 nr_options +=
add_exit_opt(browser, &actions[nr_options],
3044 &options[nr_options]);
3050 if (choice == -1 || choice >= nr_options)
3053 act = &actions[choice];
3054 key = act->
fn(browser, act);
3078 void *
entry,
int row)
3085 unsigned long nr_events = hists->
stats.
nr_events[PERF_RECORD_SAMPLE];
3088 const char *warn =
" ";
3106 printed = scnprintf(bf,
sizeof(bf),
"%lu%c%s%s", nr_events,
3107 unit, unit ==
' ' ?
"" :
" ", ev_name);
3111 if (nr_events != 0) {
3116 printed += scnprintf(bf,
sizeof(bf),
": %ld%c%schunks LOST!",
3117 nr_events, unit, unit ==
' ' ?
"" :
" ");
3128 int nr_events,
const char *help,
3130 bool warn_lost_event)
3134 const char *title =
"Available samples";
3135 int delay_secs = hbt ? hbt->
refresh : 0;
3139 "ESC: exit, ENTER|->: Browse histograms") < 0)
3201 "Do you really want to exit?"))
3229 int nr_entries,
const char *help,
3233 bool warn_lost_event,
3244 .nr_entries = nr_entries,
3256 size_t line_len = strlen(ev_name) + 7;
3258 if (menu.
b.
width < line_len)
3263 hbt, warn_lost_event);
3270 bool warn_lost_event,
3276 if (nr_entries == 1) {
3280 false, hbt, min_pcnt,
3281 env, warn_lost_event,
3294 if (nr_entries == 1)
struct pstack * pstack__new(unsigned short max_nr_entries)
static bool check_percent_display(struct rb_node *node, u64 parent_total)
static void hists_browser__hierarchy_headers(struct hist_browser *browser)
static int hist_browser__dump(struct hist_browser *browser)
const char * col_width_list_str
void ui_browser__update_nr_entries(struct ui_browser *browser, u32 nr_entries)
void hists__filter_by_symbol(struct hists *hists)
static int add_annotate_opt(struct hist_browser *browser __maybe_unused, struct popup_action *act, char **optstr, struct map *map, struct symbol *sym)
int(* width)(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp, struct hists *hists)
u64 nr_non_filtered_entries
int(* title)(struct hist_browser *browser, char *bf, size_t size)
u64 hists__total_period(struct hists *hists)
static int add_thread_opt(struct hist_browser *browser, struct popup_action *act, char **optstr, struct thread *thread)
static int hists_browser__scnprintf_hierarchy_headers(struct hist_browser *browser, char *buf, size_t size)
void ui_browser__reset_index(struct ui_browser *browser)
static int hierarchy_count_rows(struct hist_browser *hb, struct hist_entry *he, bool include_children)
static void hist_browser__set_folding_selected(struct hist_browser *browser, bool unfold)
enum sort_mode sort__mode
struct map_symbol * selection
int map__browse(struct map *map)
int perf_evlist__tui_browse_hists(struct perf_evlist *evlist, const char *help, struct hist_browser_timer *hbt, float min_pcnt, struct perf_env *env, bool warn_lost_event, struct annotation_options *annotation_opts)
static bool perf_hpp__should_skip(struct perf_hpp_fmt *format, struct hists *hists)
static int callchain_node__set_folding(struct callchain_node *node, bool unfold)
#define HE_COLORSET_NORMAL
static char * hist_browser__folded_callchain_str(struct hist_browser *browser, struct callchain_list *chain, char *value_str, char *old_str)
#define thread__zput(thread)
static int do_exit_browser(struct hist_browser *browser __maybe_unused, struct popup_action *act __maybe_unused)
static int callchain_node__count_rows(struct callchain_node *node)
int(* entry)(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp, struct hist_entry *he)
static int add_dso_opt(struct hist_browser *browser, struct popup_action *act, char **optstr, struct map *map)
static int add_map_opt(struct hist_browser *browser, struct popup_action *act, char **optstr, struct map *map)
static int hist_browser__show_callchain(struct hist_browser *browser, struct hist_entry *entry, int level, unsigned short row, print_callchain_entry_fn print, struct callchain_print_arg *arg, check_output_full_fn is_output_full)
struct rb_node * rb_hierarchy_prev(struct rb_node *node)
int hist_entry__snprintf_alignment(struct hist_entry *he, struct perf_hpp *hpp, struct perf_hpp_fmt *fmt, int printed)
int ui_browser__show(struct ui_browser *browser, const char *title, const char *helpline,...)
static int hists_browser__scnprintf_headers(struct hist_browser *browser, char *buf, size_t size, int line)
int ui__warning(const char *format,...)
static void hists_browser__headers(struct hist_browser *browser)
static char tree__folded_sign(bool unfolded)
char * callchain_list__sym_name(struct callchain_list *cl, char *bf, size_t bfsize, bool show_dso)
static int hierarchy_set_folding(struct hist_browser *hb, struct hist_entry *he, bool unfold __maybe_unused)
struct perf_hpp_list * hpp_list
int hist_browser__run(struct hist_browser *browser, const char *help, bool warn_lost_event)
#define HIST_BROWSER_HELP_COMMON
u64 nr_non_filtered_entries
static void hist_browser__update_nr_entries(struct hist_browser *hb)
static bool hist_browser__check_dump_full(struct hist_browser *browser __maybe_unused, unsigned short row __maybe_unused)
void hist_browser__init(struct hist_browser *browser, struct hists *hists)
void ui_browser__show_title(struct ui_browser *browser, const char *title)
static unsigned int hist_browser__refresh(struct ui_browser *browser)
static struct hists * evsel__hists(struct perf_evsel *evsel)
static void ui_browser__warn_lost_events(struct ui_browser *browser)
static bool hists__has_filter(struct hists *hists)
static char * trim(char *s)
static int callchain_node__set_folding_rb_tree(struct callchain_node *node, bool unfold)
static void hist_browser__update_rows(struct hist_browser *hb)
#define perf_hpp_list__for_each_format(_list, format)
x86 movsq based memset() in arch/x86/lib/memset_64.S") MEMSET_FN(memset_erms
struct callchain_root callchain[0]
int callchain_list_counts__printf_value(struct callchain_list *clist, FILE *fp, char *bf, int bfsize)
static void hist_browser__refresh_dimensions(struct ui_browser *browser)
static int hist_browser__fprintf(struct hist_browser *browser, FILE *fp)
struct list_head hpp_formats
static void hist_browser__set_title_space(struct hist_browser *hb)
void ui_helpline__push(const char *msg)
static void hist_entry__set_folding(struct hist_entry *he, struct hist_browser *browser, bool unfold)
static int hist_browser__show_entry(struct hist_browser *browser, struct hist_entry *entry, unsigned short row)
#define __HPP_COLOR_PERCENT_FN(_type, _field)
struct annotation_options * annotation_opts
void perf_hpp__set_elide(int idx, bool elide)
void ui_browser__refresh_dimensions(struct ui_browser *browser)
struct rb_node * rb_hierarchy_last(struct rb_node *node)
void hists__reset_column_width(struct hists *hists)
static int callchain__set_folding(struct rb_root *chain, bool unfold)
void perf_evlist__set_selected(struct perf_evlist *evlist, struct perf_evsel *evsel)
void hist_browser__delete(struct hist_browser *browser)
static __pure bool hist_entry__has_callchains(struct hist_entry *he)
static struct hist_entry * hist_browser__selected_entry(struct hist_browser *browser)
int ui_browser__help_window(struct ui_browser *browser, const char *text)
int(* header)(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp, struct hists *hists, int line, int *span)
static struct perf_evsel * perf_evsel__next(struct perf_evsel *evsel)
static void hist_browser__update_percent_limit(struct hist_browser *hb, double percent)
const char * objdump_path
const char * thread__comm_str(const struct thread *thread)
void ui_browser__gotorc_title(struct ui_browser *browser, int y, int x)
void pstack__remove(struct pstack *pstack, void *key)
static int add_switch_opt(struct hist_browser *browser, struct popup_action *act, char **optstr)
void pstack__push(struct pstack *pstack, void *key)
static struct perf_evsel * hists_to_evsel(struct hists *hists)
static void ui_browser__hists_seek(struct ui_browser *browser, off_t offset, int whence)
struct perf_evlist * evlist
bool ui_browser__is_current_entry(struct ui_browser *browser, unsigned row)
static bool filter_group_entries(struct ui_browser *browser __maybe_unused, void *entry)
int perf_env__lookup_objdump(struct perf_env *env, const char **path)
#define evlist__for_each_entry(evlist, evsel)
void pstack__delete(struct pstack *pstack)
unsigned int ui_browser__list_head_refresh(struct ui_browser *browser)
void ui_browser__list_head_seek(struct ui_browser *browser, off_t offset, int whence)
static int entry(u64 ip, struct unwind_info *ui)
static int do_run_script(struct hist_browser *browser __maybe_unused, struct popup_action *act)
static void callchain_list__set_folding(struct callchain_list *cl, bool unfold)
static struct rb_node * hists__filter_prev_entries(struct rb_node *nd, float min_pcnt)
#define __HPP_COLOR_ACC_PERCENT_FN(_type, _field)
static int do_browse_map(struct hist_browser *browser __maybe_unused, struct popup_action *act)
bool pstack__empty(const struct pstack *pstack)
static int hist_browser__show_no_entry(struct hist_browser *browser, unsigned short row, int level)
struct hist_entry * he_selection
unsigned long convert_unit(unsigned long value, char *unit)
static u32 hist_browser__nr_entries(struct hist_browser *hb)
static int str(yyscan_t scanner, int token)
static int hists_browser__scnprintf_title(struct hist_browser *browser, char *bf, size_t size)
struct rb_root sorted_chain
static int hist_browser__show_hierarchy_entry(struct hist_browser *browser, struct hist_entry *entry, unsigned short row, int level)
static void perf_evsel_menu__write(struct ui_browser *browser, void *entry, int row)
void ui_browser__write_graph(struct ui_browser *browser __maybe_unused, int graph)
#define hists__has(__h, __f)
bool hist_entry__has_hierarchy_children(struct hist_entry *he, float limit)
int ui_browser__input_window(const char *title, const char *text, char *input, const char *exit_msg, int delay_sec)
static struct annotation * symbol__annotation(struct symbol *sym)
struct perf_hpp_fmt perf_hpp__format[]
void ui_browser__handle_resize(struct ui_browser *browser)
const struct dso * dso_filter
int map_symbol__tui_annotate(struct map_symbol *ms, struct perf_evsel *evsel, struct hist_browser_timer *hbt, struct annotation_options *opts)
const char * symbol_filter_str
static int hist_browser__title(struct hist_browser *browser, char *bf, size_t size)
static struct perf_evsel * perf_evsel__prev(struct perf_evsel *evsel)
int __hpp__slsmg_color_printf(struct perf_hpp *hpp, const char *fmt,...)
static bool is_report_browser(void *timer)
static int hist_browser__fprintf_entry(struct hist_browser *browser, struct hist_entry *he, FILE *fp)
void ui_helpline__fpush(const char *fmt,...)
static void hist_browser__fprintf_callchain_entry(struct hist_browser *b __maybe_unused, struct callchain_list *chain, const char *str, int offset, unsigned short row __maybe_unused, struct callchain_print_arg *arg)
void ui_browser__printf(struct ui_browser *browser __maybe_unused, const char *fmt,...)
static struct hist_browser * perf_evsel_browser__new(struct perf_evsel *evsel, struct hist_browser_timer *hbt, struct perf_env *env, struct annotation_options *annotation_opts)
static int add_exit_opt(struct hist_browser *browser __maybe_unused, struct popup_action *act, char **optstr)
const char * perf_evsel__name(struct perf_evsel *evsel)
unsigned int(* refresh)(struct ui_browser *browser)
static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events, const char *helpline, bool left_exits, struct hist_browser_timer *hbt, float min_pcnt, struct perf_env *env, bool warn_lost_event, struct annotation_options *annotation_opts)
static int hist_browser__get_folding(struct hist_browser *browser)
struct thread * thread_filter
unsigned int hists__sort_list_width(struct hists *hists)
static void hist_browser__show_headers(struct hist_browser *browser)
static void ui_browser__hists_init_top(struct ui_browser *browser)
static int do_annotate(struct hist_browser *browser, struct popup_action *act)
int tui__header_window(struct perf_env *env)
struct hist_browser_timer * hbt
struct branch_info * branch_info
void ui_browser__write_nstring(struct ui_browser *browser __maybe_unused, const char *msg, unsigned int width)
static struct perf_evsel * perf_evlist__first(struct perf_evlist *evlist)
static int callchain_node__count_flat_rows(struct callchain_node *node)
#define for_each_group_member(_evsel, _leader)
void hists__filter_by_socket(struct hists *hists)
static int add_socket_opt(struct hist_browser *browser, struct popup_action *act, char **optstr, int socket_id)
struct rb_node * __rb_hierarchy_next(struct rb_node *node, enum hierarchy_move_dir hmd)
static int switch_data_file(void)
void perf_evlist__toggle_enable(struct perf_evlist *evlist)
static bool is_input_name_malloced
static struct rb_node * hists__filter_entries(struct rb_node *nd, float min_pcnt)
void ui_browser__gotorc(struct ui_browser *browser, int y, int x)
struct annotated_source * src
static int do_switch_data(struct hist_browser *browser __maybe_unused, struct popup_action *act __maybe_unused)
#define hists__for_each_format(hists, format)
static int __perf_evlist__tui_browse_hists(struct perf_evlist *evlist, int nr_entries, const char *help, struct hist_browser_timer *hbt, float min_pcnt, struct perf_env *env, bool warn_lost_event, struct annotation_options *annotation_opts)
static int hist_browser__fprintf_hierarchy_entry(struct hist_browser *browser, struct hist_entry *he, FILE *fp, int level)
static char callchain_list__folded(const struct callchain_list *cl)
void ui_helpline__pop(void)
static int sym(yyscan_t scanner, int type, int config)
bool __map__is_kernel(const struct map *map)
void hists__filter_by_thread(struct hists *hists)
static int hist_browser__fprintf_callchain(struct hist_browser *browser, struct hist_entry *he, FILE *fp, int level)
bool show_branchflag_count
int(* color)(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp, struct hist_entry *he)
static int hist_browser__show_callchain_flat(struct hist_browser *browser, struct rb_root *root, unsigned short row, u64 total, u64 parent_total, print_callchain_entry_fn print, struct callchain_print_arg *arg, check_output_full_fn is_output_full)
static void advance_hpp(struct perf_hpp *hpp, int inc)
void(* print_callchain_entry_fn)(struct hist_browser *browser, struct callchain_list *chain, const char *str, int offset, unsigned short row, struct callchain_print_arg *arg)
static __pure bool hists__has_callchains(struct hists *hists)
static int hist_browser__show_callchain_folded(struct hist_browser *browser, struct rb_root *root, unsigned short row, u64 total, u64 parent_total, print_callchain_entry_fn print, struct callchain_print_arg *arg, check_output_full_fn is_output_full)
static double percent(int st, int tot)
void * pstack__peek(struct pstack *pstack)
static int callchain_node__count_rows_rb_tree(struct callchain_node *node)
#define HE_COLORSET_SELECTED
struct perf_hpp_list * hpp_list
int ui_browser__run(struct ui_browser *browser, int delay_secs)
void(* seek)(struct ui_browser *browser, off_t offset, int whence)
struct addr_map_symbol to
struct addr_map_symbol from
struct events_stats stats
static struct thread * hist_browser__selected_thread(struct hist_browser *browser)
u32 nr_events[PERF_RECORD_HEADER_MAX]
static void callchain__init_have_children(struct rb_root *root)
void hists__filter_by_dso(struct hists *hists)
static bool perf_evsel__is_group_event(struct perf_evsel *evsel)
void ui_browser__hide(struct ui_browser *browser)
static bool perf_evsel__is_group_leader(const struct perf_evsel *evsel)
int ui_browser__set_color(struct ui_browser *browser, int color)
static void hist_browser__show_callchain_entry(struct hist_browser *browser, struct callchain_list *chain, const char *str, int offset, unsigned short row, struct callchain_print_arg *arg)
struct hist_browser * hist_browser__new(struct hists *hists)
void ui_browser__set_percent_color(struct ui_browser *browser, double percent, bool current)
static void free_popup_options(char **options, int n)
static struct rb_node * rb_hierarchy_next(struct rb_node *node)
static bool hist_browser__toggle_fold(struct hist_browser *browser)
#define K_SWITCH_INPUT_DATA
static struct perf_evsel * perf_evlist__last(struct perf_evlist *evlist)
bool(* check_output_full_fn)(struct hist_browser *browser, unsigned short row)
#define LEVEL_OFFSET_STEP
static void callchain_node__init_have_children_rb_tree(struct callchain_node *node)
int callchain_node__make_parent_list(struct callchain_node *node)
struct thread * thread__get(struct thread *thread)
static int do_zoom_socket(struct hist_browser *browser, struct popup_action *act)
static void hist_browser__set_folding(struct hist_browser *browser, bool unfold)
static void hist_browser__reset(struct hist_browser *browser)
static int callchain__count_rows(struct rb_root *chain)
struct he_stat * stat_acc
static u64 callchain_cumul_hits(struct callchain_node *node)
static int do_zoom_dso(struct hist_browser *browser, struct popup_action *act)
void perf_hpp__set_user_width(const char *width_list_str)
int script_browse(const char *script_opt)
int ui_browser__warning(struct ui_browser *browser, int timeout, const char *format,...)
static void hist_entry__init_have_children(struct hist_entry *he)
static bool callchain_list__toggle_fold(struct callchain_list *cl)
const char * perf_evsel__group_name(struct perf_evsel *evsel)
static void callchain_node__init_have_children(struct callchain_node *node, bool has_sibling)
struct perf_evlist * evlist
static char hist_entry__folded(const struct hist_entry *he)
void hist_browser__init_hpp(void)
static bool hist_entry__toggle_fold(struct hist_entry *he)
int ui__popup_menu(int argc, char *const argv[])
static int add_script_opt(struct hist_browser *browser __maybe_unused, struct popup_action *act, char **optstr, struct thread *thread, struct symbol *sym)
static void __hist_entry__set_folding(struct hist_entry *he, struct hist_browser *hb, bool unfold)
static int callchain_node__count_folded_rows(struct callchain_node *node __maybe_unused)
struct list_head parent_val
static float hist_entry__get_percent_limit(struct hist_entry *he)
static bool hist_browser__check_output_full(struct hist_browser *browser, unsigned short row)
static void __hist_browser__set_folding(struct hist_browser *browser, bool unfold)
static int do_zoom_thread(struct hist_browser *browser, struct popup_action *act)
static int hist_browser__show_callchain_list(struct hist_browser *browser, struct callchain_node *node, struct callchain_list *chain, unsigned short row, u64 total, bool need_percent, int offset, print_callchain_entry_fn print, struct callchain_print_arg *arg)
bool ui_browser__dialog_yesno(struct ui_browser *browser, const char *text)
char * callchain_node__scnprintf_value(struct callchain_node *node, char *bf, size_t bfsize, u64 total)
static int advance_hpp_check(struct perf_hpp *hpp, int inc)
int __hists__scnprintf_title(struct hists *hists, char *bf, size_t size, bool show_freq)
void static void * zalloc(size_t size)
static int perf_evsel_menu__run(struct perf_evsel_menu *menu, int nr_events, const char *help, struct hist_browser_timer *hbt, bool warn_lost_event)
void(* refresh_dimensions)(struct ui_browser *browser)
static bool hist_browser__has_filter(struct hist_browser *hb)
static int hist_browser__show_callchain_graph(struct hist_browser *browser, struct rb_root *root, int level, unsigned short row, u64 total, u64 parent_total, print_callchain_entry_fn print, struct callchain_print_arg *arg, check_output_full_fn is_output_full)