mirror of https://gitee.com/openkylin/linux.git
perf tools fixes for v5.9: 3rd batch
- Set PERF_SAMPLE_PERIOD if attr->freq is set. - Remove trailing commas from AMD JSON vendor event files. - Don't clear event's period if set by a event definition term. - Leader sampling shouldn't clear sample period in 'perf test'. - Fix the "signal" test inline assembly when built with DEBUG=1. - Fix memory leaks detected by ASAN, some in normal paths, some in error paths. - Fix 2 memory sanitizer warnings in 'perf bench'. - Fix the ratio comments of miss-events in 'perf stat'. - Prevent override of attr->sample_period for libpfm4 events. - Sync kvm.h and in.h headers with the kernel sources. 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 Wed 16 Sep 2020 11:15:24 AM -03 # export PERF_TARBALL=http://192.168.122.1/perf/perf-5.9.0-rc5.tar.xz # dm 1 70.56 alpine:3.4 : Ok gcc (Alpine 5.3.0) 5.3.0, clang version 3.8.0 (tags/RELEASE_380/final) 2 71.39 alpine:3.5 : Ok gcc (Alpine 6.2.1) 6.2.1 20160822, clang version 3.8.1 (tags/RELEASE_381/final) 3 76.82 alpine:3.6 : Ok gcc (Alpine 6.3.0) 6.3.0, clang version 4.0.0 (tags/RELEASE_400/final) 4 83.00 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 82.55 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 85.51 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 105.20 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 120.42 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 104.13 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 71.21 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) 11 87.61 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 12 84.82 alt:sisyphus : Ok x86_64-alt-linux-gcc (GCC) 9.3.1 20200518 (ALT Sisyphus 9.3.1-alt1), clang version 10.0.1 13 62.90 amazonlinux:1 : Ok gcc (GCC) 7.2.1 20170915 (Red Hat 7.2.1-2), clang version 3.6.2 (tags/RELEASE_362/final) 14 100.02 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) 15 22.01 android-ndk:r12b-arm : Ok arm-linux-androideabi-gcc (GCC) 4.9.x 20150123 (prerelease) 16 21.86 android-ndk:r15c-arm : Ok arm-linux-androideabi-gcc (GCC) 4.9.x 20150123 (prerelease) 17 28.10 centos:6 : Ok gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-23) 18 33.15 centos:7 : Ok gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39) 19 113.26 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) 20 55.11 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 21 68.80 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) 22 79.02 debian:9 : Ok gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516, clang version 3.8.1-24 (tags/RELEASE_381/final) 23 75.06 debian:10 : Ok gcc (Debian 8.3.0-6) 8.3.0, clang version 7.0.1-8 (tags/RELEASE_701/final) 24 79.97 debian:experimental : Ok gcc (Debian 10.2.0-7) 10.2.0, Debian clang version 11.0.0-+rc2-5 25 32.05 debian:experimental-x-arm64 : Ok aarch64-linux-gnu-gcc (Debian 10.2.0-3) 10.2.0 26 29.14 debian:experimental-x-mips64 : Ok mips64-linux-gnuabi64-gcc (Debian 9.3.0-8) 9.3.0 27 31.20 debian:experimental-x-mipsel : Ok mipsel-linux-gnu-gcc (Debian 9.3.0-8) 9.3.0 28 32.64 fedora:20 : Ok gcc (GCC) 4.8.3 20140911 (Red Hat 4.8.3-7) 29 32.22 fedora:22 : Ok gcc (GCC) 5.3.1 20160406 (Red Hat 5.3.1-6), clang version 3.5.0 (tags/RELEASE_350/final) 30 72.38 fedora:23 : Ok gcc (GCC) 5.3.1 20160406 (Red Hat 5.3.1-6), clang version 3.7.0 (tags/RELEASE_370/final) 31 83.19 fedora:24 : Ok gcc (GCC) 6.3.1 20161221 (Red Hat 6.3.1-1), clang version 3.8.1 (tags/RELEASE_381/final) 32 26.12 fedora:24-x-ARC-uClibc : Ok arc-linux-gcc (ARCompact ISA Linux uClibc toolchain 2017.09-rc2) 7.1.1 20170710 33 83.82 fedora:25 : Ok gcc (GCC) 6.4.1 20170727 (Red Hat 6.4.1-1), clang version 3.9.1 (tags/RELEASE_391/final) 34 95.77 fedora:26 : Ok gcc (GCC) 7.3.1 20180130 (Red Hat 7.3.1-2), clang version 4.0.1 (tags/RELEASE_401/final) 35 96.57 fedora:27 : Ok gcc (GCC) 7.3.1 20180712 (Red Hat 7.3.1-6), clang version 5.0.2 (tags/RELEASE_502/final) 36 106.17 fedora:28 : Ok gcc (GCC) 8.3.1 20190223 (Red Hat 8.3.1-2), clang version 6.0.1 (tags/RELEASE_601/final) 37 111.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) 38 115.80 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) 39 29.10 fedora:30-x-ARC-glibc : Ok arc-linux-gcc (ARC HS GNU/Linux glibc toolchain 2019.03-rc1) 8.3.1 20190225 40 26.39 fedora:30-x-ARC-uClibc : Ok arc-linux-gcc (ARCv2 ISA Linux uClibc toolchain 2019.03-rc1) 8.3.1 20190225 41 116.53 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) 42 98.99 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) 43 18.48 fedora:rawhide : FAIL gcc (GCC) 10.2.1 20200826 (Red Hat 10.2.1-3), clang version 11.0.0 (Fedora 11.0.0-0.2.rc1.fc34) util/scripting-engines/trace-event-python.c: In function 'python_start_script': util/scripting-engines/trace-event-python.c:1595:2: error: 'visibility' attribute ignored [-Werror=attributes] 1595 | PyMODINIT_FUNC (*initfunc)(void); | ^~~~~~~~~~~~~~ At this point I should realize nobody is looking at this... Prove me wrong and provide a fix, this is tricky and I need your help :-) 44 34.56 gentoo-stage3-amd64:latest : Ok gcc (Gentoo 9.3.0-r1 p3) 9.3.0 45 71.64 mageia:5 : Ok gcc (GCC) 4.9.2, clang version 3.5.2 (tags/RELEASE_352/final) 46 89.60 mageia:6 : Ok gcc (Mageia 5.5.0-1.mga6) 5.5.0, clang version 3.9.1 (tags/RELEASE_391/final) 47 114.09 mageia:7 : Ok gcc (Mageia 8.4.0-1.mga7) 8.4.0, clang version 8.0.0 (Mageia 8.0.0-1.mga7) 48 93.72 manjaro:latest : Ok gcc (GCC) 10.2.0, clang version 10.0.1 49 246.86 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) 50 115.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) 51 124.22 opensuse:15.1 : Ok gcc (SUSE Linux) 7.5.0, clang version 7.0.1 (tags/RELEASE_701/final 349238) 52 114.75 opensuse:15.2 : Ok gcc (SUSE Linux) 7.5.0, clang version 9.0.1 53 108.32 opensuse:42.3 : Ok gcc (SUSE Linux) 4.8.5, clang version 3.8.0 (tags/RELEASE_380/final 262553) 54 108.20 opensuse:tumbleweed : Ok gcc (SUSE Linux) 10.2.1 20200825 [revision c0746a1beb1ba073c7981eb09f55b3d993b32e5c], clang version 10.0.1 55 28.17 oraclelinux:6 : Ok gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-23.0.1) 56 33.23 oraclelinux:7 : Ok gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39.0.5) 57 113.78 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 31.14 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 33.05 ubuntu:14.04 : Ok gcc (Ubuntu 4.8.4-2ubuntu1~14.04.4) 4.8.4 60 81.61 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 27.06 ubuntu:16.04-x-arm : Ok arm-linux-gnueabihf-gcc (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609 62 27.31 ubuntu:16.04-x-arm64 : Ok aarch64-linux-gnu-gcc (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609 63 26.36 ubuntu:16.04-x-powerpc : Ok powerpc-linux-gnu-gcc (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609 64 27.31 ubuntu:16.04-x-powerpc64 : Ok powerpc64-linux-gnu-gcc (Ubuntu/IBM 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609 65 27.09 ubuntu:16.04-x-powerpc64el : Ok powerpc64le-linux-gnu-gcc (Ubuntu/IBM 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609 66 26.11 ubuntu:16.04-x-s390 : Ok s390x-linux-gnu-gcc (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609 67 275.70 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 29.17 ubuntu:18.04-x-arm : Ok arm-linux-gnueabihf-gcc (Ubuntu/Linaro 7.5.0-3ubuntu1~18.04) 7.5.0 69 28.84 ubuntu:18.04-x-arm64 : Ok aarch64-linux-gnu-gcc (Ubuntu/Linaro 7.5.0-3ubuntu1~18.04) 7.5.0 70 23.26 ubuntu:18.04-x-m68k : Ok m68k-linux-gnu-gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 71 28.13 ubuntu:18.04-x-powerpc : Ok powerpc-linux-gnu-gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 72 28.87 ubuntu:18.04-x-powerpc64 : Ok powerpc64-linux-gnu-gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 73 30.32 ubuntu:18.04-x-powerpc64el : Ok powerpc64le-linux-gnu-gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 74 184.84 ubuntu:18.04-x-riscv64 : Ok riscv64-linux-gnu-gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 75 25.52 ubuntu:18.04-x-s390 : Ok s390x-linux-gnu-gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 76 26.90 ubuntu:18.04-x-sh4 : Ok sh4-linux-gnu-gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 77 25.95 ubuntu:18.04-x-sparc64 : Ok sparc64-linux-gnu-gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 78 81.24 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 86.43 ubuntu:20.04 : Ok gcc (Ubuntu 9.3.0-10ubuntu2) 9.3.0, clang version 10.0.0-4ubuntu1 80 30.55 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 85.38 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-rc3 #1 SMP Mon Aug 31 08:38:27 -03 2020 x86_64 x86_64 x86_64 GNU/Linux # git log --oneline -1ce9c13f31b
perf stat: Fix the ratio comments of miss-events # perf version --build-options perf version 5.9.rc5.gce9c13f31b10 dwarf: [ on ] # HAVE_DWARF_SUPPORT dwarf_getlocations: [ on ] # HAVE_DWARF_GETLOCATIONS_SUPPORT glibc: [ on ] # HAVE_GLIBC_SUPPORT gtk2: [ on ] # HAVE_GTK2_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: x86 rdpmc : Ok 69: Convert perf time to TSC : Ok 70: DWARF unwind : Ok 71: x86 instruction decoder - new instructions : Ok 72: Intel PT packet decoder : Ok 73: x86 bp modify : Ok 74: probe libc's inet_pton & backtrace it with ping : Ok 75: Use vfs_getname probe to get syscall args filenames : Ok 76: Check open filename arg using perf trace + vfs_getname: Ok 77: Zstd perf.data compression/decompression : Ok 78: Add vfs_getname probe to get syscall args filenames : Ok # $ cd ~acme/git/perf ; git log --oneline -1 ; time make -C tools/perf build-testce9c13f31b
(HEAD -> perf/urgent, five/perf/urgent) perf stat: Fix the ratio comments of miss-events make: Entering directory '/home/acme/git/perf/tools/perf' - tarpkg: ./tests/perf-targz-src-pkg . make_no_libpython_O: make NO_LIBPYTHON=1 make_no_sdt_O: make NO_SDT=1 make_no_scripts_O: make NO_LIBPYTHON=1 NO_LIBPERL=1 make_no_libunwind_O: make NO_LIBUNWIND=1 make_no_libelf_O: make NO_LIBELF=1 make_doc_O: make doc make_perf_o_O: make perf.o make_no_libbpf_DEBUG_O: make NO_LIBBPF=1 DEBUG=1 make_no_libbionic_O: make NO_LIBBIONIC=1 make_no_demangle_O: make NO_DEMANGLE=1 make_no_auxtrace_O: make NO_AUXTRACE=1 make_no_libcrypto_O: make NO_LIBCRYPTO=1 make_util_map_o_O: make util/map.o make_help_O: make help make_no_ui_O: make NO_NEWT=1 NO_SLANG=1 NO_GTK2=1 make_install_bin_O: make install-bin make_util_pmu_bison_o_O: make util/pmu-bison.o make_install_prefix_O: make install prefix=/tmp/krava make_with_babeltrace_O: make LIBBABELTRACE=1 make_no_backtrace_O: make NO_BACKTRACE=1 make_no_syscall_tbl_O: make NO_SYSCALL_TABLE=1 make_tags_O: make tags make_no_libaudit_O: make NO_LIBAUDIT=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_prefix_slash_O: make install prefix=/tmp/krava/ make_install_O: make install make_clean_all_O: make clean all make_cscope_O: make cscope make_with_clangllvm_O: make LIBCLANGLLVM=1 make_no_libnuma_O: make NO_LIBNUMA=1 make_with_libpfm4_O: make LIBPFM4=1 make_debug_O: make DEBUG=1 make_no_libdw_dwarf_unwind_O: make NO_LIBDW_DWARF_UNWIND=1 make_no_gtk2_O: make NO_GTK2=1 - /home/acme/git/perf/tools/perf/BUILD_TEST_FEATURE_DUMP_STATIC: make FEATURE_DUMP_COPY=/home/acme/git/perf/tools/perf/BUILD_TEST_FEATURE_DUMP_STATIC LDFLAGS='-static' feature-dump make FEATURE_DUMP_COPY=/home/acme/git/perf/tools/perf/BUILD_TEST_FEATURE_DUMP_STATIC LDFLAGS='-static' feature-dump make_static_O: make LDFLAGS=-static NO_PERF_READ_VDSO32=1 NO_PERF_READ_VDSOX32=1 NO_JVMTI=1 make_no_libperl_O: make NO_LIBPERL=1 make_pure_O: make make_no_newt_O: make NO_NEWT=1 make_no_libbpf_O: make NO_LIBBPF=1 make_no_slang_O: make NO_SLANG=1 OK make: Leaving directory '/home/acme/git/perf/tools/perf' $ -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQR2GiIUctdOfX2qHhGyPKLppCJ+JwUCX2JLqAAKCRCyPKLppCJ+ J9FNAQDY2ZfjpL0eppFjxnxr0Of7T9ULpgsUeEVFsGETKmkAFQEAgWGcOoQ3hWZv AjRWqbSNjwz40/wccztY9OSO2cVlegc= =40Lf -----END PGP SIGNATURE----- Merge tag 'perf-tools-fixes-for-v5.9-2020-09-16' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux Pull perf tools fixes from Arnaldo Carvalho de Melo: - Set PERF_SAMPLE_PERIOD if attr->freq is set. - Remove trailing commas from AMD JSON vendor event files. - Don't clear event's period if set by a event definition term. - Leader sampling shouldn't clear sample period in 'perf test'. - Fix the "signal" test inline assembly when built with DEBUG=1. - Fix memory leaks detected by ASAN, some in normal paths, some in error paths. - Fix 2 memory sanitizer warnings in 'perf bench'. - Fix the ratio comments of miss-events in 'perf stat'. - Prevent override of attr->sample_period for libpfm4 events. - Sync kvm.h and in.h headers with the kernel sources. * tag 'perf-tools-fixes-for-v5.9-2020-09-16' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux: perf stat: Fix the ratio comments of miss-events perf test: Free formats for perf pmu parse test perf metric: Do not free metric when failed to resolve perf metric: Free metric when it failed to resolve perf metric: Release expr_parse_ctx after testing perf test: Fix memory leaks in parse-metric test perf parse-event: Fix memory leak in evsel->unit perf evlist: Fix cpu/thread map leak perf metric: Fix some memory leaks - part 2 perf metric: Fix some memory leaks perf test: Free aliases for PMU event map aliases test perf vendor events amd: Remove trailing commas perf test: Leader sampling shouldn't clear sample period perf record: Don't clear event's period if set by a term tools headers UAPI: update linux/in.h copy tools headers UAPI: Sync kvm.h headers with the kernel sources perf record: Prevent override of attr->sample_period for libpfm4 events perf record: Set PERF_RECORD_PERIOD if attr->freq is set. perf bench: Fix 2 memory sanitizer warnings perf test: Fix the "signal" test inline assembly
This commit is contained in:
commit
5925fa68fe
|
@ -135,7 +135,7 @@ struct in_addr {
|
|||
* this socket to prevent accepting spoofed ones.
|
||||
*/
|
||||
#define IP_PMTUDISC_INTERFACE 4
|
||||
/* weaker version of IP_PMTUDISC_INTERFACE, which allos packets to get
|
||||
/* weaker version of IP_PMTUDISC_INTERFACE, which allows packets to get
|
||||
* fragmented if they exeed the interface mtu
|
||||
*/
|
||||
#define IP_PMTUDISC_OMIT 5
|
||||
|
|
|
@ -790,9 +790,10 @@ struct kvm_ppc_resize_hpt {
|
|||
#define KVM_VM_PPC_HV 1
|
||||
#define KVM_VM_PPC_PR 2
|
||||
|
||||
/* on MIPS, 0 forces trap & emulate, 1 forces VZ ASE */
|
||||
#define KVM_VM_MIPS_TE 0
|
||||
/* on MIPS, 0 indicates auto, 1 forces VZ ASE, 2 forces trap & emulate */
|
||||
#define KVM_VM_MIPS_AUTO 0
|
||||
#define KVM_VM_MIPS_VZ 1
|
||||
#define KVM_VM_MIPS_TE 2
|
||||
|
||||
#define KVM_S390_SIE_PAGE_OFFSET 1
|
||||
|
||||
|
@ -1035,6 +1036,7 @@ struct kvm_ppc_resize_hpt {
|
|||
#define KVM_CAP_LAST_CPU 184
|
||||
#define KVM_CAP_SMALLER_MAXPHYADDR 185
|
||||
#define KVM_CAP_S390_DIAG318 186
|
||||
#define KVM_CAP_STEAL_TIME 187
|
||||
|
||||
#ifdef KVM_CAP_IRQ_ROUTING
|
||||
|
||||
|
|
|
@ -66,11 +66,10 @@ static void fdpair(int fds[2])
|
|||
/* Block until we're ready to go */
|
||||
static void ready(int ready_out, int wakefd)
|
||||
{
|
||||
char dummy;
|
||||
struct pollfd pollfd = { .fd = wakefd, .events = POLLIN };
|
||||
|
||||
/* Tell them we're ready. */
|
||||
if (write(ready_out, &dummy, 1) != 1)
|
||||
if (write(ready_out, "R", 1) != 1)
|
||||
err(EXIT_FAILURE, "CLIENT: ready write");
|
||||
|
||||
/* Wait for "GO" signal */
|
||||
|
@ -85,6 +84,7 @@ static void *sender(struct sender_context *ctx)
|
|||
unsigned int i, j;
|
||||
|
||||
ready(ctx->ready_out, ctx->wakefd);
|
||||
memset(data, 'S', sizeof(data));
|
||||
|
||||
/* Now pump to every receiver. */
|
||||
for (i = 0; i < nr_loops; i++) {
|
||||
|
|
|
@ -61,7 +61,7 @@
|
|||
{
|
||||
"EventName": "ex_ret_brn_ind_misp",
|
||||
"EventCode": "0xca",
|
||||
"BriefDescription": "Retired Indirect Branch Instructions Mispredicted.",
|
||||
"BriefDescription": "Retired Indirect Branch Instructions Mispredicted."
|
||||
},
|
||||
{
|
||||
"EventName": "ex_ret_mmx_fp_instr.sse_instr",
|
||||
|
|
|
@ -125,6 +125,6 @@
|
|||
{
|
||||
"EventName": "ex_ret_fus_brnch_inst",
|
||||
"EventCode": "0x1d0",
|
||||
"BriefDescription": "Retired Fused Instructions. The number of fuse-branch instructions retired per cycle. The number of events logged per cycle can vary from 0-8.",
|
||||
"BriefDescription": "Retired Fused Instructions. The number of fuse-branch instructions retired per cycle. The number of events logged per cycle can vary from 0-8."
|
||||
}
|
||||
]
|
||||
|
|
|
@ -49,6 +49,7 @@ Following tests are defined (with perf commands):
|
|||
perf record --call-graph fp kill (test-record-graph-fp)
|
||||
perf record --group -e cycles,instructions kill (test-record-group)
|
||||
perf record -e '{cycles,instructions}' kill (test-record-group1)
|
||||
perf record -e '{cycles/period=1/,instructions/period=2/}:S' kill (test-record-group2)
|
||||
perf record -D kill (test-record-no-delay)
|
||||
perf record -i kill (test-record-no-inherit)
|
||||
perf record -n kill (test-record-no-samples)
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
[config]
|
||||
command = record
|
||||
args = --no-bpf-event -e '{cycles/period=1234000/,instructions/period=6789000/}:S' kill >/dev/null 2>&1
|
||||
ret = 1
|
||||
|
||||
[event-1:base-record]
|
||||
fd=1
|
||||
group_fd=-1
|
||||
config=0|1
|
||||
sample_period=1234000
|
||||
sample_type=87
|
||||
read_format=12
|
||||
inherit=0
|
||||
freq=0
|
||||
|
||||
[event-2:base-record]
|
||||
fd=2
|
||||
group_fd=1
|
||||
config=0|1
|
||||
sample_period=6789000
|
||||
sample_type=87
|
||||
read_format=12
|
||||
disabled=0
|
||||
inherit=0
|
||||
mmap=0
|
||||
comm=0
|
||||
freq=0
|
||||
enable_on_exec=0
|
||||
task=0
|
|
@ -45,10 +45,13 @@ volatile long the_var;
|
|||
#if defined (__x86_64__)
|
||||
extern void __test_function(volatile long *ptr);
|
||||
asm (
|
||||
".pushsection .text;"
|
||||
".globl __test_function\n"
|
||||
".type __test_function, @function;"
|
||||
"__test_function:\n"
|
||||
"incq (%rdi)\n"
|
||||
"ret\n");
|
||||
"ret\n"
|
||||
".popsection\n");
|
||||
#else
|
||||
static void __test_function(volatile long *ptr)
|
||||
{
|
||||
|
|
|
@ -153,8 +153,10 @@ static int __compute_metric(const char *name, struct value *vals,
|
|||
return -ENOMEM;
|
||||
|
||||
cpus = perf_cpu_map__new("0");
|
||||
if (!cpus)
|
||||
if (!cpus) {
|
||||
evlist__delete(evlist);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
perf_evlist__set_maps(&evlist->core, cpus, NULL);
|
||||
|
||||
|
@ -163,10 +165,11 @@ static int __compute_metric(const char *name, struct value *vals,
|
|||
false, false,
|
||||
&metric_events);
|
||||
if (err)
|
||||
return err;
|
||||
goto out;
|
||||
|
||||
if (perf_evlist__alloc_stats(evlist, false))
|
||||
return -1;
|
||||
err = perf_evlist__alloc_stats(evlist, false);
|
||||
if (err)
|
||||
goto out;
|
||||
|
||||
/* Load the runtime stats with given numbers for events. */
|
||||
runtime_stat__init(&st);
|
||||
|
@ -178,13 +181,14 @@ static int __compute_metric(const char *name, struct value *vals,
|
|||
if (name2 && ratio2)
|
||||
*ratio2 = compute_single(&metric_events, evlist, &st, name2);
|
||||
|
||||
out:
|
||||
/* ... clenup. */
|
||||
metricgroup__rblist_exit(&metric_events);
|
||||
runtime_stat__exit(&st);
|
||||
perf_evlist__free_stats(evlist);
|
||||
perf_cpu_map__put(cpus);
|
||||
evlist__delete(evlist);
|
||||
return 0;
|
||||
return err;
|
||||
}
|
||||
|
||||
static int compute_metric(const char *name, struct value *vals, double *ratio)
|
||||
|
|
|
@ -274,6 +274,7 @@ static int __test__pmu_event_aliases(char *pmu_name, int *count)
|
|||
int res = 0;
|
||||
bool use_uncore_table;
|
||||
struct pmu_events_map *map = __test_pmu_get_events_map();
|
||||
struct perf_pmu_alias *a, *tmp;
|
||||
|
||||
if (!map)
|
||||
return -1;
|
||||
|
@ -347,6 +348,10 @@ static int __test__pmu_event_aliases(char *pmu_name, int *count)
|
|||
pmu_name, alias->name);
|
||||
}
|
||||
|
||||
list_for_each_entry_safe(a, tmp, &aliases, list) {
|
||||
list_del(&a->list);
|
||||
perf_pmu_free_alias(a);
|
||||
}
|
||||
free(pmu);
|
||||
return res;
|
||||
}
|
||||
|
|
|
@ -173,6 +173,7 @@ int test__pmu(struct test *test __maybe_unused, int subtest __maybe_unused)
|
|||
ret = 0;
|
||||
} while (0);
|
||||
|
||||
perf_pmu__del_formats(&formats);
|
||||
test_format_dir_put(format);
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -946,6 +946,10 @@ int perf_evlist__create_maps(struct evlist *evlist, struct target *target)
|
|||
|
||||
perf_evlist__set_maps(&evlist->core, cpus, threads);
|
||||
|
||||
/* as evlist now has references, put count here */
|
||||
perf_cpu_map__put(cpus);
|
||||
perf_thread_map__put(threads);
|
||||
|
||||
return 0;
|
||||
|
||||
out_delete_threads:
|
||||
|
@ -1273,11 +1277,12 @@ static int perf_evlist__create_syswide_maps(struct evlist *evlist)
|
|||
goto out_put;
|
||||
|
||||
perf_evlist__set_maps(&evlist->core, cpus, threads);
|
||||
out:
|
||||
return err;
|
||||
|
||||
perf_thread_map__put(threads);
|
||||
out_put:
|
||||
perf_cpu_map__put(cpus);
|
||||
goto out;
|
||||
out:
|
||||
return err;
|
||||
}
|
||||
|
||||
int evlist__open(struct evlist *evlist)
|
||||
|
|
|
@ -976,16 +976,20 @@ void evsel__config(struct evsel *evsel, struct record_opts *opts,
|
|||
* We default some events to have a default interval. But keep
|
||||
* it a weak assumption overridable by the user.
|
||||
*/
|
||||
if (!attr->sample_period || (opts->user_freq != UINT_MAX ||
|
||||
opts->user_interval != ULLONG_MAX)) {
|
||||
if (!attr->sample_period) {
|
||||
if (opts->freq) {
|
||||
evsel__set_sample_bit(evsel, PERIOD);
|
||||
attr->freq = 1;
|
||||
attr->sample_freq = opts->freq;
|
||||
} else {
|
||||
attr->sample_period = opts->default_interval;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* If attr->freq was set (here or earlier), ask for period
|
||||
* to be sampled.
|
||||
*/
|
||||
if (attr->freq)
|
||||
evsel__set_sample_bit(evsel, PERIOD);
|
||||
|
||||
if (opts->no_samples)
|
||||
attr->sample_freq = 0;
|
||||
|
|
|
@ -85,6 +85,7 @@ static void metric_event_delete(struct rblist *rblist __maybe_unused,
|
|||
|
||||
list_for_each_entry_safe(expr, tmp, &me->head, nd) {
|
||||
free(expr->metric_refs);
|
||||
free(expr->metric_events);
|
||||
free(expr);
|
||||
}
|
||||
|
||||
|
@ -316,6 +317,7 @@ static int metricgroup__setup_events(struct list_head *groups,
|
|||
if (!metric_refs) {
|
||||
ret = -ENOMEM;
|
||||
free(metric_events);
|
||||
free(expr);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -530,6 +532,9 @@ void metricgroup__print(bool metrics, bool metricgroups, char *filter,
|
|||
continue;
|
||||
strlist__add(me->metrics, s);
|
||||
}
|
||||
|
||||
if (!raw)
|
||||
free(s);
|
||||
}
|
||||
free(omg);
|
||||
}
|
||||
|
@ -667,7 +672,6 @@ static int __add_metric(struct list_head *metric_list,
|
|||
m->has_constraint = metric_no_group || metricgroup__has_constraint(pe);
|
||||
INIT_LIST_HEAD(&m->metric_refs);
|
||||
m->metric_refs_cnt = 0;
|
||||
*mp = m;
|
||||
|
||||
parent = expr_ids__alloc(ids);
|
||||
if (!parent) {
|
||||
|
@ -680,6 +684,7 @@ static int __add_metric(struct list_head *metric_list,
|
|||
free(m);
|
||||
return -ENOMEM;
|
||||
}
|
||||
*mp = m;
|
||||
} else {
|
||||
/*
|
||||
* We got here for the referenced metric, via the
|
||||
|
@ -714,8 +719,11 @@ static int __add_metric(struct list_head *metric_list,
|
|||
* all the metric's IDs and add it to the parent context.
|
||||
*/
|
||||
if (expr__find_other(pe->metric_expr, NULL, &m->pctx, runtime) < 0) {
|
||||
expr__ctx_clear(&m->pctx);
|
||||
free(m);
|
||||
if (m->metric_refs_cnt == 0) {
|
||||
expr__ctx_clear(&m->pctx);
|
||||
free(m);
|
||||
*mp = NULL;
|
||||
}
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
@ -934,7 +942,7 @@ static int metricgroup__add_metric(const char *metric, bool metric_no_group,
|
|||
|
||||
ret = add_metric(&list, pe, metric_no_group, &m, NULL, &ids);
|
||||
if (ret)
|
||||
return ret;
|
||||
goto out;
|
||||
|
||||
/*
|
||||
* Process any possible referenced metrics
|
||||
|
@ -943,12 +951,14 @@ static int metricgroup__add_metric(const char *metric, bool metric_no_group,
|
|||
ret = resolve_metric(metric_no_group,
|
||||
&list, map, &ids);
|
||||
if (ret)
|
||||
return ret;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* End of pmu events. */
|
||||
if (!has_match)
|
||||
return -EINVAL;
|
||||
if (!has_match) {
|
||||
ret = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
list_for_each_entry(m, &list, nd) {
|
||||
if (events->len > 0)
|
||||
|
@ -963,9 +973,14 @@ static int metricgroup__add_metric(const char *metric, bool metric_no_group,
|
|||
}
|
||||
}
|
||||
|
||||
out:
|
||||
/*
|
||||
* add to metric_list so that they can be released
|
||||
* even if it's failed
|
||||
*/
|
||||
list_splice(&list, metric_list);
|
||||
expr_ids__exit(&ids);
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int metricgroup__add_metric_list(const char *list, bool metric_no_group,
|
||||
|
@ -1040,7 +1055,7 @@ static int parse_groups(struct evlist *perf_evlist, const char *str,
|
|||
ret = metricgroup__add_metric_list(str, metric_no_group,
|
||||
&extra_events, &metric_list, map);
|
||||
if (ret)
|
||||
return ret;
|
||||
goto out;
|
||||
pr_debug("adding %s\n", extra_events.buf);
|
||||
bzero(&parse_error, sizeof(parse_error));
|
||||
ret = __parse_events(perf_evlist, extra_events.buf, &parse_error, fake_pmu);
|
||||
|
@ -1048,11 +1063,11 @@ static int parse_groups(struct evlist *perf_evlist, const char *str,
|
|||
parse_events_print_error(&parse_error, extra_events.buf);
|
||||
goto out;
|
||||
}
|
||||
strbuf_release(&extra_events);
|
||||
ret = metricgroup__setup_events(&metric_list, metric_no_merge,
|
||||
perf_evlist, metric_events);
|
||||
out:
|
||||
metricgroup__free_metrics(&metric_list);
|
||||
strbuf_release(&extra_events);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -411,7 +411,7 @@ static int add_event_tool(struct list_head *list, int *idx,
|
|||
return -ENOMEM;
|
||||
evsel->tool_event = tool_event;
|
||||
if (tool_event == PERF_TOOL_DURATION_TIME)
|
||||
evsel->unit = strdup("ns");
|
||||
evsel->unit = "ns";
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -274,7 +274,7 @@ static void perf_pmu_update_alias(struct perf_pmu_alias *old,
|
|||
}
|
||||
|
||||
/* Delete an alias entry. */
|
||||
static void perf_pmu_free_alias(struct perf_pmu_alias *newalias)
|
||||
void perf_pmu_free_alias(struct perf_pmu_alias *newalias)
|
||||
{
|
||||
zfree(&newalias->name);
|
||||
zfree(&newalias->desc);
|
||||
|
@ -1354,6 +1354,17 @@ void perf_pmu__set_format(unsigned long *bits, long from, long to)
|
|||
set_bit(b, bits);
|
||||
}
|
||||
|
||||
void perf_pmu__del_formats(struct list_head *formats)
|
||||
{
|
||||
struct perf_pmu_format *fmt, *tmp;
|
||||
|
||||
list_for_each_entry_safe(fmt, tmp, formats, list) {
|
||||
list_del(&fmt->list);
|
||||
free(fmt->name);
|
||||
free(fmt);
|
||||
}
|
||||
}
|
||||
|
||||
static int sub_non_neg(int a, int b)
|
||||
{
|
||||
if (b > a)
|
||||
|
|
|
@ -94,6 +94,7 @@ int perf_pmu__new_format(struct list_head *list, char *name,
|
|||
int config, unsigned long *bits);
|
||||
void perf_pmu__set_format(unsigned long *bits, long from, long to);
|
||||
int perf_pmu__format_parse(char *dir, struct list_head *head);
|
||||
void perf_pmu__del_formats(struct list_head *formats);
|
||||
|
||||
struct perf_pmu *perf_pmu__scan(struct perf_pmu *pmu);
|
||||
|
||||
|
@ -113,6 +114,7 @@ void pmu_add_cpu_aliases_map(struct list_head *head, struct perf_pmu *pmu,
|
|||
|
||||
struct pmu_events_map *perf_pmu__find_map(struct perf_pmu *pmu);
|
||||
bool pmu_uncore_alias_match(const char *pmu_name, const char *name);
|
||||
void perf_pmu_free_alias(struct perf_pmu_alias *alias);
|
||||
|
||||
int perf_pmu__convert_scale(const char *scale, char **end, double *sval);
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include "debug.h"
|
||||
#include "evlist.h"
|
||||
#include "evsel.h"
|
||||
#include "evsel_config.h"
|
||||
#include "parse-events.h"
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
|
@ -33,11 +34,24 @@ static struct evsel *evsel__read_sampler(struct evsel *evsel, struct evlist *evl
|
|||
return leader;
|
||||
}
|
||||
|
||||
static u64 evsel__config_term_mask(struct evsel *evsel)
|
||||
{
|
||||
struct evsel_config_term *term;
|
||||
struct list_head *config_terms = &evsel->config_terms;
|
||||
u64 term_types = 0;
|
||||
|
||||
list_for_each_entry(term, config_terms, list) {
|
||||
term_types |= 1 << term->type;
|
||||
}
|
||||
return term_types;
|
||||
}
|
||||
|
||||
static void evsel__config_leader_sampling(struct evsel *evsel, struct evlist *evlist)
|
||||
{
|
||||
struct perf_event_attr *attr = &evsel->core.attr;
|
||||
struct evsel *leader = evsel->leader;
|
||||
struct evsel *read_sampler;
|
||||
u64 term_types, freq_mask;
|
||||
|
||||
if (!leader->sample_read)
|
||||
return;
|
||||
|
@ -47,16 +61,20 @@ static void evsel__config_leader_sampling(struct evsel *evsel, struct evlist *ev
|
|||
if (evsel == read_sampler)
|
||||
return;
|
||||
|
||||
term_types = evsel__config_term_mask(evsel);
|
||||
/*
|
||||
* Disable sampling for all group members other than the leader in
|
||||
* case the leader 'leads' the sampling, except when the leader is an
|
||||
* AUX area event, in which case the 2nd event in the group is the one
|
||||
* that 'leads' the sampling.
|
||||
* Disable sampling for all group members except those with explicit
|
||||
* config terms or the leader. In the case of an AUX area event, the 2nd
|
||||
* event in the group is the one that 'leads' the sampling.
|
||||
*/
|
||||
attr->freq = 0;
|
||||
attr->sample_freq = 0;
|
||||
attr->sample_period = 0;
|
||||
attr->write_backward = 0;
|
||||
freq_mask = (1 << EVSEL__CONFIG_TERM_FREQ) | (1 << EVSEL__CONFIG_TERM_PERIOD);
|
||||
if ((term_types & freq_mask) == 0) {
|
||||
attr->freq = 0;
|
||||
attr->sample_freq = 0;
|
||||
attr->sample_period = 0;
|
||||
}
|
||||
if ((term_types & (1 << EVSEL__CONFIG_TERM_OVERWRITE)) == 0)
|
||||
attr->write_backward = 0;
|
||||
|
||||
/*
|
||||
* We don't get a sample for slave events, we make them when delivering
|
||||
|
|
|
@ -517,7 +517,7 @@ static void print_l1_dcache_misses(struct perf_stat_config *config,
|
|||
|
||||
color = get_ratio_color(GRC_CACHE_MISSES, ratio);
|
||||
|
||||
out->print_metric(config, out->ctx, color, "%7.2f%%", "of all L1-dcache hits", ratio);
|
||||
out->print_metric(config, out->ctx, color, "%7.2f%%", "of all L1-dcache accesses", ratio);
|
||||
}
|
||||
|
||||
static void print_l1_icache_misses(struct perf_stat_config *config,
|
||||
|
@ -538,7 +538,7 @@ static void print_l1_icache_misses(struct perf_stat_config *config,
|
|||
ratio = avg / total * 100.0;
|
||||
|
||||
color = get_ratio_color(GRC_CACHE_MISSES, ratio);
|
||||
out->print_metric(config, out->ctx, color, "%7.2f%%", "of all L1-icache hits", ratio);
|
||||
out->print_metric(config, out->ctx, color, "%7.2f%%", "of all L1-icache accesses", ratio);
|
||||
}
|
||||
|
||||
static void print_dtlb_cache_misses(struct perf_stat_config *config,
|
||||
|
@ -558,7 +558,7 @@ static void print_dtlb_cache_misses(struct perf_stat_config *config,
|
|||
ratio = avg / total * 100.0;
|
||||
|
||||
color = get_ratio_color(GRC_CACHE_MISSES, ratio);
|
||||
out->print_metric(config, out->ctx, color, "%7.2f%%", "of all dTLB cache hits", ratio);
|
||||
out->print_metric(config, out->ctx, color, "%7.2f%%", "of all dTLB cache accesses", ratio);
|
||||
}
|
||||
|
||||
static void print_itlb_cache_misses(struct perf_stat_config *config,
|
||||
|
@ -578,7 +578,7 @@ static void print_itlb_cache_misses(struct perf_stat_config *config,
|
|||
ratio = avg / total * 100.0;
|
||||
|
||||
color = get_ratio_color(GRC_CACHE_MISSES, ratio);
|
||||
out->print_metric(config, out->ctx, color, "%7.2f%%", "of all iTLB cache hits", ratio);
|
||||
out->print_metric(config, out->ctx, color, "%7.2f%%", "of all iTLB cache accesses", ratio);
|
||||
}
|
||||
|
||||
static void print_ll_cache_misses(struct perf_stat_config *config,
|
||||
|
@ -598,7 +598,7 @@ static void print_ll_cache_misses(struct perf_stat_config *config,
|
|||
ratio = avg / total * 100.0;
|
||||
|
||||
color = get_ratio_color(GRC_CACHE_MISSES, ratio);
|
||||
out->print_metric(config, out->ctx, color, "%7.2f%%", "of all LL-cache hits", ratio);
|
||||
out->print_metric(config, out->ctx, color, "%7.2f%%", "of all LL-cache accesses", ratio);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -853,14 +853,16 @@ static void generic_metric(struct perf_stat_config *config,
|
|||
double test_generic_metric(struct metric_expr *mexp, int cpu, struct runtime_stat *st)
|
||||
{
|
||||
struct expr_parse_ctx pctx;
|
||||
double ratio;
|
||||
double ratio = 0.0;
|
||||
|
||||
if (prepare_metric(mexp->metric_events, mexp->metric_refs, &pctx, cpu, st) < 0)
|
||||
return 0.;
|
||||
goto out;
|
||||
|
||||
if (expr__parse(&ratio, &pctx, mexp->metric_expr, 1))
|
||||
return 0.;
|
||||
ratio = 0.0;
|
||||
|
||||
out:
|
||||
expr__ctx_clear(&pctx);
|
||||
return ratio;
|
||||
}
|
||||
|
||||
|
@ -918,7 +920,7 @@ void perf_stat__print_shadow_stats(struct perf_stat_config *config,
|
|||
if (runtime_stat_n(st, STAT_L1_DCACHE, ctx, cpu) != 0)
|
||||
print_l1_dcache_misses(config, cpu, evsel, avg, out, st);
|
||||
else
|
||||
print_metric(config, ctxp, NULL, NULL, "of all L1-dcache hits", 0);
|
||||
print_metric(config, ctxp, NULL, NULL, "of all L1-dcache accesses", 0);
|
||||
} else if (
|
||||
evsel->core.attr.type == PERF_TYPE_HW_CACHE &&
|
||||
evsel->core.attr.config == ( PERF_COUNT_HW_CACHE_L1I |
|
||||
|
@ -928,7 +930,7 @@ void perf_stat__print_shadow_stats(struct perf_stat_config *config,
|
|||
if (runtime_stat_n(st, STAT_L1_ICACHE, ctx, cpu) != 0)
|
||||
print_l1_icache_misses(config, cpu, evsel, avg, out, st);
|
||||
else
|
||||
print_metric(config, ctxp, NULL, NULL, "of all L1-icache hits", 0);
|
||||
print_metric(config, ctxp, NULL, NULL, "of all L1-icache accesses", 0);
|
||||
} else if (
|
||||
evsel->core.attr.type == PERF_TYPE_HW_CACHE &&
|
||||
evsel->core.attr.config == ( PERF_COUNT_HW_CACHE_DTLB |
|
||||
|
@ -938,7 +940,7 @@ void perf_stat__print_shadow_stats(struct perf_stat_config *config,
|
|||
if (runtime_stat_n(st, STAT_DTLB_CACHE, ctx, cpu) != 0)
|
||||
print_dtlb_cache_misses(config, cpu, evsel, avg, out, st);
|
||||
else
|
||||
print_metric(config, ctxp, NULL, NULL, "of all dTLB cache hits", 0);
|
||||
print_metric(config, ctxp, NULL, NULL, "of all dTLB cache accesses", 0);
|
||||
} else if (
|
||||
evsel->core.attr.type == PERF_TYPE_HW_CACHE &&
|
||||
evsel->core.attr.config == ( PERF_COUNT_HW_CACHE_ITLB |
|
||||
|
@ -948,7 +950,7 @@ void perf_stat__print_shadow_stats(struct perf_stat_config *config,
|
|||
if (runtime_stat_n(st, STAT_ITLB_CACHE, ctx, cpu) != 0)
|
||||
print_itlb_cache_misses(config, cpu, evsel, avg, out, st);
|
||||
else
|
||||
print_metric(config, ctxp, NULL, NULL, "of all iTLB cache hits", 0);
|
||||
print_metric(config, ctxp, NULL, NULL, "of all iTLB cache accesses", 0);
|
||||
} else if (
|
||||
evsel->core.attr.type == PERF_TYPE_HW_CACHE &&
|
||||
evsel->core.attr.config == ( PERF_COUNT_HW_CACHE_LL |
|
||||
|
@ -958,7 +960,7 @@ void perf_stat__print_shadow_stats(struct perf_stat_config *config,
|
|||
if (runtime_stat_n(st, STAT_LL_CACHE, ctx, cpu) != 0)
|
||||
print_ll_cache_misses(config, cpu, evsel, avg, out, st);
|
||||
else
|
||||
print_metric(config, ctxp, NULL, NULL, "of all LL-cache hits", 0);
|
||||
print_metric(config, ctxp, NULL, NULL, "of all LL-cache accesses", 0);
|
||||
} else if (evsel__match(evsel, HARDWARE, HW_CACHE_MISSES)) {
|
||||
total = runtime_stat_avg(st, STAT_CACHEREFS, ctx, cpu);
|
||||
|
||||
|
|
Loading…
Reference in New Issue