aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMasami Hiramatsu <mhiramat@kernel.org>2016-07-12 06:05:56 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2016-07-13 22:09:09 -0400
commite26e63be64a108c1fd12020b93b5b447ffe0532b (patch)
tree456d74dd1e29ca602315eaa9a77460146c7e4f96
parent7e9fca51fbf8430e27fb6b29299eda575e3f00cf (diff)
perf build: Add sdt feature detection
This checks whether sys/sdt.h is available or not, which is required for DTRACE_PROBE(). We can disable this feature by passing NO_SDT=1 when building. This flag will be used for SDT test case and further SDT events in perftools. Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org> Cc: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com> Cc: Brendan Gregg <brendan.d.gregg@gmail.com> Cc: Hemant Kumar <hemant@linux.vnet.ibm.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/146831795615.17065.17513820540591053933.stgit@devbox Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r--tools/build/Makefile.feature3
-rw-r--r--tools/build/feature/Makefile6
-rw-r--r--tools/build/feature/test-all.c5
-rw-r--r--tools/build/feature/test-sdt.c7
-rw-r--r--tools/perf/Makefile.perf3
-rw-r--r--tools/perf/config/Makefile10
-rw-r--r--tools/perf/tests/make3
7 files changed, 34 insertions, 3 deletions
diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature
index fe12bee57418..a120c6b755a9 100644
--- a/tools/build/Makefile.feature
+++ b/tools/build/Makefile.feature
@@ -62,7 +62,8 @@ FEATURE_TESTS_BASIC := \
62 zlib \ 62 zlib \
63 lzma \ 63 lzma \
64 get_cpuid \ 64 get_cpuid \
65 bpf 65 bpf \
66 sdt
66 67
67# FEATURE_TESTS_BASIC + FEATURE_TESTS_EXTRA is the complete list 68# FEATURE_TESTS_BASIC + FEATURE_TESTS_EXTRA is the complete list
68# of all feature tests 69# of all feature tests
diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
index d6017c1abdb0..a0b29a311816 100644
--- a/tools/build/feature/Makefile
+++ b/tools/build/feature/Makefile
@@ -45,7 +45,8 @@ FILES= \
45 test-zlib.bin \ 45 test-zlib.bin \
46 test-lzma.bin \ 46 test-lzma.bin \
47 test-bpf.bin \ 47 test-bpf.bin \
48 test-get_cpuid.bin 48 test-get_cpuid.bin \
49 test-sdt.bin
49 50
50FILES := $(addprefix $(OUTPUT),$(FILES)) 51FILES := $(addprefix $(OUTPUT),$(FILES))
51 52
@@ -213,6 +214,9 @@ $(OUTPUT)test-get_cpuid.bin:
213$(OUTPUT)test-bpf.bin: 214$(OUTPUT)test-bpf.bin:
214 $(BUILD) 215 $(BUILD)
215 216
217$(OUTPUT)test-sdt.bin:
218 $(BUILD)
219
216-include $(OUTPUT)*.d 220-include $(OUTPUT)*.d
217 221
218############################### 222###############################
diff --git a/tools/build/feature/test-all.c b/tools/build/feature/test-all.c
index 843aed024a3a..699e43627397 100644
--- a/tools/build/feature/test-all.c
+++ b/tools/build/feature/test-all.c
@@ -145,6 +145,10 @@
145# include "test-libcrypto.c" 145# include "test-libcrypto.c"
146#undef main 146#undef main
147 147
148#define main main_test_sdt
149# include "test-sdt.c"
150#undef main
151
148int main(int argc, char *argv[]) 152int main(int argc, char *argv[])
149{ 153{
150 main_test_libpython(); 154 main_test_libpython();
@@ -178,6 +182,7 @@ int main(int argc, char *argv[])
178 main_test_get_cpuid(); 182 main_test_get_cpuid();
179 main_test_bpf(); 183 main_test_bpf();
180 main_test_libcrypto(); 184 main_test_libcrypto();
185 main_test_sdt();
181 186
182 return 0; 187 return 0;
183} 188}
diff --git a/tools/build/feature/test-sdt.c b/tools/build/feature/test-sdt.c
new file mode 100644
index 000000000000..e4531a6e80ea
--- /dev/null
+++ b/tools/build/feature/test-sdt.c
@@ -0,0 +1,7 @@
1#include <sys/sdt.h>
2
3int main(void)
4{
5 DTRACE_PROBE(provider, name);
6 return 0;
7}
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index feb2c66b110b..a129fbc1ed37 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -81,6 +81,9 @@ include ../scripts/utilities.mak
81# 81#
82# Define NO_LIBBPF if you do not want BPF support 82# Define NO_LIBBPF if you do not want BPF support
83# 83#
84# Define NO_SDT if you do not want to define SDT event in perf tools,
85# note that it doesn't disable SDT scanning support.
86#
84# Define FEATURES_DUMP to provide features detection dump file 87# Define FEATURES_DUMP to provide features detection dump file
85# and bypass the feature detection 88# and bypass the feature detection
86 89
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 5ac428060779..24803c58049a 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -355,6 +355,16 @@ ifndef NO_LIBELF
355 endif # NO_LIBBPF 355 endif # NO_LIBBPF
356endif # NO_LIBELF 356endif # NO_LIBELF
357 357
358ifndef NO_SDT
359 ifneq ($(feature-sdt), 1)
360 msg := $(warning No sys/sdt.h found, no SDT events are defined, please install systemtap-sdt-devel or systemtap-sdt-dev);
361 NO_SDT := 1;
362 else
363 CFLAGS += -DHAVE_SDT_EVENT
364 $(call detected,CONFIG_SDT_EVENT)
365 endif
366endif
367
358ifdef PERF_HAVE_JITDUMP 368ifdef PERF_HAVE_JITDUMP
359 ifndef NO_DWARF 369 ifndef NO_DWARF
360 $(call detected,CONFIG_JITDUMP) 370 $(call detected,CONFIG_JITDUMP)
diff --git a/tools/perf/tests/make b/tools/perf/tests/make
index 51966d92fc82..143f4d549769 100644
--- a/tools/perf/tests/make
+++ b/tools/perf/tests/make
@@ -82,6 +82,7 @@ make_no_auxtrace := NO_AUXTRACE=1
82make_no_libbpf := NO_LIBBPF=1 82make_no_libbpf := NO_LIBBPF=1
83make_no_libcrypto := NO_LIBCRYPTO=1 83make_no_libcrypto := NO_LIBCRYPTO=1
84make_with_babeltrace:= LIBBABELTRACE=1 84make_with_babeltrace:= LIBBABELTRACE=1
85make_no_sdt := NO_SDT=1
85make_tags := tags 86make_tags := tags
86make_cscope := cscope 87make_cscope := cscope
87make_help := help 88make_help := help
@@ -105,7 +106,7 @@ make_minimal := NO_LIBPERL=1 NO_LIBPYTHON=1 NO_NEWT=1 NO_GTK2=1
105make_minimal += NO_DEMANGLE=1 NO_LIBELF=1 NO_LIBUNWIND=1 NO_BACKTRACE=1 106make_minimal += NO_DEMANGLE=1 NO_LIBELF=1 NO_LIBUNWIND=1 NO_BACKTRACE=1
106make_minimal += NO_LIBNUMA=1 NO_LIBAUDIT=1 NO_LIBBIONIC=1 107make_minimal += NO_LIBNUMA=1 NO_LIBAUDIT=1 NO_LIBBIONIC=1
107make_minimal += NO_LIBDW_DWARF_UNWIND=1 NO_AUXTRACE=1 NO_LIBBPF=1 108make_minimal += NO_LIBDW_DWARF_UNWIND=1 NO_AUXTRACE=1 NO_LIBBPF=1
108make_minimal += NO_LIBCRYPTO=1 109make_minimal += NO_LIBCRYPTO=1 NO_SDT=1
109 110
110# $(run) contains all available tests 111# $(run) contains all available tests
111run := make_pure 112run := make_pure