Lines Matching refs:top

75 static void perf_top__update_print_entries(struct perf_top *top)  in perf_top__update_print_entries()  argument
77 top->print_entries = top->winsize.ws_row - HEADER_LINE_NR; in perf_top__update_print_entries()
83 struct perf_top *top = arg; in perf_top__sig_winch() local
85 get_term_dimensions(&top->winsize); in perf_top__sig_winch()
86 perf_top__update_print_entries(top); in perf_top__sig_winch()
89 static int perf_top__parse_source(struct perf_top *top, struct hist_entry *he) in perf_top__parse_source() argument
132 top->sym_filter_entry = he; in perf_top__parse_source()
172 static void perf_top__record_precise_ip(struct perf_top *top, in perf_top__record_precise_ip() argument
181 ((top->sym_filter_entry == NULL || in perf_top__record_precise_ip()
182 top->sym_filter_entry->ms.sym != he->ms.sym) && use_browser != 1)) in perf_top__record_precise_ip()
215 static void perf_top__show_details(struct perf_top *top) in perf_top__show_details() argument
217 struct hist_entry *he = top->sym_filter_entry; in perf_top__show_details()
233 printf("Showing %s for %s\n", perf_evsel__name(top->sym_evsel), symbol->name); in perf_top__show_details()
234 printf(" Events Pcnt (>=%d%%)\n", top->sym_pcnt_filter); in perf_top__show_details()
236 more = symbol__annotate_printf(symbol, he->ms.map, top->sym_evsel, in perf_top__show_details()
237 0, top->sym_pcnt_filter, top->print_entries, 4); in perf_top__show_details()
238 if (top->zero) in perf_top__show_details()
239 symbol__annotate_zero_histogram(symbol, top->sym_evsel->idx); in perf_top__show_details()
241 symbol__annotate_decay_histogram(symbol, top->sym_evsel->idx); in perf_top__show_details()
248 static void perf_top__print_sym_table(struct perf_top *top) in perf_top__print_sym_table() argument
252 const int win_width = top->winsize.ws_col - 1; in perf_top__print_sym_table()
253 struct hists *hists = evsel__hists(top->sym_evsel); in perf_top__print_sym_table()
257 perf_top__header_snprintf(top, bf, sizeof(bf)); in perf_top__print_sym_table()
260 perf_top__reset_sample_counters(top); in perf_top__print_sym_table()
274 if (top->sym_filter_entry) { in perf_top__print_sym_table()
275 perf_top__show_details(top); in perf_top__print_sym_table()
279 if (top->zero) { in perf_top__print_sym_table()
282 hists__decay_entries(hists, top->hide_user_symbols, in perf_top__print_sym_table()
283 top->hide_kernel_symbols); in perf_top__print_sym_table()
289 hists__output_recalc_col_len(hists, top->print_entries - printed); in perf_top__print_sym_table()
291 hists__fprintf(hists, false, top->print_entries - printed, win_width, in perf_top__print_sym_table()
292 top->min_percent, stdout); in perf_top__print_sym_table()
330 static void perf_top__prompt_symbol(struct perf_top *top, const char *msg) in perf_top__prompt_symbol() argument
333 struct hist_entry *syme = top->sym_filter_entry, *n, *found = NULL; in perf_top__prompt_symbol()
334 struct hists *hists = evsel__hists(top->sym_evsel); in perf_top__prompt_symbol()
341 top->sym_filter_entry = NULL; in perf_top__prompt_symbol()
366 perf_top__parse_source(top, found); in perf_top__prompt_symbol()
372 static void perf_top__print_mapped_keys(struct perf_top *top) in perf_top__print_mapped_keys() argument
376 if (top->sym_filter_entry) { in perf_top__print_mapped_keys()
377 struct symbol *sym = top->sym_filter_entry->ms.sym; in perf_top__print_mapped_keys()
382 fprintf(stdout, "\t[d] display refresh delay. \t(%d)\n", top->delay_secs); in perf_top__print_mapped_keys()
383 fprintf(stdout, "\t[e] display entries (lines). \t(%d)\n", top->print_entries); in perf_top__print_mapped_keys()
385 if (top->evlist->nr_entries > 1) in perf_top__print_mapped_keys()
386 …fprintf(stdout, "\t[E] active event counter. \t(%s)\n", perf_evsel__name(top->sym… in perf_top__print_mapped_keys()
388 fprintf(stdout, "\t[f] profile display filter (count). \t(%d)\n", top->count_filter); in perf_top__print_mapped_keys()
390 fprintf(stdout, "\t[F] annotate display filter (percent). \t(%d%%)\n", top->sym_pcnt_filter); in perf_top__print_mapped_keys()
396 top->hide_kernel_symbols ? "yes" : "no"); in perf_top__print_mapped_keys()
399 top->hide_user_symbols ? "yes" : "no"); in perf_top__print_mapped_keys()
400 fprintf(stdout, "\t[z] toggle sample zeroing. \t(%d)\n", top->zero ? 1 : 0); in perf_top__print_mapped_keys()
404 static int perf_top__key_mapped(struct perf_top *top, int c) in perf_top__key_mapped() argument
420 return top->evlist->nr_entries > 1 ? 1 : 0; in perf_top__key_mapped()
428 static bool perf_top__handle_keypress(struct perf_top *top, int c) in perf_top__handle_keypress() argument
432 if (!perf_top__key_mapped(top, c)) { in perf_top__handle_keypress()
436 perf_top__print_mapped_keys(top); in perf_top__handle_keypress()
446 if (!perf_top__key_mapped(top, c)) in perf_top__handle_keypress()
452 prompt_integer(&top->delay_secs, "Enter display delay"); in perf_top__handle_keypress()
453 if (top->delay_secs < 1) in perf_top__handle_keypress()
454 top->delay_secs = 1; in perf_top__handle_keypress()
457 prompt_integer(&top->print_entries, "Enter display entries (lines)"); in perf_top__handle_keypress()
458 if (top->print_entries == 0) { in perf_top__handle_keypress()
463 perf_top__sig_winch(SIGWINCH, NULL, top); in perf_top__handle_keypress()
470 if (top->evlist->nr_entries > 1) { in perf_top__handle_keypress()
476 evlist__for_each(top->evlist, top->sym_evsel) in perf_top__handle_keypress()
477 fprintf(stderr, "\n\t%d %s", top->sym_evsel->idx, perf_evsel__name(top->sym_evsel)); in perf_top__handle_keypress()
481 if (counter >= top->evlist->nr_entries) { in perf_top__handle_keypress()
482 top->sym_evsel = perf_evlist__first(top->evlist); in perf_top__handle_keypress()
483 fprintf(stderr, "Sorry, no such event, using %s.\n", perf_evsel__name(top->sym_evsel)); in perf_top__handle_keypress()
487 evlist__for_each(top->evlist, top->sym_evsel) in perf_top__handle_keypress()
488 if (top->sym_evsel->idx == counter) in perf_top__handle_keypress()
491 top->sym_evsel = perf_evlist__first(top->evlist); in perf_top__handle_keypress()
494 prompt_integer(&top->count_filter, "Enter display event count filter"); in perf_top__handle_keypress()
497 prompt_percent(&top->sym_pcnt_filter, in perf_top__handle_keypress()
501 top->hide_kernel_symbols = !top->hide_kernel_symbols; in perf_top__handle_keypress()
506 if (top->dump_symtab) in perf_top__handle_keypress()
507 perf_session__fprintf_dsos(top->session, stderr); in perf_top__handle_keypress()
511 perf_top__prompt_symbol(top, "Enter details symbol"); in perf_top__handle_keypress()
514 if (!top->sym_filter_entry) in perf_top__handle_keypress()
517 struct hist_entry *syme = top->sym_filter_entry; in perf_top__handle_keypress()
519 top->sym_filter_entry = NULL; in perf_top__handle_keypress()
524 top->hide_user_symbols = !top->hide_user_symbols; in perf_top__handle_keypress()
527 top->zero = !top->zero; in perf_top__handle_keypress()
562 struct perf_top *top = arg; in display_thread_tui() local
566 .arg = top, in display_thread_tui()
567 .refresh = top->delay_secs, in display_thread_tui()
570 perf_top__sort_new_samples(top); in display_thread_tui()
577 evlist__for_each(top->evlist, pos) { in display_thread_tui()
579 hists->uid_filter_str = top->record_opts.target.uid_str; in display_thread_tui()
582 perf_evlist__tui_browse_hists(top->evlist, help, &hbt, top->min_percent, in display_thread_tui()
583 &top->session->header.env); in display_thread_tui()
607 struct perf_top *top = arg; in display_thread() local
613 delay_msecs = top->delay_secs * 1000; in display_thread()
619 perf_top__print_sym_table(top); in display_thread()
635 if (perf_top__handle_keypress(top, c)) in display_thread()
677 struct perf_top *top = arg; in hist_iter__top_callback() local
687 perf_top__record_precise_ip(top, he, evsel->idx, ip); in hist_iter__top_callback()
699 struct perf_top *top = container_of(tool, struct perf_top, tool); in perf_event__process_sample() local
719 top->session->evlist->stats.nr_unprocessable_samples++); in perf_event__process_sample()
724 top->exact_samples++; in perf_event__process_sample()
729 if (!top->kptr_restrict_warned && in perf_event__process_sample()
740 top->kptr_restrict_warned = true; in perf_event__process_sample()
756 if (!top->kptr_restrict_warned && !top->vmlinux_warned && in perf_event__process_sample()
771 top->vmlinux_warned = true; in perf_event__process_sample()
789 top->max_stack, top); in perf_event__process_sample()
799 static void perf_top__mmap_read_idx(struct perf_top *top, int idx) in perf_top__mmap_read_idx() argument
803 struct perf_session *session = top->session; in perf_top__mmap_read_idx()
809 while ((event = perf_evlist__mmap_read(top->evlist, idx)) != NULL) { in perf_top__mmap_read_idx()
810 ret = perf_evlist__parse_sample(top->evlist, event, &sample); in perf_top__mmap_read_idx()
822 ++top->samples; in perf_top__mmap_read_idx()
826 ++top->us_samples; in perf_top__mmap_read_idx()
827 if (top->hide_user_symbols) in perf_top__mmap_read_idx()
832 ++top->kernel_samples; in perf_top__mmap_read_idx()
833 if (top->hide_kernel_symbols) in perf_top__mmap_read_idx()
838 ++top->guest_kernel_samples; in perf_top__mmap_read_idx()
843 ++top->guest_us_samples; in perf_top__mmap_read_idx()
855 perf_event__process_sample(&top->tool, event, evsel, in perf_top__mmap_read_idx()
863 perf_evlist__mmap_consume(top->evlist, idx); in perf_top__mmap_read_idx()
867 static void perf_top__mmap_read(struct perf_top *top) in perf_top__mmap_read() argument
871 for (i = 0; i < top->evlist->nr_mmaps; i++) in perf_top__mmap_read()
872 perf_top__mmap_read_idx(top, i); in perf_top__mmap_read()
875 static int perf_top__start_counters(struct perf_top *top) in perf_top__start_counters() argument
879 struct perf_evlist *evlist = top->evlist; in perf_top__start_counters()
880 struct record_opts *opts = &top->record_opts; in perf_top__start_counters()
886 if (perf_evsel__open(counter, top->evlist->cpus, in perf_top__start_counters()
887 top->evlist->threads) < 0) { in perf_top__start_counters()
913 static int perf_top__setup_sample_type(struct perf_top *top __maybe_unused) in perf_top__setup_sample_type()
930 static int __cmd_top(struct perf_top *top) in __cmd_top() argument
932 struct record_opts *opts = &top->record_opts; in __cmd_top()
936 top->session = perf_session__new(NULL, false, NULL); in __cmd_top()
937 if (top->session == NULL) in __cmd_top()
940 machines__set_symbol_filter(&top->session->machines, symbol_filter); in __cmd_top()
943 ret = perf_session_env__lookup_objdump(&top->session->header.env); in __cmd_top()
948 ret = perf_top__setup_sample_type(top); in __cmd_top()
952 machine__synthesize_threads(&top->session->machines.host, &opts->target, in __cmd_top()
953 top->evlist->threads, false); in __cmd_top()
954 ret = perf_top__start_counters(top); in __cmd_top()
958 top->session->evlist = top->evlist; in __cmd_top()
959 perf_session__set_id_hdr_size(top->session); in __cmd_top()
970 perf_evlist__enable(top->evlist); in __cmd_top()
973 perf_evlist__poll(top->evlist, 100); in __cmd_top()
975 perf_top__mmap_read(top); in __cmd_top()
979 display_thread), top)) { in __cmd_top()
984 if (top->realtime_prio) { in __cmd_top()
987 param.sched_priority = top->realtime_prio; in __cmd_top()
995 u64 hits = top->samples; in __cmd_top()
997 perf_top__mmap_read(top); in __cmd_top()
999 if (hits == top->samples) in __cmd_top()
1000 ret = perf_evlist__poll(top->evlist, 100); in __cmd_top()
1007 perf_session__delete(top->session); in __cmd_top()
1008 top->session = NULL; in __cmd_top()
1043 struct perf_top *top = opt->value; in parse_percent_limit() local
1045 top->min_percent = strtof(arg, NULL); in parse_percent_limit()
1052 struct perf_top top = { in cmd_top() local
1067 struct record_opts *opts = &top.record_opts; in cmd_top()
1070 OPT_CALLBACK('e', "event", &top.evlist, "event", in cmd_top()
1086 OPT_BOOLEAN('K', "hide_kernel_symbols", &top.hide_kernel_symbols, in cmd_top()
1091 OPT_INTEGER('r', "realtime", &top.realtime_prio, in cmd_top()
1093 OPT_INTEGER('d', "delay", &top.delay_secs, in cmd_top()
1095 OPT_BOOLEAN('D', "dump-symtab", &top.dump_symtab, in cmd_top()
1097 OPT_INTEGER('f', "count-filter", &top.count_filter, in cmd_top()
1103 OPT_STRING(0, "sym-annotate", &top.sym_filter, "symbol name", in cmd_top()
1105 OPT_BOOLEAN('z', "zero", &top.zero, "zero history across updates"), in cmd_top()
1107 OPT_INTEGER('E', "entries", &top.print_entries, in cmd_top()
1109 OPT_BOOLEAN('U', "hide_user_symbols", &top.hide_user_symbols, in cmd_top()
1111 OPT_BOOLEAN(0, "tui", &top.use_tui, "Use the TUI interface"), in cmd_top()
1112 OPT_BOOLEAN(0, "stdio", &top.use_stdio, "Use the stdio interface"), in cmd_top()
1122 OPT_CALLBACK_NOOPT('g', NULL, &top.record_opts, in cmd_top()
1125 OPT_CALLBACK(0, "call-graph", &top.record_opts, in cmd_top()
1130 OPT_INTEGER(0, "max-stack", &top.max_stack, in cmd_top()
1155 OPT_CALLBACK(0, "percent-limit", &top, "percent", in cmd_top()
1173 top.evlist = perf_evlist__new(); in cmd_top()
1174 if (top.evlist == NULL) in cmd_top()
1177 perf_config(perf_top_config, &top); in cmd_top()
1196 if (top.use_stdio) in cmd_top()
1198 else if (top.use_tui) in cmd_top()
1223 if (perf_evlist__create_maps(top.evlist, target) < 0) in cmd_top()
1226 if (!top.evlist->nr_entries && in cmd_top()
1227 perf_evlist__add_default(top.evlist) < 0) { in cmd_top()
1232 symbol_conf.nr_events = top.evlist->nr_entries; in cmd_top()
1234 if (top.delay_secs < 1) in cmd_top()
1235 top.delay_secs = 1; in cmd_top()
1242 top.sym_evsel = perf_evlist__first(top.evlist); in cmd_top()
1257 get_term_dimensions(&top.winsize); in cmd_top()
1258 if (top.print_entries == 0) { in cmd_top()
1263 perf_top__update_print_entries(&top); in cmd_top()
1267 status = __cmd_top(&top); in cmd_top()
1270 perf_evlist__delete(top.evlist); in cmd_top()