Skip to content

Commit 2a07d81

Browse files
Alexey Budankovacmel
authored andcommitted
tools build feature: Check if libaio is available
This will be used by 'perf record' to speed up reading the perf ring buffer. Committer testing: $ make -C tools/perf O=/tmp/build/perf make: Entering directory '/home/acme/git/perf/tools/perf' BUILD: Doing 'make -j8' parallel build Auto-detecting system features: ... dwarf: [ on ] ... dwarf_getlocations: [ on ] ... glibc: [ on ] ... gtk2: [ OFF ] ... libaudit: [ OFF ] ... libbfd: [ OFF ] ... libelf: [ on ] ... libnuma: [ OFF ] ... numa_num_possible_cpus: [ OFF ] ... libperl: [ OFF ] ... libpython: [ OFF ] ... libslang: [ on ] ... libcrypto: [ on ] ... libunwind: [ on ] ... libdw-dwarf-unwind: [ on ] ... zlib: [ on ] ... lzma: [ on ] ... get_cpuid: [ on ] ... bpf: [ on ] ... libaio: [ on ] $ ls -la /tmp/build/perf/feature/test-libaio.* -rwxrwxr-x. 1 acme acme 18296 Nov 26 08:49 /tmp/build/perf/feature/test-libaio.bin -rw-rw-r--. 1 acme acme 1165 Nov 26 08:49 /tmp/build/perf/feature/test-libaio.d -rw-rw-r--. 1 acme acme 0 Nov 26 08:49 /tmp/build/perf/feature/test-libaio.make.output $ $ grep -i aio /tmp/build/perf/FEATURE-DUMP feature-libaio=1 $ Signed-off-by: Alexey Budankov <alexey.budankov@linux.intel.com> Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com> Reviewed-by: Jiri Olsa <jolsa@redhat.com> Acked-by: Namhyung Kim <namhyung@kernel.org> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/5fcda10c-6c63-68df-383a-c6d9e5d1f918@linux.intel.com [ split from a larger patch ] Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent 1c6f709 commit 2a07d81

6 files changed

Lines changed: 42 additions & 4 deletions

File tree

‎tools/build/Makefile.feature‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ FEATURE_TESTS_BASIC := \
7070
sched_getcpu \
7171
sdt \
7272
setns \
73-
libopencsd
73+
libopencsd \
74+
libaio
7475

7576
# FEATURE_TESTS_BASIC + FEATURE_TESTS_EXTRA is the complete list
7677
# of all feature tests
@@ -116,7 +117,8 @@ FEATURE_DISPLAY ?= \
116117
zlib \
117118
lzma \
118119
get_cpuid \
119-
bpf
120+
bpf \
121+
libaio
120122

121123
# Set FEATURE_CHECK_(C|LD)FLAGS-all for all FEATURE_TESTS features.
122124
# If in the future we need per-feature checks/flags for features not

‎tools/build/feature/Makefile‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ FILES= \
6161
test-libopencsd.bin \
6262
test-clang.bin \
6363
test-llvm.bin \
64-
test-llvm-version.bin
64+
test-llvm-version.bin \
65+
test-libaio.bin
6566

6667
FILES := $(addprefix $(OUTPUT),$(FILES))
6768

@@ -297,6 +298,9 @@ $(OUTPUT)test-clang.bin:
297298

298299
-include $(OUTPUT)*.d
299300

301+
$(OUTPUT)test-libaio.bin:
302+
$(BUILD) -lrt
303+
300304
###############################
301305

302306
clean:

‎tools/build/feature/test-all.c‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,10 @@
174174
# include "test-libopencsd.c"
175175
#undef main
176176

177+
#define main main_test_libaio
178+
# include "test-libaio.c"
179+
#undef main
180+
177181
int main(int argc, char *argv[])
178182
{
179183
main_test_libpython();
@@ -214,6 +218,7 @@ int main(int argc, char *argv[])
214218
main_test_sdt();
215219
main_test_setns();
216220
main_test_libopencsd();
221+
main_test_libaio();
217222

218223
return 0;
219224
}

‎tools/build/feature/test-libaio.c‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// SPDX-License-Identifier: GPL-2.0
2+
#include <aio.h>
3+
4+
int main(void)
5+
{
6+
struct aiocb aiocb;
7+
8+
aiocb.aio_fildes = 0;
9+
aiocb.aio_offset = 0;
10+
aiocb.aio_buf = 0;
11+
aiocb.aio_nbytes = 0;
12+
aiocb.aio_reqprio = 0;
13+
aiocb.aio_sigevent.sigev_notify = 1 /*SIGEV_NONE*/;
14+
15+
return (int)aio_return(&aiocb);
16+
}

‎tools/perf/Makefile.config‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,12 @@ ifeq ($(feature-glibc), 1)
365365
CFLAGS += -DHAVE_GLIBC_SUPPORT
366366
endif
367367

368+
ifeq ($(feature-libaio), 1)
369+
ifndef NO_AIO
370+
CFLAGS += -DHAVE_AIO_SUPPORT
371+
endif
372+
endif
373+
368374
ifdef NO_DWARF
369375
NO_LIBDW_DWARF_UNWIND := 1
370376
endif

‎tools/perf/Makefile.perf‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,13 @@ include ../scripts/utilities.mak
101101
# Define LIBCLANGLLVM if you DO want builtin clang and llvm support.
102102
# When selected, pass LLVM_CONFIG=/path/to/llvm-config to `make' if
103103
# llvm-config is not in $PATH.
104-
104+
#
105105
# Define NO_CORESIGHT if you do not want support for CoreSight trace decoding.
106+
#
107+
# Define NO_AIO if you do not want support of Posix AIO based trace
108+
# streaming for record mode. Currently Posix AIO trace streaming is
109+
# supported only when linking with glibc.
110+
#
106111

107112
# As per kernel Makefile, avoid funny character set dependencies
108113
unexport LC_ALL

0 commit comments

Comments
 (0)