aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf')
-rw-r--r--tools/perf/Makefile.perf25
-rw-r--r--tools/perf/arch/x86/tests/intel-cqm.c2
-rw-r--r--tools/perf/config/Makefile4
-rw-r--r--tools/perf/tests/make55
-rw-r--r--tools/perf/ui/browsers/annotate.c4
-rw-r--r--tools/perf/util/hist.c2
-rw-r--r--tools/perf/util/session.c2
-rw-r--r--tools/perf/util/stat.c1
-rw-r--r--tools/perf/util/symbol.c2
9 files changed, 75 insertions, 22 deletions
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 0a22407e1d7d..5d34815c7ccb 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -77,6 +77,9 @@ include config/utilities.mak
77# Define NO_AUXTRACE if you do not want AUX area tracing support 77# Define NO_AUXTRACE if you do not want AUX area tracing support
78# 78#
79# Define NO_LIBBPF if you do not want BPF support 79# Define NO_LIBBPF if you do not want BPF support
80#
81# Define FEATURES_DUMP to provide features detection dump file
82# and bypass the feature detection
80 83
81# As per kernel Makefile, avoid funny character set dependencies 84# As per kernel Makefile, avoid funny character set dependencies
82unexport LC_ALL 85unexport LC_ALL
@@ -166,6 +169,15 @@ ifeq ($(config),1)
166include config/Makefile 169include config/Makefile
167endif 170endif
168 171
172# The FEATURE_DUMP_EXPORT holds location of the actual
173# FEATURE_DUMP file to be used to bypass feature detection
174# (for bpf or any other subproject)
175ifeq ($(FEATURES_DUMP),)
176FEATURE_DUMP_EXPORT := $(realpath $(OUTPUT)FEATURE-DUMP)
177else
178FEATURE_DUMP_EXPORT := $(FEATURES_DUMP)
179endif
180
169export prefix bindir sharedir sysconfdir DESTDIR 181export prefix bindir sharedir sysconfdir DESTDIR
170 182
171# sparse is architecture-neutral, which means that we need to tell it 183# sparse is architecture-neutral, which means that we need to tell it
@@ -436,7 +448,7 @@ $(LIBAPI)-clean:
436 $(Q)$(MAKE) -C $(LIB_DIR) O=$(OUTPUT) clean >/dev/null 448 $(Q)$(MAKE) -C $(LIB_DIR) O=$(OUTPUT) clean >/dev/null
437 449
438$(LIBBPF): fixdep FORCE 450$(LIBBPF): fixdep FORCE
439 $(Q)$(MAKE) -C $(BPF_DIR) O=$(OUTPUT) $(OUTPUT)libbpf.a FEATURES_DUMP=$(realpath $(OUTPUT)FEATURE-DUMP) 451 $(Q)$(MAKE) -C $(BPF_DIR) O=$(OUTPUT) $(OUTPUT)libbpf.a FEATURES_DUMP=$(FEATURE_DUMP_EXPORT)
440 452
441$(LIBBPF)-clean: 453$(LIBBPF)-clean:
442 $(call QUIET_CLEAN, libbpf) 454 $(call QUIET_CLEAN, libbpf)
@@ -611,6 +623,17 @@ clean: $(LIBTRACEEVENT)-clean $(LIBAPI)-clean $(LIBBPF)-clean $(LIBSUBCMD)-clean
611 $(python-clean) 623 $(python-clean)
612 624
613# 625#
626# To provide FEATURE-DUMP into $(FEATURE_DUMP_COPY)
627# file if defined, with no further action.
628feature-dump:
629ifdef FEATURE_DUMP_COPY
630 @cp $(OUTPUT)FEATURE-DUMP $(FEATURE_DUMP_COPY)
631 @echo "FEATURE-DUMP file copied into $(FEATURE_DUMP_COPY)"
632else
633 @echo "FEATURE-DUMP file available in $(OUTPUT)FEATURE-DUMP"
634endif
635
636#
614# Trick: if ../../.git does not exist - we are building out of tree for example, 637# Trick: if ../../.git does not exist - we are building out of tree for example,
615# then force version regeneration: 638# then force version regeneration:
616# 639#
diff --git a/tools/perf/arch/x86/tests/intel-cqm.c b/tools/perf/arch/x86/tests/intel-cqm.c
index 3e89ba825f6b..7f064eb37158 100644
--- a/tools/perf/arch/x86/tests/intel-cqm.c
+++ b/tools/perf/arch/x86/tests/intel-cqm.c
@@ -17,7 +17,7 @@ static pid_t spawn(void)
17 if (pid) 17 if (pid)
18 return pid; 18 return pid;
19 19
20 while(1); 20 while(1)
21 sleep(5); 21 sleep(5);
22 return 0; 22 return 0;
23} 23}
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index e5959c136a19..511141b102e8 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -181,7 +181,11 @@ LDFLAGS += -Wl,-z,noexecstack
181 181
182EXTLIBS = -lpthread -lrt -lm -ldl 182EXTLIBS = -lpthread -lrt -lm -ldl
183 183
184ifeq ($(FEATURES_DUMP),)
184include $(srctree)/tools/build/Makefile.feature 185include $(srctree)/tools/build/Makefile.feature
186else
187include $(FEATURES_DUMP)
188endif
185 189
186ifeq ($(feature-stackprotector-all), 1) 190ifeq ($(feature-stackprotector-all), 1)
187 CFLAGS += -fstack-protector-all 191 CFLAGS += -fstack-protector-all
diff --git a/tools/perf/tests/make b/tools/perf/tests/make
index df38decc48c3..f918015512af 100644
--- a/tools/perf/tests/make
+++ b/tools/perf/tests/make
@@ -5,7 +5,7 @@ ifeq ($(MAKECMDGOALS),)
5# no target specified, trigger the whole suite 5# no target specified, trigger the whole suite
6all: 6all:
7 @echo "Testing Makefile"; $(MAKE) -sf tests/make MK=Makefile 7 @echo "Testing Makefile"; $(MAKE) -sf tests/make MK=Makefile
8 @echo "Testing Makefile.perf"; $(MAKE) -sf tests/make MK=Makefile.perf 8 @echo "Testing Makefile.perf"; $(MAKE) -sf tests/make MK=Makefile.perf SET_PARALLEL=1 SET_O=1
9else 9else
10# run only specific test over 'Makefile' 10# run only specific test over 'Makefile'
11%: 11%:
@@ -13,6 +13,26 @@ else
13endif 13endif
14else 14else
15PERF := . 15PERF := .
16PERF_O := $(PERF)
17O_OPT :=
18
19ifneq ($(O),)
20 FULL_O := $(shell readlink -f $(O) || echo $(O))
21 PERF_O := $(FULL_O)
22 ifeq ($(SET_O),1)
23 O_OPT := 'O=$(FULL_O)'
24 endif
25 K_O_OPT := 'O=$(FULL_O)'
26endif
27
28PARALLEL_OPT=
29ifeq ($(SET_PARALLEL),1)
30 cores := $(shell (getconf _NPROCESSORS_ONLN || egrep -c '^processor|^CPU[0-9]' /proc/cpuinfo) 2>/dev/null)
31 ifeq ($(cores),0)
32 cores := 1
33 endif
34 PARALLEL_OPT="-j$(cores)"
35endif
16 36
17# As per kernel Makefile, avoid funny character set dependencies 37# As per kernel Makefile, avoid funny character set dependencies
18unexport LC_ALL 38unexport LC_ALL
@@ -156,11 +176,11 @@ test_make_doc := $(test_ok)
156test_make_help_O := $(test_ok) 176test_make_help_O := $(test_ok)
157test_make_doc_O := $(test_ok) 177test_make_doc_O := $(test_ok)
158 178
159test_make_python_perf_so := test -f $(PERF)/python/perf.so 179test_make_python_perf_so := test -f $(PERF_O)/python/perf.so
160 180
161test_make_perf_o := test -f $(PERF)/perf.o 181test_make_perf_o := test -f $(PERF_O)/perf.o
162test_make_util_map_o := test -f $(PERF)/util/map.o 182test_make_util_map_o := test -f $(PERF_O)/util/map.o
163test_make_util_pmu_bison_o := test -f $(PERF)/util/pmu-bison.o 183test_make_util_pmu_bison_o := test -f $(PERF_O)/util/pmu-bison.o
164 184
165define test_dest_files 185define test_dest_files
166 for file in $(1); do \ 186 for file in $(1); do \
@@ -227,7 +247,7 @@ test_make_perf_o_O := test -f $$TMP_O/perf.o
227test_make_util_map_o_O := test -f $$TMP_O/util/map.o 247test_make_util_map_o_O := test -f $$TMP_O/util/map.o
228test_make_util_pmu_bison_o_O := test -f $$TMP_O/util/pmu-bison.o 248test_make_util_pmu_bison_o_O := test -f $$TMP_O/util/pmu-bison.o
229 249
230test_default = test -x $(PERF)/perf 250test_default = test -x $(PERF_O)/perf
231test = $(if $(test_$1),$(test_$1),$(test_default)) 251test = $(if $(test_$1),$(test_$1),$(test_default))
232 252
233test_default_O = test -x $$TMP_O/perf 253test_default_O = test -x $$TMP_O/perf
@@ -247,12 +267,12 @@ endif
247 267
248MAKEFLAGS := --no-print-directory 268MAKEFLAGS := --no-print-directory
249 269
250clean := @(cd $(PERF); make -s -f $(MK) clean >/dev/null) 270clean := @(cd $(PERF); make -s -f $(MK) $(O_OPT) clean >/dev/null)
251 271
252$(run): 272$(run):
253 $(call clean) 273 $(call clean)
254 @TMP_DEST=$$(mktemp -d); \ 274 @TMP_DEST=$$(mktemp -d); \
255 cmd="cd $(PERF) && make -f $(MK) DESTDIR=$$TMP_DEST $($@)"; \ 275 cmd="cd $(PERF) && make -f $(MK) $(PARALLEL_OPT) $(O_OPT) DESTDIR=$$TMP_DEST $($@)"; \
256 echo "- $@: $$cmd" && echo $$cmd > $@ && \ 276 echo "- $@: $$cmd" && echo $$cmd > $@ && \
257 ( eval $$cmd ) >> $@ 2>&1; \ 277 ( eval $$cmd ) >> $@ 2>&1; \
258 echo " test: $(call test,$@)" >> $@ 2>&1; \ 278 echo " test: $(call test,$@)" >> $@ 2>&1; \
@@ -263,7 +283,7 @@ $(run_O):
263 $(call clean) 283 $(call clean)
264 @TMP_O=$$(mktemp -d); \ 284 @TMP_O=$$(mktemp -d); \
265 TMP_DEST=$$(mktemp -d); \ 285 TMP_DEST=$$(mktemp -d); \
266 cmd="cd $(PERF) && make -f $(MK) O=$$TMP_O DESTDIR=$$TMP_DEST $($(patsubst %_O,%,$@))"; \ 286 cmd="cd $(PERF) && make -f $(MK) $(PARALLEL_OPT) O=$$TMP_O DESTDIR=$$TMP_DEST $($(patsubst %_O,%,$@))"; \
267 echo "- $@: $$cmd" && echo $$cmd > $@ && \ 287 echo "- $@: $$cmd" && echo $$cmd > $@ && \
268 ( eval $$cmd ) >> $@ 2>&1 && \ 288 ( eval $$cmd ) >> $@ 2>&1 && \
269 echo " test: $(call test_O,$@)" >> $@ 2>&1; \ 289 echo " test: $(call test_O,$@)" >> $@ 2>&1; \
@@ -276,17 +296,22 @@ tarpkg:
276 ( eval $$cmd ) >> $@ 2>&1 && \ 296 ( eval $$cmd ) >> $@ 2>&1 && \
277 rm -f $@ 297 rm -f $@
278 298
299KERNEL_O := ../..
300ifneq ($(O),)
301 KERNEL_O := $(O)
302endif
303
279make_kernelsrc: 304make_kernelsrc:
280 @echo "- make -C <kernelsrc> tools/perf" 305 @echo "- make -C <kernelsrc> $(PARALLEL_OPT) $(K_O_OPT) tools/perf"
281 $(call clean); \ 306 $(call clean); \
282 (make -C ../.. tools/perf) > $@ 2>&1 && \ 307 (make -C ../.. $(PARALLEL_OPT) $(K_O_OPT) tools/perf) > $@ 2>&1 && \
283 test -x perf && rm -f $@ || (cat $@ ; false) 308 test -x $(KERNEL_O)/tools/perf/perf && rm -f $@ || (cat $@ ; false)
284 309
285make_kernelsrc_tools: 310make_kernelsrc_tools:
286 @echo "- make -C <kernelsrc>/tools perf" 311 @echo "- make -C <kernelsrc>/tools $(PARALLEL_OPT) $(K_O_OPT) perf"
287 $(call clean); \ 312 $(call clean); \
288 (make -C ../../tools perf) > $@ 2>&1 && \ 313 (make -C ../../tools $(PARALLEL_OPT) $(K_O_OPT) perf) > $@ 2>&1 && \
289 test -x perf && rm -f $@ || (cat $@ ; false) 314 test -x $(KERNEL_O)/tools/perf/perf && rm -f $@ || (cat $@ ; false)
290 315
291all: $(run) $(run_O) tarpkg make_kernelsrc make_kernelsrc_tools 316all: $(run) $(run_O) tarpkg make_kernelsrc make_kernelsrc_tools
292 @echo OK 317 @echo OK
diff --git a/tools/perf/ui/browsers/annotate.c b/tools/perf/ui/browsers/annotate.c
index d4d7cc27252f..718bd46d47fa 100644
--- a/tools/perf/ui/browsers/annotate.c
+++ b/tools/perf/ui/browsers/annotate.c
@@ -755,11 +755,11 @@ static int annotate_browser__run(struct annotate_browser *browser,
755 nd = browser->curr_hot; 755 nd = browser->curr_hot;
756 break; 756 break;
757 case K_UNTAB: 757 case K_UNTAB:
758 if (nd != NULL) 758 if (nd != NULL) {
759 nd = rb_next(nd); 759 nd = rb_next(nd);
760 if (nd == NULL) 760 if (nd == NULL)
761 nd = rb_first(&browser->entries); 761 nd = rb_first(&browser->entries);
762 else 762 } else
763 nd = browser->curr_hot; 763 nd = browser->curr_hot;
764 break; 764 break;
765 case K_F1: 765 case K_F1:
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index c226303e3da0..68a7612019dc 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -131,6 +131,8 @@ void hists__calc_col_len(struct hists *hists, struct hist_entry *h)
131 symlen = unresolved_col_width + 4 + 2; 131 symlen = unresolved_col_width + 4 + 2;
132 hists__new_col_len(hists, HISTC_MEM_DADDR_SYMBOL, 132 hists__new_col_len(hists, HISTC_MEM_DADDR_SYMBOL,
133 symlen); 133 symlen);
134 hists__new_col_len(hists, HISTC_MEM_DCACHELINE,
135 symlen);
134 } 136 }
135 137
136 if (h->mem_info->iaddr.sym) { 138 if (h->mem_info->iaddr.sym) {
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index d5636ba94b20..40b7a0d0905b 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -1149,7 +1149,7 @@ static struct machine *machines__find_for_cpumode(struct machines *machines,
1149 1149
1150 machine = machines__find(machines, pid); 1150 machine = machines__find(machines, pid);
1151 if (!machine) 1151 if (!machine)
1152 machine = machines__find(machines, DEFAULT_GUEST_KERNEL_ID); 1152 machine = machines__findnew(machines, DEFAULT_GUEST_KERNEL_ID);
1153 return machine; 1153 return machine;
1154 } 1154 }
1155 1155
diff --git a/tools/perf/util/stat.c b/tools/perf/util/stat.c
index 2f901d15e063..2b58edccd56f 100644
--- a/tools/perf/util/stat.c
+++ b/tools/perf/util/stat.c
@@ -310,7 +310,6 @@ int perf_stat_process_counter(struct perf_stat_config *config,
310 int i, ret; 310 int i, ret;
311 311
312 aggr->val = aggr->ena = aggr->run = 0; 312 aggr->val = aggr->ena = aggr->run = 0;
313 init_stats(ps->res_stats);
314 313
315 if (counter->per_pkg) 314 if (counter->per_pkg)
316 zero_per_pkg(counter); 315 zero_per_pkg(counter);
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 3b2de6eb3376..ab02209a7cf3 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -1466,7 +1466,7 @@ int dso__load(struct dso *dso, struct map *map, symbol_filter_t filter)
1466 * Read the build id if possible. This is required for 1466 * Read the build id if possible. This is required for
1467 * DSO_BINARY_TYPE__BUILDID_DEBUGINFO to work 1467 * DSO_BINARY_TYPE__BUILDID_DEBUGINFO to work
1468 */ 1468 */
1469 if (filename__read_build_id(dso->name, build_id, BUILD_ID_SIZE) > 0) 1469 if (filename__read_build_id(dso->long_name, build_id, BUILD_ID_SIZE) > 0)
1470 dso__set_build_id(dso, build_id); 1470 dso__set_build_id(dso, build_id);
1471 1471
1472 /* 1472 /*