diff options
Diffstat (limited to 'tools/perf/builtin-top.c')
-rw-r--r-- | tools/perf/builtin-top.c | 52 |
1 files changed, 19 insertions, 33 deletions
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index 418ed94756d3..fe3af9535e85 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include "util/annotate.h" | 24 | #include "util/annotate.h" |
25 | #include "util/config.h" | 25 | #include "util/config.h" |
26 | #include "util/color.h" | 26 | #include "util/color.h" |
27 | #include "util/drv_configs.h" | ||
27 | #include "util/evlist.h" | 28 | #include "util/evlist.h" |
28 | #include "util/evsel.h" | 29 | #include "util/evsel.h" |
29 | #include "util/machine.h" | 30 | #include "util/machine.h" |
@@ -68,6 +69,7 @@ | |||
68 | #include <sys/mman.h> | 69 | #include <sys/mman.h> |
69 | 70 | ||
70 | #include <linux/stringify.h> | 71 | #include <linux/stringify.h> |
72 | #include <linux/time64.h> | ||
71 | #include <linux/types.h> | 73 | #include <linux/types.h> |
72 | 74 | ||
73 | static volatile int done; | 75 | static volatile int done; |
@@ -624,7 +626,7 @@ static void *display_thread(void *arg) | |||
624 | display_setup_sig(); | 626 | display_setup_sig(); |
625 | pthread__unblock_sigwinch(); | 627 | pthread__unblock_sigwinch(); |
626 | repeat: | 628 | repeat: |
627 | delay_msecs = top->delay_secs * 1000; | 629 | delay_msecs = top->delay_secs * MSEC_PER_SEC; |
628 | set_term_quiet_input(&save); | 630 | set_term_quiet_input(&save); |
629 | /* trash return*/ | 631 | /* trash return*/ |
630 | getc(stdin); | 632 | getc(stdin); |
@@ -656,34 +658,6 @@ repeat: | |||
656 | return NULL; | 658 | return NULL; |
657 | } | 659 | } |
658 | 660 | ||
659 | static int symbol_filter(struct map *map, struct symbol *sym) | ||
660 | { | ||
661 | const char *name = sym->name; | ||
662 | |||
663 | if (!__map__is_kernel(map)) | ||
664 | return 0; | ||
665 | /* | ||
666 | * ppc64 uses function descriptors and appends a '.' to the | ||
667 | * start of every instruction address. Remove it. | ||
668 | */ | ||
669 | if (name[0] == '.') | ||
670 | name++; | ||
671 | |||
672 | if (!strcmp(name, "_text") || | ||
673 | !strcmp(name, "_etext") || | ||
674 | !strcmp(name, "_sinittext") || | ||
675 | !strncmp("init_module", name, 11) || | ||
676 | !strncmp("cleanup_module", name, 14) || | ||
677 | strstr(name, "_text_start") || | ||
678 | strstr(name, "_text_end")) | ||
679 | return 1; | ||
680 | |||
681 | if (symbol__is_idle(sym)) | ||
682 | sym->ignore = true; | ||
683 | |||
684 | return 0; | ||
685 | } | ||
686 | |||
687 | static int hist_iter__top_callback(struct hist_entry_iter *iter, | 661 | static int hist_iter__top_callback(struct hist_entry_iter *iter, |
688 | struct addr_location *al, bool single, | 662 | struct addr_location *al, bool single, |
689 | void *arg) | 663 | void *arg) |
@@ -782,7 +756,7 @@ static void perf_event__process_sample(struct perf_tool *tool, | |||
782 | } | 756 | } |
783 | } | 757 | } |
784 | 758 | ||
785 | if (al.sym == NULL || !al.sym->ignore) { | 759 | if (al.sym == NULL || !al.sym->idle) { |
786 | struct hists *hists = evsel__hists(evsel); | 760 | struct hists *hists = evsel__hists(evsel); |
787 | struct hist_entry_iter iter = { | 761 | struct hist_entry_iter iter = { |
788 | .evsel = evsel, | 762 | .evsel = evsel, |
@@ -940,6 +914,10 @@ static int callchain_param__setup_sample_type(struct callchain_param *callchain) | |||
940 | 914 | ||
941 | static int __cmd_top(struct perf_top *top) | 915 | static int __cmd_top(struct perf_top *top) |
942 | { | 916 | { |
917 | char msg[512]; | ||
918 | struct perf_evsel *pos; | ||
919 | struct perf_evsel_config_term *err_term; | ||
920 | struct perf_evlist *evlist = top->evlist; | ||
943 | struct record_opts *opts = &top->record_opts; | 921 | struct record_opts *opts = &top->record_opts; |
944 | pthread_t thread; | 922 | pthread_t thread; |
945 | int ret; | 923 | int ret; |
@@ -948,8 +926,6 @@ static int __cmd_top(struct perf_top *top) | |||
948 | if (top->session == NULL) | 926 | if (top->session == NULL) |
949 | return -1; | 927 | return -1; |
950 | 928 | ||
951 | machines__set_symbol_filter(&top->session->machines, symbol_filter); | ||
952 | |||
953 | if (!objdump_path) { | 929 | if (!objdump_path) { |
954 | ret = perf_env__lookup_objdump(&top->session->header.env); | 930 | ret = perf_env__lookup_objdump(&top->session->header.env); |
955 | if (ret) | 931 | if (ret) |
@@ -976,6 +952,14 @@ static int __cmd_top(struct perf_top *top) | |||
976 | if (ret) | 952 | if (ret) |
977 | goto out_delete; | 953 | goto out_delete; |
978 | 954 | ||
955 | ret = perf_evlist__apply_drv_configs(evlist, &pos, &err_term); | ||
956 | if (ret) { | ||
957 | error("failed to set config \"%s\" on event %s with %d (%s)\n", | ||
958 | err_term->val.drv_cfg, perf_evsel__name(pos), errno, | ||
959 | str_error_r(errno, msg, sizeof(msg))); | ||
960 | goto out_delete; | ||
961 | } | ||
962 | |||
979 | top->session->evlist = top->evlist; | 963 | top->session->evlist = top->evlist; |
980 | perf_session__set_id_hdr_size(top->session); | 964 | perf_session__set_id_hdr_size(top->session); |
981 | 965 | ||
@@ -1323,7 +1307,9 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused) | |||
1323 | if (symbol_conf.cumulate_callchain && !callchain_param.order_set) | 1307 | if (symbol_conf.cumulate_callchain && !callchain_param.order_set) |
1324 | callchain_param.order = ORDER_CALLER; | 1308 | callchain_param.order = ORDER_CALLER; |
1325 | 1309 | ||
1326 | symbol_conf.priv_size = sizeof(struct annotation); | 1310 | status = symbol__annotation_init(); |
1311 | if (status < 0) | ||
1312 | goto out_delete_evlist; | ||
1327 | 1313 | ||
1328 | symbol_conf.try_vmlinux_path = (symbol_conf.vmlinux_name == NULL); | 1314 | symbol_conf.try_vmlinux_path = (symbol_conf.vmlinux_name == NULL); |
1329 | if (symbol__init(NULL) < 0) | 1315 | if (symbol__init(NULL) < 0) |