diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/Makefile | 30 | ||||
-rw-r--r-- | tools/perf/feature-tests.mak | 2 | ||||
-rw-r--r-- | tools/perf/util/callchain.h | 1 | ||||
-rw-r--r-- | tools/perf/util/probe-event.c | 1 | ||||
-rw-r--r-- | tools/perf/util/probe-finder.c | 42 | ||||
-rw-r--r-- | tools/perf/util/symbol.c | 7 | ||||
-rw-r--r-- | tools/perf/util/symbol.h | 3 | ||||
-rw-r--r-- | tools/perf/util/trace-event-scripting.c | 4 | ||||
-rw-r--r-- | tools/perf/util/ui/browsers/annotate.c | 3 | ||||
-rw-r--r-- | tools/perf/util/ui/browsers/hists.c | 2 |
10 files changed, 66 insertions, 29 deletions
diff --git a/tools/perf/Makefile b/tools/perf/Makefile index 41abb90df50d..1950e19af1cf 100644 --- a/tools/perf/Makefile +++ b/tools/perf/Makefile | |||
@@ -5,6 +5,12 @@ endif | |||
5 | # The default target of this Makefile is... | 5 | # The default target of this Makefile is... |
6 | all:: | 6 | all:: |
7 | 7 | ||
8 | ifneq ($(OUTPUT),) | ||
9 | # check that the output directory actually exists | ||
10 | OUTDIR := $(shell cd $(OUTPUT) && /bin/pwd) | ||
11 | $(if $(OUTDIR),, $(error output directory "$(OUTPUT)" does not exist)) | ||
12 | endif | ||
13 | |||
8 | # Define V=1 to have a more verbose compile. | 14 | # Define V=1 to have a more verbose compile. |
9 | # Define V=2 to have an even more verbose compile. | 15 | # Define V=2 to have an even more verbose compile. |
10 | # | 16 | # |
@@ -157,10 +163,6 @@ all:: | |||
157 | # | 163 | # |
158 | # Define NO_DWARF if you do not want debug-info analysis feature at all. | 164 | # Define NO_DWARF if you do not want debug-info analysis feature at all. |
159 | 165 | ||
160 | $(shell sh -c 'mkdir -p $(OUTPUT)scripts/{perl,python}/Perf-Trace-Util/' 2> /dev/null) | ||
161 | $(shell sh -c 'mkdir -p $(OUTPUT)util/{ui/browsers,scripting-engines}/' 2> /dev/null) | ||
162 | $(shell sh -c 'mkdir $(OUTPUT)bench' 2> /dev/null) | ||
163 | |||
164 | $(OUTPUT)PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE | 166 | $(OUTPUT)PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE |
165 | @$(SHELL_PATH) util/PERF-VERSION-GEN $(OUTPUT) | 167 | @$(SHELL_PATH) util/PERF-VERSION-GEN $(OUTPUT) |
166 | -include $(OUTPUT)PERF-VERSION-FILE | 168 | -include $(OUTPUT)PERF-VERSION-FILE |
@@ -186,8 +188,6 @@ ifeq ($(ARCH),x86_64) | |||
186 | ARCH := x86 | 188 | ARCH := x86 |
187 | endif | 189 | endif |
188 | 190 | ||
189 | $(shell sh -c 'mkdir -p $(OUTPUT)arch/$(ARCH)/util/' 2> /dev/null) | ||
190 | |||
191 | # CFLAGS and LDFLAGS are for the users to override from the command line. | 191 | # CFLAGS and LDFLAGS are for the users to override from the command line. |
192 | 192 | ||
193 | # | 193 | # |
@@ -268,6 +268,7 @@ export prefix bindir sharedir sysconfdir | |||
268 | CC = $(CROSS_COMPILE)gcc | 268 | CC = $(CROSS_COMPILE)gcc |
269 | AR = $(CROSS_COMPILE)ar | 269 | AR = $(CROSS_COMPILE)ar |
270 | RM = rm -f | 270 | RM = rm -f |
271 | MKDIR = mkdir | ||
271 | TAR = tar | 272 | TAR = tar |
272 | FIND = find | 273 | FIND = find |
273 | INSTALL = install | 274 | INSTALL = install |
@@ -838,6 +839,7 @@ ifndef V | |||
838 | QUIET_CC = @echo ' ' CC $@; | 839 | QUIET_CC = @echo ' ' CC $@; |
839 | QUIET_AR = @echo ' ' AR $@; | 840 | QUIET_AR = @echo ' ' AR $@; |
840 | QUIET_LINK = @echo ' ' LINK $@; | 841 | QUIET_LINK = @echo ' ' LINK $@; |
842 | QUIET_MKDIR = @echo ' ' MKDIR $@; | ||
841 | QUIET_BUILT_IN = @echo ' ' BUILTIN $@; | 843 | QUIET_BUILT_IN = @echo ' ' BUILTIN $@; |
842 | QUIET_GEN = @echo ' ' GEN $@; | 844 | QUIET_GEN = @echo ' ' GEN $@; |
843 | QUIET_SUBDIR0 = +@subdir= | 845 | QUIET_SUBDIR0 = +@subdir= |
@@ -935,15 +937,15 @@ $(OUTPUT)common-cmds.h: $(wildcard Documentation/perf-*.txt) | |||
935 | $(QUIET_GEN). util/generate-cmdlist.sh > $@+ && mv $@+ $@ | 937 | $(QUIET_GEN). util/generate-cmdlist.sh > $@+ && mv $@+ $@ |
936 | 938 | ||
937 | $(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh | 939 | $(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh |
938 | $(QUIET_GEN)$(RM) $@ $@+ && \ | 940 | $(QUIET_GEN)$(RM) $(OUTPUT)$@ $(OUTPUT)$@+ && \ |
939 | sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \ | 941 | sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \ |
940 | -e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \ | 942 | -e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \ |
941 | -e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \ | 943 | -e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \ |
942 | -e 's/@@PERF_VERSION@@/$(PERF_VERSION)/g' \ | 944 | -e 's/@@PERF_VERSION@@/$(PERF_VERSION)/g' \ |
943 | -e 's/@@NO_CURL@@/$(NO_CURL)/g' \ | 945 | -e 's/@@NO_CURL@@/$(NO_CURL)/g' \ |
944 | $@.sh >$@+ && \ | 946 | $@.sh > $(OUTPUT)$@+ && \ |
945 | chmod +x $@+ && \ | 947 | chmod +x $(OUTPUT)$@+ && \ |
946 | mv $@+ $(OUTPUT)$@ | 948 | mv $(OUTPUT)$@+ $(OUTPUT)$@ |
947 | 949 | ||
948 | configure: configure.ac | 950 | configure: configure.ac |
949 | $(QUIET_GEN)$(RM) $@ $<+ && \ | 951 | $(QUIET_GEN)$(RM) $@ $<+ && \ |
@@ -1012,6 +1014,14 @@ $(LIB_OBJS) $(BUILTIN_OBJS): $(LIB_H) | |||
1012 | $(patsubst perf-%$X,%.o,$(PROGRAMS)): $(LIB_H) $(wildcard */*.h) | 1014 | $(patsubst perf-%$X,%.o,$(PROGRAMS)): $(LIB_H) $(wildcard */*.h) |
1013 | builtin-revert.o wt-status.o: wt-status.h | 1015 | builtin-revert.o wt-status.o: wt-status.h |
1014 | 1016 | ||
1017 | # we compile into subdirectories. if the target directory is not the source directory, they might not exists. So | ||
1018 | # we depend the various files onto their directories. | ||
1019 | DIRECTORY_DEPS = $(LIB_OBJS) $(BUILTIN_OBJS) $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h | ||
1020 | $(DIRECTORY_DEPS): | $(sort $(dir $(DIRECTORY_DEPS))) | ||
1021 | # In the second step, we make a rule to actually create these directories | ||
1022 | $(sort $(dir $(DIRECTORY_DEPS))): | ||
1023 | $(QUIET_MKDIR)$(MKDIR) -p $@ 2>/dev/null | ||
1024 | |||
1015 | $(LIB_FILE): $(LIB_OBJS) | 1025 | $(LIB_FILE): $(LIB_OBJS) |
1016 | $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(LIB_OBJS) | 1026 | $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(LIB_OBJS) |
1017 | 1027 | ||
diff --git a/tools/perf/feature-tests.mak b/tools/perf/feature-tests.mak index ddb68e601f0e..7a7b60859053 100644 --- a/tools/perf/feature-tests.mak +++ b/tools/perf/feature-tests.mak | |||
@@ -113,7 +113,7 @@ endef | |||
113 | # try-cc | 113 | # try-cc |
114 | # Usage: option = $(call try-cc, source-to-build, cc-options) | 114 | # Usage: option = $(call try-cc, source-to-build, cc-options) |
115 | try-cc = $(shell sh -c \ | 115 | try-cc = $(shell sh -c \ |
116 | 'TMP="$(TMPOUT).$$$$"; \ | 116 | 'TMP="$(OUTPUT)$(TMPOUT).$$$$"; \ |
117 | echo "$(1)" | \ | 117 | echo "$(1)" | \ |
118 | $(CC) -x c - $(2) -o "$$TMP" > /dev/null 2>&1 && echo y; \ | 118 | $(CC) -x c - $(2) -o "$$TMP" > /dev/null 2>&1 && echo y; \ |
119 | rm -f "$$TMP"') | 119 | rm -f "$$TMP"') |
diff --git a/tools/perf/util/callchain.h b/tools/perf/util/callchain.h index 624a96c636fd..6de4313924fb 100644 --- a/tools/perf/util/callchain.h +++ b/tools/perf/util/callchain.h | |||
@@ -50,6 +50,7 @@ static inline void callchain_init(struct callchain_node *node) | |||
50 | INIT_LIST_HEAD(&node->children); | 50 | INIT_LIST_HEAD(&node->children); |
51 | INIT_LIST_HEAD(&node->val); | 51 | INIT_LIST_HEAD(&node->val); |
52 | 52 | ||
53 | node->children_hit = 0; | ||
53 | node->parent = NULL; | 54 | node->parent = NULL; |
54 | node->hit = 0; | 55 | node->hit = 0; |
55 | } | 56 | } |
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c index e72f05c3bef0..fcc16e4349df 100644 --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c | |||
@@ -1539,6 +1539,7 @@ static int convert_to_probe_trace_events(struct perf_probe_event *pev, | |||
1539 | goto error; | 1539 | goto error; |
1540 | } | 1540 | } |
1541 | tev->point.offset = pev->point.offset; | 1541 | tev->point.offset = pev->point.offset; |
1542 | tev->point.retprobe = pev->point.retprobe; | ||
1542 | tev->nargs = pev->nargs; | 1543 | tev->nargs = pev->nargs; |
1543 | if (tev->nargs) { | 1544 | if (tev->nargs) { |
1544 | tev->args = zalloc(sizeof(struct probe_trace_arg) | 1545 | tev->args = zalloc(sizeof(struct probe_trace_arg) |
diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c index 525136684d4e..32b81f707ff5 100644 --- a/tools/perf/util/probe-finder.c +++ b/tools/perf/util/probe-finder.c | |||
@@ -686,6 +686,25 @@ static int find_variable(Dwarf_Die *sp_die, struct probe_finder *pf) | |||
686 | char buf[32], *ptr; | 686 | char buf[32], *ptr; |
687 | int ret, nscopes; | 687 | int ret, nscopes; |
688 | 688 | ||
689 | if (!is_c_varname(pf->pvar->var)) { | ||
690 | /* Copy raw parameters */ | ||
691 | pf->tvar->value = strdup(pf->pvar->var); | ||
692 | if (pf->tvar->value == NULL) | ||
693 | return -ENOMEM; | ||
694 | if (pf->pvar->type) { | ||
695 | pf->tvar->type = strdup(pf->pvar->type); | ||
696 | if (pf->tvar->type == NULL) | ||
697 | return -ENOMEM; | ||
698 | } | ||
699 | if (pf->pvar->name) { | ||
700 | pf->tvar->name = strdup(pf->pvar->name); | ||
701 | if (pf->tvar->name == NULL) | ||
702 | return -ENOMEM; | ||
703 | } else | ||
704 | pf->tvar->name = NULL; | ||
705 | return 0; | ||
706 | } | ||
707 | |||
689 | if (pf->pvar->name) | 708 | if (pf->pvar->name) |
690 | pf->tvar->name = strdup(pf->pvar->name); | 709 | pf->tvar->name = strdup(pf->pvar->name); |
691 | else { | 710 | else { |
@@ -700,19 +719,6 @@ static int find_variable(Dwarf_Die *sp_die, struct probe_finder *pf) | |||
700 | if (pf->tvar->name == NULL) | 719 | if (pf->tvar->name == NULL) |
701 | return -ENOMEM; | 720 | return -ENOMEM; |
702 | 721 | ||
703 | if (!is_c_varname(pf->pvar->var)) { | ||
704 | /* Copy raw parameters */ | ||
705 | pf->tvar->value = strdup(pf->pvar->var); | ||
706 | if (pf->tvar->value == NULL) | ||
707 | return -ENOMEM; | ||
708 | if (pf->pvar->type) { | ||
709 | pf->tvar->type = strdup(pf->pvar->type); | ||
710 | if (pf->tvar->type == NULL) | ||
711 | return -ENOMEM; | ||
712 | } | ||
713 | return 0; | ||
714 | } | ||
715 | |||
716 | pr_debug("Searching '%s' variable in context.\n", | 722 | pr_debug("Searching '%s' variable in context.\n", |
717 | pf->pvar->var); | 723 | pf->pvar->var); |
718 | /* Search child die for local variables and parameters. */ | 724 | /* Search child die for local variables and parameters. */ |
@@ -783,6 +789,16 @@ static int convert_probe_point(Dwarf_Die *sp_die, struct probe_finder *pf) | |||
783 | /* This function has no name. */ | 789 | /* This function has no name. */ |
784 | tev->point.offset = (unsigned long)pf->addr; | 790 | tev->point.offset = (unsigned long)pf->addr; |
785 | 791 | ||
792 | /* Return probe must be on the head of a subprogram */ | ||
793 | if (pf->pev->point.retprobe) { | ||
794 | if (tev->point.offset != 0) { | ||
795 | pr_warning("Return probe must be on the head of" | ||
796 | " a real function\n"); | ||
797 | return -EINVAL; | ||
798 | } | ||
799 | tev->point.retprobe = true; | ||
800 | } | ||
801 | |||
786 | pr_debug("Probe point found: %s+%lu\n", tev->point.symbol, | 802 | pr_debug("Probe point found: %s+%lu\n", tev->point.symbol, |
787 | tev->point.offset); | 803 | tev->point.offset); |
788 | 804 | ||
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index 1a367734e016..b2f5ae97f33d 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c | |||
@@ -2268,6 +2268,9 @@ static int setup_list(struct strlist **list, const char *list_str, | |||
2268 | 2268 | ||
2269 | int symbol__init(void) | 2269 | int symbol__init(void) |
2270 | { | 2270 | { |
2271 | if (symbol_conf.initialized) | ||
2272 | return 0; | ||
2273 | |||
2271 | elf_version(EV_CURRENT); | 2274 | elf_version(EV_CURRENT); |
2272 | if (symbol_conf.sort_by_name) | 2275 | if (symbol_conf.sort_by_name) |
2273 | symbol_conf.priv_size += (sizeof(struct symbol_name_rb_node) - | 2276 | symbol_conf.priv_size += (sizeof(struct symbol_name_rb_node) - |
@@ -2293,6 +2296,7 @@ int symbol__init(void) | |||
2293 | symbol_conf.sym_list_str, "symbol") < 0) | 2296 | symbol_conf.sym_list_str, "symbol") < 0) |
2294 | goto out_free_comm_list; | 2297 | goto out_free_comm_list; |
2295 | 2298 | ||
2299 | symbol_conf.initialized = true; | ||
2296 | return 0; | 2300 | return 0; |
2297 | 2301 | ||
2298 | out_free_dso_list: | 2302 | out_free_dso_list: |
@@ -2304,11 +2308,14 @@ out_free_comm_list: | |||
2304 | 2308 | ||
2305 | void symbol__exit(void) | 2309 | void symbol__exit(void) |
2306 | { | 2310 | { |
2311 | if (!symbol_conf.initialized) | ||
2312 | return; | ||
2307 | strlist__delete(symbol_conf.sym_list); | 2313 | strlist__delete(symbol_conf.sym_list); |
2308 | strlist__delete(symbol_conf.dso_list); | 2314 | strlist__delete(symbol_conf.dso_list); |
2309 | strlist__delete(symbol_conf.comm_list); | 2315 | strlist__delete(symbol_conf.comm_list); |
2310 | vmlinux_path__exit(); | 2316 | vmlinux_path__exit(); |
2311 | symbol_conf.sym_list = symbol_conf.dso_list = symbol_conf.comm_list = NULL; | 2317 | symbol_conf.sym_list = symbol_conf.dso_list = symbol_conf.comm_list = NULL; |
2318 | symbol_conf.initialized = false; | ||
2312 | } | 2319 | } |
2313 | 2320 | ||
2314 | int machines__create_kernel_maps(struct rb_root *self, pid_t pid) | 2321 | int machines__create_kernel_maps(struct rb_root *self, pid_t pid) |
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h index b7a8da4af5a0..ea95c2756f05 100644 --- a/tools/perf/util/symbol.h +++ b/tools/perf/util/symbol.h | |||
@@ -69,7 +69,8 @@ struct symbol_conf { | |||
69 | show_nr_samples, | 69 | show_nr_samples, |
70 | use_callchain, | 70 | use_callchain, |
71 | exclude_other, | 71 | exclude_other, |
72 | show_cpu_utilization; | 72 | show_cpu_utilization, |
73 | initialized; | ||
73 | const char *vmlinux_name, | 74 | const char *vmlinux_name, |
74 | *source_prefix, | 75 | *source_prefix, |
75 | *field_sep; | 76 | *field_sep; |
diff --git a/tools/perf/util/trace-event-scripting.c b/tools/perf/util/trace-event-scripting.c index 7ea983acfaea..f7af2fca965d 100644 --- a/tools/perf/util/trace-event-scripting.c +++ b/tools/perf/util/trace-event-scripting.c | |||
@@ -97,7 +97,7 @@ void setup_python_scripting(void) | |||
97 | register_python_scripting(&python_scripting_unsupported_ops); | 97 | register_python_scripting(&python_scripting_unsupported_ops); |
98 | } | 98 | } |
99 | #else | 99 | #else |
100 | struct scripting_ops python_scripting_ops; | 100 | extern struct scripting_ops python_scripting_ops; |
101 | 101 | ||
102 | void setup_python_scripting(void) | 102 | void setup_python_scripting(void) |
103 | { | 103 | { |
@@ -158,7 +158,7 @@ void setup_perl_scripting(void) | |||
158 | register_perl_scripting(&perl_scripting_unsupported_ops); | 158 | register_perl_scripting(&perl_scripting_unsupported_ops); |
159 | } | 159 | } |
160 | #else | 160 | #else |
161 | struct scripting_ops perl_scripting_ops; | 161 | extern struct scripting_ops perl_scripting_ops; |
162 | 162 | ||
163 | void setup_perl_scripting(void) | 163 | void setup_perl_scripting(void) |
164 | { | 164 | { |
diff --git a/tools/perf/util/ui/browsers/annotate.c b/tools/perf/util/ui/browsers/annotate.c index 55ff792459ac..a90273e63f4f 100644 --- a/tools/perf/util/ui/browsers/annotate.c +++ b/tools/perf/util/ui/browsers/annotate.c | |||
@@ -146,6 +146,7 @@ static int annotate_browser__run(struct annotate_browser *self, | |||
146 | return -1; | 146 | return -1; |
147 | 147 | ||
148 | newtFormAddHotKey(self->b.form, NEWT_KEY_LEFT); | 148 | newtFormAddHotKey(self->b.form, NEWT_KEY_LEFT); |
149 | newtFormAddHotKey(self->b.form, NEWT_KEY_RIGHT); | ||
149 | 150 | ||
150 | nd = self->curr_hot; | 151 | nd = self->curr_hot; |
151 | if (nd) { | 152 | if (nd) { |
@@ -178,7 +179,7 @@ static int annotate_browser__run(struct annotate_browser *self, | |||
178 | } | 179 | } |
179 | out: | 180 | out: |
180 | ui_browser__hide(&self->b); | 181 | ui_browser__hide(&self->b); |
181 | return 0; | 182 | return es->u.key; |
182 | } | 183 | } |
183 | 184 | ||
184 | int hist_entry__tui_annotate(struct hist_entry *self) | 185 | int hist_entry__tui_annotate(struct hist_entry *self) |
diff --git a/tools/perf/util/ui/browsers/hists.c b/tools/perf/util/ui/browsers/hists.c index dafdf6775d77..6866aa4c41e0 100644 --- a/tools/perf/util/ui/browsers/hists.c +++ b/tools/perf/util/ui/browsers/hists.c | |||
@@ -773,7 +773,7 @@ int hists__browse(struct hists *self, const char *helpline, const char *ev_name) | |||
773 | 773 | ||
774 | switch (key) { | 774 | switch (key) { |
775 | case 'a': | 775 | case 'a': |
776 | if (browser->selection->map == NULL && | 776 | if (browser->selection->map == NULL || |
777 | browser->selection->map->dso->annotate_warned) | 777 | browser->selection->map->dso->annotate_warned) |
778 | continue; | 778 | continue; |
779 | goto do_annotate; | 779 | goto do_annotate; |