aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@kernel.org>2015-02-20 17:16:58 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2015-02-25 10:42:24 -0500
commit53d0a57343949b2af9b27229db534b98e5a0c4d0 (patch)
tree185d1091b60ab88279015e0003222201ff013fc0
parent85c273d2b6569706762cf400079ca0699e007d81 (diff)
perf tools: Add feature check for libbabeltrace
Adding feature check for babeltrace library [1], which will be used for perf data file CTF [2] conversion in following patches. The babeltrace library is now automatically detected as standard feature. It's possible to specify LIBBABELTRACE_DIR make variable to specify location of installed libbabeltrace, like: $ make LIBBABELTRACE_DIR=/opt/libbabeltrace/ BUILD: Doing 'make -j4' parallel build Auto-detecting system features: ... dwarf: [ on ] ... glibc: [ on ] ... gtk2: [ on ] ... libaudit: [ on ] ... libbfd: [ on ] ... libelf: [ on ] ... libnuma: [ on ] ... libperl: [ on ] ... libpython: [ on ] ... libslang: [ on ] ... libunwind: [ on ] ... libbabeltrace: [ on ] ... libdw-dwarf-unwind: [ on ] ... zlib: [ on ] ... DWARF post unwind library: libunwind NOTE The installation of the [1] to to used by above make: $ git clone git://git.efficios.com/babeltrace.git $ cd babeltrace $ vim README $ ./bootstrap $ ./configure --prefix=/opt/libbabeltrace $ make prefix=/opt/libbabeltrace $ sudo make install prefix=/opt/libbabeltrace Please make sure that the /opt/libbabeltrace/lib directory is in your LD_LIBRARY_PATH: $ export LD_LIBRARY_PATH=/opt/libbabeltrace/lib [1] babeltrace - http://www.efficios.com/babeltrace [2] Common Trace Format - http://www.efficios.com/ctf Signed-off-by: Jiri Olsa <jolsa@kernel.org> Acked-by: Namhyung Kim <namhyung@kernel.org> Reviewed-by: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Jeremie Galarneau <jgalar@efficios.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Cc: Tom Zanussi <tzanussi@gmail.com> Cc: Wang Nan <wangnan0@huawei.com> Link: http://lkml.kernel.org/r/1424470628-5969-2-git-send-email-jolsa@kernel.org Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> [ Added missing babeltrace build instructions ] Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r--tools/perf/Makefile.perf4
-rw-r--r--tools/perf/config/Makefile24
-rw-r--r--tools/perf/config/feature-checks/Makefile8
-rw-r--r--tools/perf/config/feature-checks/test-all.c5
-rw-r--r--tools/perf/config/feature-checks/test-libbabeltrace.c8
5 files changed, 46 insertions, 3 deletions
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index efc5158738f4..ec4c063ed9f3 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -68,7 +68,9 @@ include config/utilities.mak
68# for reading the x32 mode 32-bit compatibility VDSO in 64-bit mode 68# for reading the x32 mode 32-bit compatibility VDSO in 64-bit mode
69# 69#
70# Define NO_ZLIB if you do not want to support compressed kernel modules 70# Define NO_ZLIB if you do not want to support compressed kernel modules
71 71#
72# Define NO_LIBBABELTRACE if you do not want libbabeltrace support
73# for CTF data format.
72 74
73ifeq ($(srctree),) 75ifeq ($(srctree),)
74srctree := $(patsubst %/,%,$(dir $(shell pwd))) 76srctree := $(patsubst %/,%,$(dir $(shell pwd)))
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index b97a7b903a23..6f129b0a9c64 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -96,6 +96,17 @@ ifndef NO_LIBELF
96 FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind := $(LIBDW_LDFLAGS) -ldw 96 FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind := $(LIBDW_LDFLAGS) -ldw
97endif 97endif
98 98
99ifndef NO_LIBBABELTRACE
100 # for linking with debug library, run like:
101 # make DEBUG=1 LIBBABELTRACE_DIR=/opt/libbabeltrace/
102 ifdef LIBBABELTRACE_DIR
103 LIBBABELTRACE_CFLAGS := -I$(LIBBABELTRACE_DIR)/include
104 LIBBABELTRACE_LDFLAGS := -L$(LIBBABELTRACE_DIR)/lib
105 endif
106 FEATURE_CHECK_CFLAGS-libbabeltrace := $(LIBBABELTRACE_CFLAGS)
107 FEATURE_CHECK_LDFLAGS-libbabeltrace := $(LIBBABELTRACE_LDFLAGS) -lbabeltrace-ctf
108endif
109
99# include ARCH specific config 110# include ARCH specific config
100-include $(src-perf)/arch/$(ARCH)/Makefile 111-include $(src-perf)/arch/$(ARCH)/Makefile
101 112
@@ -216,6 +227,7 @@ CORE_FEATURE_TESTS = \
216 stackprotector-all \ 227 stackprotector-all \
217 timerfd \ 228 timerfd \
218 libdw-dwarf-unwind \ 229 libdw-dwarf-unwind \
230 libbabeltrace \
219 zlib 231 zlib
220 232
221LIB_FEATURE_TESTS = \ 233LIB_FEATURE_TESTS = \
@@ -231,6 +243,7 @@ LIB_FEATURE_TESTS = \
231 libslang \ 243 libslang \
232 libunwind \ 244 libunwind \
233 libdw-dwarf-unwind \ 245 libdw-dwarf-unwind \
246 libbabeltrace \
234 zlib 247 zlib
235 248
236VF_FEATURE_TESTS = \ 249VF_FEATURE_TESTS = \
@@ -692,6 +705,17 @@ else
692 NO_PERF_READ_VDSOX32 := 1 705 NO_PERF_READ_VDSOX32 := 1
693endif 706endif
694 707
708ifndef NO_LIBBABELTRACE
709 ifeq ($(feature-libbabeltrace), 0)
710 msg := $(warning No libbabeltrace found, disables 'perf data' CTF format support, please install libbabeltrace-devel/libbabeltrace-ctf-dev);
711 NO_LIBBABELTRACE := 1
712 else
713 CFLAGS += -DHAVE_LIBBABELTRACE_SUPPORT $(LIBBABELTRACE_CFLAGS)
714 LDFLAGS += $(LIBBABELTRACE_LDFLAGS)
715 EXTLIBS += -lbabeltrace-ctf
716 endif
717endif
718
695# Among the variables below, these: 719# Among the variables below, these:
696# perfexecdir 720# perfexecdir
697# template_dir 721# template_dir
diff --git a/tools/perf/config/feature-checks/Makefile b/tools/perf/config/feature-checks/Makefile
index b32ff3372514..70c9aebe9da3 100644
--- a/tools/perf/config/feature-checks/Makefile
+++ b/tools/perf/config/feature-checks/Makefile
@@ -29,6 +29,7 @@ FILES= \
29 test-stackprotector-all.bin \ 29 test-stackprotector-all.bin \
30 test-timerfd.bin \ 30 test-timerfd.bin \
31 test-libdw-dwarf-unwind.bin \ 31 test-libdw-dwarf-unwind.bin \
32 test-libbabeltrace.bin \
32 test-compile-32.bin \ 33 test-compile-32.bin \
33 test-compile-x32.bin \ 34 test-compile-x32.bin \
34 test-zlib.bin 35 test-zlib.bin
@@ -43,7 +44,7 @@ BUILD = $(CC) $(CFLAGS) -o $(OUTPUT)$@ $(patsubst %.bin,%.c,$@) $(LDFLAGS)
43############################### 44###############################
44 45
45test-all.bin: 46test-all.bin:
46 $(BUILD) -Werror -fstack-protector-all -O2 -Werror -D_FORTIFY_SOURCE=2 -ldw -lelf -lnuma -lelf -laudit -I/usr/include/slang -lslang $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null) $(FLAGS_PERL_EMBED) $(FLAGS_PYTHON_EMBED) -DPACKAGE='"perf"' -lbfd -ldl -lz 47 $(BUILD) -Werror -fstack-protector-all -O2 -Werror -D_FORTIFY_SOURCE=2 -ldw -lelf -lnuma -lelf -laudit -I/usr/include/slang -lslang $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null) $(FLAGS_PERL_EMBED) $(FLAGS_PYTHON_EMBED) -DPACKAGE='"perf"' -lbfd -ldl -lz -lbabeltrace
47 48
48test-hello.bin: 49test-hello.bin:
49 $(BUILD) 50 $(BUILD)
@@ -133,7 +134,10 @@ test-timerfd.bin:
133 $(BUILD) 134 $(BUILD)
134 135
135test-libdw-dwarf-unwind.bin: 136test-libdw-dwarf-unwind.bin:
136 $(BUILD) 137 $(BUILD) # -ldw provided by $(FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind)
138
139test-libbabeltrace.bin:
140 $(BUILD) # -lbabeltrace provided by $(FEATURE_CHECK_LDFLAGS-libbabeltrace)
137 141
138test-sync-compare-and-swap.bin: 142test-sync-compare-and-swap.bin:
139 $(BUILD) -Werror 143 $(BUILD) -Werror
diff --git a/tools/perf/config/feature-checks/test-all.c b/tools/perf/config/feature-checks/test-all.c
index 6d4d09323922..1ffc3da5ca10 100644
--- a/tools/perf/config/feature-checks/test-all.c
+++ b/tools/perf/config/feature-checks/test-all.c
@@ -101,6 +101,10 @@
101# include "test-pthread_attr_setaffinity_np.c" 101# include "test-pthread_attr_setaffinity_np.c"
102#undef main 102#undef main
103 103
104#define main main_test_libbabeltrace
105# include "test-libbabeltrace.c"
106#undef main
107
104int main(int argc, char *argv[]) 108int main(int argc, char *argv[])
105{ 109{
106 main_test_libpython(); 110 main_test_libpython();
@@ -126,6 +130,7 @@ int main(int argc, char *argv[])
126 main_test_sync_compare_and_swap(argc, argv); 130 main_test_sync_compare_and_swap(argc, argv);
127 main_test_zlib(); 131 main_test_zlib();
128 main_test_pthread_attr_setaffinity_np(); 132 main_test_pthread_attr_setaffinity_np();
133 main_test_libbabeltrace();
129 134
130 return 0; 135 return 0;
131} 136}
diff --git a/tools/perf/config/feature-checks/test-libbabeltrace.c b/tools/perf/config/feature-checks/test-libbabeltrace.c
new file mode 100644
index 000000000000..3b7dd68a4d52
--- /dev/null
+++ b/tools/perf/config/feature-checks/test-libbabeltrace.c
@@ -0,0 +1,8 @@
1
2#include <babeltrace/ctf-writer/writer.h>
3
4int main(void)
5{
6 bt_ctf_stream_class_get_packet_context_type((void *) 0);
7 return 0;
8}