perf/core improvements and fixes
Subsystems (6)
Arnaldo Carvalho de Melo
maintainerHi Ingo/Thomas,
Please consider pulling,
Best regards,
- Arnaldo
Test results at the end of this message, as usual.
The following changes since commit b9fb2de0115bbacab36da31fd10483ea66d9cfab:
Merge tag 'perf-urgent-for-mingo-5.5-20191223' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent (2019-12-23 22:27:44 +0100)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-core-for-mingo-5.6-20200106
for you to fetch changes up to 6c4798d3f08b81c2c52936b10e0fa872590c96ae:
tools lib: Fix builds when glibc contains strlcpy() (2020-01-06 11:46:10 -0300)
----------------------------------------------------------------
perf/core improvements and fixes.
perf record:
Alexey Budankov:
- Adapt affinity for machines with #CPUs > 1K to overcome current 1024 CPUs mask size limitation of cpu_set_t type.
perf report/top TUI:
Arnaldo Carvalho de Melo:
- Make ENTER consistently present the pop up menu with and without call chains, to eliminate confusion. The menu continues available at all times use 'm' and '+' can be used to toggle just one call chain level, 'e' for all the call chains for a top level histogram entry and 'E' to expand all call chains in all top level entries. Extra info about these options was added to the pop up menu entries. Pressing 'k' serves as special hotkey to go straight to the main vmlinux entries, to avoid having to press enter and then select "Zoom into the kernel DSO".
perf sched timehist:
David Ahern:
- Add support for filtering on CPU.
perf tests:
Arnaldo Carvalho de Melo:
- Show expected versus obtained values in bp_signal test.
libperf:
Jiri Olsa:
- Move to tools/lib/perf.
- Add man pages.
libapi:
Andrey Zhizhikin:
- Fix gcc9 stringop-truncation compilation error.
tools lib:
Vitaly Chikunov:
- Fix builds when glibc contains strlcpy(), which is the case for ALT Linux.
----------------------------------------------------------------
Alexey Budankov (3):
tools bitmap: Implement bitmap_equal() operation at bitmap API perf mmap: Declare type for cpu mask of arbitrary length perf record: Adapt affinity to machines with #CPUs > 1K
Andrey Zhizhikin (1):
tools lib api fs: Fix gcc9 stringop-truncation compilation error
Arnaldo Carvalho de Melo (12):
perf tests bp_signal: Show expected versus obtained values
perf hists browser: Restore ESC as "Zoom out" of DSO/thread/etc
perf report/top: Make ENTER consistently bring up menu
perf report/top: Add menu entry for toggling callchain expansion
perf report/top: Improve toggle callchain menu option
perf hists browser: Generalize the do_zoom_dso() function
perf report/top: Add 'k' hotkey to zoom directly into the kernel map perf hists browser: Allow passing an initial hotkey
tools ui popup: Allow returning hotkeys
perf report/top: Allow pressing hotkeys in the options popup menu perf report/top: Do not offer annotation for symbols without samples perf report/top: Make 'e' visible in the help and make it toggle showing callchains
David Ahern (1):
perf sched timehist: Add support for filtering on CPU
Jiri Olsa (2):
libperf: Move to tools/lib/perf
libperf: Add man pages
Vitaly Chikunov (1):
tools lib: Fix builds when glibc contains strlcpy()
tools/include/linux/bitmap.h | 30 +++
tools/include/linux/string.h | 8 +
tools/lib/api/fs/fs.c | 4 +-
tools/lib/bitmap.c | 15 ++
tools/{perf/lib => lib/perf}/Build | 0
tools/lib/perf/Documentation/Makefile | 156 ++++++++++++
tools/lib/perf/Documentation/asciidoc.conf | 120 +++++++++
tools/lib/perf/Documentation/examples/sampling.c | 119 +++++++++
tools/lib/perf/Documentation/libperf-counting.txt | 211 ++++++++++++++++
tools/lib/perf/Documentation/libperf-sampling.txt | 243 ++++++++++++++++++
tools/lib/perf/Documentation/libperf.txt | 246 ++++++++++++++++++
tools/lib/perf/Documentation/manpage-1.72.xsl | 14 ++
tools/lib/perf/Documentation/manpage-base.xsl | 35 +++
.../perf/Documentation/manpage-bold-literal.xsl | 17 ++
tools/lib/perf/Documentation/manpage-normal.xsl | 13 +
.../lib/perf/Documentation/manpage-suppress-sp.xsl | 21 ++
tools/{perf/lib => lib/perf}/Makefile | 7 +-
tools/{perf/lib => lib/perf}/core.c | 0
tools/{perf/lib => lib/perf}/cpumap.c | 0
tools/{perf/lib => lib/perf}/evlist.c | 0
tools/{perf/lib => lib/perf}/evsel.c | 0
.../lib => lib/perf}/include/internal/cpumap.h | 0
.../lib => lib/perf}/include/internal/evlist.h | 0
.../lib => lib/perf}/include/internal/evsel.h | 0
.../{perf/lib => lib/perf}/include/internal/lib.h | 0
.../{perf/lib => lib/perf}/include/internal/mmap.h | 0
.../lib => lib/perf}/include/internal/tests.h | 0
.../lib => lib/perf}/include/internal/threadmap.h | 0
.../lib => lib/perf}/include/internal/xyarray.h | 0
tools/{perf/lib => lib/perf}/include/perf/core.h | 0
tools/{perf/lib => lib/perf}/include/perf/cpumap.h | 0
tools/{perf/lib => lib/perf}/include/perf/event.h | 0
tools/{perf/lib => lib/perf}/include/perf/evlist.h | 0
tools/{perf/lib => lib/perf}/include/perf/evsel.h | 0
tools/{perf/lib => lib/perf}/include/perf/mmap.h | 0
.../lib => lib/perf}/include/perf/threadmap.h | 0
tools/{perf/lib => lib/perf}/internal.h | 0
tools/{perf/lib => lib/perf}/lib.c | 0
tools/{perf/lib => lib/perf}/libperf.map | 0
tools/{perf/lib => lib/perf}/libperf.pc.template | 0
tools/{perf/lib => lib/perf}/mmap.c | 0
tools/{perf/lib => lib/perf}/tests/Makefile | 2 +-
tools/{perf/lib => lib/perf}/tests/test-cpumap.c | 0
tools/{perf/lib => lib/perf}/tests/test-evlist.c | 0
tools/{perf/lib => lib/perf}/tests/test-evsel.c | 0
.../{perf/lib => lib/perf}/tests/test-threadmap.c | 0
tools/{perf/lib => lib/perf}/threadmap.c | 0
tools/{perf/lib => lib/perf}/xyarray.c | 0
tools/lib/string.c | 7 +
tools/perf/Documentation/perf-sched.txt | 4 +
tools/perf/MANIFEST | 1 +
tools/perf/Makefile.config | 2 +-
tools/perf/Makefile.perf | 2 +-
tools/perf/builtin-c2c.c | 4 +-
tools/perf/builtin-record.c | 28 ++-
tools/perf/builtin-sched.c | 13 +
tools/perf/lib/Documentation/Makefile | 7 -
tools/perf/lib/Documentation/man/libperf.rst | 100 --------
tools/perf/lib/Documentation/tutorial/tutorial.rst | 123 ---------
tools/perf/tests/bp_signal.c | 10 +-
tools/perf/ui/browsers/hists.c | 277 ++++++++++++++-------
tools/perf/ui/browsers/hists.h | 2 +-
tools/perf/ui/browsers/res_sample.c | 2 +-
tools/perf/ui/browsers/scripts.c | 2 +-
tools/perf/ui/tui/util.c | 12 +-
tools/perf/ui/util.h | 2 +-
tools/perf/util/mmap.c | 40 ++-
tools/perf/util/mmap.h | 13 +-
tools/perf/util/sort.c | 3 +-
tools/perf/util/sort.h | 2 +
70 files changed, 1565 insertions(+), 352 deletions(-)
rename tools/{perf/lib => lib/perf}/Build (100%)
create mode 100644 tools/lib/perf/Documentation/Makefile
create mode 100644 tools/lib/perf/Documentation/asciidoc.conf
create mode 100644 tools/lib/perf/Documentation/examples/sampling.c
create mode 100644 tools/lib/perf/Documentation/libperf-counting.txt
create mode 100644 tools/lib/perf/Documentation/libperf-sampling.txt
create mode 100644 tools/lib/perf/Documentation/libperf.txt
create mode 100644 tools/lib/perf/Documentation/manpage-1.72.xsl
create mode 100644 tools/lib/perf/Documentation/manpage-base.xsl
create mode 100644 tools/lib/perf/Documentation/manpage-bold-literal.xsl
create mode 100644 tools/lib/perf/Documentation/manpage-normal.xsl
create mode 100644 tools/lib/perf/Documentation/manpage-suppress-sp.xsl
rename tools/{perf/lib => lib/perf}/Makefile (96%)
rename tools/{perf/lib => lib/perf}/core.c (100%)
rename tools/{perf/lib => lib/perf}/cpumap.c (100%)
rename tools/{perf/lib => lib/perf}/evlist.c (100%)
rename tools/{perf/lib => lib/perf}/evsel.c (100%)
rename tools/{perf/lib => lib/perf}/include/internal/cpumap.h (100%)
rename tools/{perf/lib => lib/perf}/include/internal/evlist.h (100%)
rename tools/{perf/lib => lib/perf}/include/internal/evsel.h (100%)
rename tools/{perf/lib => lib/perf}/include/internal/lib.h (100%)
rename tools/{perf/lib => lib/perf}/include/internal/mmap.h (100%)
rename tools/{perf/lib => lib/perf}/include/internal/tests.h (100%)
rename tools/{perf/lib => lib/perf}/include/internal/threadmap.h (100%)
rename tools/{perf/lib => lib/perf}/include/internal/xyarray.h (100%)
rename tools/{perf/lib => lib/perf}/include/perf/core.h (100%)
rename tools/{perf/lib => lib/perf}/include/perf/cpumap.h (100%)
rename tools/{perf/lib => lib/perf}/include/perf/event.h (100%)
rename tools/{perf/lib => lib/perf}/include/perf/evlist.h (100%)
rename tools/{perf/lib => lib/perf}/include/perf/evsel.h (100%)
rename tools/{perf/lib => lib/perf}/include/perf/mmap.h (100%)
rename tools/{perf/lib => lib/perf}/include/perf/threadmap.h (100%)
rename tools/{perf/lib => lib/perf}/internal.h (100%)
rename tools/{perf/lib => lib/perf}/lib.c (100%)
rename tools/{perf/lib => lib/perf}/libperf.map (100%)
rename tools/{perf/lib => lib/perf}/libperf.pc.template (100%)
rename tools/{perf/lib => lib/perf}/mmap.c (100%)
rename tools/{perf/lib => lib/perf}/tests/Makefile (93%)
rename tools/{perf/lib => lib/perf}/tests/test-cpumap.c (100%)
rename tools/{perf/lib => lib/perf}/tests/test-evlist.c (100%)
rename tools/{perf/lib => lib/perf}/tests/test-evsel.c (100%)
rename tools/{perf/lib => lib/perf}/tests/test-threadmap.c (100%)
rename tools/{perf/lib => lib/perf}/threadmap.c (100%)
rename tools/{perf/lib => lib/perf}/xyarray.c (100%)
delete mode 100644 tools/perf/lib/Documentation/Makefile
delete mode 100644 tools/perf/lib/Documentation/man/libperf.rst
delete mode 100644 tools/perf/lib/Documentation/tutorial/tutorial.rstTest 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.
Clearlinux is failing when due to:
.gnu.debuglto_.debug_macro' referenced in section .gnu.debuglto_.debug_macro' of /tmp/build/perf/util/scripting-engines/perf-in.o: defined in discarded section `.gnu.debuglto_.debug_macro[wm4.stdcpredef.h.19.8dc41bed5d9037ff9622e015fb5f0ce3]' of /tmp/build/perf/util/scripting-engines/perf-in.o
OpenMandriva Cooker works well with gcc, uncovers a bug where we have to get compiler-clang.h from the kernel sources, will be fixed soon.
With the update of linux/linkage.h to move from ENTRY()/ENDPROC() to SYM_FUNC_START()/etc some of the older containers can't be used with clang, as the minimum version for the constructs used in the new linkage.h is 3.5, older versions (3.4, 3.4.2, etc) end up with:
bench/../../arch/x86/lib/memcpy_64.S:44:14: error: unexpected token in '.type' directive .type MEMCPY STT_FUNC ; .size MEMCPY, .-MEMCPY
^
# export PERF_TARBALL=http://192.168.124.1/perf/perf-5.5.0-rc3.tar.xz # dm 1 alpine:3.4 : Ok gcc (Alpine 5.3.0) 5.3.0, clang version 3.8.0 (tags/RELEASE_380/final) 2 alpine:3.5 : Ok gcc (Alpine 6.2.1) 6.2.1 20160822, clang version 3.8.1 (tags/RELEASE_381/final) 3 alpine:3.6 : Ok gcc (Alpine 6.3.0) 6.3.0, clang version 4.0.0 (tags/RELEASE_400/final) 4 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 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 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 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 alpine:3.11 : Ok gcc (Alpine 9.2.0) 9.2.0, Alpine clang version 9.0.0 (https://git.alpinelinux.org/aports f7f0d2c2b8bcd6a5843401a9a702029556492689) (based on LLVM 9.0.0) 9 alpine:edge : Ok gcc (Alpine 9.2.0) 9.2.0, Alpine clang version 9.0.0 (git://git.alpinelinux.org/aports 25c73ae7b95bdb42ae5f0ceac3b703e766582527) (based on LLVM 9.0.0) 10 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 alt:p9 : Ok x86_64-alt-linux-gcc (GCC) 8.3.1 20190507 (ALT p9 8.3.1-alt5), clang version 7.0.1 12 alt:sisyphus : Ok x86_64-alt-linux-gcc (GCC) 9.2.1 20190827 (ALT Sisyphus 9.2.1-alt2), clang version 7.0.1 13 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 amazonlinux:2 : Ok gcc (GCC) 7.3.1 20180712 (Red Hat 7.3.1-6), clang version 7.0.1 (Amazon Linux 2 7.0.1-1.amzn2.0.2) 15 android-ndk:r12b-arm : Ok arm-linux-androideabi-gcc (GCC) 4.9.x 20150123 (prerelease) 16 android-ndk:r15c-arm : Ok arm-linux-androideabi-gcc (GCC) 4.9.x 20150123 (prerelease) 17 centos:5 : Ok gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-55) 18 centos:6 : Ok gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-23) 19 centos:7 : Ok gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39) 20 centos:8 : Ok gcc (GCC) 8.2.1 20180905 (Red Hat 8.2.1-3), clang version 7.0.1 (tags/RELEASE_701/final) 21 clearlinux:latest : Ok gcc (Clear Linux OS for Intel Architecture) 9.2.1 20191210 gcc-9-branch@279166, clang version 9.0.0 (tags/RELEASE_900/final) 22 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 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 debian:10 : Ok gcc (Debian 8.3.0-6) 8.3.0, clang version 7.0.1-8 (tags/RELEASE_701/final) 25 debian:experimental : Ok gcc (Debian 9.2.1-19) 9.2.1 20191109, clang version 8.0.1-4 (tags/RELEASE_801/final) 26 debian:experimental-x-arm64 : Ok aarch64-linux-gnu-gcc (Debian 8.3.0-19) 8.3.0 27 debian:experimental-x-mips : Ok mips-linux-gnu-gcc (Debian 8.3.0-19) 8.3.0 28 debian:experimental-x-mips64 : Ok mips64-linux-gnuabi64-gcc (Debian 9.2.1-8) 9.2.1 20190909 29 debian:experimental-x-mipsel : Ok mipsel-linux-gnu-gcc (Debian 9.2.1-8) 9.2.1 20190909 30 fedora:20 : Ok gcc (GCC) 4.8.3 20140911 (Red Hat 4.8.3-7) 31 fedora:22 : Ok gcc (GCC) 5.3.1 20160406 (Red Hat 5.3.1-6), clang version 3.5.0 (tags/RELEASE_350/final) 32 fedora:23 : Ok gcc (GCC) 5.3.1 20160406 (Red Hat 5.3.1-6), clang version 3.7.0 (tags/RELEASE_370/final) 33 fedora:24 : Ok gcc (GCC) 6.3.1 20161221 (Red Hat 6.3.1-1), clang version 3.8.1 (tags/RELEASE_381/final) 34 fedora:24-x-ARC-uClibc : Ok arc-linux-gcc (ARCompact ISA Linux uClibc toolchain 2017.09-rc2) 7.1.1 20170710 35 fedora:25 : Ok gcc (GCC) 6.4.1 20170727 (Red Hat 6.4.1-1), clang version 3.9.1 (tags/RELEASE_391/final) 36 fedora:26 : Ok gcc (GCC) 7.3.1 20180130 (Red Hat 7.3.1-2), clang version 4.0.1 (tags/RELEASE_401/final) 37 fedora:27 : Ok gcc (GCC) 7.3.1 20180712 (Red Hat 7.3.1-6), clang version 5.0.2 (tags/RELEASE_502/final) 38 fedora:28 : Ok gcc (GCC) 8.3.1 20190223 (Red Hat 8.3.1-2), clang version 6.0.1 (tags/RELEASE_601/final) 39 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) 40 fedora:30 : Ok gcc (GCC) 9.2.1 20190827 (Red Hat 9.2.1-1), clang version 8.0.0 (Fedora 8.0.0-3.fc30) 41 fedora:30-x-ARC-glibc : Ok arc-linux-gcc (ARC HS GNU/Linux glibc toolchain 2019.03-rc1) 8.3.1 20190225 42 fedora:30-x-ARC-uClibc : Ok arc-linux-gcc (ARCv2 ISA Linux uClibc toolchain 2019.03-rc1) 8.3.1 20190225 43 fedora:31 : Ok gcc (GCC) 9.2.1 20190827 (Red Hat 9.2.1-1), clang version 9.0.0 (Fedora 9.0.0-1.fc31) 44 fedora:32 : Ok gcc (GCC) 9.2.1 20190827 (Red Hat 9.2.1-1), clang version 9.0.0 (Fedora 9.0.0-1.fc32) 45 fedora:rawhide : Ok gcc (GCC) 9.2.1 20190827 (Red Hat 9.2.1-1), clang version 9.0.0 (Fedora 9.0.0-1.fc32) 46 gentoo-stage3-amd64:latest : Ok gcc (Gentoo 9.2.0-r2 p3) 9.2.0 47 mageia:5 : Ok gcc (GCC) 4.9.2, clang version 3.5.2 (tags/RELEASE_352/final) 48 mageia:6 : Ok gcc (Mageia 5.5.0-1.mga6) 5.5.0, clang version 3.9.1 (tags/RELEASE_391/final) 49 mageia:7 : Ok gcc (Mageia 8.3.1-0.20190524.1.mga7) 8.3.1 20190524, clang version 8.0.0 (Mageia 8.0.0-1.mga7) 50 manjaro:latest : Ok gcc (GCC) 9.2.0, clang version 9.0.0 (tags/RELEASE_900/final) 51 openmandriva:cooker : Ok gcc (GCC) 9.2.1 20191123 (OpenMandriva) 52 opensuse:15.0 : Ok gcc (SUSE Linux) 7.4.1 20190424 [gcc-7-branch revision 270538], clang version 5.0.1 (tags/RELEASE_501/final 312548) 53 opensuse:15.1 : Ok gcc (SUSE Linux) 7.4.1 20190905 [gcc-7-branch revision 275407], clang version 7.0.1 (tags/RELEASE_701/final 349238) 54 opensuse:15.2 : Ok gcc (SUSE Linux) 7.4.1 20190905 [gcc-7-branch revision 275407], clang version 7.0.1 (tags/RELEASE_701/final 349238) 55 opensuse:42.3 : Ok gcc (SUSE Linux) 4.8.5, clang version 3.8.0 (tags/RELEASE_380/final 262553) 56 opensuse:tumbleweed : Ok gcc (SUSE Linux) 9.2.1 20190903 [gcc-9-branch revision 275330], clang version 9.0.0 (tags/RELEASE_900/final 372316) 57 oraclelinux:6 : Ok gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-23.0.1) 58 oraclelinux:7 : Ok gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39.0.3) 59 oraclelinux:8 : Ok gcc (GCC) 8.2.1 20180905 (Red Hat 8.2.1-3.0.1), clang version 7.0.1 (tags/RELEASE_701/final) 60 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) 61 ubuntu:14.04 : Ok gcc (Ubuntu 4.8.4-2ubuntu1~14.04.4) 4.8.4 62 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) 63 ubuntu:16.04-x-arm : Ok arm-linux-gnueabihf-gcc (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609 64 ubuntu:16.04-x-arm64 : Ok aarch64-linux-gnu-gcc (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609 65 ubuntu:16.04-x-powerpc : Ok powerpc-linux-gnu-gcc (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609 66 ubuntu:16.04-x-powerpc64 : Ok powerpc64-linux-gnu-gcc (Ubuntu/IBM 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609 67 ubuntu:16.04-x-powerpc64el : Ok powerpc64le-linux-gnu-gcc (Ubuntu/IBM 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609 68 ubuntu:16.04-x-s390 : Ok s390x-linux-gnu-gcc (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609 69 ubuntu:18.04 : Ok gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0, clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final) 70 ubuntu:18.04-x-arm : Ok arm-linux-gnueabihf-gcc (Ubuntu/Linaro 7.4.0-1ubuntu1~18.04.1) 7.4.0 71 ubuntu:18.04-x-arm64 : Ok aarch64-linux-gnu-gcc (Ubuntu/Linaro 7.4.0-1ubuntu1~18.04.1) 7.4.0 72 ubuntu:18.04-x-m68k : Ok m68k-linux-gnu-gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0 73 ubuntu:18.04-x-powerpc : Ok powerpc-linux-gnu-gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0 74 ubuntu:18.04-x-powerpc64 : Ok powerpc64-linux-gnu-gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0 75 ubuntu:18.04-x-powerpc64el : Ok powerpc64le-linux-gnu-gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0 76 ubuntu:18.04-x-riscv64 : Ok riscv64-linux-gnu-gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0 77 ubuntu:18.04-x-s390 : Ok s390x-linux-gnu-gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0 78 ubuntu:18.04-x-sh4 : Ok sh4-linux-gnu-gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0 79 ubuntu:18.04-x-sparc64 : Ok sparc64-linux-gnu-gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0 80 ubuntu:18.10 : Ok gcc (Ubuntu 8.3.0-6ubuntu1~18.10.1) 8.3.0, clang version 7.0.0-3 (tags/RELEASE_700/final) 81 ubuntu:19.04 : Ok gcc (Ubuntu 8.3.0-6ubuntu1) 8.3.0, clang version 8.0.0-3 (tags/RELEASE_800/final) 82 ubuntu:19.04-x-alpha : Ok alpha-linux-gnu-gcc (Ubuntu 8.3.0-6ubuntu1) 8.3.0 83 ubuntu:19.04-x-arm64 : Ok aarch64-linux-gnu-gcc (Ubuntu/Linaro 8.3.0-6ubuntu1) 8.3.0 84 ubuntu:19.04-x-hppa : Ok hppa-linux-gnu-gcc (Ubuntu 8.3.0-6ubuntu1) 8.3.0 85 ubuntu:19.10 : Ok gcc (Ubuntu 9.2.1-9ubuntu2) 9.2.1 20191008, clang version 9.0.0-2 (tags/RELEASE_900/final) #
# uname -a
Linux quaco 5.5.0-rc4+ #2 SMP Thu Jan 2 11:17:21 -03 2020 x86_64 x86_64 x86_64 GNU/Linux
# git log --oneline -1
6c4798d3f08b tools lib: Fix builds when glibc contains strlcpy()
# perf version --build-options
perf version 5.5.rc3.g6c4798d3f08b
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: DSO data read : Ok
11: DSO data cache : Ok
12: DSO data reopen : Ok
13: Roundtrip evsel->name : Ok
14: Parse sched tracepoints fields : Ok
15: syscalls:sys_enter_openat event fields : Ok
16: Setup struct perf_event_attr : Ok
17: Match and link multiple hists : Ok
18: 'import perf' in python : Ok
19: Breakpoint overflow signal handler : Ok
20: Breakpoint overflow sampling : Ok
21: Breakpoint accounting : Ok
22: Watchpoint :
22.1: Read Only Watchpoint : Skip
22.2: Write Only Watchpoint : Ok
22.3: Read / Write Watchpoint : Ok
22.4: Modify Watchpoint : Ok
23: Number of exit events of a simple workload : Ok
24: Software clock events period values : Ok
25: Object code reading : Ok
26: Sample parsing : Ok
27: Use a dummy software event to keep tracking : Ok
28: Parse with no sample_id_all bit set : Ok
29: Filter hist entries : Ok
30: Lookup mmap thread : Ok
31: Share thread maps : Ok
32: Sort output of hist entries : Ok
33: Cumulate child hist entries : Ok
34: Track with sched_switch : Ok
35: Filter fds with revents mask in a fdarray : Ok
36: Add fd to a fdarray, making it autogrow : Ok
37: kmod_path__parse : Ok
38: Thread map : Ok
39: LLVM search and compile :
39.1: Basic BPF llvm compile : Ok
39.2: kbuild searching : Ok
39.3: Compile source for BPF prologue generation : Ok
39.4: Compile source for BPF relocation : Ok
40: Session topology : Ok
41: BPF filter :
41.1: Basic BPF filtering : Ok
41.2: BPF pinning : Ok
41.3: BPF prologue generation : Ok
41.4: BPF relocation checker : Ok
42: Synthesize thread map : Ok
43: Remove thread map : Ok
44: Synthesize cpu map : Ok
45: Synthesize stat config : Ok
46: Synthesize stat : Ok
47: Synthesize stat round : Ok
48: Synthesize attr update : Ok
49: Event times : Ok
50: Read backward ring buffer : Ok
51: Print cpu map : Ok
52: Merge cpu map : Ok
53: Probe SDT events : Ok
54: is_printable_array : Ok
55: Print bitmap : Ok
56: perf hooks : Ok
57: builtin clang support : Skip (not compiled in)
58: unit_number__scnprintf : Ok
59: mem2node : Ok
60: time utils : Ok
61: Test jit_write_elf : Ok
62: maps__merge_in : Ok
63: x86 rdpmc : Ok
64: Convert perf time to TSC : Ok
65: DWARF unwind : Ok
66: x86 instruction decoder - new instructions : Ok
67: Intel PT packet decoder : Ok
68: x86 bp modify : Ok
69: probe libc's inet_pton & backtrace it with ping : Ok
70: Use vfs_getname probe to get syscall args filenames : Ok
71: Add vfs_getname probe to get syscall args filenames : Ok
72: Check open filename arg using perf trace + vfs_getname: Ok
73: Zstd perf.data compression/decompression : Ok $ time make -C tools/perf build-test
make: Entering directory '/home/acme/git/perf/tools/perf'
- tarpkg: ./tests/perf-targz-src-pkg .
make_util_pmu_bison_o_O: make util/pmu-bison.o
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
make_doc_O: make doc
make_no_libbionic_O: make NO_LIBBIONIC=1
make_no_libbpf_O: make NO_LIBBPF=1
make_install_prefix_slash_O: make install prefix=/tmp/krava/
make_cscope_O: make cscope
make_clean_all_O: make clean all
make_install_bin_O: make install-bin
make_no_libpython_O: make NO_LIBPYTHON=1
make_static_O: make LDFLAGS=-static NO_PERF_READ_VDSO32=1 NO_PERF_READ_VDSOX32=1 NO_JVMTI=1
make_util_map_o_O: make util/map.o
make_perf_o_O: make perf.o
make_with_babeltrace_O: make LIBBABELTRACE=1
make_no_newt_O: make NO_NEWT=1
make_debug_O: make DEBUG=1
make_no_libaudit_O: make NO_LIBAUDIT=1
make_no_scripts_O: make NO_LIBPYTHON=1 NO_LIBPERL=1
make_no_backtrace_O: make NO_BACKTRACE=1
make_with_clangllvm_O: make LIBCLANGLLVM=1
make_no_libunwind_O: make NO_LIBUNWIND=1
make_install_O: make install
make_no_libdw_dwarf_unwind_O: make NO_LIBDW_DWARF_UNWIND=1
make_help_O: make help
make_no_libnuma_O: make NO_LIBNUMA=1
make_no_slang_O: make NO_SLANG=1
make_no_demangle_O: make NO_DEMANGLE=1
make_no_libperl_O: make NO_LIBPERL=1
make_no_gtk2_O: make NO_GTK2=1
make_tags_O: make tags
make_no_ui_O: make NO_NEWT=1 NO_SLANG=1 NO_GTK2=1
make_no_auxtrace_O: make NO_AUXTRACE=1
make_pure_O: make
make_no_libelf_O: make NO_LIBELF=1
make_install_prefix_O: make install prefix=/tmp/krava
OK
make: Leaving directory '/home/acme/git/perf/tools/perf'
$Arnaldo Carvalho de Melo
maintainerPATCH 1/20 tools bitmap: Implement bitmap_equal() operation at bitmap API
From: Alexey Budankov <[email protected]>
Extend tools bitmap API with bitmap_equal() implementation.
The implementation has been derived from the kernel.
Extend tools bitmap API with bitmap_free() implementation for symmetry with bitmap_alloc() function.
--- tools/include/linux/bitmap.h | 30 ++++++++++++++++++++++++++++++ tools/lib/bitmap.c | 15 +++++++++++++++ 2 files changed, 45 insertions(+)
tools/include/linux/bitmap.h +30 -0
@@ -15,6 +15,8 @@ void __bitmap_or(unsigned long *dst, const unsigned long *bitmap1, const unsigned long *bitmap2, int bits);int __bitmap_and (unsigned long *dst,const unsigned long *bitmap1,const unsigned long *bitmap2,unsigned int bits); +int __bitmap_equal (const unsigned long *bitmap1, +const unsigned long *bitmap2,unsigned int bits);void bitmap_clear (unsigned long *map,unsigned int start,int len);#define BITMAP_FIRST_WORD_MASK (start) (~0UL << ((start) & (BITS_PER_LONG - 1)))
@@ -123,6 +125,15 @@ static inline unsigned long *bitmap_alloc(int nbits)return calloc (1 ,BITS_TO_LONGS (nbits) *sizeof (unsigned long )); } +/* +* bitmap_free - Free bitmap +* @bitmap: pointer to bitmap +*/ +static inline void bitmap_free (unsigned long *bitmap) +{ +free (bitmap); +} +/* * bitmap_scnprintf - print bitmap list into buffer * @bitmap: bitmap
@@ -148,4 +159,23 @@ static inline int bitmap_and(unsigned long *dst, const unsigned long *src1, return __bitmap_and(dst, src1, src2, nbits); } +#ifdef __LITTLE_ENDIAN +#define BITMAP_MEM_ALIGNMENT 8 +#else +#define BITMAP_MEM_ALIGNMENT (8 * sizeof(unsigned long)) +#endif +#define BITMAP_MEM_MASK (BITMAP_MEM_ALIGNMENT - 1) +#define IS_ALIGNED (x, a) (((x) & ((typeof(x))(a) - 1)) == 0) + +static inline int bitmap_equal (const unsigned long *src1, +const unsigned long *src2,unsigned int nbits) +{ +if (small_const_nbits (nbits)) +return !((*src1 ^ *src2) &BITMAP_LAST_WORD_MASK (nbits)); +if (__builtin_constant_p (nbits &BITMAP_MEM_MASK ) && +IS_ALIGNED (nbits,BITMAP_MEM_ALIGNMENT )) +return !memcmp (src1, src2, nbits /8 ); +return __bitmap_equal (src1, src2, nbits); +} +#endif /* _PERF_BITOPS_H */
tools/lib/bitmap.c +15 -0
@@ -71,3 +71,18 @@ int __bitmap_and(unsigned long *dst, const unsigned long *bitmap1, BITMAP_LAST_WORD_MASK(bits));return result !=0 ; } + +int __bitmap_equal (const unsigned long *bitmap1, +const unsigned long *bitmap2,unsigned int bits) +{ +unsigned int k, lim = bits/BITS_PER_LONG ; +for (k =0 ; k < lim; ++k) +if (bitmap1[k] != bitmap2[k]) +return 0 ; + +if (bits %BITS_PER_LONG ) +if ((bitmap1[k] ^ bitmap2[k]) &BITMAP_LAST_WORD_MASK (bits)) +return 0 ; + +return 1 ; +}
Signature · 1 line
2.21.1
Arnaldo Carvalho de Melo
maintainerPATCH 2/20 perf mmap: Declare type for cpu mask of arbitrary length
In reply to Arnaldo Carvalho de MeloFrom: Alexey Budankov <[email protected]>
Declare a dedicated struct map_cpu_mask type for cpu masks of arbitrary length.
The mask is available thru bits pointer and the mask length is kept in nbits field. MMAP_CPU_MASK_BYTES() macro returns mask storage size in bytes.
The mmap_cpu_mask__scnprintf() function can be used to log text representation of the mask.
Committer notes:
To print the 'nbits' struct member we must use %zd, since it is a size_t, this fixes the build in some toolchains/arches.
--- tools/perf/util/mmap.c | 12 ++++++++++++ tools/perf/util/mmap.h | 11 +++++++++++ 2 files changed, 23 insertions(+)
tools/perf/util/mmap.c +12 -0
@@ -23,6 +23,18 @@#include "mmap.h" #include "../perf.h" #include <internal/lib.h> /* page_size */ +#include <linux/bitmap.h> + +#define MASK_SIZE 1023 +void mmap_cpu_mask__scnprintf (struct mmap_cpu_mask *mask,const char *tag) +{ +char buf[MASK_SIZE +1 ]; +size_t len; + + len =bitmap_scnprintf (mask->bits, mask->nbits, buf,MASK_SIZE ); + buf[len] ='\0' ; +pr_debug ("%p: %s mask[%zd]: %s\n" , mask, tag, mask->nbits, buf); +}size_t mmap__mmap_len (struct mmap *map) {
tools/perf/util/mmap.h +11 -0
@@ -15,6 +15,15 @@#include "event.h" struct aiocb ; + +struct mmap_cpu_mask { +unsigned long *bits; +size_t nbits; +}; + +#define MMAP_CPU_MASK_BYTES (m) \ + (BITS_TO_LONGS(((struct mmap_cpu_mask *)m)->nbits) * sizeof(unsigned long)) +/** * struct mmap - perf's ring buffer mmap details *
@@ -52,4 +61,6 @@ int perf_mmap__push(struct mmap *md, void *to,size_t mmap__mmap_len (struct mmap *map); +void mmap_cpu_mask__scnprintf (struct mmap_cpu_mask *mask,const char *tag); +#endif /*__PERF_MMAP_H */
Signature · 1 line
2.21.1
Arnaldo Carvalho de Melo
maintainerPATCH 3/20 perf record: Adapt affinity to machines with #CPUs > 1K
In reply to Arnaldo Carvalho de MeloFrom: Alexey Budankov <[email protected]>
Use struct mmap_cpu_mask type for the tool's thread and mmap data buffers to overcome current 1024 CPUs mask size limitation of cpu_set_t type.
Currently glibc's cpu_set_t type has an internal mask size limit of 1024 CPUs.
Moving to the 'struct mmap_cpu_mask' type allows overcoming that limit.
The tools bitmap API is used to manipulate objects of 'struct mmap_cpu_mask' type.
Committer notes:
To print the 'nbits' struct member we must use %zd, since it is a size_t, this fixes the build in some toolchains/arches.
--- tools/perf/builtin-record.c | 28 ++++++++++++++++++++++------ tools/perf/util/mmap.c | 28 ++++++++++++++++++++++------ tools/perf/util/mmap.h | 2 +- 3 files changed, 45 insertions(+), 13 deletions(-)
tools/perf/builtin-record.c +22 -6
@@ -62,6 +62,7 @@#include <linux/string.h> #include <linux/time64.h> #include <linux/zalloc.h> +#include <linux/bitmap.h> struct switch_output {bool enabled;
@@ -93,7 +94,7 @@ struct record {bool timestamp_boundary;struct switch_output switch_output;unsigned long long samples; -cpu_set_t affinity_mask; +struct mmap_cpu_mask affinity_mask;unsigned long output_max_size;/* = 0: unlimited */ };
@@ -961,10 +962,15 @@ static struct perf_event_header finished_round_event = {static void record__adjust_affinity (struct record *rec,struct mmap *map) {if (rec->opts.affinity !=PERF_AFFINITY_SYS && - !CPU_EQUAL (&rec->affinity_mask, &map->affinity_mask)) { -CPU_ZERO (&rec->affinity_mask); -CPU_OR (&rec->affinity_mask, &rec->affinity_mask, &map->affinity_mask); -sched_setaffinity (0 ,sizeof (rec->affinity_mask), &rec->affinity_mask); + !bitmap_equal (rec->affinity_mask.bits, map->affinity_mask.bits, + rec->affinity_mask.nbits)) { +bitmap_zero (rec->affinity_mask.bits, rec->affinity_mask.nbits); +bitmap_or (rec->affinity_mask.bits, rec->affinity_mask.bits, + map->affinity_mask.bits, rec->affinity_mask.nbits); +sched_setaffinity (0 ,MMAP_CPU_MASK_BYTES (&rec->affinity_mask), + (cpu_set_t *)rec->affinity_mask.bits); +if (verbose ==2 ) +mmap_cpu_mask__scnprintf (&rec->affinity_mask,"thread" ); } }
@@ -2433,7 +2439,6 @@ int cmd_record(int argc, const char **argv)# undef REASON#endif -CPU_ZERO (&rec->affinity_mask); rec->opts.affinity =PERF_AFFINITY_SYS ; rec->evlist =evlist__new ();
@@ -2499,6 +2504,16 @@ int cmd_record(int argc, const char **argv)symbol__init (NULL ); +if (rec->opts.affinity !=PERF_AFFINITY_SYS ) { + rec->affinity_mask.nbits =cpu__max_cpu (); + rec->affinity_mask.bits =bitmap_alloc (rec->affinity_mask.nbits); +if (!rec->affinity_mask.bits) { +pr_err ("Failed to allocate thread mask for %zd cpus\n" , rec->affinity_mask.nbits); +return -ENOMEM ; + } +pr_debug2 ("thread mask[%zd]: empty\n" , rec->affinity_mask.nbits); + } + err =record__auxtrace_init (rec);if (err) goto out;
@@ -2613,6 +2628,7 @@ int cmd_record(int argc, const char **argv) err =__cmd_record (&record, argc, argv); out: +bitmap_free (rec->affinity_mask.bits);evlist__delete (rec->evlist);symbol__exit ();auxtrace_record__free (rec->itr);
tools/perf/util/mmap.c +22 -6
@@ -219,6 +219,8 @@ static void perf_mmap__aio_munmap(struct mmap *map __maybe_unused)void mmap__munmap (struct mmap *map) { +bitmap_free (map->affinity_mask.bits); +perf_mmap__aio_munmap (map);if (map->data !=NULL ) {munmap (map->data,mmap__mmap_len (map));
@@ -227,7 +229,7 @@ void mmap__munmap(struct mmap *map)auxtrace_mmap__munmap (&map->auxtrace_mmap); } -static void build_node_mask (int node,cpu_set_t *mask) +static void build_node_mask (int node,struct mmap_cpu_mask *mask) {int c, cpu, nr_cpus;const struct perf_cpu_map *cpu_map =NULL ;
@@ -240,17 +242,23 @@ static void build_node_mask(int node, cpu_set_t *mask)for (c =0 ; c < nr_cpus; c++) { cpu = cpu_map->map[c];/* map c index to online cpu index */ if (cpu__get_node (cpu) == node) -CPU_SET (cpu, mask); +set_bit (cpu, mask->bits); } } -static void perf_mmap__setup_affinity_mask (struct mmap *map,struct mmap_params *mp) +static int perf_mmap__setup_affinity_mask (struct mmap *map,struct mmap_params *mp) { -CPU_ZERO (&map->affinity_mask); + map->affinity_mask.nbits =cpu__max_cpu (); + map->affinity_mask.bits =bitmap_alloc (map->affinity_mask.nbits); +if (!map->affinity_mask.bits) +return -1 ; +if (mp->affinity ==PERF_AFFINITY_NODE &&cpu__max_node () >1 )build_node_mask (cpu__get_node (map->core.cpu), &map->affinity_mask);else if (mp->affinity ==PERF_AFFINITY_CPU ) -CPU_SET (map->core.cpu, &map->affinity_mask); +set_bit (map->core.cpu, map->affinity_mask.bits); + +return 0 ; }int mmap__mmap (struct mmap *map,struct mmap_params *mp,int fd,int cpu)
@@ -261,7 +269,15 @@ int mmap__mmap(struct mmap *map, struct mmap_params *mp, int fd, int cpu)return -1 ; } -perf_mmap__setup_affinity_mask (map, mp); +if (mp->affinity !=PERF_AFFINITY_SYS && +perf_mmap__setup_affinity_mask (map, mp)) { +pr_debug2 ("failed to alloc mmap affinity mask, error %d\n" , + errno); +return -1 ; + } + +if (verbose ==2 ) +mmap_cpu_mask__scnprintf (&map->affinity_mask,"mmap" ); map->core.flush = mp->flush;
tools/perf/util/mmap.h +1 -1
@@ -40,7 +40,7 @@ struct mmap { int nr_cblocks; } aio;#endif -cpu_set_t affinity_mask; +struct mmap_cpu_mask affinity_mask;void *data;int comp_level; };
Signature · 1 line
2.21.1
Arnaldo Carvalho de Melo
maintainerPATCH 4/20 perf sched timehist: Add support for filtering on CPU
In reply to Arnaldo Carvalho de MeloFrom: David Ahern <[email protected]>
Allow user to limit output to one or more CPUs. Really helpful on systems with a large number of cpus.
Committer testing:
# perf sched record -a sleep 1
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 1.765 MB perf.data (1412 samples) ]
[root@quaco ~]# perf sched timehist | head
Samples do not have callchains.
time cpu task name wait time sch delay run time
[tid/pid] (msec) (msec) (msec)
--------------- ------ ------------------------------ --------- --------- ---------
66307.802686 [0000] perf[13086] 0.000 0.000 0.000
66307.802700 [0000] migration/0[12] 0.000 0.001 0.014
66307.802766 [0001] perf[13086] 0.000 0.000 0.000
66307.802774 [0001] migration/1[15] 0.000 0.001 0.007
66307.802841 [0002] perf[13086] 0.000 0.000 0.000
66307.802849 [0002] migration/2[20] 0.000 0.001 0.008
66307.802913 [0003] perf[13086] 0.000 0.000 0.000
#
# perf sched timehist --cpu 2 | head
Samples do not have callchains.
time cpu task name wait time sch delay run time
[tid/pid] (msec) (msec) (msec)
--------------- ------ ------------------------------ --------- --------- ---------
66307.802841 [0002] perf[13086] 0.000 0.000 0.000
66307.802849 [0002] migration/2[20] 0.000 0.001 0.008
66307.964485 [0002] <idle> 0.000 0.000 161.635
66307.964811 [0002] CPU 0/KVM[3589/3561] 0.000 0.056 0.325
66307.965477 [0002] <idle> 0.325 0.000 0.666
66307.965553 [0002] CPU 0/KVM[3589/3561] 0.666 0.024 0.076
66307.966456 [0002] <idle> 0.076 0.000 0.903
#--- tools/perf/Documentation/perf-sched.txt | 4 ++++ tools/perf/builtin-sched.c | 13 +++++++++++++ 2 files changed, 17 insertions(+)
tools/perf/Documentation/perf-sched.txt +4 -0
@@ -110,6 +110,10 @@ OPTIONS for 'perf sched timehist' --max-stack:: Maximum number of functions to display in backtrace, default 5. +-C=:: +--cpu=:: + Only show events for the given CPU(s) (comma separated list). + -p=:: --pid=:: Only show events for given process ID (comma separated list).
tools/perf/builtin-sched.c +13 -0
@@ -51,6 +51,9 @@#define SYM_LEN 129#define MAX_PID 1024000 +static const char *cpu_list; +static DECLARE_BITMAP(cpu_bitmap, MAX_NR_CPUS); +struct sched_atom ;struct task_desc {
@@ -2008,6 +2011,9 @@ static void timehist_print_sample(struct perf_sched *sched,char nstr[30 ];u64 wait_time; +if (cpu_list && !test_bit (sample->cpu, cpu_bitmap)) +return ; +timestamp__scnprintf_usec (t, tstr,sizeof (tstr));printf ("%15s [%04d] " , tstr, sample->cpu);
@@ -2994,6 +3000,12 @@ static int perf_sched__timehist(struct perf_sched *sched)if (IS_ERR (session))return PTR_ERR (session); +if (cpu_list) { + err =perf_session__cpu_bitmap (session, cpu_list, cpu_bitmap); +if (err <0 ) + goto out; + } + evlist = session->evlist;symbol__init (&session->header.env);
@@ -3429,6 +3441,7 @@ int cmd_sched(int argc, const char **argv) "analyze events only for given process id(s)"),OPT_STRING ('t' ,"tid" , &symbol_conf.tid_list_str,"tid[,tid...]" ,"analyze events only for given thread id(s)" ), +OPT_STRING ('C' ,"cpu" , &cpu_list,"cpu" ,"list of cpus to profile" ), OPT_PARENT(sched_options) };
Signature · 1 line
2.21.1
Arnaldo Carvalho de Melo
maintainerPATCH 5/20 perf tests bp_signal: Show expected versus obtained values
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
To help understand failures.
--- tools/perf/tests/bp_signal.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
tools/perf/tests/bp_signal.c +5 -5
@@ -263,20 +263,20 @@ int test__bp_signal(struct test *test __maybe_unused, int subtest __maybe_unusedif (count1 ==11 )pr_debug ("failed: RF EFLAG recursion issue detected\n" );else -pr_debug ("failed: wrong count for bp1%lld\n" , count1); +pr_debug ("failed: wrong count for bp1: %lld, expected 1\n" , count1); }if (overflows !=3 ) -pr_debug ("failed: wrong overflow hit\n" ); +pr_debug ("failed: wrong overflow (%d) hit, expected 3\n" , overflows);if (overflows_2 !=3 ) -pr_debug ("failed: wrong overflow_2 hit\n" ); +pr_debug ("failed: wrong overflow_2 (%d) hit, expected 3\n" , overflows_2);if (count2 !=3 ) -pr_debug ("failed: wrong count for bp2\n" ); +pr_debug ("failed: wrong count for bp2 (%lld), expected 3\n" , count2);if (count3 !=2 ) -pr_debug ("failed: wrong count for bp3\n" ); +pr_debug ("failed: wrong count for bp3 (%lld), expected 2\n" , count3);return count1 ==1 && overflows ==3 && count2 ==3 && overflows_2 ==3 && count3 ==2 ?TEST_OK :TEST_FAIL ;
Signature · 1 line
2.21.1
Arnaldo Carvalho de Melo
maintainerPATCH 6/20 libperf: Move to tools/lib/perf
In reply to Arnaldo Carvalho de MeloFrom: Jiri Olsa <[email protected]>
Move libperf from its current location under tools/perf to a separate directory under tools/lib/.
Also change various paths (mainly includes) to reflect the libperf move to a separate directory and add a new directory under MANIFEST.
---
tools/{perf/lib => lib/perf}/Build | 0
tools/{perf/lib => lib/perf}/Documentation/Makefile | 0
tools/{perf/lib => lib/perf}/Documentation/man/libperf.rst | 0
.../{perf/lib => lib/perf}/Documentation/tutorial/tutorial.rst | 0
tools/{perf/lib => lib/perf}/Makefile | 2 +-
tools/{perf/lib => lib/perf}/core.c | 0
tools/{perf/lib => lib/perf}/cpumap.c | 0
tools/{perf/lib => lib/perf}/evlist.c | 0
tools/{perf/lib => lib/perf}/evsel.c | 0
tools/{perf/lib => lib/perf}/include/internal/cpumap.h | 0
tools/{perf/lib => lib/perf}/include/internal/evlist.h | 0
tools/{perf/lib => lib/perf}/include/internal/evsel.h | 0
tools/{perf/lib => lib/perf}/include/internal/lib.h | 0
tools/{perf/lib => lib/perf}/include/internal/mmap.h | 0
tools/{perf/lib => lib/perf}/include/internal/tests.h | 0
tools/{perf/lib => lib/perf}/include/internal/threadmap.h | 0
tools/{perf/lib => lib/perf}/include/internal/xyarray.h | 0
tools/{perf/lib => lib/perf}/include/perf/core.h | 0
tools/{perf/lib => lib/perf}/include/perf/cpumap.h | 0
tools/{perf/lib => lib/perf}/include/perf/event.h | 0
tools/{perf/lib => lib/perf}/include/perf/evlist.h | 0
tools/{perf/lib => lib/perf}/include/perf/evsel.h | 0
tools/{perf/lib => lib/perf}/include/perf/mmap.h | 0
tools/{perf/lib => lib/perf}/include/perf/threadmap.h | 0
tools/{perf/lib => lib/perf}/internal.h | 0
tools/{perf/lib => lib/perf}/lib.c | 0
tools/{perf/lib => lib/perf}/libperf.map | 0
tools/{perf/lib => lib/perf}/libperf.pc.template | 0
tools/{perf/lib => lib/perf}/mmap.c | 0
tools/{perf/lib => lib/perf}/tests/Makefile | 2 +-
tools/{perf/lib => lib/perf}/tests/test-cpumap.c | 0
tools/{perf/lib => lib/perf}/tests/test-evlist.c | 0
tools/{perf/lib => lib/perf}/tests/test-evsel.c | 0
tools/{perf/lib => lib/perf}/tests/test-threadmap.c | 0
tools/{perf/lib => lib/perf}/threadmap.c | 0
tools/{perf/lib => lib/perf}/xyarray.c | 0
tools/perf/MANIFEST | 1 +
tools/perf/Makefile.config | 2 +-
tools/perf/Makefile.perf | 2 +-
39 files changed, 5 insertions(+), 4 deletions(-)
rename tools/{perf/lib => lib/perf}/Build (100%)
rename tools/{perf/lib => lib/perf}/Documentation/Makefile (100%)
rename tools/{perf/lib => lib/perf}/Documentation/man/libperf.rst (100%)
rename tools/{perf/lib => lib/perf}/Documentation/tutorial/tutorial.rst (100%)
rename tools/{perf/lib => lib/perf}/Makefile (99%)
rename tools/{perf/lib => lib/perf}/core.c (100%)
rename tools/{perf/lib => lib/perf}/cpumap.c (100%)
rename tools/{perf/lib => lib/perf}/evlist.c (100%)
rename tools/{perf/lib => lib/perf}/evsel.c (100%)
rename tools/{perf/lib => lib/perf}/include/internal/cpumap.h (100%)
rename tools/{perf/lib => lib/perf}/include/internal/evlist.h (100%)
rename tools/{perf/lib => lib/perf}/include/internal/evsel.h (100%)
rename tools/{perf/lib => lib/perf}/include/internal/lib.h (100%)
rename tools/{perf/lib => lib/perf}/include/internal/mmap.h (100%)
rename tools/{perf/lib => lib/perf}/include/internal/tests.h (100%)
rename tools/{perf/lib => lib/perf}/include/internal/threadmap.h (100%)
rename tools/{perf/lib => lib/perf}/include/internal/xyarray.h (100%)
rename tools/{perf/lib => lib/perf}/include/perf/core.h (100%)
rename tools/{perf/lib => lib/perf}/include/perf/cpumap.h (100%)
rename tools/{perf/lib => lib/perf}/include/perf/event.h (100%)
rename tools/{perf/lib => lib/perf}/include/perf/evlist.h (100%)
rename tools/{perf/lib => lib/perf}/include/perf/evsel.h (100%)
rename tools/{perf/lib => lib/perf}/include/perf/mmap.h (100%)
rename tools/{perf/lib => lib/perf}/include/perf/threadmap.h (100%)
rename tools/{perf/lib => lib/perf}/internal.h (100%)
rename tools/{perf/lib => lib/perf}/lib.c (100%)
rename tools/{perf/lib => lib/perf}/libperf.map (100%)
rename tools/{perf/lib => lib/perf}/libperf.pc.template (100%)
rename tools/{perf/lib => lib/perf}/mmap.c (100%)
rename tools/{perf/lib => lib/perf}/tests/Makefile (93%)
rename tools/{perf/lib => lib/perf}/tests/test-cpumap.c (100%)
rename tools/{perf/lib => lib/perf}/tests/test-evlist.c (100%)
rename tools/{perf/lib => lib/perf}/tests/test-evsel.c (100%)
rename tools/{perf/lib => lib/perf}/tests/test-threadmap.c (100%)
rename tools/{perf/lib => lib/perf}/threadmap.c (100%)
rename tools/{perf/lib => lib/perf}/xyarray.c (100%)tools/lib/perf/Build renamed from tools/perf/lib/Build +0 -0
tools/lib/perf/Documentation/Makefile renamed from tools/perf/lib/Documentation/Makefile +0 -0
tools/lib/perf/Documentation/man/libperf.rst renamed from tools/perf/lib/Documentation/man/libperf.rst +0 -0
tools/lib/perf/Documentation/tutorial/tutorial.rst renamed from tools/perf/lib/Documentation/tutorial/tutorial.rst +0 -0
tools/lib/perf/Makefile renamed from tools/perf/lib/Makefile +1 -1
@@ -60,7 +60,7 @@ else endif INCLUDES = \ --I$(srctree)/tools/perf/lib/include \ +-I$(srctree)/tools/lib/perf/include \ -I$(srctree)/tools/lib/ \ -I$(srctree)/tools/include \ -I$(srctree)/tools/arch/$(SRCARCH)/include/ \
tools/lib/perf/core.c renamed from tools/perf/lib/core.c +0 -0
tools/lib/perf/cpumap.c renamed from tools/perf/lib/cpumap.c +0 -0
tools/lib/perf/evlist.c renamed from tools/perf/lib/evlist.c +0 -0
tools/lib/perf/evsel.c renamed from tools/perf/lib/evsel.c +0 -0
tools/lib/perf/include/internal/cpumap.h renamed from tools/perf/lib/include/internal/cpumap.h +0 -0
tools/lib/perf/include/internal/evlist.h renamed from tools/perf/lib/include/internal/evlist.h +0 -0
tools/lib/perf/include/internal/evsel.h renamed from tools/perf/lib/include/internal/evsel.h +0 -0
tools/lib/perf/include/internal/lib.h renamed from tools/perf/lib/include/internal/lib.h +0 -0
tools/lib/perf/include/internal/mmap.h renamed from tools/perf/lib/include/internal/mmap.h +0 -0
tools/lib/perf/include/internal/tests.h renamed from tools/perf/lib/include/internal/tests.h +0 -0
tools/lib/perf/include/internal/threadmap.h renamed from tools/perf/lib/include/internal/threadmap.h +0 -0
tools/lib/perf/include/internal/xyarray.h renamed from tools/perf/lib/include/internal/xyarray.h +0 -0
tools/lib/perf/include/perf/core.h renamed from tools/perf/lib/include/perf/core.h +0 -0
tools/lib/perf/include/perf/cpumap.h renamed from tools/perf/lib/include/perf/cpumap.h +0 -0
tools/lib/perf/include/perf/event.h renamed from tools/perf/lib/include/perf/event.h +0 -0
tools/lib/perf/include/perf/evlist.h renamed from tools/perf/lib/include/perf/evlist.h +0 -0
tools/lib/perf/include/perf/evsel.h renamed from tools/perf/lib/include/perf/evsel.h +0 -0
tools/lib/perf/include/perf/mmap.h renamed from tools/perf/lib/include/perf/mmap.h +0 -0
tools/lib/perf/include/perf/threadmap.h renamed from tools/perf/lib/include/perf/threadmap.h +0 -0
tools/lib/perf/internal.h renamed from tools/perf/lib/internal.h +0 -0
tools/lib/perf/lib.c renamed from tools/perf/lib/lib.c +0 -0
tools/lib/perf/libperf.map renamed from tools/perf/lib/libperf.map +0 -0
tools/lib/perf/libperf.pc.template renamed from tools/perf/lib/libperf.pc.template +0 -0
tools/lib/perf/mmap.c renamed from tools/perf/lib/mmap.c +0 -0
tools/lib/perf/tests/Makefile renamed from tools/perf/lib/tests/Makefile +1 -1
@@ -16,7 +16,7 @@ all: include $(srctree)/tools/scripts/Makefile.include -INCLUDE = -I$(srctree)/tools/perf/lib/include -I$(srctree)/tools/include -I$(srctree)/tools/lib +INCLUDE = -I$(srctree)/tools/lib/perf/include -I$(srctree)/tools/include -I$(srctree)/tools/lib $(TESTS_A): FORCE $(QUIET_LINK)$(CC) $(INCLUDE) $(CFLAGS) -o $@ $(subst -a,.c,$@) ../libperf.a $(LIBAPI)
tools/lib/perf/tests/test-cpumap.c renamed from tools/perf/lib/tests/test-cpumap.c +0 -0
tools/lib/perf/tests/test-evlist.c renamed from tools/perf/lib/tests/test-evlist.c +0 -0
tools/lib/perf/tests/test-evsel.c renamed from tools/perf/lib/tests/test-evsel.c +0 -0
tools/lib/perf/tests/test-threadmap.c renamed from tools/perf/lib/tests/test-threadmap.c +0 -0
tools/lib/perf/threadmap.c renamed from tools/perf/lib/threadmap.c +0 -0
tools/lib/perf/xyarray.c renamed from tools/perf/lib/xyarray.c +0 -0
tools/perf/MANIFEST +1 -0
@@ -7,6 +7,7 @@ tools/lib/traceevent tools/lib/api tools/lib/bpf tools/lib/subcmd +tools/lib/perf tools/lib/argv_split.c tools/lib/ctype.c tools/lib/hweight.c
tools/perf/Makefile.config +1 -1
@@ -286,7 +286,7 @@ ifeq ($(DEBUG),0) endif endif -INC_FLAGS += -I$(src-perf)/lib/include +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/
tools/perf/Makefile.perf +1 -1
@@ -230,7 +230,7 @@ LIB_DIR = $(srctree)/tools/lib/api/ TRACE_EVENT_DIR = $(srctree)/tools/lib/traceevent/ BPF_DIR = $(srctree)/tools/lib/bpf/ SUBCMD_DIR = $(srctree)/tools/lib/subcmd/ -LIBPERF_DIR = $(srctree)/tools/perf/lib/ +LIBPERF_DIR = $(srctree)/tools/lib/perf/ # Set FEATURE_TESTS to 'all' so all possible feature checkers are executed. # Without this setting the output feature dump file misses some features, for
Signature · 1 line
2.21.1
Arnaldo Carvalho de Melo
maintainerPATCH 7/20 libperf: Add man pages
In reply to Arnaldo Carvalho de MeloFrom: Jiri Olsa <[email protected]>
Change the man page generation to asciidoc, because it's easier to use and has been more commonly used in related projects. Remove the current rst pages.
Add 3 man pages to have a base for more additions:
libperf.3 - overall description
libperf-counting.7 - counting basics explained on simple example libperf-sampling.7 - sampling basics explained on simple example
The plan is to add more man pages to cover the basic API.
The build generates html and man pages:
$ cd tools/lib/perf/Documentation
$ make
ASCIIDOC libperf.xml
XMLTO libperf.3
ASCIIDOC libperf-counting.xml
XMLTO libperf-counting.7
ASCIIDOC libperf-sampling.xml
XMLTO libperf-sampling.7
ASCIIDOC libperf.html
ASCIIDOC libperf-counting.html
ASCIIDOC libperf-sampling.htmlAdd the following install targets:
install-man - man pages
install-html - html version of man pages
install-examples - examples mentioned in the man pages
--- tools/lib/perf/Documentation/Makefile | 159 ++++++++++- tools/lib/perf/Documentation/asciidoc.conf | 120 +++++++++ .../perf/Documentation/examples/sampling.c | 119 +++++++++ .../perf/Documentation/libperf-counting.txt | 211 +++++++++++++++ .../perf/Documentation/libperf-sampling.txt | 243 +++++++++++++++++ tools/lib/perf/Documentation/libperf.txt | 246 ++++++++++++++++++ tools/lib/perf/Documentation/man/libperf.rst | 100 ------- tools/lib/perf/Documentation/manpage-1.72.xsl | 14 + tools/lib/perf/Documentation/manpage-base.xsl | 35 +++ .../Documentation/manpage-bold-literal.xsl | 17 ++ .../lib/perf/Documentation/manpage-normal.xsl | 13 + .../Documentation/manpage-suppress-sp.xsl | 21 ++ .../perf/Documentation/tutorial/tutorial.rst | 123 --------- tools/lib/perf/Makefile | 5 +- 14 files changed, 1197 insertions(+), 229 deletions(-) create mode 100644 tools/lib/perf/Documentation/asciidoc.conf create mode 100644 tools/lib/perf/Documentation/examples/sampling.c create mode 100644 tools/lib/perf/Documentation/libperf-counting.txt create mode 100644 tools/lib/perf/Documentation/libperf-sampling.txt create mode 100644 tools/lib/perf/Documentation/libperf.txt delete mode 100644 tools/lib/perf/Documentation/man/libperf.rst create mode 100644 tools/lib/perf/Documentation/manpage-1.72.xsl create mode 100644 tools/lib/perf/Documentation/manpage-base.xsl create mode 100644 tools/lib/perf/Documentation/manpage-bold-literal.xsl create mode 100644 tools/lib/perf/Documentation/manpage-normal.xsl create mode 100644 tools/lib/perf/Documentation/manpage-suppress-sp.xsl delete mode 100644 tools/lib/perf/Documentation/tutorial/tutorial.rst
tools/lib/perf/Documentation/Makefile +154 -5
@@ -1,7 +1,156 @@ -all: - rst2man man/libperf.rst > man/libperf.7 - rst2pdf tutorial/tutorial.rst +# SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause) +# Most of this file is copied from tools/perf/Documentation/Makefile + +include ../../../scripts/Makefile.include +include ../../../scripts/utilities.mak + +MAN3_TXT = libperf.txt +MAN7_TXT = libperf-counting.txt libperf-sampling.txt +MAN_EX = examples/*.c + +MAN_TXT = $(MAN3_TXT) $(MAN7_TXT) + +_MAN_XML = $(patsubst %.txt,%.xml,$(MAN_TXT)) +_MAN_HTML = $(patsubst %.txt,%.html,$(MAN_TXT)) +_MAN_3 = $(patsubst %.txt,%.3,$(MAN3_TXT)) +_MAN_7 = $(patsubst %.txt,%.7,$(MAN7_TXT)) + +MAN_XML = $(addprefix $(OUTPUT),$(_MAN_XML)) +MAN_HTML = $(addprefix $(OUTPUT),$(_MAN_HTML)) +MAN_3 = $(addprefix $(OUTPUT),$(_MAN_3)) +MAN_7 = $(addprefix $(OUTPUT),$(_MAN_7)) +MAN_X = $(MAN_3) $(MAN_7) + +# Make the path relative to DESTDIR, not prefix +ifndef DESTDIR + prefix ?=$(HOME) +endif + +mandir ?= $(prefix)/share/man +man3dir = $(mandir)/man3 +man7dir = $(mandir)/man7 + +docdir ?= $(prefix)/share/doc/libperf +htmldir = $(docdir)/html +exdir = $(docdir)/examples + +ASCIIDOC = asciidoc +ASCIIDOC_EXTRA = --unsafe -f asciidoc.conf +ASCIIDOC_HTML = xhtml11 +MANPAGE_XSL = manpage-normal.xsl +XMLTO_EXTRA = +XMLTO =xmlto + +INSTALL ?= install +RM ?= rm -f + +# For asciidoc ... +# -7.1.2, no extra settings are needed. +# 8.0-, set ASCIIDOC8. +# + +# For docbook-xsl ... +# -1.68.1, set ASCIIDOC_NO_ROFF? (based on changelog from 1.73.0) +# 1.69.0, no extra settings are needed? +# 1.69.1-1.71.0, set DOCBOOK_SUPPRESS_SP? +# 1.71.1, no extra settings are needed? +# 1.72.0, set DOCBOOK_XSL_172. +# 1.73.0-, set ASCIIDOC_NO_ROFF + +# If you had been using DOCBOOK_XSL_172 in an attempt to get rid +# of 'the ".ft C" problem' in your generated manpages, and you +# instead ended up with weird characters around callouts, try +# using ASCIIDOC_NO_ROFF instead (it works fine with ASCIIDOC8). + +ifdef ASCIIDOC8 + ASCIIDOC_EXTRA += -a asciidoc7compatible +endif +ifdef DOCBOOK_XSL_172 + ASCIIDOC_EXTRA += -a libperf-asciidoc-no-roff + MANPAGE_XSL = manpage-1.72.xsl +else + ifdef ASCIIDOC_NO_ROFF + # docbook-xsl after 1.72 needs the regular XSL, but will not + # pass-thru raw roff codes from asciidoc.conf, so turn them off. + ASCIIDOC_EXTRA += -a libperf-asciidoc-no-roff + endif +endif +ifdef MAN_BOLD_LITERAL + XMLTO_EXTRA += -m manpage-bold-literal.xsl +endif +ifdef DOCBOOK_SUPPRESS_SP + XMLTO_EXTRA += -m manpage-suppress-sp.xsl +endif + +DESTDIR ?= +DESTDIR_SQ = '$(subst ','\'',$(DESTDIR))' + +export DESTDIR DESTDIR_SQ + +# Please note that there is a minor bug in asciidoc. +# The version after 6.0.3 _will_ include the patch found here: +# http://marc.theaimsgroup.com/?l=libtraceevent&m=111558757202243&w=2 +# +# Until that version is released you may have to apply the patch +# yourself - yes, all 6 characters of it! + +QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir +QUIET_SUBDIR1 = + +ifneq ($(findstring $(MAKEFLAGS),w),w) + PRINT_DIR = --no-print-directory +else # "make -w" + NO_SUBDIR = : +endif + +ifneq ($(findstring $(MAKEFLAGS),s),s) + ifneq ($(V),1) + QUIET_ASCIIDOC = @echo ' ASCIIDOC '$@; + QUIET_XMLTO = @echo ' XMLTO '$@; + endif +endif + +all: $(MAN_X) $(MAN_HTML) + +$(MAN_HTML) $(MAN_X): asciidoc.conf + +install-man: all + $(call QUIET_INSTALL, man) \ + $(INSTALL) -d -m 755 $(DESTDIR)$(man3dir); \ + $(INSTALL) -m 644 $(MAN_3) $(DESTDIR)$(man3dir); \ + $(INSTALL) -d -m 755 $(DESTDIR)$(man7dir); \ + $(INSTALL) -m 644 $(MAN_7) $(DESTDIR)$(man7dir); + +install-html: + $(call QUIET_INSTALL, html) \ + $(INSTALL) -d -m 755 $(DESTDIR)$(htmldir); \ + $(INSTALL) -m 644 $(MAN_HTML) $(DESTDIR)$(htmldir); \ + +install-examples: + $(call QUIET_INSTALL, examples) \ + $(INSTALL) -d -m 755 $(DESTDIR)$(exdir); \ + $(INSTALL) -m 644 $(MAN_EX) $(DESTDIR)$(exdir); \ + +CLEAN_FILES = \ + $(MAN_XML) $(addsuffix +,$(MAN_XML)) \ + $(MAN_HTML) $(addsuffix +,$(MAN_HTML)) \ + $(MAN_X) clean: - rm -f man/libperf.7 - rm -f tutorial/tutorial.pdf + $(call QUIET_CLEAN, Documentation) $(RM) $(CLEAN_FILES) + +$(MAN_3): $(OUTPUT)%.3: %.xml + $(QUIET_XMLTO)$(XMLTO) -o $(OUTPUT). -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $< + +$(MAN_7): $(OUTPUT)%.7: %.xml + $(QUIET_XMLTO)$(XMLTO) -o $(OUTPUT). -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $< + +$(MAN_XML): $(OUTPUT)%.xml: %.txt + $(QUIET_ASCIIDOC)$(ASCIIDOC) -b docbook -d manpage \ + $(ASCIIDOC_EXTRA) -alibperf_version=$(EVENT_PARSE_VERSION) -o $@+ $< && \ + mv $@+ $@ + +$(MAN_HTML): $(OUTPUT)%.html: %.txt + $(QUIET_ASCIIDOC)$(ASCIIDOC) -b $(ASCIIDOC_HTML) -d manpage \ + $(ASCIIDOC_EXTRA) -aperf_version=$(EVENT_PARSE_VERSION) -o $@+ $< && \ + mv $@+ $@
tools/lib/perf/Documentation/asciidoc.conf new file +120 -0
120 lines not on this page · raw message
tools/lib/perf/Documentation/examples/sampling.c new file +119 -0
119 lines not on this page · raw message
tools/lib/perf/Documentation/libperf-counting.txt new file +211 -0
211 lines not on this page · raw message
tools/lib/perf/Documentation/libperf-sampling.txt new file +243 -0
243 lines not on this page · raw message
tools/lib/perf/Documentation/libperf.txt new file +246 -0
246 lines not on this page · raw message
tools/lib/perf/Documentation/man/libperf.rst deleted +0 -100
100 lines not on this page · raw message
tools/lib/perf/Documentation/manpage-1.72.xsl new file +14 -0
@@ -0,0 +1,14 @@ +<!-- manpage-1.72.xsl: + special settings for manpages rendered from asciidoc+docbook + handles peculiarities in docbook-xsl 1.72.0 --> +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + version="1.0"> + +<xsl:import href="manpage-base.xsl"/> + +<!-- these are the special values for the roff control characters + needed for docbook-xsl 1.72.0 --> +<xsl:param name="git.docbook.backslash">▓</xsl:param> +<xsl:param name="git.docbook.dot" >⌂</xsl:param> + +</xsl:stylesheet>
tools/lib/perf/Documentation/manpage-base.xsl new file +35 -0
@@ -0,0 +1,35 @@ +<!-- manpage-base.xsl: + special formatting for manpages rendered from asciidoc+docbook --> +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + version="1.0"> + +<!-- these params silence some output from xmlto --> +<xsl:param name="man.output.quietly" select="1"/> +<xsl:param name="refentry.meta.get.quietly" select="1"/> + +<!-- convert asciidoc callouts to man page format; + git.docbook.backslash and git.docbook.dot params + must be supplied by another XSL file or other means --> +<xsl:template match="co"> + <xsl:value-of select="concat( + $git.docbook.backslash,'fB(', + substring-after(@id,'-'),')', + $git.docbook.backslash,'fR')"/> +</xsl:template> +<xsl:template match="calloutlist"> + <xsl:value-of select="$git.docbook.dot"/> + <xsl:text>sp </xsl:text> + <xsl:apply-templates/> + <xsl:text> </xsl:text> +</xsl:template> +<xsl:template match="callout"> + <xsl:value-of select="concat( + $git.docbook.backslash,'fB', + substring-after(@arearefs,'-'), + '. ',$git.docbook.backslash,'fR')"/> + <xsl:apply-templates/> + <xsl:value-of select="$git.docbook.dot"/> + <xsl:text>br </xsl:text> +</xsl:template> + +</xsl:stylesheet>
tools/lib/perf/Documentation/manpage-bold-literal.xsl new file +17 -0
@@ -0,0 +1,17 @@ +<!-- manpage-bold-literal.xsl: + special formatting for manpages rendered from asciidoc+docbook --> +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + version="1.0"> + +<!-- render literal text as bold (instead of plain or monospace); + this makes literal text easier to distinguish in manpages + viewed on a tty --> +<xsl:template match="literal"> + <xsl:value-of select="$git.docbook.backslash"/> + <xsl:text>fB</xsl:text> + <xsl:apply-templates/> + <xsl:value-of select="$git.docbook.backslash"/> + <xsl:text>fR</xsl:text> +</xsl:template> + +</xsl:stylesheet>
tools/lib/perf/Documentation/manpage-normal.xsl new file +13 -0
@@ -0,0 +1,13 @@ +<!-- manpage-normal.xsl: + special settings for manpages rendered from asciidoc+docbook + handles anything we want to keep away from docbook-xsl 1.72.0 --> +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + version="1.0"> + +<xsl:import href="manpage-base.xsl"/> + +<!-- these are the normal values for the roff control characters --> +<xsl:param name="git.docbook.backslash">\</xsl:param> +<xsl:param name="git.docbook.dot" >.</xsl:param> + +</xsl:stylesheet>
tools/lib/perf/Documentation/manpage-suppress-sp.xsl new file +21 -0
@@ -0,0 +1,21 @@ +<!-- manpage-suppress-sp.xsl: + special settings for manpages rendered from asciidoc+docbook + handles erroneous, inline .sp in manpage output of some + versions of docbook-xsl --> +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + version="1.0"> + +<!-- attempt to work around spurious .sp at the tail of the line + that some versions of docbook stylesheets seem to add --> +<xsl:template match="simpara"> + <xsl:variable name="content"> + <xsl:apply-templates/> + </xsl:variable> + <xsl:value-of select="normalize-space($content)"/> + <xsl:if test="not(ancestor::authorblurb) and + not(ancestor::personblurb)"> + <xsl:text> </xsl:text> + </xsl:if> +</xsl:template> + +</xsl:stylesheet>
tools/lib/perf/Documentation/tutorial/tutorial.rst deleted +0 -123
123 lines not on this page · raw message
tools/lib/perf/Makefile +4 -1
@@ -181,7 +181,10 @@ install_pkgconfig: $(LIBPERF_PC) $(call QUIET_INSTALL, $(LIBPERF_PC)) \ $(call do_install,$(LIBPERF_PC),$(libdir_SQ)/pkgconfig,644) -install: install_lib install_headers install_pkgconfig +install_doc: + $(Q)$(MAKE) -C Documentation install-man install-html install-examples + +install: install_lib install_headers install_pkgconfig install_doc FORCE:
Signature · 1 line
2.21.1
Arnaldo Carvalho de Melo
maintainerPATCH 8/20 tools lib api fs: Fix gcc9 stringop-truncation compilation error
In reply to Arnaldo Carvalho de MeloFrom: Andrey Zhizhikin <[email protected]>
GCC9 introduced string hardening mechanisms, which exhibits the error during fs api compilation:
error: '__builtin_strncpy' specified bound 4096 equals destination size [-Werror=stringop-truncation]
This comes when the length of copy passed to strncpy is is equal to destination size, which could potentially lead to buffer overflow.
There is a need to mitigate this potential issue by limiting the size of destination by 1 and explicitly terminate the destination with NULL.
--- tools/lib/api/fs/fs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
tools/lib/api/fs/fs.c +3 -1
@@ -210,6 +210,7 @@ static bool fs__env_override(struct fs *fs)size_t name_len =strlen (fs->name);/* name + "_PATH" + '\0' */ char upper_name[name_len +5 +1 ]; +memcpy (upper_name, fs->name, name_len);mem_toupper (upper_name, name_len);strcpy (&upper_name[name_len],"_PATH" );
@@ -219,7 +220,8 @@ static bool fs__env_override(struct fs *fs)return false; fs->found = true; -strncpy (fs->path, override_path,sizeof (fs->path)); +strncpy (fs->path, override_path,sizeof (fs->path) -1 ); + fs->path[sizeof (fs->path) -1 ] ='\0' ;return true; }
Signature · 1 line
2.21.1
Arnaldo Carvalho de Melo
maintainerPATCH 9/20 perf hists browser: Restore ESC as "Zoom out" of DSO/thread/etc
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
We need to set actions->ms.map since 599a2f38a989 ("perf hists browser:
Check sort keys before hot key actions"), as in that patch we bail out if map is NULL.
--- tools/perf/ui/browsers/hists.c | 1 + 1 file changed, 1 insertion(+)
tools/perf/ui/browsers/hists.c +1 -0
@@ -3062,6 +3062,7 @@ static int perf_evsel__hists_browse(struct evsel *evsel, int nr_events,continue ; } + actions->ms.map = map; top =pstack__peek (browser->pstack);if (top == &browser->hists->dso_filter) {/*
Signature · 1 line
2.21.1
Arnaldo Carvalho de Melo
maintainerPATCH 10/20 perf report/top: Make ENTER consistently bring up menu
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
When callchains are present the ENTER key switches from bringing up the menu that offers Annotation, Zoom by DSO, etc to expanding/collapsing one callchain level, causing confusion, fix it by making it consistently bring up the menu and use '+' to expand/collapse one callchain level.
Next patch will also add an entry to the menu to allow expanding/collapsing, so that people used to ENTER expanding one callchain level can quickly find it and use it instead.
--- tools/perf/ui/browsers/hists.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/perf/ui/browsers/hists.c +2 -1
@@ -706,7 +706,7 @@ int hist_browser__run(struct hist_browser *browser, const char *help, browser->show_headers = !browser->show_headers;hist_browser__update_rows (browser);break ; -case K_ENTER : +case '+' :if (hist_browser__toggle_fold (browser))break ;/* fall thru */
@@ -2858,6 +2858,7 @@ static int perf_evsel__hists_browse(struct evsel *evsel, int nr_events,"For symbolic views (--sort has sym):\n\n" \"ENTER Zoom into DSO/Threads & Annotate current symbol\n" \"ESC Zoom out\n" \ +"+ Expand/Collapse one callchain level\n" \"a Annotate current symbol\n" \"C Collapse all callchains\n" \"d Zoom into current DSO\n" \
Signature · 1 line
2.21.1
Arnaldo Carvalho de Melo
maintainerPATCH 11/20 perf report/top: Add menu entry for toggling callchain expansion
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
Since previously pressing ENTER toggled expansion/collapse of callchain entries and now brings up the same menu used when callchains are not present, add an entry so that users can quickly figure out the change in behaviour.
Its worth mentioning that we also always had 'e'/'c' to expand/collapse all entries in a hist entry and 'E'/'C' for all hist entries.
--- tools/perf/ui/browsers/hists.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
tools/perf/ui/browsers/hists.c +21 -0
@@ -2527,6 +2527,26 @@ add_dso_opt(struct hist_browser *browser, struct popup_action *act,return 1 ; } +static int do_toggle_callchain (struct hist_browser *browser,struct popup_action *act__maybe_unused ) +{ +hist_browser__toggle_fold (browser); +return 0 ; +} + +static int add_callchain_toggle_opt (struct hist_browser *browser,struct popup_action *act,char **optstr) +{ +struct hist_entry *he = browser->he_selection; + +if (!he->has_children) +return 0 ; + +if (asprintf (optstr,"Expand/Collapse callchain" ) <0 ) +return 0 ; + + act->fn = do_toggle_callchain; +return 1 ; +} +static int do_browse_map (struct hist_browser *browser__maybe_unused ,struct popup_action *act)
@@ -3137,6 +3157,7 @@ static int perf_evsel__hists_browse(struct evsel *evsel, int nr_events, &options[nr_options], thread); nr_options +=add_dso_opt (browser, &actions[nr_options], &options[nr_options], map); + nr_options +=add_callchain_toggle_opt (browser, &actions[nr_options], &options[nr_options]); nr_options += add_map_opt(browser, &actions[nr_options], &options[nr_options], browser->selection ?
Signature · 1 line
2.21.1
Arnaldo Carvalho de Melo
maintainerPATCH 12/20 perf report/top: Improve toggle callchain menu option
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
Taking into account the current status of the callchain, i.e. if folded, show "Expand", otherwise "Collapse", also show the name of the entry that will be affected and mention the hotkeys for expanding/collapsing all callchains below the main entry, the one that appears with/without callchains.
--- tools/perf/ui/browsers/hists.c | 54 ++++++++++++++++++++++++++++++++-- tools/perf/util/sort.c | 3 +- tools/perf/util/sort.h | 2 ++ 3 files changed, 54 insertions(+), 5 deletions(-)
tools/perf/ui/browsers/hists.c +51 -3
@@ -391,6 +391,52 @@ static void hist_entry__init_have_children(struct hist_entry *he) he->init_have_children = true; } +static bool hist_browser__selection_has_children (struct hist_browser *browser) +{ +struct hist_entry *he = browser->he_selection; +struct map_symbol *ms = browser->selection; + +if (!he || !ms) +return false; + +if (ms == &he->ms) +return he->has_children; + + return container_of(ms, struct callchain_list, ms)->has_children; +} + +static bool hist_browser__selection_unfolded (struct hist_browser *browser) +{ +struct hist_entry *he = browser->he_selection; +struct map_symbol *ms = browser->selection; + +if (!he || !ms) +return false; + +if (ms == &he->ms) +return he->unfolded; + + return container_of(ms, struct callchain_list, ms)->unfolded; +} + +static char *hist_browser__selection_sym_name (struct hist_browser *browser,char *bf,size_t size) +{ +struct hist_entry *he = browser->he_selection; +struct map_symbol *ms = browser->selection; +struct callchain_list *callchain_entry; + +if (!he || !ms) +return NULL ; + +if (ms == &he->ms) { +hist_entry__sym_snprintf (he, bf, size,0 ); +return bf +4 ;// skip the level, e.g. '[k] ' + } + + callchain_entry = container_of(ms, struct callchain_list, ms); +return callchain_list__sym_name (callchain_entry, bf, size, browser->show_dso); +} +static bool hist_browser__toggle_fold (struct hist_browser *browser) {struct hist_entry *he = browser->he_selection;
@@ -2535,12 +2581,14 @@ static int do_toggle_callchain(struct hist_browser *browser, struct popup_actionstatic int add_callchain_toggle_opt (struct hist_browser *browser,struct popup_action *act,char **optstr) { -struct hist_entry *he = browser->he_selection; +char sym_name[512 ]; -if (!he->has_children) +if (!hist_browser__selection_has_children (browser))return 0 ; -if (asprintf (optstr,"Expand/Collapse callchain" ) <0 ) +if (asprintf (optstr,"%s [%s] callchain (one level, same as '+' hotkey, use 'e'/'c' for the whole main level entry)" , +hist_browser__selection_unfolded (browser) ?"Collapse" :"Expand" , +hist_browser__selection_sym_name (browser, sym_name,sizeof (sym_name))) <0 )return 0 ; act->fn = do_toggle_callchain;
tools/perf/util/sort.c +1 -2
@@ -324,8 +324,7 @@ static int _hist_entry__sym_snprintf(struct map_symbol *ms,return ret; } -static int hist_entry__sym_snprintf (struct hist_entry *he,char *bf, -size_t size,unsigned int width) +int hist_entry__sym_snprintf (struct hist_entry *he,char *bf,size_t size,unsigned int width) {return _hist_entry__sym_snprintf (&he->ms, he->ip, he->level, bf, size, width);
tools/perf/util/sort.h +2 -0
@@ -164,6 +164,8 @@ static __pure inline bool hist_entry__has_callchains(struct hist_entry *he)return he->callchain_size !=0 ; } +int hist_entry__sym_snprintf (struct hist_entry *he,char *bf,size_t size,unsigned int width); +static inline bool hist_entry__has_pairs (struct hist_entry *he) {return !list_empty (&he->pairs.node);
Signature · 1 line
2.21.1
Arnaldo Carvalho de Melo
maintainerPATCH 13/20 perf hists browser: Generalize the do_zoom_dso() function
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
We'll use it to provide a top level hotkey to zoom into the kernel dso directly.
--- tools/perf/ui/browsers/hists.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
tools/perf/ui/browsers/hists.c +7 -4
@@ -2530,11 +2530,8 @@ add_thread_opt(struct hist_browser *browser, struct popup_action *act,return 1 ; } -static int -do_zoom_dso (struct hist_browser *browser,struct popup_action *act) +static int hists_browser__zoom_map (struct hist_browser *browser,struct map *map) { -struct map *map = act->ms.map; -if (!hists__has (browser->hists, dso) || map ==NULL )return 0 ;
@@ -2556,6 +2553,12 @@ do_zoom_dso(struct hist_browser *browser, struct popup_action *act)return 0 ; } +static int +do_zoom_dso (struct hist_browser *browser,struct popup_action *act) +{ +return hists_browser__zoom_map (browser, act->ms.map); +} +static int add_dso_opt (struct hist_browser *browser,struct popup_action *act,char **optstr,struct map *map)
Signature · 1 line
2.21.1
Arnaldo Carvalho de Melo
maintainerPATCH 14/20 perf report/top: Add 'k' hotkey to zoom directly into the kernel map
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
As a convenience, equivalent to pressing Enter in a line with a kernel symbol and then selecting "Zoom" into the kernel DSO.
--- tools/perf/ui/browsers/hists.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
tools/perf/ui/browsers/hists.c +8 -1
@@ -18,7 +18,9 @@#include "../../util/evlist.h" #include "../../util/header.h" #include "../../util/hist.h" +#include "../../util/machine.h" #include "../../util/map.h" +#include "../../util/maps.h" #include "../../util/symbol.h" #include "../../util/map_symbol.h" #include "../../util/branch.h"
@@ -2566,7 +2568,7 @@ add_dso_opt(struct hist_browser *browser, struct popup_action *act,if (!hists__has (browser->hists, dso) || map ==NULL )return 0 ; -if (asprintf (optstr,"Zoom %s %s DSO" , +if (asprintf (optstr,"Zoom %s %s DSO (use the 'k' hotkey to zoom directly into the kernel)" , browser->hists->dso_filter ?"out of" :"into" ,__map__is_kernel (map) ?"the Kernel" : map->dso->short_name) <0 )return 0 ;
@@ -2936,6 +2938,7 @@ static int perf_evsel__hists_browse(struct evsel *evsel, int nr_events,"E Expand all callchains\n" \"F Toggle percentage of filtered entries\n" \"H Display column headers\n" \ +"k Zoom into the kernel map\n" \"L Change percent limit\n" \"m Display context menu\n" \"S Zoom into current Processor Socket\n" \
@@ -3033,6 +3036,10 @@ static int perf_evsel__hists_browse(struct evsel *evsel, int nr_events, actions->ms.map = map;do_zoom_dso (browser, actions);continue ; +case 'k' : +if (browser->selection !=NULL ) +hists_browser__zoom_map (browser, browser->selection->maps->machine->vmlinux_map); +continue ;case 'V' : verbose = (verbose +1 ) %4 ; browser->show_dso = verbose >0 ;
Signature · 1 line
2.21.1
Arnaldo Carvalho de Melo
maintainerPATCH 15/20 perf hists browser: Allow passing an initial hotkey
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
Sometimes we're in an outer code, like the main hists browser popup menu and the user follows a suggestion about using some hotkey, and that hotkey is really handled by hists_browser__run(), so allow for calling it with that hotkey, making it handle it instead of waiting for the user to press one.
--- tools/perf/builtin-c2c.c | 4 +- tools/perf/ui/browsers/hists.c | 153 +++++++++++++++++---------------- tools/perf/ui/browsers/hists.h | 2 +- 3 files changed, 82 insertions(+), 77 deletions(-)
tools/perf/builtin-c2c.c +2 -2
@@ -2384,7 +2384,7 @@ static int perf_c2c__browse_cacheline(struct hist_entry *he)c2c_browser__update_nr_entries (browser);while (1 ) { - key =hist_browser__run (browser,"? - help" , true); + key =hist_browser__run (browser,"? - help" , true,0 );switch (key) {case 's' :
@@ -2453,7 +2453,7 @@ static int perf_c2c__hists_browse(struct hists *hists)c2c_browser__update_nr_entries (browser);while (1 ) { - key =hist_browser__run (browser,"? - help" , true); + key =hist_browser__run (browser,"? - help" , true,0 );switch (key) {case 'q' :
tools/perf/ui/browsers/hists.c +79 -74
183 lines not on this page · raw message
tools/perf/ui/browsers/hists.h +1 -1
@@ -34,7 +34,7 @@ struct hist_browser {struct hist_browser *hist_browser__new (struct hists *hists);void hist_browser__delete (struct hist_browser *browser);int hist_browser__run (struct hist_browser *browser,const char *help, -bool warn_lost_event); +bool warn_lost_event,int key);void hist_browser__init (struct hist_browser *browser,struct hists *hists);#endif /* _PERF_UI_BROWSER_HISTS_H_ */
Signature · 1 line
2.21.1
Arnaldo Carvalho de Melo
maintainerPATCH 16/20 tools ui popup: Allow returning hotkeys
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
With this patch if an optional pointer is passed to ui__popup_menu() then when any key that is not being handled (ENTER, ESC, etc) is typed, it'll record that key in the pointer and return, allowing for hotkey processing on the caller.
If NULL is passed, no change in logic, unhandled keys continue to be ignored.
--- tools/perf/ui/browsers/hists.c | 4 ++-- tools/perf/ui/browsers/res_sample.c | 2 +- tools/perf/ui/browsers/scripts.c | 2 +- tools/perf/ui/tui/util.c | 12 ++++++++---- tools/perf/ui/util.h | 2 +- 5 files changed, 13 insertions(+), 9 deletions(-)
tools/perf/ui/browsers/hists.c +2 -2
@@ -2393,7 +2393,7 @@ static int switch_data_file(void)closedir (pwd_dir);if (nr_options) { - choice =ui__popup_menu (nr_options, options); + choice =ui__popup_menu (nr_options, options,NULL );if (choice < nr_options && choice >=0 ) { tmp =strdup (abs_path[choice]);if (tmp) {
@@ -3279,7 +3279,7 @@ static int perf_evsel__hists_browse(struct evsel *evsel, int nr_events, do { struct popup_action *act; - choice = ui__popup_menu(nr_options, options); + choice = ui__popup_menu(nr_options, options, NULL); if (choice == -1 || choice >= nr_options) break;
tools/perf/ui/browsers/res_sample.c +1 -1
@@ -56,7 +56,7 @@ int res_sample_browse(struct res_sample *res_samples, int num_res,return -1 ; } } - choice =ui__popup_menu (num_res, names); + choice =ui__popup_menu (num_res, names,NULL );for (i =0 ; i < num_res; i++)zfree (&names[i]);free (names);
tools/perf/ui/browsers/scripts.c +1 -1
@@ -126,7 +126,7 @@ static int list_scripts(char *script_name, bool *custom, SCRIPT_FULLPATH_LEN);if (num <0 ) num =0 ; - choice =ui__popup_menu (num + max_std, (char *const *)names); + choice =ui__popup_menu (num + max_std, (char *const *)names,NULL );if (choice <0 ) { ret =-1 ; goto out;
tools/perf/ui/tui/util.c +8 -4
@@ -23,7 +23,7 @@ static void ui_browser__argv_write(struct ui_browser *browser,ui_browser__write_nstring (browser, *arg, browser->width); } -static int popup_menu__run (struct ui_browser *menu) +static int popup_menu__run (struct ui_browser *menu,int *keyp) {int key;
@@ -45,6 +45,11 @@ static int popup_menu__run(struct ui_browser *menu) key =-1 ;break ;default : +if (keyp) { + *keyp = key; + key = menu->nr_entries; +break ; + }continue ; }
@@ -55,7 +60,7 @@ static int popup_menu__run(struct ui_browser *menu)return key; } -int ui__popup_menu (int argc,char *const argv[]) +int ui__popup_menu (int argc,char *const argv[],int *keyp) {struct ui_browser menu = { .entries = (void *)argv,
@@ -64,8 +69,7 @@ int ui__popup_menu(int argc, char * const argv[]) .write = ui_browser__argv_write, .nr_entries = argc, }; - -return popup_menu__run (&menu); +return popup_menu__run (&menu, keyp); } int ui_browser__input_window(const char *title, const char *text, char *input,
tools/perf/ui/util.h +1 -1
@@ -5,7 +5,7 @@#include <stdarg.h> int ui__getch (int delay_secs); -int ui__popup_menu (int argc,char *const argv[]); +int ui__popup_menu (int argc,char *const argv[],int *keyp);int ui__help_window (const char *text);int ui__dialog_yesno (const char *msg);void __ui__info_window (const char *title,const char *text,const char *exit_msg);
Signature · 1 line
2.21.1
Arnaldo Carvalho de Melo
maintainerPATCH 17/20 perf report/top: Allow pressing hotkeys in the options popup menu
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
When the users presses ENTER in the main 'perf report/top' screen a popup menu is presented, in it some hotkeys are suggested as alternatives to using the menu, or for additional features.
At that point the user may try those hotkeys, so allow for that by recording the key used and exiting, the caller then can check for that possibility and process the hotkey.
I.e. try pressing ENTER, and then 'k' to exit and zoom into the kernel map, using ESC then zooms out, etc.
--- tools/perf/ui/browsers/hists.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
tools/perf/ui/browsers/hists.c +10 -6
@@ -2995,12 +2995,13 @@ static int perf_evsel__hists_browse(struct evsel *evsel, int nr_events,while (1 ) {struct thread *thread =NULL ;struct map *map =NULL ; -int choice =0 ; +int choice;int socked_id =-1 ; - nr_options =0 ; - - key =hist_browser__run (browser, helpline, warn_lost_event,0 ); + key =0 ;// reset key +do_hotkey:// key came straight from options ui__popup_menu() + choice = nr_options =0 ; + key =hist_browser__run (browser, helpline, warn_lost_event, key);if (browser->he_selection !=NULL ) { thread =hist_browser__selected_thread (browser);
@@ -3279,10 +3280,13 @@ static int perf_evsel__hists_browse(struct evsel *evsel, int nr_events,do {struct popup_action *act; - choice =ui__popup_menu (nr_options, options,NULL ); -if (choice ==-1 || choice >= nr_options) + choice =ui__popup_menu (nr_options, options, &key); +if (choice ==-1 )break ; +if (choice == nr_options) + goto do_hotkey; + act = &actions[choice]; key = act->fn (browser, act); }while (key ==1 );
Signature · 1 line
2.21.1
Arnaldo Carvalho de Melo
maintainerPATCH 18/20 perf report/top: Do not offer annotation for symbols without samples
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
This can happen in the --children mode, i.e. the default mode when callchains are present, where one of the main entries may be a callchain entry with no samples.
So far we were not providing any information about why an annotation couldn't be provided even offering the Annotation option in the popup menu.
Work is needed to allow for no-samples "annotation', i.e. to show the disassembly anyway and allow for navigation, etc.
--- tools/perf/ui/browsers/hists.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
tools/perf/ui/browsers/hists.c +10 -1
@@ -2465,7 +2465,8 @@ add_annotate_opt(struct hist_browser *browser __maybe_unused, struct popup_action *act, char **optstr, struct map_symbol *ms) { - if (ms->sym == NULL || ms->map->dso->annotate_warned) + if (ms->sym == NULL || ms->map->dso->annotate_warned || + symbol__annotation(ms->sym)->src == NULL) return 0; if (asprintf(optstr, "Annotate %s", ms->sym->name) < 0)
@@ -3031,6 +3032,14 @@ static int perf_evsel__hists_browse(struct evsel *evsel, int nr_events, browser->selection->map->dso->annotate_warned) continue; +if (symbol__annotation (browser->selection->sym)->src ==NULL ) { +ui_browser__warning (&browser->b, delay_secs *2 , +"No samples for the \"%s\" symbol.\n\n" +"Probably appeared just in a callchain" , + browser->selection->sym->name); +continue ; + } + actions->ms.map = browser->selection->map; actions->ms.sym = browser->selection->sym;do_annotate (browser, actions);
Signature · 1 line
2.21.1
Arnaldo Carvalho de Melo
maintainerPATCH 19/20 perf report/top: Make 'e' visible in the help and make it toggle showing callchains
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
The 'e' and 'c' hotkeys were present for a long time, but not documented in the help window, change 'e' to be a toggle so that it gets consistent with other toggles like '+' and document it in the help window.
Keep 'c' as is for people used to it but don't document, as it is easier to just use 'e' to show/hide all the callchains for a top level histogram entry.
--- tools/perf/ui/browsers/hists.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
tools/perf/ui/browsers/hists.c +7 -1
@@ -407,6 +407,11 @@ static bool hist_browser__selection_has_children(struct hist_browser *browser) return container_of(ms, struct callchain_list, ms)->has_children; } +static bool hist_browser__he_selection_unfolded (struct hist_browser *browser) +{ +return browser->he_selection ? browser->he_selection->unfolded : false; +} +static bool hist_browser__selection_unfolded (struct hist_browser *browser) {struct hist_entry *he = browser->he_selection;
@@ -727,7 +732,7 @@ static int hist_browser__handle_hotkey(struct hist_browser *browser, bool warn_lbreak ;case 'e' :/* Expand the selected entry. */ -hist_browser__set_folding_selected (browser, true); +hist_browser__set_folding_selected (browser, !hist_browser__he_selection_unfolded (browser));break ;case 'H' : browser->show_headers = !browser->show_headers;
@@ -2942,6 +2947,7 @@ static int perf_evsel__hists_browse(struct evsel *evsel, int nr_events,"a Annotate current symbol\n" \"C Collapse all callchains\n" \"d Zoom into current DSO\n" \ +"e Expand/Collapse main entry callchains\n" \"E Expand all callchains\n" \"F Toggle percentage of filtered entries\n" \"H Display column headers\n" \
Signature · 1 line
2.21.1
Arnaldo Carvalho de Melo
maintainerPATCH 20/20 tools lib: Fix builds when glibc contains strlcpy()
In reply to Arnaldo Carvalho de MeloFrom: Vitaly Chikunov <[email protected]>
Disable a couple of compilation warnings (which are treated as errors) on strlcpy() definition and declaration, allowing users to compile perf and kernel (objtool) when:
1. glibc have strlcpy() (such as in ALT Linux since 2004) objtool and perf build fails with this (in gcc):
In file included from exec-cmd.c:3:
tools/include/linux/string.h:20:15: error: redundant redeclaration of ‘strlcpy’ [-Werror=redundant-decls]
20 | extern size_t strlcpy(char *dest, const char *src, size_t size);
2. clang ignores `-Wredundant-decls', but produces another warning when building perf:
CC util/string.o
../lib/string.c:99:8: error: attribute declaration must precede definition [-Werror,-Wignored-attributes] size_t __weak strlcpy(char *dest, const char *src, size_t size) ../../tools/include/linux/compiler.h:66:34: note: expanded from macro '__weak'
# define __weak __attribute__((weak)) /usr/include/bits/string_fortified.h:151:8: note: previous definition is here __NTH (strlcpy (char *__restrict __dest, const char *__restrict __src,
Committer notes:
The
#pragma GCC diagnostic
directive was introduced in gcc 4.6, so check for that as well.
Resolves: https://bugzilla.kernel.org/show_bug.cgi?id=118481
--- tools/include/linux/string.h | 8 ++++++++ tools/lib/string.c | 7 +++++++ 2 files changed, 15 insertions(+)
tools/include/linux/string.h +8 -0
@@ -17,7 +17,15 @@ int strtobool(const char *s, bool *res);* However uClibc headers also define __GLIBC__ hence the hack below */ #if defined(__GLIBC__) && !defined(__UCLIBC__) +// pragma diagnostic was introduced in gcc 4.6 +#if __GNUC__ >4 || (__GNUC__ ==4 && __GNUC_MINOR__ >=6 ) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wredundant-decls" +#endif extern size_t strlcpy (char *dest,const char *src,size_t size); +#if __GNUC__ >4 || (__GNUC__ ==4 && __GNUC_MINOR__ >=6 ) +#pragma GCC diagnostic pop +#endif #endif char *str_error_r (int errnum,char *buf,size_t buflen);
tools/lib/string.c +7 -0
@@ -96,6 +96,10 @@ int strtobool(const char *s, bool *res)* If libc has strlcpy() then that version will override this * implementation: */ +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wignored-attributes" +#endif size_t __weak strlcpy (char *dest,const char *src,size_t size) {size_t ret =strlen (src);
@@ -107,6 +111,9 @@ size_t __weak strlcpy(char *dest, const char *src, size_t size) }return ret; } +#ifdef __clang__ +#pragma clang diagnostic pop +#endif /** * skip_spaces - Removes leading whitespace from @str.
Signature · 1 line
2.21.1
RE: [PATCH 20/20] tools lib: Fix builds when glibc contains strlcpy()
From: Arnaldo Carvalho de Melo
Quoted 18 lines
Sent: 06 January 2020 16:07
From: Vitaly Chikunov <[email protected]>
Disable a couple of compilation warnings (which are treated as errors) on
strlcpy()definition and declaration, allowing users to compile perf and kernel (objtool) when:1. glibc have
strlcpy()(such as in ALT Linux since 2004) objtool and perf build fails with this (in gcc):In file included from exec-cmd.c:3:
tools/include/linux/string.h:20:15: error: redundant redeclaration of ‘strlcpy’ [-Werror=redundant-decls]20 | extern size_t strlcpy(char *dest, const char *src, size_t size);2. clang ignores `-Wredundant-decls', but produces another warning when building perf:
Quoted 7 lines
CC
util/string.o
../lib/string.c:99:8: error: attribute declaration must precede definition [-Werror,-Wignored-attributes]size_t__weakstrlcpy(char *dest, const char *src, size_t size)../../tools/include/linux/compiler.h:66:34: note: expanded from macro '__weak'# define __weak __attribute__((weak)) /usr/include/bits/string_fortified.h:151:8: note: previous definition is here __NTH (strlcpy (char *__restrict __dest, const char *__restrict __src,
Why not just always use the local version by renaming it?
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)
Re: [PATCH 08/20] tools lib api fs: Fix gcc9 stringop-truncation compilation error
In reply to Arnaldo Carvalho de MeloQuoted 14 lines · Arnaldo Carvalho de Melo
From: Andrey Zhizhikin <[email protected]>
GCC9 introduced string hardening mechanisms, which exhibits the error during fs api compilation:
error: '
__builtin_strncpy' specified bound 4096 equals destination size [-Werror=stringop-truncation]This comes when the length of copy passed to strncpy is is equal to destination size, which could potentially lead to buffer overflow.
There is a need to mitigate this potential issue by limiting the size of destination by 1 and explicitly terminate the destination with NULL.
Quoted 16 lines
Signed-off-by Andrey Zhizhikin <[email protected]>Reviewed-by Petr Mladek <[email protected]>Acked-by Jiri Olsa <[email protected]>Cc Alexei Starovoitov <[email protected]>Cc Andrii Nakryiko <[email protected]>Cc Daniel Borkmann <[email protected]>Cc Kefeng Wang <[email protected]>Cc Martin KaFai Lau <[email protected]>Cc Petr Mladek <[email protected]>Cc Sergey Senozhatsky <[email protected]>Cc Song Liu <[email protected]>Cc Yonghong Song <[email protected]>Signed-off-by Arnaldo Carvalho de Melo <[email protected]>
Best Regards,
Petr
Re: [PATCH 20/20] tools lib: Fix builds when glibc contains strlcpy()
In reply to David LaightDavid,
Quoted 27 lines · David Laight
From: Arnaldo Carvalho de Melo
Quoted 18 lines
Sent: 06 January 2020 16:07
From: Vitaly Chikunov <[email protected]>
Disable a couple of compilation warnings (which are treated as errors) on
strlcpy()definition and declaration, allowing users to compile perf and kernel (objtool) when:1. glibc have
strlcpy()(such as in ALT Linux since 2004) objtool and perf build fails with this (in gcc):In file included from exec-cmd.c:3:
tools/include/linux/string.h:20:15: error: redundant redeclaration of ‘strlcpy’ [-Werror=redundant-decls]20 | extern size_t strlcpy(char *dest, const char *src, size_t size);2. clang ignores `-Wredundant-decls', but produces another warning when building perf:
Quoted 7 lines
CC
util/string.o
../lib/string.c:99:8: error: attribute declaration must precede definition [-Werror,-Wignored-attributes]size_t__weakstrlcpy(char *dest, const char *src, size_t size)../../tools/include/linux/compiler.h:66:34: note: expanded from macro '__weak'# define __weak __attribute__((weak)) /usr/include/bits/string_fortified.h:151:8: note: previous definition is here __NTH (strlcpy (char *__restrict __dest, const char *__restrict __src,
Quoted 1 line
Why not just always use the local version by renaming it?
I believe that was the initial approach, which is changed some time ago to using weak linking. Also, Dmitry Levin (as one of glibc maintainers) claims that glibc implementation of strlcpy() is more correct and thus better.
Thanks,
Quoted 6 lines
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)
Quoted 105 lines · Arnaldo Carvalho de Melo
Hi Ingo/Thomas,
Please consider pulling,
Best regards,
- Arnaldo
Test results at the end of this message, as usual.
The following changes since commit
b9fb2de0115bbacab36da31fd10483ea66d9cfab:Merge tag 'perf-urgent-for-mingo-5.5-20191223' of
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linuxinto perf/urgent (2019-12-23 22:27:44 +0100)are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.gittags/perf-core-for-mingo-5.6-20200106for you to fetch changes up to
6c4798d3f08b81c2c52936b10e0fa872590c96ae:tools lib: Fix builds when glibc contains
strlcpy()(2020-01-06 11:46:10 -0300)----------------------------------------------------------------
perf/core improvements and fixes.perf record:
Alexey Budankov:
- Adapt affinity for machines with #CPUs > 1K to overcome current 1024 CPUs mask size limitation of
cpu_set_ttype.perf report/top TUI:
Arnaldo Carvalho de Melo:
- Make ENTER consistently present the pop up menu with and without call chains, to eliminate confusion. The menu continues available at all times use 'm' and '+' can be used to toggle just one call chain level, 'e' for all the call chains for a top level histogram entry and 'E' to expand all call chains in all top level entries. Extra info about these options was added to the pop up menu entries. Pressing 'k' serves as special hotkey to go straight to the main vmlinux entries, to avoid having to press enter and then select "Zoom into the kernel DSO".
perf sched timehist:
David Ahern:
- Add support for filtering on CPU.
perf tests:
Arnaldo Carvalho de Melo:
- Show expected versus obtained values in
bp_signaltest.libperf:
Jiri Olsa:
- Move to
tools/lib/perf.- Add man pages.
libapi:
Andrey Zhizhikin:
- Fix gcc9 stringop-truncation compilation error.
tools lib:
Vitaly Chikunov:
- Fix builds when glibc contains
strlcpy(), which is the case for ALT Linux.Signed-off-by Arnaldo Carvalho de Melo <[email protected]>----------------------------------------------------------------
Alexey Budankov (3):
tools bitmap: Implementbitmap_equal()operation at bitmap API perf mmap: Declare type for cpu mask of arbitrary length perf record: Adapt affinity to machines with #CPUs > 1KAndrey Zhizhikin (1):
tools lib api fs: Fix gcc9 stringop-truncation compilation errorArnaldo Carvalho de Melo (12):
perf testsbp_signal: Show expected versus obtained values
perf hists browser: Restore ESC as "Zoom out" of DSO/thread/etc
perf report/top: Make ENTER consistently bring up menu
perf report/top: Add menu entry for toggling callchain expansion
perf report/top: Improve toggle callchain menu option
perf hists browser: Generalize thedo_zoom_dso()function
perf report/top: Add 'k' hotkey to zoom directly into the kernel map perf hists browser: Allow passing an initial hotkey
tools ui popup: Allow returning hotkeys
perf report/top: Allow pressing hotkeys in the options popup menu perf report/top: Do not offer annotation for symbols without samples perf report/top: Make 'e' visible in the help and make it toggle showing callchainsDavid Ahern (1):
perf sched timehist: Add support for filtering on CPU
Quoted 8 lines
Jiri Olsa (2):
libperf: Move totools/lib/perf
libperf: Add man pagesVitaly Chikunov (1):
tools lib: Fix builds when glibc containsstrlcpy()70 files changed, 1565 insertions(+), 352 deletions(-)
Pulled, thanks a lot Arnaldo!
Ingo
The pull request you sent on Mon, 6 Jan 2020 13:06:45 -0300:
The pull request you sent on Mon, 6 Jan 2020 13:06:45 -0300:
Quoted 1 line
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.gittags/perf-core-for-mingo-5.6-20200106
has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/53f3feeb7bd2d78039b3dc9ab158bad2a5dbe012
Thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.wiki.kernel.org/userdoc/prtracker