aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-top.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/builtin-top.c')
-rw-r--r--tools/perf/builtin-top.c36
1 files changed, 24 insertions, 12 deletions
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index e06c4f869330..212214162bb2 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -40,6 +40,7 @@
40#include "util/xyarray.h" 40#include "util/xyarray.h"
41#include "util/sort.h" 41#include "util/sort.h"
42#include "util/intlist.h" 42#include "util/intlist.h"
43#include "arch/common.h"
43 44
44#include "util/debug.h" 45#include "util/debug.h"
45 46
@@ -102,7 +103,8 @@ static int perf_top__parse_source(struct perf_top *top, struct hist_entry *he)
102 /* 103 /*
103 * We can't annotate with just /proc/kallsyms 104 * We can't annotate with just /proc/kallsyms
104 */ 105 */
105 if (map->dso->symtab_type == DSO_BINARY_TYPE__KALLSYMS) { 106 if (map->dso->symtab_type == DSO_BINARY_TYPE__KALLSYMS &&
107 !dso__is_kcore(map->dso)) {
106 pr_err("Can't annotate %s: No vmlinux file was found in the " 108 pr_err("Can't annotate %s: No vmlinux file was found in the "
107 "path\n", sym->name); 109 "path\n", sym->name);
108 sleep(1); 110 sleep(1);
@@ -237,8 +239,6 @@ out_unlock:
237 pthread_mutex_unlock(&notes->lock); 239 pthread_mutex_unlock(&notes->lock);
238} 240}
239 241
240static const char CONSOLE_CLEAR[] = "";
241
242static struct hist_entry *perf_evsel__add_hist_entry(struct perf_evsel *evsel, 242static struct hist_entry *perf_evsel__add_hist_entry(struct perf_evsel *evsel,
243 struct addr_location *al, 243 struct addr_location *al,
244 struct perf_sample *sample) 244 struct perf_sample *sample)
@@ -689,7 +689,7 @@ static void perf_event__process_sample(struct perf_tool *tool,
689{ 689{
690 struct perf_top *top = container_of(tool, struct perf_top, tool); 690 struct perf_top *top = container_of(tool, struct perf_top, tool);
691 struct symbol *parent = NULL; 691 struct symbol *parent = NULL;
692 u64 ip = event->ip.ip; 692 u64 ip = sample->ip;
693 struct addr_location al; 693 struct addr_location al;
694 int err; 694 int err;
695 695
@@ -699,10 +699,10 @@ static void perf_event__process_sample(struct perf_tool *tool,
699 if (!seen) 699 if (!seen)
700 seen = intlist__new(NULL); 700 seen = intlist__new(NULL);
701 701
702 if (!intlist__has_entry(seen, event->ip.pid)) { 702 if (!intlist__has_entry(seen, sample->pid)) {
703 pr_err("Can't find guest [%d]'s kernel information\n", 703 pr_err("Can't find guest [%d]'s kernel information\n",
704 event->ip.pid); 704 sample->pid);
705 intlist__add(seen, event->ip.pid); 705 intlist__add(seen, sample->pid);
706 } 706 }
707 return; 707 return;
708 } 708 }
@@ -716,8 +716,7 @@ static void perf_event__process_sample(struct perf_tool *tool,
716 if (event->header.misc & PERF_RECORD_MISC_EXACT_IP) 716 if (event->header.misc & PERF_RECORD_MISC_EXACT_IP)
717 top->exact_samples++; 717 top->exact_samples++;
718 718
719 if (perf_event__preprocess_sample(event, machine, &al, sample, 719 if (perf_event__preprocess_sample(event, machine, &al, sample) < 0 ||
720 symbol_filter) < 0 ||
721 al.filtered) 720 al.filtered)
722 return; 721 return;
723 722
@@ -772,8 +771,7 @@ static void perf_event__process_sample(struct perf_tool *tool,
772 sample->callchain) { 771 sample->callchain) {
773 err = machine__resolve_callchain(machine, evsel, 772 err = machine__resolve_callchain(machine, evsel,
774 al.thread, sample, 773 al.thread, sample,
775 &parent); 774 &parent, &al);
776
777 if (err) 775 if (err)
778 return; 776 return;
779 } 777 }
@@ -838,7 +836,8 @@ static void perf_top__mmap_read_idx(struct perf_top *top, int idx)
838 break; 836 break;
839 case PERF_RECORD_MISC_GUEST_KERNEL: 837 case PERF_RECORD_MISC_GUEST_KERNEL:
840 ++top->guest_kernel_samples; 838 ++top->guest_kernel_samples;
841 machine = perf_session__find_machine(session, event->ip.pid); 839 machine = perf_session__find_machine(session,
840 sample.pid);
842 break; 841 break;
843 case PERF_RECORD_MISC_GUEST_USER: 842 case PERF_RECORD_MISC_GUEST_USER:
844 ++top->guest_us_samples; 843 ++top->guest_us_samples;
@@ -939,6 +938,14 @@ static int __cmd_top(struct perf_top *top)
939 if (top->session == NULL) 938 if (top->session == NULL)
940 return -ENOMEM; 939 return -ENOMEM;
941 940
941 machines__set_symbol_filter(&top->session->machines, symbol_filter);
942
943 if (!objdump_path) {
944 ret = perf_session_env__lookup_objdump(&top->session->header.env);
945 if (ret)
946 goto out_delete;
947 }
948
942 ret = perf_top__setup_sample_type(top); 949 ret = perf_top__setup_sample_type(top);
943 if (ret) 950 if (ret)
944 goto out_delete; 951 goto out_delete;
@@ -1102,6 +1109,9 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused)
1102 OPT_CALLBACK_DEFAULT('G', "call-graph", &top.record_opts, 1109 OPT_CALLBACK_DEFAULT('G', "call-graph", &top.record_opts,
1103 "mode[,dump_size]", record_callchain_help, 1110 "mode[,dump_size]", record_callchain_help,
1104 &parse_callchain_opt, "fp"), 1111 &parse_callchain_opt, "fp"),
1112 OPT_CALLBACK(0, "ignore-callees", NULL, "regex",
1113 "ignore callees of these functions in call graphs",
1114 report_parse_ignore_callees_opt),
1105 OPT_BOOLEAN(0, "show-total-period", &symbol_conf.show_total_period, 1115 OPT_BOOLEAN(0, "show-total-period", &symbol_conf.show_total_period,
1106 "Show a column with the sum of periods"), 1116 "Show a column with the sum of periods"),
1107 OPT_STRING(0, "dsos", &symbol_conf.dso_list_str, "dso[,dso...]", 1117 OPT_STRING(0, "dsos", &symbol_conf.dso_list_str, "dso[,dso...]",
@@ -1114,6 +1124,8 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused)
1114 "Interleave source code with assembly code (default)"), 1124 "Interleave source code with assembly code (default)"),
1115 OPT_BOOLEAN(0, "asm-raw", &symbol_conf.annotate_asm_raw, 1125 OPT_BOOLEAN(0, "asm-raw", &symbol_conf.annotate_asm_raw,
1116 "Display raw encoding of assembly instructions (default)"), 1126 "Display raw encoding of assembly instructions (default)"),
1127 OPT_STRING(0, "objdump", &objdump_path, "path",
1128 "objdump binary to use for disassembly and annotations"),
1117 OPT_STRING('M', "disassembler-style", &disassembler_style, "disassembler style", 1129 OPT_STRING('M', "disassembler-style", &disassembler_style, "disassembler style",
1118 "Specify disassembler style (e.g. -M intel for intel syntax)"), 1130 "Specify disassembler style (e.g. -M intel for intel syntax)"),
1119 OPT_STRING('u', "uid", &target->uid_str, "user", "user to profile"), 1131 OPT_STRING('u', "uid", &target->uid_str, "user", "user to profile"),