9d9af1007b
- cgroup improvements for 'perf stat', allowing for compact specification of events and cgroups in the command line. - Support per thread topdown metrics in 'perf stat'. - Support sample-read topdown metric group in 'perf record' - Show start of latency in addition to its start in 'perf sched latency'. - Add min, max to 'perf script' futex-contention output, in addition to avg. - Allow usage of 'perf_event_attr->exclusive' attribute via the new ':e' event modifier. - Add 'snapshot' command to 'perf record --control', using it with Intel PT. - Support FIFO file names as alternative options to 'perf record --control'. - Introduce branch history "streams", to compare 'perf record' runs with 'perf diff' based on branch records and report hot streams. - Support PE executable symbol tables using libbfd, to profile, for instance, wine binaries. - Add filter support for option 'perf ftrace -F/--funcs'. - Allow configuring the 'disassembler_style' 'perf annotate' knob via 'perf config' - Update CascadelakeX and SkylakeX JSON vendor events files. - Add support for parsing perchip/percore JSON vendor events. - Add power9 hv_24x7 core level metric events. - Add L2 prefetch, ITLB instruction fetch hits JSON events for AMD zen1. - Enable Family 19h users by matching Zen2 AMD vendor events. - Use debuginfod in 'perf probe' when required debug files not found locally. - Display negative tid in non-sample events in 'perf script'. - Make GTK2 support opt-in - Add build test with GTK+ - Add missing -lzstd to the fast path feature detection - Add scripts to auto generate 'mmap', 'mremap' string<->id tables for use in 'perf trace'. - Show python test script in verbose mode. - Fix uncore metric expressions - Msan uninitialized use fixes. - Use condition variables in 'perf bench numa' - Autodetect python3 binary in systems without python2. - Support md5 build ids in addition to sha1. - Add build id 'perf test' regression test. - Fix printable strings in python3 scripts. - Fix off by ones in 'perf trace' in arches using libaudit. - Fix JSON event code for events referencing std arch events. - Introduce 'perf test' shell script for Arm CoreSight testing. - Add rdtsc() for Arm64 for used in the PERF_RECORD_TIME_CONV metadata event and in 'perf test tsc'. - 'perf c2c' improvements: Add "RMT Load Hit" metric, "Total Stores", fixes and documentation update. - Fix usage of reloc_sym in 'perf probe' when using both kallsyms and debuginfo files. - Do not print 'Metric Groups:' unnecessarily in 'perf list' - Refcounting fixes in the event parsing code. - Add expand cgroup event 'perf test' entry. - Fix out of bounds CPU map access when handling armv8_pmu events in 'perf stat'. - Add build-id injection 'perf bench' benchmark. - Enter namespace when reading build-id in 'perf inject'. - Do not load map/dso when injecting build-id speeding up the 'perf inject' process. - Add --buildid-all option to avoid processing all samples, just the mmap metadata events. - Add feature test to check if libbfd has buildid support - Add 'perf test' entry for PE binary format support. - Fix typos in power8 PMU vendor events JSON files. - Hide libtraceevent non API functions. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Test results: The first ones are container based builds of tools/perf with and without libelf support. Where clang is available, it is also used to build perf with/without libelf, and building with LIBCLANGLLVM=1 (built-in clang) with gcc and clang when clang and its devel libraries are installed. The objtool and samples/bpf/ builds are disabled now that I'm switching from using the sources in a local volume to fetching them from a http server to build it inside the container, to make it easier to build in a container cluster. Those will come back later. Several are cross builds, the ones with -x-ARCH and the android one, and those may not have all the features built, due to lack of multi-arch devel packages, available and being used so far on just a few, like debian:experimental-x-{arm64,mipsel}. The 'perf test' one will perform a variety of tests exercising tools/perf/util/, tools/lib/{bpf,traceevent,etc}, as well as run perf commands with a variety of command line event specifications to then intercept the sys_perf_event syscall to check that the perf_event_attr fields are set up as expected, among a variety of other unit tests. Then there is the 'make -C tools/perf build-test' ones, that build tools/perf/ with a variety of feature sets, exercising the build with an incomplete set of features as well as with a complete one. It is planned to have it run on each of the containers mentioned above, using some container orchestration infrastructure. Get in contact if interested in helping having this in place. $ grep "model name" -m1 /proc/cpuinfo model name: AMD Ryzen 9 3900X 12-Core Processor $ export PERF_TARBALL=http://192.168.122.1/perf/perf-5.9.0-rc7.tar.xz $ dm Thu 15 Oct 2020 01:10:56 PM -03 1 67.40 alpine:3.4 : Ok gcc (Alpine 5.3.0) 5.3.0, clang version 3.8.0 (tags/RELEASE_380/final) 2 69.01 alpine:3.5 : Ok gcc (Alpine 6.2.1) 6.2.1 20160822, clang version 3.8.1 (tags/RELEASE_381/final) 3 70.79 alpine:3.6 : Ok gcc (Alpine 6.3.0) 6.3.0, clang version 4.0.0 (tags/RELEASE_400/final) 4 79.89 alpine:3.7 : Ok gcc (Alpine 6.4.0) 6.4.0, Alpine clang version 5.0.0 (tags/RELEASE_500/final) (based on LLVM 5.0.0) 5 80.88 alpine:3.8 : Ok gcc (Alpine 6.4.0) 6.4.0, Alpine clang version 5.0.1 (tags/RELEASE_501/final) (based on LLVM 5.0.1) 6 83.88 alpine:3.9 : Ok gcc (Alpine 8.3.0) 8.3.0, Alpine clang version 5.0.1 (tags/RELEASE_502/final) (based on LLVM 5.0.1) 7 107.87 alpine:3.10 : Ok gcc (Alpine 8.3.0) 8.3.0, Alpine clang version 8.0.0 (tags/RELEASE_800/final) (based on LLVM 8.0.0) 8 115.43 alpine:3.11 : Ok gcc (Alpine 9.3.0) 9.3.0, Alpine clang version 9.0.0 (https://git.alpinelinux.org/aports f7f0d2c2b8bcd6a5843401a9a702029556492689) (based on LLVM 9.0.0) 9 106.80 alpine:3.12 : Ok gcc (Alpine 9.3.0) 9.3.0, Alpine clang version 10.0.0 (https://gitlab.alpinelinux.org/alpine/aports.git 7445adce501f8473efdb93b17b5eaf2f1445ed4c) 10 114.06 alpine:edge : Ok gcc (Alpine 10.2.0) 10.2.0, Alpine clang version 10.0.1 11 70.42 alt:p8 : Ok x86_64-alt-linux-gcc (GCC) 5.3.1 20151207 (ALT p8 5.3.1-alt3.M80P.1), clang version 3.8.0 (tags/RELEASE_380/final) 12 98.70 alt:p9 : Ok x86_64-alt-linux-gcc (GCC) 8.4.1 20200305 (ALT p9 8.4.1-alt0.p9.1), clang version 10.0.0 13 80.37 alt:sisyphus : Ok x86_64-alt-linux-gcc (GCC) 9.3.1 20200518 (ALT Sisyphus 9.3.1-alt1), clang version 10.0.1 14 64.12 amazonlinux:1 : Ok gcc (GCC) 7.2.1 20170915 (Red Hat 7.2.1-2), clang version 3.6.2 (tags/RELEASE_362/final) 15 97.64 amazonlinux:2 : Ok gcc (GCC) 7.3.1 20180712 (Red Hat 7.3.1-9), clang version 7.0.1 (Amazon Linux 2 7.0.1-1.amzn2.0.2) 16 22.70 android-ndk:r12b-arm : Ok arm-linux-androideabi-gcc (GCC) 4.9.x 20150123 (prerelease) 17 22.72 android-ndk:r15c-arm : Ok arm-linux-androideabi-gcc (GCC) 4.9.x 20150123 (prerelease) 18 26.70 centos:6 : Ok gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-23) 19 31.86 centos:7 : Ok gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39) 20 113.19 centos:8 : Ok gcc (GCC) 8.3.1 20191121 (Red Hat 8.3.1-5), clang version 9.0.1 (Red Hat 9.0.1-2.module_el8.2.0+309+0c7b6b03) 21 57.23 clearlinux:latest : Ok gcc (Clear Linux OS for Intel Architecture) 10.2.1 20200908 releases/gcc-10.2.0-203-g127d693955, clang version 10.0.1 22 64.98 debian:8 : Ok gcc (Debian 4.9.2-10+deb8u2) 4.9.2, Debian clang version 3.5.0-10 (tags/RELEASE_350/final) (based on LLVM 3.5.0) 23 76.08 debian:9 : Ok gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516, clang version 3.8.1-24 (tags/RELEASE_381/final) 24 74.49 debian:10 : Ok gcc (Debian 8.3.0-6) 8.3.0, clang version 7.0.1-8+deb10u2 (tags/RELEASE_701/final) 25 78.50 debian:experimental : Ok gcc (Debian 10.2.0-15) 10.2.0, Debian clang version 11.0.0-2 26 33.30 debian:experimental-x-arm64 : Ok aarch64-linux-gnu-gcc (Debian 10.2.0-3) 10.2.0 27 30.96 debian:experimental-x-mips64 : Ok mips64-linux-gnuabi64-gcc (Debian 9.3.0-8) 9.3.0 28 32.63 debian:experimental-x-mipsel : Ok mipsel-linux-gnu-gcc (Debian 9.3.0-8) 9.3.0 29 30.12 fedora:20 : Ok gcc (GCC) 4.8.3 20140911 (Red Hat 4.8.3-7) 30 30.99 fedora:22 : Ok gcc (GCC) 5.3.1 20160406 (Red Hat 5.3.1-6), clang version 3.5.0 (tags/RELEASE_350/final) 31 68.60 fedora:23 : Ok gcc (GCC) 5.3.1 20160406 (Red Hat 5.3.1-6), clang version 3.7.0 (tags/RELEASE_370/final) 32 78.92 fedora:24 : Ok gcc (GCC) 6.3.1 20161221 (Red Hat 6.3.1-1), clang version 3.8.1 (tags/RELEASE_381/final) 33 26.15 fedora:24-x-ARC-uClibc : Ok arc-linux-gcc (ARCompact ISA Linux uClibc toolchain 2017.09-rc2) 7.1.1 20170710 34 80.13 fedora:25 : Ok gcc (GCC) 6.4.1 20170727 (Red Hat 6.4.1-1), clang version 3.9.1 (tags/RELEASE_391/final) 35 90.68 fedora:26 : Ok gcc (GCC) 7.3.1 20180130 (Red Hat 7.3.1-2), clang version 4.0.1 (tags/RELEASE_401/final) 36 90.45 fedora:27 : Ok gcc (GCC) 7.3.1 20180712 (Red Hat 7.3.1-6), clang version 5.0.2 (tags/RELEASE_502/final) 37 100.88 fedora:28 : Ok gcc (GCC) 8.3.1 20190223 (Red Hat 8.3.1-2), clang version 6.0.1 (tags/RELEASE_601/final) 38 105.99 fedora:29 : Ok gcc (GCC) 8.3.1 20190223 (Red Hat 8.3.1-2), clang version 7.0.1 (Fedora 7.0.1-6.fc29) 39 111.05 fedora:30 : Ok gcc (GCC) 9.3.1 20200408 (Red Hat 9.3.1-2), clang version 8.0.0 (Fedora 8.0.0-3.fc30) 40 29.96 fedora:30-x-ARC-glibc : Ok arc-linux-gcc (ARC HS GNU/Linux glibc toolchain 2019.03-rc1) 8.3.1 20190225 41 27.02 fedora:30-x-ARC-uClibc : Ok arc-linux-gcc (ARCv2 ISA Linux uClibc toolchain 2019.03-rc1) 8.3.1 20190225 42 110.47 fedora:31 : Ok gcc (GCC) 9.3.1 20200408 (Red Hat 9.3.1-2), clang version 9.0.1 (Fedora 9.0.1-2.fc31) 43 88.78 fedora:32 : Ok gcc (GCC) 10.2.1 20200723 (Red Hat 10.2.1-1), clang version 10.0.0 (Fedora 10.0.0-2.fc32) 44 15.92 fedora:rawhide : FAIL gcc (GCC) 10.2.1 20200916 (Red Hat 10.2.1-4), clang version 11.0.0 (Fedora 11.0.0-0.4.rc3.fc34) 45 33.58 gentoo-stage3-amd64:latest : Ok gcc (Gentoo 9.3.0-r1 p3) 9.3.0 46 65.32 mageia:5 : Ok gcc (GCC) 4.9.2, clang version 3.5.2 (tags/RELEASE_352/final) 47 81.35 mageia:6 : Ok gcc (Mageia 5.5.0-1.mga6) 5.5.0, clang version 3.9.1 (tags/RELEASE_391/final) 48 103.94 mageia:7 : Ok gcc (Mageia 8.4.0-1.mga7) 8.4.0, clang version 8.0.0 (Mageia 8.0.0-1.mga7) 49 91.62 manjaro:latest : Ok gcc (GCC) 10.2.0, clang version 10.0.1 50 219.87 openmandriva:cooker : Ok gcc (GCC) 10.2.0 20200723 (OpenMandriva), OpenMandriva 11.0.0-0.20200909.1 clang version 11.0.0 (/builddir/build/BUILD/llvm-project-release-11.x/clang 5cb8ffbab42358a7cdb0a67acfadb84df0779579) 51 111.76 opensuse:15.0 : Ok gcc (SUSE Linux) 7.4.1 20190905 [gcc-7-branch revision 275407], clang version 5.0.1 (tags/RELEASE_501/final 312548) 52 118.03 opensuse:15.1 : Ok gcc (SUSE Linux) 7.5.0, clang version 7.0.1 (tags/RELEASE_701/final 349238) 53 107.91 opensuse:15.2 : Ok gcc (SUSE Linux) 7.5.0, clang version 9.0.1 54 102.34 opensuse:tumbleweed : Ok gcc (SUSE Linux) 10.2.1 20200825 [revision c0746a1beb1ba073c7981eb09f55b3d993b32e5c], clang version 10.0.1 55 25.33 oraclelinux:6 : Ok gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-23.0.1) 56 30.45 oraclelinux:7 : Ok gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44.0.3) 57 104.65 oraclelinux:8 : Ok gcc (GCC) 8.3.1 20191121 (Red Hat 8.3.1-5.0.3), clang version 9.0.1 (Red Hat 9.0.1-2.0.1.module+el8.2.0+5599+9ed9ef6d) 58 26.04 ubuntu:12.04 : Ok gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3, Ubuntu clang version 3.0-6ubuntu3 (tags/RELEASE_30/final) (based on LLVM 3.0) 59 29.49 ubuntu:14.04 : Ok gcc (Ubuntu 4.8.4-2ubuntu1~14.04.4) 4.8.4 60 72.95 ubuntu:16.04 : Ok gcc (Ubuntu 5.4.0-6ubuntu1~16.04.12) 5.4.0 20160609, clang version 3.8.0-2ubuntu4 (tags/RELEASE_380/final) 61 26.03 ubuntu:16.04-x-arm : Ok arm-linux-gnueabihf-gcc (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609 62 25.15 ubuntu:16.04-x-arm64 : Ok aarch64-linux-gnu-gcc (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609 63 24.88 ubuntu:16.04-x-powerpc : Ok powerpc-linux-gnu-gcc (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609 64 25.72 ubuntu:16.04-x-powerpc64 : Ok powerpc64-linux-gnu-gcc (Ubuntu/IBM 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609 65 25.39 ubuntu:16.04-x-powerpc64el : Ok powerpc64le-linux-gnu-gcc (Ubuntu/IBM 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609 66 25.34 ubuntu:16.04-x-s390 : Ok s390x-linux-gnu-gcc (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609 67 84.84 ubuntu:18.04 : Ok gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0, clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final) 68 27.15 ubuntu:18.04-x-arm : Ok arm-linux-gnueabihf-gcc (Ubuntu/Linaro 7.5.0-3ubuntu1~18.04) 7.5.0 69 26.68 ubuntu:18.04-x-arm64 : Ok aarch64-linux-gnu-gcc (Ubuntu/Linaro 7.5.0-3ubuntu1~18.04) 7.5.0 70 22.38 ubuntu:18.04-x-m68k : Ok m68k-linux-gnu-gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 71 26.35 ubuntu:18.04-x-powerpc : Ok powerpc-linux-gnu-gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 72 28.58 ubuntu:18.04-x-powerpc64 : Ok powerpc64-linux-gnu-gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 73 28.18 ubuntu:18.04-x-powerpc64el : Ok powerpc64le-linux-gnu-gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 74 178.55 ubuntu:18.04-x-riscv64 : Ok riscv64-linux-gnu-gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 75 24.58 ubuntu:18.04-x-s390 : Ok s390x-linux-gnu-gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 76 26.89 ubuntu:18.04-x-sh4 : Ok sh4-linux-gnu-gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 77 24.81 ubuntu:18.04-x-sparc64 : Ok sparc64-linux-gnu-gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 78 68.90 ubuntu:19.10 : Ok gcc (Ubuntu 9.2.1-9ubuntu2) 9.2.1 20191008, clang version 8.0.1-3build1 (tags/RELEASE_801/final) 79 69.31 ubuntu:20.04 : Ok gcc (Ubuntu 9.3.0-10ubuntu2) 9.3.0, clang version 10.0.0-4ubuntu1 80 30.00 ubuntu:20.04-x-powerpc64el : Ok powerpc64le-linux-gnu-gcc (Ubuntu 10-20200411-0ubuntu1) 10.0.1 20200411 (experimental) [master revision bb87d5cc77d:75961caccb7:f883c46b4877f637e0fa5025b4d6b5c9040ec566] 81 70.34 ubuntu:20.10 : Ok gcc (Ubuntu 10.2.0-5ubuntu2) 10.2.0, Ubuntu clang version 10.0.1-1 $ # uname -a Linux five 5.9.0+ #1 SMP Thu Oct 15 09:06:41 -03 2020 x86_64 x86_64 x86_64 GNU/Linux # git log --oneline -1744aec4df2
perf c2c: Update documentation for metrics reorganization # perf version --build-options perf version 5.9.rc7.g744aec4df2c5 dwarf: [ on ] # HAVE_DWARF_SUPPORT dwarf_getlocations: [ on ] # HAVE_DWARF_GETLOCATIONS_SUPPORT glibc: [ on ] # HAVE_GLIBC_SUPPORT syscall_table: [ on ] # HAVE_SYSCALL_TABLE_SUPPORT libbfd: [ on ] # HAVE_LIBBFD_SUPPORT libelf: [ on ] # HAVE_LIBELF_SUPPORT libnuma: [ on ] # HAVE_LIBNUMA_SUPPORT numa_num_possible_cpus: [ on ] # HAVE_LIBNUMA_SUPPORT libperl: [ on ] # HAVE_LIBPERL_SUPPORT libpython: [ on ] # HAVE_LIBPYTHON_SUPPORT libslang: [ on ] # HAVE_SLANG_SUPPORT libcrypto: [ on ] # HAVE_LIBCRYPTO_SUPPORT libunwind: [ on ] # HAVE_LIBUNWIND_SUPPORT libdw-dwarf-unwind: [ on ] # HAVE_DWARF_SUPPORT zlib: [ on ] # HAVE_ZLIB_SUPPORT lzma: [ on ] # HAVE_LZMA_SUPPORT get_cpuid: [ on ] # HAVE_AUXTRACE_SUPPORT bpf: [ on ] # HAVE_LIBBPF_SUPPORT aio: [ on ] # HAVE_AIO_SUPPORT zstd: [ on ] # HAVE_ZSTD_SUPPORT # perf test 1: vmlinux symtab matches kallsyms : Ok 2: Detect openat syscall event : Ok 3: Detect openat syscall event on all cpus : Ok 4: Read samples using the mmap interface : Ok 5: Test data source output : Ok 6: Parse event definition strings : Ok 7: Simple expression parser : Ok 8: PERF_RECORD_* events & perf_sample fields : Ok 9: Parse perf pmu format : Ok 10: PMU events : 10.1: PMU event table sanity : Ok 10.2: PMU event map aliases : Ok 10.3: Parsing of PMU event table metrics : Ok 10.4: Parsing of PMU event table metrics with fake PMUs : Ok 11: DSO data read : Ok 12: DSO data cache : Ok 13: DSO data reopen : Ok 14: Roundtrip evsel->name : Ok 15: Parse sched tracepoints fields : Ok 16: syscalls:sys_enter_openat event fields : Ok 17: Setup struct perf_event_attr : Ok 18: Match and link multiple hists : Ok 19: 'import perf' in python : Ok 20: Breakpoint overflow signal handler : Ok 21: Breakpoint overflow sampling : Ok 22: Breakpoint accounting : Ok 23: Watchpoint : 23.1: Read Only Watchpoint : Skip 23.2: Write Only Watchpoint : Ok 23.3: Read / Write Watchpoint : Ok 23.4: Modify Watchpoint : Ok 24: Number of exit events of a simple workload : Ok 25: Software clock events period values : Ok 26: Object code reading : Ok 27: Sample parsing : Ok 28: Use a dummy software event to keep tracking : Ok 29: Parse with no sample_id_all bit set : Ok 30: Filter hist entries : Ok 31: Lookup mmap thread : Ok 32: Share thread maps : Ok 33: Sort output of hist entries : Ok 34: Cumulate child hist entries : Ok 35: Track with sched_switch : Ok 36: Filter fds with revents mask in a fdarray : Ok 37: Add fd to a fdarray, making it autogrow : Ok 38: kmod_path__parse : Ok 39: Thread map : Ok 40: LLVM search and compile : 40.1: Basic BPF llvm compile : Ok 40.2: kbuild searching : Ok 40.3: Compile source for BPF prologue generation : Ok 40.4: Compile source for BPF relocation : Ok 41: Session topology : Ok 42: BPF filter : 42.1: Basic BPF filtering : Ok 42.2: BPF pinning : Ok 42.3: BPF prologue generation : Ok 42.4: BPF relocation checker : Ok 43: Synthesize thread map : Ok 44: Remove thread map : Ok 45: Synthesize cpu map : Ok 46: Synthesize stat config : Ok 47: Synthesize stat : Ok 48: Synthesize stat round : Ok 49: Synthesize attr update : Ok 50: Event times : Ok 51: Read backward ring buffer : Ok 52: Print cpu map : Ok 53: Merge cpu map : Ok 54: Probe SDT events : Ok 55: is_printable_array : Ok 56: Print bitmap : Ok 57: perf hooks : Ok 58: builtin clang support : Skip (not compiled in) 59: unit_number__scnprintf : Ok 60: mem2node : Ok 61: time utils : Ok 62: Test jit_write_elf : Ok 63: Test libpfm4 support : Skip (not compiled in) 64: Test api io : Ok 65: maps__merge_in : Ok 66: Demangle Java : Ok 67: Parse and process metrics : Ok 68: PE file support : Ok 69: Event expansion for cgroups : Ok 70: x86 rdpmc : Ok 71: Convert perf time to TSC : Ok 72: DWARF unwind : Ok 73: x86 instruction decoder - new instructions : Ok 74: Intel PT packet decoder : Ok 75: x86 bp modify : Ok 76: probe libc's inet_pton & backtrace it with ping : Ok 77: Check Arm CoreSight trace data recording and synthesized samples: Skip 78: Use vfs_getname probe to get syscall args filenames : Ok 79: Check open filename arg using perf trace + vfs_getname : Ok 80: Zstd perf.data compression/decompression : Ok 81: Add vfs_getname probe to get syscall args filenames : Ok 82: build id cache operations : Ok # $ git log --oneline -1744aec4df2
(HEAD -> perf/core, quaco/perf/core) perf c2c: Update documentation for metrics reorganization $ make -C tools/perf build-test make: Entering directory '/home/acme/git/perf/tools/perf' - tarpkg: ./tests/perf-targz-src-pkg . make_install_bin_O: make install-bin make_static_O: make LDFLAGS=-static NO_PERF_READ_VDSO32=1 NO_PERF_READ_VDSOX32=1 NO_JVMTI=1 make_no_libdw_dwarf_unwind_O: make NO_LIBDW_DWARF_UNWIND=1 make_no_newt_O: make NO_NEWT=1 make_no_libbionic_O: make NO_LIBBIONIC=1 make_no_sdt_O: make NO_SDT=1 make_debug_O: make DEBUG=1 make_perf_o_O: make perf.o make_no_libbpf_O: make NO_LIBBPF=1 make_no_libbpf_DEBUG_O: make NO_LIBBPF=1 DEBUG=1 make_clean_all_O: make clean all make_tags_O: make tags make_with_babeltrace_O: make LIBBABELTRACE=1 make_with_clangllvm_O: make LIBCLANGLLVM=1 make_no_scripts_O: make NO_LIBPYTHON=1 NO_LIBPERL=1 make_no_libelf_O: make NO_LIBELF=1 make_no_libcrypto_O: make NO_LIBCRYPTO=1 make_with_libpfm4_O: make LIBPFM4=1 make_no_libunwind_O: make NO_LIBUNWIND=1 make_util_map_o_O: make util/map.o make_no_slang_O: make NO_SLANG=1 make_with_gtk2_O: make GTK2=1 make_no_ui_O: make NO_NEWT=1 NO_SLANG=1 NO_GTK2=1 make_util_pmu_bison_o_O: make util/pmu-bison.o make_no_backtrace_O: make NO_BACKTRACE=1 make_no_demangle_O: make NO_DEMANGLE=1 make_help_O: make help make_pure_O: make make_no_gtk2_O: make NO_GTK2=1 make_install_prefix_O: make install prefix=/tmp/krava make_no_libnuma_O: make NO_LIBNUMA=1 make_no_libpython_O: make NO_LIBPYTHON=1 make_install_prefix_slash_O: make install prefix=/tmp/krava/ make_no_libaudit_O: make NO_LIBAUDIT=1 make_no_auxtrace_O: make NO_AUXTRACE=1 make_minimal_O: make NO_LIBPERL=1 NO_LIBPYTHON=1 NO_NEWT=1 NO_GTK2=1 NO_DEMANGLE=1 NO_LIBELF=1 NO_LIBUNWIND=1 NO_BACKTRACE=1 NO_LIBNUMA=1 NO_LIBAUDIT=1 NO_LIBBIONIC=1 NO_LIBDW_DWARF_UNWIND=1 NO_AUXTRACE=1 NO_LIBBPF=1 NO_LIBCRYPTO=1 NO_SDT=1 NO_JVMTI=1 NO_LIBZSTD=1 NO_LIBCAP=1 NO_SYSCALL_TABLE=1 make_install_O: make install make_doc_O: make doc make_no_libperl_O: make NO_LIBPERL=1 make_no_syscall_tbl_O: make NO_SYSCALL_TABLE=1 OK make: Leaving directory '/home/acme/git/perf/tools/perf' $ -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQR2GiIUctdOfX2qHhGyPKLppCJ+JwUCX4iuzgAKCRCyPKLppCJ+ J1khAP4iMQMFCMpNsBaL6KLtj3aTOhrooYuhbNL3kajqYVyW/QD8Dws35k6m2+tB tcOMJykFjPkQ4I13zsxKyugeJuUzSQw= =KdSj -----END PGP SIGNATURE----- Merge tag 'perf-tools-for-v5.10-2020-10-15' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux Pull perf tools updates from Arnaldo Carvalho de Melo: - cgroup improvements for 'perf stat', allowing for compact specification of events and cgroups in the command line. - Support per thread topdown metrics in 'perf stat'. - Support sample-read topdown metric group in 'perf record' - Show start of latency in addition to its start in 'perf sched latency'. - Add min, max to 'perf script' futex-contention output, in addition to avg. - Allow usage of 'perf_event_attr->exclusive' attribute via the new ':e' event modifier. - Add 'snapshot' command to 'perf record --control', using it with Intel PT. - Support FIFO file names as alternative options to 'perf record --control'. - Introduce branch history "streams", to compare 'perf record' runs with 'perf diff' based on branch records and report hot streams. - Support PE executable symbol tables using libbfd, to profile, for instance, wine binaries. - Add filter support for option 'perf ftrace -F/--funcs'. - Allow configuring the 'disassembler_style' 'perf annotate' knob via 'perf config' - Update CascadelakeX and SkylakeX JSON vendor events files. - Add support for parsing perchip/percore JSON vendor events. - Add power9 hv_24x7 core level metric events. - Add L2 prefetch, ITLB instruction fetch hits JSON events for AMD zen1. - Enable Family 19h users by matching Zen2 AMD vendor events. - Use debuginfod in 'perf probe' when required debug files not found locally. - Display negative tid in non-sample events in 'perf script'. - Make GTK2 support opt-in - Add build test with GTK+ - Add missing -lzstd to the fast path feature detection - Add scripts to auto generate 'mmap', 'mremap' string<->id tables for use in 'perf trace'. - Show python test script in verbose mode. - Fix uncore metric expressions - Msan uninitialized use fixes. - Use condition variables in 'perf bench numa' - Autodetect python3 binary in systems without python2. - Support md5 build ids in addition to sha1. - Add build id 'perf test' regression test. - Fix printable strings in python3 scripts. - Fix off by ones in 'perf trace' in arches using libaudit. - Fix JSON event code for events referencing std arch events. - Introduce 'perf test' shell script for Arm CoreSight testing. - Add rdtsc() for Arm64 for used in the PERF_RECORD_TIME_CONV metadata event and in 'perf test tsc'. - 'perf c2c' improvements: Add "RMT Load Hit" metric, "Total Stores", fixes and documentation update. - Fix usage of reloc_sym in 'perf probe' when using both kallsyms and debuginfo files. - Do not print 'Metric Groups:' unnecessarily in 'perf list' - Refcounting fixes in the event parsing code. - Add expand cgroup event 'perf test' entry. - Fix out of bounds CPU map access when handling armv8_pmu events in 'perf stat'. - Add build-id injection 'perf bench' benchmark. - Enter namespace when reading build-id in 'perf inject'. - Do not load map/dso when injecting build-id speeding up the 'perf inject' process. - Add --buildid-all option to avoid processing all samples, just the mmap metadata events. - Add feature test to check if libbfd has buildid support - Add 'perf test' entry for PE binary format support. - Fix typos in power8 PMU vendor events JSON files. - Hide libtraceevent non API functions. * tag 'perf-tools-for-v5.10-2020-10-15' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux: (113 commits) perf c2c: Update documentation for metrics reorganization perf c2c: Add metrics "RMT Load Hit" perf c2c: Correct LLC load hit metrics perf c2c: Change header for LLC local hit perf c2c: Use more explicit headers for HITM perf c2c: Change header from "LLC Load Hitm" to "Load Hitm" perf c2c: Organize metrics based on memory hierarchy perf c2c: Display "Total Stores" as a standalone metrics perf c2c: Display the total numbers continuously perf bench: Use condition variables in numa. perf jevents: Fix event code for events referencing std arch events perf diff: Support hot streams comparison perf streams: Report hot streams perf streams: Calculate the sum of total streams hits perf streams: Link stream pair perf streams: Compare two streams perf streams: Get the evsel_streams by evsel_idx perf streams: Introduce branch history "streams" perf intel-pt: Improve PT documentation slightly perf tools: Add support for exclusive groups/events ...
1201 lines
35 KiB
Makefile
1201 lines
35 KiB
Makefile
# SPDX-License-Identifier: GPL-2.0-only
|
|
|
|
ifeq ($(src-perf),)
|
|
src-perf := $(srctree)/tools/perf
|
|
endif
|
|
|
|
ifeq ($(obj-perf),)
|
|
obj-perf := $(OUTPUT)
|
|
endif
|
|
|
|
ifneq ($(obj-perf),)
|
|
obj-perf := $(abspath $(obj-perf))/
|
|
endif
|
|
|
|
$(shell printf "" > $(OUTPUT).config-detected)
|
|
detected = $(shell echo "$(1)=y" >> $(OUTPUT).config-detected)
|
|
detected_var = $(shell echo "$(1)=$($(1))" >> $(OUTPUT).config-detected)
|
|
|
|
CFLAGS := $(EXTRA_CFLAGS) $(filter-out -Wnested-externs,$(EXTRA_WARNINGS))
|
|
|
|
include $(srctree)/tools/scripts/Makefile.arch
|
|
|
|
$(call detected_var,SRCARCH)
|
|
|
|
NO_PERF_REGS := 1
|
|
|
|
ifneq ($(NO_SYSCALL_TABLE),1)
|
|
NO_SYSCALL_TABLE := 1
|
|
|
|
ifeq ($(SRCARCH),x86)
|
|
ifeq (${IS_64_BIT}, 1)
|
|
NO_SYSCALL_TABLE := 0
|
|
endif
|
|
else
|
|
ifeq ($(SRCARCH),$(filter $(SRCARCH),powerpc arm64 s390))
|
|
NO_SYSCALL_TABLE := 0
|
|
endif
|
|
endif
|
|
|
|
ifneq ($(NO_SYSCALL_TABLE),1)
|
|
CFLAGS += -DHAVE_SYSCALL_TABLE_SUPPORT
|
|
endif
|
|
endif
|
|
|
|
# Additional ARCH settings for ppc
|
|
ifeq ($(SRCARCH),powerpc)
|
|
NO_PERF_REGS := 0
|
|
CFLAGS += -I$(OUTPUT)arch/powerpc/include/generated
|
|
LIBUNWIND_LIBS := -lunwind -lunwind-ppc64
|
|
endif
|
|
|
|
# Additional ARCH settings for x86
|
|
ifeq ($(SRCARCH),x86)
|
|
$(call detected,CONFIG_X86)
|
|
ifeq (${IS_64_BIT}, 1)
|
|
CFLAGS += -DHAVE_ARCH_X86_64_SUPPORT -I$(OUTPUT)arch/x86/include/generated
|
|
ARCH_INCLUDE = ../../arch/x86/lib/memcpy_64.S ../../arch/x86/lib/memset_64.S
|
|
LIBUNWIND_LIBS = -lunwind-x86_64 -lunwind -llzma
|
|
$(call detected,CONFIG_X86_64)
|
|
else
|
|
LIBUNWIND_LIBS = -lunwind-x86 -llzma -lunwind
|
|
endif
|
|
NO_PERF_REGS := 0
|
|
endif
|
|
|
|
ifeq ($(SRCARCH),arm)
|
|
NO_PERF_REGS := 0
|
|
LIBUNWIND_LIBS = -lunwind -lunwind-arm
|
|
endif
|
|
|
|
ifeq ($(SRCARCH),arm64)
|
|
NO_PERF_REGS := 0
|
|
CFLAGS += -I$(OUTPUT)arch/arm64/include/generated
|
|
LIBUNWIND_LIBS = -lunwind -lunwind-aarch64
|
|
endif
|
|
|
|
ifeq ($(SRCARCH),riscv)
|
|
NO_PERF_REGS := 0
|
|
endif
|
|
|
|
ifeq ($(SRCARCH),csky)
|
|
NO_PERF_REGS := 0
|
|
endif
|
|
|
|
ifeq ($(ARCH),s390)
|
|
NO_PERF_REGS := 0
|
|
CFLAGS += -fPIC -I$(OUTPUT)arch/s390/include/generated
|
|
endif
|
|
|
|
ifeq ($(NO_PERF_REGS),0)
|
|
$(call detected,CONFIG_PERF_REGS)
|
|
endif
|
|
|
|
# So far there's only x86 and arm libdw unwind support merged in perf.
|
|
# Disable it on all other architectures in case libdw unwind
|
|
# support is detected in system. Add supported architectures
|
|
# to the check.
|
|
ifneq ($(SRCARCH),$(filter $(SRCARCH),x86 arm arm64 powerpc s390 csky riscv))
|
|
NO_LIBDW_DWARF_UNWIND := 1
|
|
endif
|
|
|
|
ifeq ($(LIBUNWIND_LIBS),)
|
|
NO_LIBUNWIND := 1
|
|
endif
|
|
#
|
|
# For linking with debug library, run like:
|
|
#
|
|
# make DEBUG=1 LIBUNWIND_DIR=/opt/libunwind/
|
|
#
|
|
|
|
libunwind_arch_set_flags = $(eval $(libunwind_arch_set_flags_code))
|
|
define libunwind_arch_set_flags_code
|
|
FEATURE_CHECK_CFLAGS-libunwind-$(1) = -I$(LIBUNWIND_DIR)/include
|
|
FEATURE_CHECK_LDFLAGS-libunwind-$(1) = -L$(LIBUNWIND_DIR)/lib
|
|
endef
|
|
|
|
ifdef LIBUNWIND_DIR
|
|
LIBUNWIND_CFLAGS = -I$(LIBUNWIND_DIR)/include
|
|
LIBUNWIND_LDFLAGS = -L$(LIBUNWIND_DIR)/lib
|
|
LIBUNWIND_ARCHS = x86 x86_64 arm aarch64 debug-frame-arm debug-frame-aarch64
|
|
$(foreach libunwind_arch,$(LIBUNWIND_ARCHS),$(call libunwind_arch_set_flags,$(libunwind_arch)))
|
|
endif
|
|
|
|
# Set per-feature check compilation flags
|
|
FEATURE_CHECK_CFLAGS-libunwind = $(LIBUNWIND_CFLAGS)
|
|
FEATURE_CHECK_LDFLAGS-libunwind = $(LIBUNWIND_LDFLAGS) $(LIBUNWIND_LIBS)
|
|
FEATURE_CHECK_CFLAGS-libunwind-debug-frame = $(LIBUNWIND_CFLAGS)
|
|
FEATURE_CHECK_LDFLAGS-libunwind-debug-frame = $(LIBUNWIND_LDFLAGS) $(LIBUNWIND_LIBS)
|
|
|
|
FEATURE_CHECK_LDFLAGS-libunwind-arm = -lunwind -lunwind-arm
|
|
FEATURE_CHECK_LDFLAGS-libunwind-aarch64 = -lunwind -lunwind-aarch64
|
|
FEATURE_CHECK_LDFLAGS-libunwind-x86 = -lunwind -llzma -lunwind-x86
|
|
FEATURE_CHECK_LDFLAGS-libunwind-x86_64 = -lunwind -llzma -lunwind-x86_64
|
|
|
|
FEATURE_CHECK_LDFLAGS-libcrypto = -lcrypto
|
|
|
|
ifdef CSINCLUDES
|
|
LIBOPENCSD_CFLAGS := -I$(CSINCLUDES)
|
|
endif
|
|
OPENCSDLIBS := -lopencsd_c_api -lopencsd
|
|
ifdef CSLIBS
|
|
LIBOPENCSD_LDFLAGS := -L$(CSLIBS)
|
|
endif
|
|
FEATURE_CHECK_CFLAGS-libopencsd := $(LIBOPENCSD_CFLAGS)
|
|
FEATURE_CHECK_LDFLAGS-libopencsd := $(LIBOPENCSD_LDFLAGS) $(OPENCSDLIBS)
|
|
|
|
ifeq ($(NO_PERF_REGS),0)
|
|
CFLAGS += -DHAVE_PERF_REGS_SUPPORT
|
|
endif
|
|
|
|
# for linking with debug library, run like:
|
|
# make DEBUG=1 LIBDW_DIR=/opt/libdw/
|
|
ifdef LIBDW_DIR
|
|
LIBDW_CFLAGS := -I$(LIBDW_DIR)/include
|
|
LIBDW_LDFLAGS := -L$(LIBDW_DIR)/lib
|
|
endif
|
|
DWARFLIBS := -ldw
|
|
ifeq ($(findstring -static,${LDFLAGS}),-static)
|
|
DWARFLIBS += -lelf -lebl -ldl -lz -llzma -lbz2
|
|
endif
|
|
FEATURE_CHECK_CFLAGS-libdw-dwarf-unwind := $(LIBDW_CFLAGS)
|
|
FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind := $(LIBDW_LDFLAGS) $(DWARFLIBS)
|
|
|
|
# for linking with debug library, run like:
|
|
# make DEBUG=1 LIBBABELTRACE_DIR=/opt/libbabeltrace/
|
|
ifdef LIBBABELTRACE_DIR
|
|
LIBBABELTRACE_CFLAGS := -I$(LIBBABELTRACE_DIR)/include
|
|
LIBBABELTRACE_LDFLAGS := -L$(LIBBABELTRACE_DIR)/lib
|
|
endif
|
|
FEATURE_CHECK_CFLAGS-libbabeltrace := $(LIBBABELTRACE_CFLAGS)
|
|
FEATURE_CHECK_LDFLAGS-libbabeltrace := $(LIBBABELTRACE_LDFLAGS) -lbabeltrace-ctf
|
|
|
|
ifdef LIBZSTD_DIR
|
|
LIBZSTD_CFLAGS := -I$(LIBZSTD_DIR)/lib
|
|
LIBZSTD_LDFLAGS := -L$(LIBZSTD_DIR)/lib
|
|
endif
|
|
FEATURE_CHECK_CFLAGS-libzstd := $(LIBZSTD_CFLAGS)
|
|
FEATURE_CHECK_LDFLAGS-libzstd := $(LIBZSTD_LDFLAGS)
|
|
|
|
FEATURE_CHECK_CFLAGS-bpf = -I. -I$(srctree)/tools/include -I$(srctree)/tools/arch/$(SRCARCH)/include/uapi -I$(srctree)/tools/include/uapi
|
|
# include ARCH specific config
|
|
-include $(src-perf)/arch/$(SRCARCH)/Makefile
|
|
|
|
ifdef PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET
|
|
CFLAGS += -DHAVE_ARCH_REGS_QUERY_REGISTER_OFFSET
|
|
endif
|
|
|
|
include $(srctree)/tools/scripts/utilities.mak
|
|
|
|
ifeq ($(call get-executable,$(FLEX)),)
|
|
dummy := $(error Error: $(FLEX) is missing on this system, please install it)
|
|
endif
|
|
|
|
ifeq ($(call get-executable,$(BISON)),)
|
|
dummy := $(error Error: $(BISON) is missing on this system, please install it)
|
|
endif
|
|
|
|
# Treat warnings as errors unless directed not to
|
|
ifneq ($(WERROR),0)
|
|
CORE_CFLAGS += -Werror
|
|
CXXFLAGS += -Werror
|
|
endif
|
|
|
|
ifndef DEBUG
|
|
DEBUG := 0
|
|
endif
|
|
|
|
ifeq ($(DEBUG),0)
|
|
ifeq ($(CC_NO_CLANG), 0)
|
|
CORE_CFLAGS += -O3
|
|
else
|
|
CORE_CFLAGS += -O6
|
|
endif
|
|
endif
|
|
|
|
ifdef PARSER_DEBUG
|
|
PARSER_DEBUG_BISON := -t
|
|
PARSER_DEBUG_FLEX := -d
|
|
CFLAGS += -DPARSER_DEBUG
|
|
$(call detected_var,PARSER_DEBUG_BISON)
|
|
$(call detected_var,PARSER_DEBUG_FLEX)
|
|
endif
|
|
|
|
# Try different combinations to accommodate systems that only have
|
|
# python[2][-config] in weird combinations but always preferring
|
|
# python2 and python2-config as per pep-0394. If python2 or python
|
|
# aren't found, then python3 is used.
|
|
PYTHON_AUTO := python
|
|
PYTHON_AUTO := $(if $(call get-executable,python3),python3,$(PYTHON_AUTO))
|
|
PYTHON_AUTO := $(if $(call get-executable,python),python,$(PYTHON_AUTO))
|
|
PYTHON_AUTO := $(if $(call get-executable,python2),python2,$(PYTHON_AUTO))
|
|
override PYTHON := $(call get-executable-or-default,PYTHON,$(PYTHON_AUTO))
|
|
PYTHON_AUTO_CONFIG := \
|
|
$(if $(call get-executable,$(PYTHON)-config),$(PYTHON)-config,python-config)
|
|
override PYTHON_CONFIG := \
|
|
$(call get-executable-or-default,PYTHON_CONFIG,$(PYTHON_AUTO_CONFIG))
|
|
|
|
grep-libs = $(filter -l%,$(1))
|
|
strip-libs = $(filter-out -l%,$(1))
|
|
|
|
PYTHON_CONFIG_SQ := $(call shell-sq,$(PYTHON_CONFIG))
|
|
|
|
# Python 3.8 changed the output of `python-config --ldflags` to not include the
|
|
# '-lpythonX.Y' flag unless '--embed' is also passed. The feature check for
|
|
# libpython fails if that flag is not included in LDFLAGS
|
|
ifeq ($(shell $(PYTHON_CONFIG_SQ) --ldflags --embed 2>&1 1>/dev/null; echo $$?), 0)
|
|
PYTHON_CONFIG_LDFLAGS := --ldflags --embed
|
|
else
|
|
PYTHON_CONFIG_LDFLAGS := --ldflags
|
|
endif
|
|
|
|
ifdef PYTHON_CONFIG
|
|
PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) $(PYTHON_CONFIG_LDFLAGS) 2>/dev/null)
|
|
PYTHON_EMBED_LDFLAGS := $(call strip-libs,$(PYTHON_EMBED_LDOPTS))
|
|
PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS)) -lutil
|
|
PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --includes 2>/dev/null)
|
|
FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS)
|
|
endif
|
|
|
|
FEATURE_CHECK_CFLAGS-libpython := $(PYTHON_EMBED_CCOPTS)
|
|
FEATURE_CHECK_LDFLAGS-libpython := $(PYTHON_EMBED_LDOPTS)
|
|
FEATURE_CHECK_CFLAGS-libpython-version := $(PYTHON_EMBED_CCOPTS)
|
|
FEATURE_CHECK_LDFLAGS-libpython-version := $(PYTHON_EMBED_LDOPTS)
|
|
|
|
FEATURE_CHECK_LDFLAGS-libaio = -lrt
|
|
|
|
FEATURE_CHECK_LDFLAGS-disassembler-four-args = -lbfd -lopcodes -ldl
|
|
|
|
CORE_CFLAGS += -fno-omit-frame-pointer
|
|
CORE_CFLAGS += -ggdb3
|
|
CORE_CFLAGS += -funwind-tables
|
|
CORE_CFLAGS += -Wall
|
|
CORE_CFLAGS += -Wextra
|
|
CORE_CFLAGS += -std=gnu99
|
|
|
|
CXXFLAGS += -std=gnu++11 -fno-exceptions -fno-rtti
|
|
CXXFLAGS += -Wall
|
|
CXXFLAGS += -fno-omit-frame-pointer
|
|
CXXFLAGS += -ggdb3
|
|
CXXFLAGS += -funwind-tables
|
|
CXXFLAGS += -Wno-strict-aliasing
|
|
|
|
# Enforce a non-executable stack, as we may regress (again) in the future by
|
|
# adding assembler files missing the .GNU-stack linker note.
|
|
LDFLAGS += -Wl,-z,noexecstack
|
|
|
|
EXTLIBS = -lpthread -lrt -lm -ldl
|
|
|
|
ifneq ($(TCMALLOC),)
|
|
CFLAGS += -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free
|
|
EXTLIBS += -ltcmalloc
|
|
endif
|
|
|
|
ifeq ($(FEATURES_DUMP),)
|
|
include $(srctree)/tools/build/Makefile.feature
|
|
else
|
|
include $(FEATURES_DUMP)
|
|
endif
|
|
|
|
ifeq ($(feature-stackprotector-all), 1)
|
|
CORE_CFLAGS += -fstack-protector-all
|
|
endif
|
|
|
|
ifeq ($(DEBUG),0)
|
|
ifeq ($(feature-fortify-source), 1)
|
|
CORE_CFLAGS += -D_FORTIFY_SOURCE=2
|
|
endif
|
|
endif
|
|
|
|
INC_FLAGS += -I$(srctree)/tools/lib/perf/include
|
|
INC_FLAGS += -I$(src-perf)/util/include
|
|
INC_FLAGS += -I$(src-perf)/arch/$(SRCARCH)/include
|
|
INC_FLAGS += -I$(srctree)/tools/include/
|
|
INC_FLAGS += -I$(srctree)/tools/arch/$(SRCARCH)/include/uapi
|
|
INC_FLAGS += -I$(srctree)/tools/include/uapi
|
|
INC_FLAGS += -I$(srctree)/tools/arch/$(SRCARCH)/include/
|
|
INC_FLAGS += -I$(srctree)/tools/arch/$(SRCARCH)/
|
|
|
|
# $(obj-perf) for generated common-cmds.h
|
|
# $(obj-perf)/util for generated bison/flex headers
|
|
ifneq ($(OUTPUT),)
|
|
INC_FLAGS += -I$(obj-perf)/util
|
|
INC_FLAGS += -I$(obj-perf)
|
|
endif
|
|
|
|
INC_FLAGS += -I$(src-perf)/util
|
|
INC_FLAGS += -I$(src-perf)
|
|
INC_FLAGS += -I$(srctree)/tools/lib/
|
|
|
|
CORE_CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
|
|
|
|
CFLAGS += $(CORE_CFLAGS) $(INC_FLAGS)
|
|
CXXFLAGS += $(INC_FLAGS)
|
|
|
|
LIBPERF_CFLAGS := $(CORE_CFLAGS) $(EXTRA_CFLAGS)
|
|
|
|
ifeq ($(feature-sync-compare-and-swap), 1)
|
|
CFLAGS += -DHAVE_SYNC_COMPARE_AND_SWAP_SUPPORT
|
|
endif
|
|
|
|
ifeq ($(feature-pthread-attr-setaffinity-np), 1)
|
|
CFLAGS += -DHAVE_PTHREAD_ATTR_SETAFFINITY_NP
|
|
endif
|
|
|
|
ifeq ($(feature-pthread-barrier), 1)
|
|
CFLAGS += -DHAVE_PTHREAD_BARRIER
|
|
endif
|
|
|
|
ifndef NO_BIONIC
|
|
$(call feature_check,bionic)
|
|
ifeq ($(feature-bionic), 1)
|
|
BIONIC := 1
|
|
CFLAGS += -DLACKS_SIGQUEUE_PROTOTYPE
|
|
CFLAGS += -DLACKS_OPEN_MEMSTREAM_PROTOTYPE
|
|
EXTLIBS := $(filter-out -lrt,$(EXTLIBS))
|
|
EXTLIBS := $(filter-out -lpthread,$(EXTLIBS))
|
|
endif
|
|
endif
|
|
|
|
ifeq ($(feature-eventfd), 1)
|
|
CFLAGS += -DHAVE_EVENTFD_SUPPORT
|
|
endif
|
|
|
|
ifeq ($(feature-get_current_dir_name), 1)
|
|
CFLAGS += -DHAVE_GET_CURRENT_DIR_NAME
|
|
endif
|
|
|
|
ifeq ($(feature-gettid), 1)
|
|
CFLAGS += -DHAVE_GETTID
|
|
endif
|
|
|
|
ifeq ($(feature-file-handle), 1)
|
|
CFLAGS += -DHAVE_FILE_HANDLE
|
|
endif
|
|
|
|
ifdef NO_LIBELF
|
|
NO_DWARF := 1
|
|
NO_DEMANGLE := 1
|
|
NO_LIBUNWIND := 1
|
|
NO_LIBDW_DWARF_UNWIND := 1
|
|
NO_LIBBPF := 1
|
|
NO_JVMTI := 1
|
|
else
|
|
ifeq ($(feature-libelf), 0)
|
|
ifeq ($(feature-glibc), 1)
|
|
LIBC_SUPPORT := 1
|
|
endif
|
|
ifeq ($(BIONIC),1)
|
|
LIBC_SUPPORT := 1
|
|
endif
|
|
ifeq ($(LIBC_SUPPORT),1)
|
|
msg := $(warning No libelf found. Disables 'probe' tool, jvmti and BPF support in 'perf record'. Please install libelf-dev, libelf-devel or elfutils-libelf-devel);
|
|
|
|
NO_LIBELF := 1
|
|
NO_DWARF := 1
|
|
NO_DEMANGLE := 1
|
|
NO_LIBUNWIND := 1
|
|
NO_LIBDW_DWARF_UNWIND := 1
|
|
NO_LIBBPF := 1
|
|
NO_JVMTI := 1
|
|
else
|
|
ifneq ($(filter s% -fsanitize=address%,$(EXTRA_CFLAGS),),)
|
|
ifneq ($(shell ldconfig -p | grep libasan >/dev/null 2>&1; echo $$?), 0)
|
|
msg := $(error No libasan found, please install libasan);
|
|
endif
|
|
endif
|
|
|
|
ifneq ($(filter s% -fsanitize=undefined%,$(EXTRA_CFLAGS),),)
|
|
ifneq ($(shell ldconfig -p | grep libubsan >/dev/null 2>&1; echo $$?), 0)
|
|
msg := $(error No libubsan found, please install libubsan);
|
|
endif
|
|
endif
|
|
|
|
ifneq ($(filter s% -static%,$(LDFLAGS),),)
|
|
msg := $(error No static glibc found, please install glibc-static);
|
|
else
|
|
msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]);
|
|
endif
|
|
endif
|
|
else
|
|
ifndef NO_LIBDW_DWARF_UNWIND
|
|
ifneq ($(feature-libdw-dwarf-unwind),1)
|
|
NO_LIBDW_DWARF_UNWIND := 1
|
|
msg := $(warning No libdw DWARF unwind found, Please install elfutils-devel/libdw-dev >= 0.158 and/or set LIBDW_DIR);
|
|
endif
|
|
endif
|
|
ifneq ($(feature-dwarf), 1)
|
|
ifndef NO_DWARF
|
|
msg := $(warning No libdw.h found or old libdw.h found or elfutils is older than 0.138, disables dwarf support. Please install new elfutils-devel/libdw-dev);
|
|
NO_DWARF := 1
|
|
endif
|
|
else
|
|
ifneq ($(feature-dwarf_getlocations), 1)
|
|
msg := $(warning Old libdw.h, finding variables at given 'perf probe' point will not work, install elfutils-devel/libdw-dev >= 0.157);
|
|
else
|
|
CFLAGS += -DHAVE_DWARF_GETLOCATIONS_SUPPORT
|
|
endif # dwarf_getlocations
|
|
endif # Dwarf support
|
|
endif # libelf support
|
|
endif # NO_LIBELF
|
|
|
|
ifeq ($(feature-glibc), 1)
|
|
CFLAGS += -DHAVE_GLIBC_SUPPORT
|
|
endif
|
|
|
|
ifeq ($(feature-libaio), 1)
|
|
ifndef NO_AIO
|
|
CFLAGS += -DHAVE_AIO_SUPPORT
|
|
endif
|
|
endif
|
|
|
|
ifdef NO_DWARF
|
|
NO_LIBDW_DWARF_UNWIND := 1
|
|
endif
|
|
|
|
ifeq ($(feature-sched_getcpu), 1)
|
|
CFLAGS += -DHAVE_SCHED_GETCPU_SUPPORT
|
|
endif
|
|
|
|
ifeq ($(feature-setns), 1)
|
|
CFLAGS += -DHAVE_SETNS_SUPPORT
|
|
$(call detected,CONFIG_SETNS)
|
|
endif
|
|
|
|
ifdef CORESIGHT
|
|
$(call feature_check,libopencsd)
|
|
ifeq ($(feature-libopencsd), 1)
|
|
CFLAGS += -DHAVE_CSTRACE_SUPPORT $(LIBOPENCSD_CFLAGS)
|
|
ifeq ($(feature-reallocarray), 0)
|
|
CFLAGS += -DCOMPAT_NEED_REALLOCARRAY
|
|
endif
|
|
LDFLAGS += $(LIBOPENCSD_LDFLAGS)
|
|
EXTLIBS += $(OPENCSDLIBS)
|
|
$(call detected,CONFIG_LIBOPENCSD)
|
|
ifdef CSTRACE_RAW
|
|
CFLAGS += -DCS_DEBUG_RAW
|
|
ifeq (${CSTRACE_RAW}, packed)
|
|
CFLAGS += -DCS_RAW_PACKED
|
|
endif
|
|
endif
|
|
endif
|
|
endif
|
|
|
|
ifndef NO_LIBELF
|
|
CFLAGS += -DHAVE_LIBELF_SUPPORT
|
|
EXTLIBS += -lelf
|
|
$(call detected,CONFIG_LIBELF)
|
|
|
|
ifeq ($(feature-libelf-getphdrnum), 1)
|
|
CFLAGS += -DHAVE_ELF_GETPHDRNUM_SUPPORT
|
|
endif
|
|
|
|
ifeq ($(feature-libelf-gelf_getnote), 1)
|
|
CFLAGS += -DHAVE_GELF_GETNOTE_SUPPORT
|
|
else
|
|
msg := $(warning gelf_getnote() not found on libelf, SDT support disabled);
|
|
endif
|
|
|
|
ifeq ($(feature-libelf-getshdrstrndx), 1)
|
|
CFLAGS += -DHAVE_ELF_GETSHDRSTRNDX_SUPPORT
|
|
endif
|
|
|
|
ifndef NO_LIBDEBUGINFOD
|
|
$(call feature_check,libdebuginfod)
|
|
ifeq ($(feature-libdebuginfod), 1)
|
|
CFLAGS += -DHAVE_DEBUGINFOD_SUPPORT
|
|
EXTLIBS += -ldebuginfod
|
|
endif
|
|
endif
|
|
|
|
ifndef NO_DWARF
|
|
ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined)
|
|
msg := $(warning DWARF register mappings have not been defined for architecture $(SRCARCH), DWARF support disabled);
|
|
NO_DWARF := 1
|
|
else
|
|
CFLAGS += -DHAVE_DWARF_SUPPORT $(LIBDW_CFLAGS)
|
|
LDFLAGS += $(LIBDW_LDFLAGS)
|
|
EXTLIBS += ${DWARFLIBS}
|
|
$(call detected,CONFIG_DWARF)
|
|
endif # PERF_HAVE_DWARF_REGS
|
|
endif # NO_DWARF
|
|
|
|
ifndef NO_LIBBPF
|
|
ifeq ($(feature-bpf), 1)
|
|
CFLAGS += -DHAVE_LIBBPF_SUPPORT
|
|
$(call detected,CONFIG_LIBBPF)
|
|
|
|
# detecting libbpf without LIBBPF_DYNAMIC, so make VF=1 shows libbpf detection status
|
|
$(call feature_check,libbpf)
|
|
ifdef LIBBPF_DYNAMIC
|
|
ifeq ($(feature-libbpf), 1)
|
|
EXTLIBS += -lbpf
|
|
else
|
|
dummy := $(error Error: No libbpf devel library found, please install libbpf-devel);
|
|
endif
|
|
endif
|
|
endif
|
|
|
|
ifndef NO_DWARF
|
|
ifdef PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET
|
|
CFLAGS += -DHAVE_BPF_PROLOGUE
|
|
$(call detected,CONFIG_BPF_PROLOGUE)
|
|
else
|
|
msg := $(warning BPF prologue is not supported by architecture $(SRCARCH), missing regs_query_register_offset());
|
|
endif
|
|
else
|
|
msg := $(warning DWARF support is off, BPF prologue is disabled);
|
|
endif
|
|
|
|
endif # NO_LIBBPF
|
|
endif # NO_LIBELF
|
|
|
|
ifndef NO_SDT
|
|
ifneq ($(feature-sdt), 1)
|
|
msg := $(warning No sys/sdt.h found, no SDT events are defined, please install systemtap-sdt-devel or systemtap-sdt-dev);
|
|
NO_SDT := 1;
|
|
else
|
|
CFLAGS += -DHAVE_SDT_EVENT
|
|
$(call detected,CONFIG_SDT_EVENT)
|
|
endif
|
|
endif
|
|
|
|
ifdef PERF_HAVE_JITDUMP
|
|
ifndef NO_LIBELF
|
|
$(call detected,CONFIG_JITDUMP)
|
|
CFLAGS += -DHAVE_JITDUMP
|
|
endif
|
|
endif
|
|
|
|
ifeq ($(SRCARCH),powerpc)
|
|
ifndef NO_DWARF
|
|
CFLAGS += -DHAVE_SKIP_CALLCHAIN_IDX
|
|
endif
|
|
endif
|
|
|
|
ifndef NO_LIBUNWIND
|
|
have_libunwind :=
|
|
|
|
$(call feature_check,libunwind-x86)
|
|
ifeq ($(feature-libunwind-x86), 1)
|
|
$(call detected,CONFIG_LIBUNWIND_X86)
|
|
CFLAGS += -DHAVE_LIBUNWIND_X86_SUPPORT
|
|
LDFLAGS += -lunwind-x86
|
|
EXTLIBS_LIBUNWIND += -lunwind-x86
|
|
have_libunwind = 1
|
|
endif
|
|
|
|
$(call feature_check,libunwind-aarch64)
|
|
ifeq ($(feature-libunwind-aarch64), 1)
|
|
$(call detected,CONFIG_LIBUNWIND_AARCH64)
|
|
CFLAGS += -DHAVE_LIBUNWIND_AARCH64_SUPPORT
|
|
LDFLAGS += -lunwind-aarch64
|
|
EXTLIBS_LIBUNWIND += -lunwind-aarch64
|
|
have_libunwind = 1
|
|
$(call feature_check,libunwind-debug-frame-aarch64)
|
|
ifneq ($(feature-libunwind-debug-frame-aarch64), 1)
|
|
msg := $(warning No debug_frame support found in libunwind-aarch64);
|
|
CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME_AARCH64
|
|
endif
|
|
endif
|
|
|
|
ifneq ($(feature-libunwind), 1)
|
|
msg := $(warning No libunwind found. Please install libunwind-dev[el] >= 1.1 and/or set LIBUNWIND_DIR);
|
|
NO_LOCAL_LIBUNWIND := 1
|
|
else
|
|
have_libunwind := 1
|
|
$(call detected,CONFIG_LOCAL_LIBUNWIND)
|
|
endif
|
|
|
|
ifneq ($(have_libunwind), 1)
|
|
NO_LIBUNWIND := 1
|
|
endif
|
|
else
|
|
NO_LOCAL_LIBUNWIND := 1
|
|
endif
|
|
|
|
ifndef NO_LIBBPF
|
|
ifneq ($(feature-bpf), 1)
|
|
msg := $(warning BPF API too old. Please install recent kernel headers. BPF support in 'perf record' is disabled.)
|
|
NO_LIBBPF := 1
|
|
endif
|
|
endif
|
|
|
|
dwarf-post-unwind := 1
|
|
dwarf-post-unwind-text := BUG
|
|
|
|
# setup DWARF post unwinder
|
|
ifdef NO_LIBUNWIND
|
|
ifdef NO_LIBDW_DWARF_UNWIND
|
|
msg := $(warning Disabling post unwind, no support found.);
|
|
dwarf-post-unwind := 0
|
|
else
|
|
dwarf-post-unwind-text := libdw
|
|
$(call detected,CONFIG_LIBDW_DWARF_UNWIND)
|
|
endif
|
|
else
|
|
dwarf-post-unwind-text := libunwind
|
|
$(call detected,CONFIG_LIBUNWIND)
|
|
# Enable libunwind support by default.
|
|
ifndef NO_LIBDW_DWARF_UNWIND
|
|
NO_LIBDW_DWARF_UNWIND := 1
|
|
endif
|
|
endif
|
|
|
|
ifeq ($(dwarf-post-unwind),1)
|
|
CFLAGS += -DHAVE_DWARF_UNWIND_SUPPORT
|
|
$(call detected,CONFIG_DWARF_UNWIND)
|
|
else
|
|
NO_DWARF_UNWIND := 1
|
|
endif
|
|
|
|
ifndef NO_LOCAL_LIBUNWIND
|
|
ifeq ($(SRCARCH),$(filter $(SRCARCH),arm arm64))
|
|
$(call feature_check,libunwind-debug-frame)
|
|
ifneq ($(feature-libunwind-debug-frame), 1)
|
|
msg := $(warning No debug_frame support found in libunwind);
|
|
CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME
|
|
endif
|
|
else
|
|
# non-ARM has no dwarf_find_debug_frame() function:
|
|
CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME
|
|
endif
|
|
EXTLIBS += $(LIBUNWIND_LIBS)
|
|
LDFLAGS += $(LIBUNWIND_LIBS)
|
|
endif
|
|
ifeq ($(findstring -static,${LDFLAGS}),-static)
|
|
# gcc -static links libgcc_eh which contans piece of libunwind
|
|
LIBUNWIND_LDFLAGS += -Wl,--allow-multiple-definition
|
|
endif
|
|
|
|
ifndef NO_LIBUNWIND
|
|
CFLAGS += -DHAVE_LIBUNWIND_SUPPORT
|
|
CFLAGS += $(LIBUNWIND_CFLAGS)
|
|
LDFLAGS += $(LIBUNWIND_LDFLAGS)
|
|
EXTLIBS += $(EXTLIBS_LIBUNWIND)
|
|
endif
|
|
|
|
ifeq ($(NO_SYSCALL_TABLE),0)
|
|
$(call detected,CONFIG_TRACE)
|
|
else
|
|
ifndef NO_LIBAUDIT
|
|
$(call feature_check,libaudit)
|
|
ifneq ($(feature-libaudit), 1)
|
|
msg := $(warning No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev);
|
|
NO_LIBAUDIT := 1
|
|
else
|
|
CFLAGS += -DHAVE_LIBAUDIT_SUPPORT
|
|
EXTLIBS += -laudit
|
|
$(call detected,CONFIG_TRACE)
|
|
endif
|
|
endif
|
|
endif
|
|
|
|
ifndef NO_LIBCRYPTO
|
|
ifneq ($(feature-libcrypto), 1)
|
|
msg := $(warning No libcrypto.h found, disables jitted code injection, please install openssl-devel or libssl-dev);
|
|
NO_LIBCRYPTO := 1
|
|
else
|
|
CFLAGS += -DHAVE_LIBCRYPTO_SUPPORT
|
|
EXTLIBS += -lcrypto
|
|
$(call detected,CONFIG_CRYPTO)
|
|
endif
|
|
endif
|
|
|
|
ifdef NO_NEWT
|
|
NO_SLANG=1
|
|
endif
|
|
|
|
ifndef NO_SLANG
|
|
ifneq ($(feature-libslang), 1)
|
|
ifneq ($(feature-libslang-include-subdir), 1)
|
|
msg := $(warning slang not found, disables TUI support. Please install slang-devel, libslang-dev or libslang2-dev);
|
|
NO_SLANG := 1
|
|
else
|
|
CFLAGS += -DHAVE_SLANG_INCLUDE_SUBDIR
|
|
endif
|
|
endif
|
|
ifndef NO_SLANG
|
|
# Fedora has /usr/include/slang/slang.h, but ubuntu /usr/include/slang.h
|
|
CFLAGS += -DHAVE_SLANG_SUPPORT
|
|
EXTLIBS += -lslang
|
|
$(call detected,CONFIG_SLANG)
|
|
endif
|
|
endif
|
|
|
|
ifdef GTK2
|
|
FLAGS_GTK2=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null)
|
|
$(call feature_check,gtk2)
|
|
ifneq ($(feature-gtk2), 1)
|
|
msg := $(warning GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev);
|
|
NO_GTK2 := 1
|
|
else
|
|
$(call feature_check,gtk2-infobar)
|
|
ifeq ($(feature-gtk2-infobar), 1)
|
|
GTK_CFLAGS := -DHAVE_GTK_INFO_BAR_SUPPORT
|
|
endif
|
|
CFLAGS += -DHAVE_GTK2_SUPPORT
|
|
GTK_CFLAGS += $(shell $(PKG_CONFIG) --cflags gtk+-2.0 2>/dev/null)
|
|
GTK_LIBS := $(shell $(PKG_CONFIG) --libs gtk+-2.0 2>/dev/null)
|
|
EXTLIBS += -ldl
|
|
endif
|
|
endif
|
|
|
|
ifdef NO_LIBPERL
|
|
CFLAGS += -DNO_LIBPERL
|
|
else
|
|
PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null)
|
|
PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS))
|
|
PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS))
|
|
PERL_EMBED_CCOPTS = $(shell perl -MExtUtils::Embed -e ccopts 2>/dev/null)
|
|
PERL_EMBED_CCOPTS := $(filter-out -specs=%,$(PERL_EMBED_CCOPTS))
|
|
PERL_EMBED_LDOPTS := $(filter-out -specs=%,$(PERL_EMBED_LDOPTS))
|
|
FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
|
|
|
|
ifneq ($(feature-libperl), 1)
|
|
CFLAGS += -DNO_LIBPERL
|
|
NO_LIBPERL := 1
|
|
msg := $(warning Missing perl devel files. Disabling perl scripting support, please install perl-ExtUtils-Embed/libperl-dev);
|
|
else
|
|
LDFLAGS += $(PERL_EMBED_LDFLAGS)
|
|
EXTLIBS += $(PERL_EMBED_LIBADD)
|
|
CFLAGS += -DHAVE_LIBPERL_SUPPORT
|
|
$(call detected,CONFIG_LIBPERL)
|
|
endif
|
|
endif
|
|
|
|
ifeq ($(feature-timerfd), 1)
|
|
CFLAGS += -DHAVE_TIMERFD_SUPPORT
|
|
else
|
|
msg := $(warning No timerfd support. Disables 'perf kvm stat live');
|
|
endif
|
|
|
|
disable-python = $(eval $(disable-python_code))
|
|
define disable-python_code
|
|
CFLAGS += -DNO_LIBPYTHON
|
|
$(warning $1)
|
|
NO_LIBPYTHON := 1
|
|
endef
|
|
|
|
ifdef NO_LIBPYTHON
|
|
$(call disable-python,Python support disabled by user)
|
|
else
|
|
|
|
ifndef PYTHON
|
|
$(call disable-python,No python interpreter was found: disables Python support - please install python-devel/python-dev)
|
|
else
|
|
PYTHON_WORD := $(call shell-wordify,$(PYTHON))
|
|
|
|
ifndef PYTHON_CONFIG
|
|
$(call disable-python,No 'python-config' tool was found: disables Python support - please install python-devel/python-dev)
|
|
else
|
|
|
|
ifneq ($(feature-libpython), 1)
|
|
$(call disable-python,No 'Python.h' (for Python 2.x support) was found: disables Python support - please install python-devel/python-dev)
|
|
else
|
|
LDFLAGS += $(PYTHON_EMBED_LDFLAGS)
|
|
EXTLIBS += $(PYTHON_EMBED_LIBADD)
|
|
LANG_BINDINGS += $(obj-perf)python/perf.so
|
|
CFLAGS += -DHAVE_LIBPYTHON_SUPPORT
|
|
$(call detected,CONFIG_LIBPYTHON)
|
|
endif
|
|
endif
|
|
endif
|
|
endif
|
|
|
|
ifeq ($(feature-libbfd), 1)
|
|
EXTLIBS += -lbfd -lopcodes
|
|
else
|
|
# we are on a system that requires -liberty and (maybe) -lz
|
|
# to link against -lbfd; test each case individually here
|
|
|
|
# call all detections now so we get correct
|
|
# status in VF output
|
|
$(call feature_check,libbfd-liberty)
|
|
$(call feature_check,libbfd-liberty-z)
|
|
|
|
ifeq ($(feature-libbfd-liberty), 1)
|
|
EXTLIBS += -lbfd -lopcodes -liberty
|
|
FEATURE_CHECK_LDFLAGS-disassembler-four-args += -liberty -ldl
|
|
else
|
|
ifeq ($(feature-libbfd-liberty-z), 1)
|
|
EXTLIBS += -lbfd -lopcodes -liberty -lz
|
|
FEATURE_CHECK_LDFLAGS-disassembler-four-args += -liberty -lz -ldl
|
|
endif
|
|
endif
|
|
$(call feature_check,disassembler-four-args)
|
|
endif
|
|
|
|
ifeq ($(feature-libbfd-buildid), 1)
|
|
CFLAGS += -DHAVE_LIBBFD_BUILDID_SUPPORT
|
|
else
|
|
msg := $(warning Old version of libbfd/binutils things like PE executable profiling will not be available);
|
|
endif
|
|
|
|
ifdef NO_DEMANGLE
|
|
CFLAGS += -DNO_DEMANGLE
|
|
else
|
|
ifdef HAVE_CPLUS_DEMANGLE_SUPPORT
|
|
EXTLIBS += -liberty
|
|
else
|
|
ifeq ($(filter -liberty,$(EXTLIBS)),)
|
|
$(call feature_check,cplus-demangle)
|
|
|
|
# we dont have neither HAVE_CPLUS_DEMANGLE_SUPPORT
|
|
# or any of 'bfd iberty z' trinity
|
|
ifeq ($(feature-cplus-demangle), 1)
|
|
EXTLIBS += -liberty
|
|
else
|
|
msg := $(warning No bfd.h/libbfd found, please install binutils-dev[el]/zlib-static/libiberty-dev to gain symbol demangling)
|
|
CFLAGS += -DNO_DEMANGLE
|
|
endif
|
|
endif
|
|
endif
|
|
|
|
ifneq ($(filter -liberty,$(EXTLIBS)),)
|
|
CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT
|
|
endif
|
|
endif
|
|
|
|
ifneq ($(filter -lbfd,$(EXTLIBS)),)
|
|
CFLAGS += -DHAVE_LIBBFD_SUPPORT
|
|
endif
|
|
|
|
ifndef NO_ZLIB
|
|
ifeq ($(feature-zlib), 1)
|
|
CFLAGS += -DHAVE_ZLIB_SUPPORT
|
|
EXTLIBS += -lz
|
|
$(call detected,CONFIG_ZLIB)
|
|
else
|
|
NO_ZLIB := 1
|
|
endif
|
|
endif
|
|
|
|
ifndef NO_LZMA
|
|
ifeq ($(feature-lzma), 1)
|
|
CFLAGS += -DHAVE_LZMA_SUPPORT
|
|
EXTLIBS += -llzma
|
|
$(call detected,CONFIG_LZMA)
|
|
else
|
|
msg := $(warning No liblzma found, disables xz kernel module decompression, please install xz-devel/liblzma-dev);
|
|
NO_LZMA := 1
|
|
endif
|
|
endif
|
|
|
|
ifndef NO_LIBZSTD
|
|
ifeq ($(feature-libzstd), 1)
|
|
CFLAGS += -DHAVE_ZSTD_SUPPORT
|
|
CFLAGS += $(LIBZSTD_CFLAGS)
|
|
LDFLAGS += $(LIBZSTD_LDFLAGS)
|
|
EXTLIBS += -lzstd
|
|
$(call detected,CONFIG_ZSTD)
|
|
else
|
|
msg := $(warning No libzstd found, disables trace compression, please install libzstd-dev[el] and/or set LIBZSTD_DIR);
|
|
NO_LIBZSTD := 1
|
|
endif
|
|
endif
|
|
|
|
ifndef NO_LIBCAP
|
|
ifeq ($(feature-libcap), 1)
|
|
CFLAGS += -DHAVE_LIBCAP_SUPPORT
|
|
EXTLIBS += -lcap
|
|
$(call detected,CONFIG_LIBCAP)
|
|
else
|
|
msg := $(warning No libcap found, disables capability support, please install libcap-devel/libcap-dev);
|
|
NO_LIBCAP := 1
|
|
endif
|
|
endif
|
|
|
|
ifndef NO_BACKTRACE
|
|
ifeq ($(feature-backtrace), 1)
|
|
CFLAGS += -DHAVE_BACKTRACE_SUPPORT
|
|
endif
|
|
endif
|
|
|
|
ifndef NO_LIBNUMA
|
|
ifeq ($(feature-libnuma), 0)
|
|
msg := $(warning No numa.h found, disables 'perf bench numa mem' benchmark, please install numactl-devel/libnuma-devel/libnuma-dev);
|
|
NO_LIBNUMA := 1
|
|
else
|
|
ifeq ($(feature-numa_num_possible_cpus), 0)
|
|
msg := $(warning Old numa library found, disables 'perf bench numa mem' benchmark, please install numactl-devel/libnuma-devel/libnuma-dev >= 2.0.8);
|
|
NO_LIBNUMA := 1
|
|
else
|
|
CFLAGS += -DHAVE_LIBNUMA_SUPPORT
|
|
EXTLIBS += -lnuma
|
|
$(call detected,CONFIG_NUMA)
|
|
endif
|
|
endif
|
|
endif
|
|
|
|
ifdef HAVE_KVM_STAT_SUPPORT
|
|
CFLAGS += -DHAVE_KVM_STAT_SUPPORT
|
|
endif
|
|
|
|
ifeq ($(feature-disassembler-four-args), 1)
|
|
CFLAGS += -DDISASM_FOUR_ARGS_SIGNATURE
|
|
endif
|
|
|
|
ifeq (${IS_64_BIT}, 1)
|
|
ifndef NO_PERF_READ_VDSO32
|
|
$(call feature_check,compile-32)
|
|
ifeq ($(feature-compile-32), 1)
|
|
CFLAGS += -DHAVE_PERF_READ_VDSO32
|
|
else
|
|
NO_PERF_READ_VDSO32 := 1
|
|
endif
|
|
endif
|
|
ifneq ($(SRCARCH), x86)
|
|
NO_PERF_READ_VDSOX32 := 1
|
|
endif
|
|
ifndef NO_PERF_READ_VDSOX32
|
|
$(call feature_check,compile-x32)
|
|
ifeq ($(feature-compile-x32), 1)
|
|
CFLAGS += -DHAVE_PERF_READ_VDSOX32
|
|
else
|
|
NO_PERF_READ_VDSOX32 := 1
|
|
endif
|
|
endif
|
|
else
|
|
NO_PERF_READ_VDSO32 := 1
|
|
NO_PERF_READ_VDSOX32 := 1
|
|
endif
|
|
|
|
ifndef NO_LIBBABELTRACE
|
|
$(call feature_check,libbabeltrace)
|
|
ifeq ($(feature-libbabeltrace), 1)
|
|
CFLAGS += -DHAVE_LIBBABELTRACE_SUPPORT $(LIBBABELTRACE_CFLAGS)
|
|
LDFLAGS += $(LIBBABELTRACE_LDFLAGS)
|
|
EXTLIBS += -lbabeltrace-ctf
|
|
$(call detected,CONFIG_LIBBABELTRACE)
|
|
else
|
|
msg := $(warning No libbabeltrace found, disables 'perf data' CTF format support, please install libbabeltrace-dev[el]/libbabeltrace-ctf-dev);
|
|
endif
|
|
endif
|
|
|
|
ifndef NO_AUXTRACE
|
|
ifeq ($(SRCARCH),x86)
|
|
ifeq ($(feature-get_cpuid), 0)
|
|
msg := $(warning Your gcc lacks the __get_cpuid() builtin, disables support for auxtrace/Intel PT, please install a newer gcc);
|
|
NO_AUXTRACE := 1
|
|
endif
|
|
endif
|
|
ifndef NO_AUXTRACE
|
|
$(call detected,CONFIG_AUXTRACE)
|
|
CFLAGS += -DHAVE_AUXTRACE_SUPPORT
|
|
endif
|
|
endif
|
|
|
|
ifndef NO_JVMTI
|
|
ifneq (,$(wildcard /usr/sbin/update-java-alternatives))
|
|
JDIR=$(shell /usr/sbin/update-java-alternatives -l | head -1 | awk '{print $$3}')
|
|
else
|
|
ifneq (,$(wildcard /usr/sbin/alternatives))
|
|
JDIR=$(shell /usr/sbin/alternatives --display java | tail -1 | cut -d' ' -f 5 | sed -e 's%/jre/bin/java.%%g' -e 's%/bin/java.%%g')
|
|
endif
|
|
endif
|
|
ifndef JDIR
|
|
$(warning No alternatives command found, you need to set JDIR= to point to the root of your Java directory)
|
|
NO_JVMTI := 1
|
|
endif
|
|
endif
|
|
|
|
ifndef NO_JVMTI
|
|
FEATURE_CHECK_CFLAGS-jvmti := -I$(JDIR)/include -I$(JDIR)/include/linux
|
|
$(call feature_check,jvmti)
|
|
ifeq ($(feature-jvmti), 1)
|
|
$(call detected_var,JDIR)
|
|
ifndef NO_JVMTI_CMLR
|
|
FEATURE_CHECK_CFLAGS-jvmti-cmlr := $(FEATURE_CHECK_CFLAGS-jvmti)
|
|
$(call feature_check,jvmti-cmlr)
|
|
ifeq ($(feature-jvmti-cmlr), 1)
|
|
CFLAGS += -DHAVE_JVMTI_CMLR
|
|
endif
|
|
endif # NO_JVMTI_CMLR
|
|
else
|
|
$(warning No openjdk development package found, please install JDK package, e.g. openjdk-8-jdk, java-1.8.0-openjdk-devel)
|
|
NO_JVMTI := 1
|
|
endif
|
|
endif
|
|
|
|
USE_CXX = 0
|
|
USE_CLANGLLVM = 0
|
|
ifdef LIBCLANGLLVM
|
|
$(call feature_check,cxx)
|
|
ifneq ($(feature-cxx), 1)
|
|
msg := $(warning No g++ found, disable clang and llvm support. Please install g++)
|
|
else
|
|
$(call feature_check,llvm)
|
|
$(call feature_check,llvm-version)
|
|
ifneq ($(feature-llvm), 1)
|
|
msg := $(warning No suitable libLLVM found, disabling builtin clang and LLVM support. Please install llvm-dev(el) (>= 3.9.0))
|
|
else
|
|
$(call feature_check,clang)
|
|
ifneq ($(feature-clang), 1)
|
|
msg := $(warning No suitable libclang found, disabling builtin clang and LLVM support. Please install libclang-dev(el) (>= 3.9.0))
|
|
else
|
|
CFLAGS += -DHAVE_LIBCLANGLLVM_SUPPORT
|
|
CXXFLAGS += -DHAVE_LIBCLANGLLVM_SUPPORT -I$(shell $(LLVM_CONFIG) --includedir)
|
|
$(call detected,CONFIG_CXX)
|
|
$(call detected,CONFIG_CLANGLLVM)
|
|
USE_CXX = 1
|
|
USE_LLVM = 1
|
|
USE_CLANG = 1
|
|
ifneq ($(feature-llvm-version),1)
|
|
msg := $(warning This version of LLVM is not tested. May cause build errors)
|
|
endif
|
|
endif
|
|
endif
|
|
endif
|
|
endif
|
|
|
|
ifdef LIBPFM4
|
|
$(call feature_check,libpfm4)
|
|
ifeq ($(feature-libpfm4), 1)
|
|
CFLAGS += -DHAVE_LIBPFM
|
|
EXTLIBS += -lpfm
|
|
ASCIIDOC_EXTRA = -aHAVE_LIBPFM=1
|
|
$(call detected,CONFIG_LIBPFM4)
|
|
else
|
|
msg := $(warning libpfm4 not found, disables libpfm4 support. Please install libpfm4-dev);
|
|
NO_LIBPFM4 := 1
|
|
endif
|
|
endif
|
|
|
|
# Among the variables below, these:
|
|
# perfexecdir
|
|
# perf_include_dir
|
|
# perf_examples_dir
|
|
# template_dir
|
|
# mandir
|
|
# infodir
|
|
# htmldir
|
|
# ETC_PERFCONFIG (but not sysconfdir)
|
|
# can be specified as a relative path some/where/else;
|
|
# this is interpreted as relative to $(prefix) and "perf" at
|
|
# runtime figures out where they are based on the path to the executable.
|
|
# This can help installing the suite in a relocatable way.
|
|
|
|
# Make the path relative to DESTDIR, not to prefix
|
|
ifndef DESTDIR
|
|
prefix ?= $(HOME)
|
|
endif
|
|
bindir_relative = bin
|
|
bindir = $(abspath $(prefix)/$(bindir_relative))
|
|
mandir = share/man
|
|
infodir = share/info
|
|
perfexecdir = libexec/perf-core
|
|
perf_include_dir = lib/perf/include
|
|
perf_examples_dir = lib/perf/examples
|
|
sharedir = $(prefix)/share
|
|
template_dir = share/perf-core/templates
|
|
STRACE_GROUPS_DIR = share/perf-core/strace/groups
|
|
htmldir = share/doc/perf-doc
|
|
tipdir = share/doc/perf-tip
|
|
srcdir = $(srctree)/tools/perf
|
|
ifeq ($(prefix),/usr)
|
|
sysconfdir = /etc
|
|
ETC_PERFCONFIG = $(sysconfdir)/perfconfig
|
|
else
|
|
sysconfdir = $(prefix)/etc
|
|
ETC_PERFCONFIG = etc/perfconfig
|
|
endif
|
|
ifndef lib
|
|
ifeq ($(SRCARCH)$(IS_64_BIT), x861)
|
|
lib = lib64
|
|
else
|
|
lib = lib
|
|
endif
|
|
endif # lib
|
|
libdir = $(prefix)/$(lib)
|
|
|
|
# Shell quote (do not use $(call) to accommodate ancient setups);
|
|
ETC_PERFCONFIG_SQ = $(subst ','\'',$(ETC_PERFCONFIG))
|
|
STRACE_GROUPS_DIR_SQ = $(subst ','\'',$(STRACE_GROUPS_DIR))
|
|
DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
|
|
bindir_SQ = $(subst ','\'',$(bindir))
|
|
mandir_SQ = $(subst ','\'',$(mandir))
|
|
infodir_SQ = $(subst ','\'',$(infodir))
|
|
perfexecdir_SQ = $(subst ','\'',$(perfexecdir))
|
|
perf_include_dir_SQ = $(subst ','\'',$(perf_include_dir))
|
|
perf_examples_dir_SQ = $(subst ','\'',$(perf_examples_dir))
|
|
template_dir_SQ = $(subst ','\'',$(template_dir))
|
|
htmldir_SQ = $(subst ','\'',$(htmldir))
|
|
tipdir_SQ = $(subst ','\'',$(tipdir))
|
|
prefix_SQ = $(subst ','\'',$(prefix))
|
|
sysconfdir_SQ = $(subst ','\'',$(sysconfdir))
|
|
libdir_SQ = $(subst ','\'',$(libdir))
|
|
srcdir_SQ = $(subst ','\'',$(srcdir))
|
|
|
|
ifneq ($(filter /%,$(firstword $(perfexecdir))),)
|
|
perfexec_instdir = $(perfexecdir)
|
|
perf_include_instdir = $(perf_include_dir)
|
|
perf_examples_instdir = $(perf_examples_dir)
|
|
STRACE_GROUPS_INSTDIR = $(STRACE_GROUPS_DIR)
|
|
tip_instdir = $(tipdir)
|
|
else
|
|
perfexec_instdir = $(prefix)/$(perfexecdir)
|
|
perf_include_instdir = $(prefix)/$(perf_include_dir)
|
|
perf_examples_instdir = $(prefix)/$(perf_examples_dir)
|
|
STRACE_GROUPS_INSTDIR = $(prefix)/$(STRACE_GROUPS_DIR)
|
|
tip_instdir = $(prefix)/$(tipdir)
|
|
endif
|
|
perfexec_instdir_SQ = $(subst ','\'',$(perfexec_instdir))
|
|
perf_include_instdir_SQ = $(subst ','\'',$(perf_include_instdir))
|
|
perf_examples_instdir_SQ = $(subst ','\'',$(perf_examples_instdir))
|
|
STRACE_GROUPS_INSTDIR_SQ = $(subst ','\'',$(STRACE_GROUPS_INSTDIR))
|
|
tip_instdir_SQ = $(subst ','\'',$(tip_instdir))
|
|
|
|
# If we install to $(HOME) we keep the traceevent default:
|
|
# $(HOME)/.traceevent/plugins
|
|
# Otherwise we install plugins into the global $(libdir).
|
|
ifdef DESTDIR
|
|
plugindir=$(libdir)/traceevent/plugins
|
|
plugindir_SQ= $(subst ','\'',$(plugindir))
|
|
endif
|
|
|
|
print_var = $(eval $(print_var_code)) $(info $(MSG))
|
|
define print_var_code
|
|
MSG = $(shell printf '...%30s: %s' $(1) $($(1)))
|
|
endef
|
|
|
|
ifeq ($(VF),1)
|
|
# Display EXTRA features which are detected manualy
|
|
# from here with feature_check call and thus cannot
|
|
# be partof global state output.
|
|
$(foreach feat,$(FEATURE_TESTS_EXTRA),$(call feature_print_status,$(feat),))
|
|
$(call print_var,prefix)
|
|
$(call print_var,bindir)
|
|
$(call print_var,libdir)
|
|
$(call print_var,sysconfdir)
|
|
$(call print_var,LIBUNWIND_DIR)
|
|
$(call print_var,LIBDW_DIR)
|
|
$(call print_var,JDIR)
|
|
|
|
ifeq ($(dwarf-post-unwind),1)
|
|
$(call feature_print_text,"DWARF post unwind library", $(dwarf-post-unwind-text))
|
|
endif
|
|
$(info )
|
|
endif
|
|
|
|
$(call detected_var,bindir_SQ)
|
|
$(call detected_var,PYTHON_WORD)
|
|
ifneq ($(OUTPUT),)
|
|
$(call detected_var,OUTPUT)
|
|
endif
|
|
$(call detected_var,htmldir_SQ)
|
|
$(call detected_var,infodir_SQ)
|
|
$(call detected_var,mandir_SQ)
|
|
$(call detected_var,ETC_PERFCONFIG_SQ)
|
|
$(call detected_var,STRACE_GROUPS_DIR_SQ)
|
|
$(call detected_var,prefix_SQ)
|
|
$(call detected_var,perfexecdir_SQ)
|
|
$(call detected_var,perf_include_dir_SQ)
|
|
$(call detected_var,perf_examples_dir_SQ)
|
|
$(call detected_var,tipdir_SQ)
|
|
$(call detected_var,srcdir_SQ)
|
|
$(call detected_var,LIBDIR)
|
|
$(call detected_var,GTK_CFLAGS)
|
|
$(call detected_var,PERL_EMBED_CCOPTS)
|
|
$(call detected_var,PYTHON_EMBED_CCOPTS)
|