perf/core fixes and cleanups
Subsystems (3)
Arnaldo Carvalho de Melo
maintainerHi Ingo,
Please consider pulling,
- Arnaldo
Test results at the end of this message, as usual.
The following changes since commit e720c19e0d5412f45736d62258d21dc7b056c4ad:
Merge tag 'perf-core-for-mingo-4.12-20170413' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core (2017-04-17 10:11:09 +0200)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-core-for-mingo-4.12-20170419
for you to fetch changes up to 1b5ad16c7aa7177512ce141e345ff36b9f1a6136:
perf tools: Ditch unused strchrnul() reimplementation (2017-04-19 13:01:57 -0300)
----------------------------------------------------------------
perf/core cleanups: (Arnaldo Carvalho de Melo)
. Introduce new header files out of the hodge-podge that util/util.h
became, trying to disentangle the includes hell that all C projects end up growing. This should help in build times, as changes to seemingly unrelated files (util.h included tons of headers) won't trigger a rebuild of most object files.
. Use equivalent facilities found in the kernel source code base
originated tools/include/ header files, such as __stringify(), ARRAY_SIZE, that has extra checks (__must_be_array()), etc.
. For that get some more files from the kernel sources, like
include/linux/bug.h, some just with the bits needed at this time.
. Use the headers where facilities declared in them are used, such
as PRIxu(32,64) macros (inttypes.h), errno defines (errno.h), etc.
. Remove various leftovers from the initial code base we copied from
git.git: FLEX_ARRAY, etc.
----------------------------------------------------------------
Arnaldo Carvalho de Melo (28):
perf unwind arm64: Add missing errno.h header
perf tools: Remove FLEX_ARRAY definition
tools include: Introduce linux/bug.h, from the kernel sources tools include: Adopt __same_type() and __must_be_array() from the kernel tools include: Move ARRAY_SIZE() to linux/kernel.h
perf tools: Add include <linux/kernel.h> where ARRAY_SIZE() is used
objtool: Drop ARRAY_SIZE() definition, tools/include/linux/kernel.h has it now tools include: Drop ARRAY_SIZE() definition from linux/hashtable.h perf tools: Remove unused macros from util.h
perf tools: Including missing inttypes.h header
perf tools: Remove PRI[xu] macros from perf.h
perf tools: Replace STR() calls with __stringify()
perf tools: Ditch unused PATH_SEP, STRIP_EXTENSION
perf tools: Move sane ctype stuff from util.h to sane_ctype.h tools include: Include missing headers for fls() and types in linux/log2.h perf tools: Move print_binary definitions to separate files
perf tools: Move srcline definitions to separate header
perf tools: Move extra string util functions to util/string2.h perf tools: Include errno.h where needed
perf str{filter,list}: Disentangle headers
perf tools: Don't include terminal handling headers in util.h perf tools: Move path related functions to util/path.h
perf tools: No need to include bitops.h in util.h
perf tools: Use api/fs/tracing_path.h where needed
perf tools: Remove misplaced __maybe_unused in some functions perf tools: Remove include dirent.h from util.h
perf tools: Remove regex.h and fnmatch.h from util.h
perf tools: Ditch unused strchrnul() reimplementation
tools/include/linux/bug.h | 10 + tools/include/linux/compiler-gcc.h | 3 + tools/include/linux/compiler.h | 5 + tools/include/linux/hashtable.h | 4 - tools/include/linux/kernel.h | 3 + tools/include/linux/log2.h | 3 + tools/lib/symbol/kallsyms.c | 1 + tools/objtool/builtin-check.c | 3 +- tools/objtool/objtool.c | 3 +- tools/perf/MANIFEST | 1 + tools/perf/arch/arm/util/dwarf-regs.c | 4 +- tools/perf/arch/arm64/util/dwarf-regs.c | 4 +- tools/perf/arch/arm64/util/unwind-libunwind.c | 2 +- tools/perf/arch/common.c | 2 + tools/perf/arch/powerpc/util/dwarf-regs.c | 5 +- tools/perf/arch/powerpc/util/kvm-stat.c | 1 + tools/perf/arch/powerpc/util/perf_regs.c | 1 + tools/perf/arch/s390/util/kvm-stat.c | 1 + tools/perf/arch/x86/tests/intel-cqm.c | 1 + tools/perf/arch/x86/tests/perf-time-to-tsc.c | 2 + tools/perf/arch/x86/util/auxtrace.c | 1 + tools/perf/arch/x86/util/intel-bts.c | 1 + tools/perf/arch/x86/util/intel-pt.c | 1 + tools/perf/arch/x86/util/kvm-stat.c | 1 + tools/perf/arch/x86/util/perf_regs.c | 1 + tools/perf/bench/mem-functions.c | 1 + tools/perf/bench/numa.c | 2 + tools/perf/builtin-annotate.c | 1 + tools/perf/builtin-buildid-cache.c | 1 + tools/perf/builtin-buildid-list.c | 1 + tools/perf/builtin-c2c.c | 2 + tools/perf/builtin-diff.c | 2 + tools/perf/builtin-ftrace.c | 2 + tools/perf/builtin-help.c | 6 +- tools/perf/builtin-inject.c | 1 + tools/perf/builtin-kallsyms.c | 1 + tools/perf/builtin-kmem.c | 5 + tools/perf/builtin-kvm.c | 4 + tools/perf/builtin-lock.c | 3 + tools/perf/builtin-mem.c | 1 + tools/perf/builtin-record.c | 2 + tools/perf/builtin-report.c | 4 +- tools/perf/builtin-sched.c | 5 + tools/perf/builtin-script.c | 8 + tools/perf/builtin-stat.c | 5 + tools/perf/builtin-timechart.c | 4 +- tools/perf/builtin-top.c | 3 + tools/perf/builtin-trace.c | 8 + tools/perf/perf.c | 12 +- tools/perf/tests/attr.c | 2 + tools/perf/tests/backward-ring-buffer.c | 1 + tools/perf/tests/bpf.c | 2 + tools/perf/tests/builtin-test.c | 2 + tools/perf/tests/clang.c | 1 + tools/perf/tests/code-reading.c | 6 +- tools/perf/tests/dso-data.c | 2 + tools/perf/tests/dwarf-unwind.c | 1 + tools/perf/tests/event-times.c | 2 + tools/perf/tests/evsel-roundtrip-name.c | 2 + tools/perf/tests/hists_common.c | 2 + tools/perf/tests/hists_cumulate.c | 1 + tools/perf/tests/hists_filter.c | 1 + tools/perf/tests/hists_link.c | 2 + tools/perf/tests/hists_output.c | 1 + tools/perf/tests/is_printable_array.c | 3 +- tools/perf/tests/mmap-basic.c | 3 + tools/perf/tests/mmap-thread-lookup.c | 2 + tools/perf/tests/openat-syscall-all-cpus.c | 6 + tools/perf/tests/openat-syscall-tp-fields.c | 1 + tools/perf/tests/openat-syscall.c | 5 + tools/perf/tests/parse-events.c | 5 +- tools/perf/tests/parse-no-sample-id-all.c | 1 + tools/perf/tests/perf-record.c | 2 + tools/perf/tests/pmu.c | 2 + tools/perf/tests/sample-parsing.c | 2 + tools/perf/tests/sdt.c | 1 + tools/perf/tests/sw-clock.c | 2 + tools/perf/tests/switch-tracking.c | 1 + tools/perf/tests/task-exit.c | 1 + tools/perf/tests/unit_number__scnprintf.c | 1 + tools/perf/tests/vmlinux-kallsyms.c | 1 + tools/perf/ui/browser.c | 2 + tools/perf/ui/browsers/annotate.c | 3 + tools/perf/ui/browsers/header.c | 2 + tools/perf/ui/browsers/hists.c | 8 + tools/perf/ui/browsers/map.c | 2 + tools/perf/ui/gtk/annotate.c | 2 +- tools/perf/ui/gtk/hists.c | 1 + tools/perf/ui/hist.c | 1 + tools/perf/ui/setup.c | 1 + tools/perf/ui/stdio/hist.c | 4 +- tools/perf/ui/tui/setup.c | 1 + tools/perf/util/Build | 1 + tools/perf/util/annotate.c | 6 + tools/perf/util/auxtrace.c | 6 +- tools/perf/util/auxtrace.h | 1 + tools/perf/util/bpf-loader.c | 3 + tools/perf/util/bpf-loader.h | 2 + tools/perf/util/bpf-prologue.c | 1 + tools/perf/util/bpf-prologue.h | 2 + tools/perf/util/build-id.c | 9 +- tools/perf/util/build-id.h | 4 +- tools/perf/util/c++/clang-c.h | 1 + tools/perf/util/callchain.c | 1 + tools/perf/util/cgroup.c | 5 +- tools/perf/util/cloexec.c | 1 + tools/perf/util/comm.c | 1 + tools/perf/util/config.c | 3 + tools/perf/util/counts.c | 2 + tools/perf/util/cpumap.c | 3 + tools/perf/util/ctype.c | 2 +- tools/perf/util/data-convert-bt.c | 4 + tools/perf/util/data.c | 1 + tools/perf/util/debug.c | 4 + tools/perf/util/demangle-java.c | 2 + tools/perf/util/drv_configs.c | 1 + tools/perf/util/dso.c | 4 + tools/perf/util/dwarf-aux.c | 3 + tools/perf/util/dwarf-regs.c | 1 + tools/perf/util/env.c | 1 + tools/perf/util/event.c | 7 +- tools/perf/util/evlist.c | 2 + tools/perf/util/evlist.h | 1 + tools/perf/util/evsel.c | 4 + tools/perf/util/evsel_fprintf.c | 2 + tools/perf/util/header.c | 5 + tools/perf/util/hist.c | 2 + tools/perf/util/intel-bts.c | 2 + tools/perf/util/intel-pt.c | 1 + tools/perf/util/jitdump.c | 7 +- tools/perf/util/lzma.c | 1 + tools/perf/util/machine.c | 8 +- tools/perf/util/map.c | 2 +- tools/perf/util/mem-events.c | 1 + tools/perf/util/ordered-events.c | 2 + tools/perf/util/parse-events.c | 7 +- tools/perf/util/path.c | 28 ++- tools/perf/util/path.h | 9 + tools/perf/util/perf-hooks.c | 1 + tools/perf/util/pmu.c | 2 + tools/perf/util/print_binary.c | 55 +++++ tools/perf/util/print_binary.h | 28 +++ tools/perf/util/probe-event.c | 5 + tools/perf/util/probe-event.h | 7 +- tools/perf/util/probe-file.c | 3 + tools/perf/util/probe-file.h | 6 +- tools/perf/util/probe-finder.c | 3 + tools/perf/util/probe-finder.h | 2 +- tools/perf/util/python-ext-sources | 1 + tools/perf/util/python.c | 1 + tools/perf/util/quote.c | 1 + tools/perf/util/record.c | 1 + tools/perf/util/sane_ctype.h | 51 +++++ .../perf/util/scripting-engines/trace-event-perl.c | 1 + .../util/scripting-engines/trace-event-python.c | 2 + tools/perf/util/session.c | 2 + tools/perf/util/session.h | 1 + tools/perf/util/sort.c | 5 + tools/perf/util/sort.h | 4 +- tools/perf/util/srcline.c | 2 + tools/perf/util/srcline.h | 34 +++ tools/perf/util/stat.c | 2 + tools/perf/util/strbuf.c | 1 + tools/perf/util/strfilter.c | 5 +- tools/perf/util/string.c | 18 +- tools/perf/util/string2.h | 42 ++++ tools/perf/util/symbol-elf.c | 3 +- tools/perf/util/symbol-minimal.c | 1 + tools/perf/util/symbol.c | 3 + tools/perf/util/symbol.h | 2 +- tools/perf/util/term.c | 6 +- tools/perf/util/thread-stack.c | 1 + tools/perf/util/thread.c | 2 + tools/perf/util/thread_map.c | 2 + tools/perf/util/trace-event-parse.c | 3 +- tools/perf/util/unwind-libdw.c | 1 + tools/perf/util/unwind-libunwind-local.c | 2 + tools/perf/util/util.c | 64 +----- tools/perf/util/util.h | 249 +-------------------- tools/perf/util/vdso.c | 2 +- 180 files changed, 659 insertions(+), 376 deletions(-) create mode 100644 tools/include/linux/bug.h create mode 100644 tools/perf/util/path.h create mode 100644 tools/perf/util/print_binary.c create mode 100644 tools/perf/util/print_binary.h create mode 100644 tools/perf/util/sane_ctype.h create mode 100644 tools/perf/util/srcline.h create mode 100644 tools/perf/util/string2.h
Test results:
The first ones are container (docker) based builds of tools/perf with and without libelf support, objtool where it is supported and samples/bpf/, ditto. Where clang is available, it is also used to build perf with/without libelf.
For this specific pull request the samples/bpf/ was disabled, as 'make headers_install' is failing with the following error, in this case in fedora:rawhide:
INSTALL usr/include/uapi/ (0 file)
/git/linux/scripts/Makefile.headersinst:62: *** Missing generated UAPI file ./arch/x86/include/generated/uapi/asm/unistd_32.h. Stop. make[1]: *** [/git/linux/Makefile:1151: headers_install] Error 2
make[1]: Leaving directory '/tmp/build/linux'
make: *** [Makefile:152: sub-make] Error 2
make: Leaving directory '/git/linux'
I'll investigate later, perf and objtool builds just fine, with clang and gcc.
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.
# dm 1 alpine:3.4: Ok 2 alpine:3.5: Ok 3 alpine:edge: Ok 4 android-ndk:r12b-arm: Ok 5 archlinux:latest: Ok 6 centos:5: Ok 7 centos:6: Ok 8 centos:7: Ok 9 debian:7: Ok 10 debian:8: Ok 11 debian:9: Ok 12 debian:experimental: Ok 13 debian:experimental-x-arm64: Ok 14 debian:experimental-x-mips: Ok 15 debian:experimental-x-mips64: Ok 16 debian:experimental-x-mipsel: Ok 17 fedora:20: Ok 18 fedora:21: Ok 19 fedora:22: Ok 20 fedora:23: Ok 21 fedora:24: Ok 22 fedora:24-x-ARC-uClibc: Ok 23 fedora:25: Ok 24 fedora:rawhide: Ok 25 mageia:5: Ok 26 opensuse:13.2: Ok 27 opensuse:42.1: Ok 28 opensuse:tumbleweed: Ok 29 ubuntu:12.04.5: Ok 30 ubuntu:14.04.4: Ok 31 ubuntu:14.04.4-x-linaro-arm64: Ok 32 ubuntu:15.10: Ok 33 ubuntu:16.04: Ok 34 ubuntu:16.04-x-arm: Ok 35 ubuntu:16.04-x-arm64: Ok 36 ubuntu:16.04-x-powerpc: Ok 37 ubuntu:16.04-x-powerpc64: Ok 38 ubuntu:16.04-x-s390: Ok 39 ubuntu:16.10: Ok 40 ubuntu:17.04: Ok #
# uname -a Linux jouet 4.11.0-rc6+ #7 SMP Tue Apr 11 11:53:14 -03 2017 x86_64 x86_64 x86_64 GNU/Linux # 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: Parse event definition strings : Ok 6: Simple expression parser : Ok 7: PERF_RECORD_* events & perf_sample fields : Ok 8: Parse perf pmu format : Ok 9: DSO data read : Ok 10: DSO data cache : Ok 11: DSO data reopen : Ok 12: Roundtrip evsel->name : Ok 13: Parse sched tracepoints fields : Ok 14: syscalls:sys_enter_openat event fields : Ok 15: Setup struct perf_event_attr : Ok 16: Match and link multiple hists : Ok 17: 'import perf' in python : Ok 18: Breakpoint overflow signal handler : Ok 19: Breakpoint overflow sampling : Ok 20: Number of exit events of a simple workload : Ok 21: Software clock events period values : Ok 22: Object code reading : Ok 23: Sample parsing : Ok 24: Use a dummy software event to keep tracking: Ok 25: Parse with no sample_id_all bit set : Ok 26: Filter hist entries : Ok 27: Lookup mmap thread : Ok 28: Share thread mg : Ok 29: Sort output of hist entries : Ok 30: Cumulate child hist entries : Ok 31: Track with sched_switch : Ok 32: Filter fds with revents mask in a fdarray : Ok 33: Add fd to a fdarray, making it autogrow : Ok 34: kmod_path__parse : Ok 35: Thread map : Ok 36: LLVM search and compile : 36.1: Basic BPF llvm compile : Ok 36.2: kbuild searching : Ok 36.3: Compile source for BPF prologue generation: Ok 36.4: Compile source for BPF relocation : Ok 37: Session topology : Ok 38: BPF filter : 38.1: Basic BPF filtering : Ok 38.2: BPF pinning : Ok 38.3: BPF prologue generation : Ok 38.4: BPF relocation checker : Ok 39: Synthesize thread map : Ok 40: Remove thread map : Ok 41: Synthesize cpu map : Ok 42: Synthesize stat config : Ok 43: Synthesize stat : Ok 44: Synthesize stat round : Ok 45: Synthesize attr update : Ok 46: Event times : Ok 47: Read backward ring buffer : Ok 48: Print cpu map : Ok 49: Probe SDT events : Ok 50: is_printable_array : Ok 51: Print bitmap : Ok 52: perf hooks : Ok 53: builtin clang support : Skip (not compiled in) 54: unit_number__scnprintf : Ok 55: x86 rdpmc : Ok 56: Convert perf time to TSC : Ok 57: DWARF unwind : Ok 58: x86 instruction decoder - new instructions : Ok 59: Intel cqm nmi context read : Skip #
$ make -C tools/perf build-test
make: Entering directory '/home/acme/git/linux/tools/perf'
- tarpkg: ./tests/perf-targz-src-pkg .
make_clean_all_O: make clean all
make_no_libbionic_O: make NO_LIBBIONIC=1
make_tags_O: make tags
make_install_prefix_slash_O: make install prefix=/tmp/krava/
make_no_libpython_O: make NO_LIBPYTHON=1
make_no_auxtrace_O: make NO_AUXTRACE=1
make_no_slang_O: make NO_SLANG=1
make_no_libperl_O: make NO_LIBPERL=1
make_no_ui_O: make NO_NEWT=1 NO_SLANG=1 NO_GTK2=1
make_no_gtk2_O: make NO_GTK2=1
make_no_libdw_dwarf_unwind_O: make NO_LIBDW_DWARF_UNWIND=1
make_no_libnuma_O: make NO_LIBNUMA=1
make_install_prefix_O: make install prefix=/tmp/krava
make_install_O: make install
make_with_clangllvm_O: make LIBCLANGLLVM=1
make_no_backtrace_O: make NO_BACKTRACE=1
make_util_map_o_O: make util/map.o
make_pure_O: make
make_static_O: make LDFLAGS=-static
make_debug_O: make DEBUG=1
make_with_babeltrace_O: make LIBBABELTRACE=1
make_no_libelf_O: make NO_LIBELF=1
make_no_libaudit_O: make NO_LIBAUDIT=1
make_minimal_O: make NO_LIBPERL=1 NO_LIBPYTHON=1 NO_NEWT=1 NO_GTK2=1 NO_DEMANGLE=1 NO_LIBELF=1 NO_LIBUNWIND=1 NO_BACKTRACE=1 NO_LIBNUMA=1 NO_LIBAUDIT=1 NO_LIBBIONIC=1 NO_LIBDW_DWARF_UNWIND=1 NO_AUXTRACE=1 NO_LIBBPF=1 NO_LIBCRYPTO=1 NO_SDT=1 NO_JVMTI=1
make_no_libunwind_O: make NO_LIBUNWIND=1
make_util_pmu_bison_o_O: make util/pmu-bison.o
make_no_scripts_O: make NO_LIBPYTHON=1 NO_LIBPERL=1
make_no_libbpf_O: make NO_LIBBPF=1
make_perf_o_O: make perf.o
make_help_O: make help
make_install_bin_O: make install-bin
make_doc_O: make doc
make_no_newt_O: make NO_NEWT=1
make_no_demangle_O: make NO_DEMANGLE=1
OK
make: Leaving directory '/home/acme/git/linux/tools/perf'
$ Arnaldo Carvalho de Melo
maintainerPATCH 1/28 perf unwind arm64: Add missing errno.h header
From: Arnaldo Carvalho de Melo <[email protected]>
Since it uses EINVAL unconditionally, it needs to also unconditionally include errno.h.
Detected when recent changes made errno.h not be included by chance when tools/perf/arch/arm64/util/unwind-libunwind.c gets included by tools/perf/util/libunwind/arm64.c.
Putting this changeset just before that change so that we don't lose bisectability on arm64.
--- tools/perf/arch/arm64/util/unwind-libunwind.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/arch/arm64/util/unwind-libunwind.c +1 -1
@@ -1,6 +1,6 @@ +#include <errno.h> #ifndef REMOTE_UNWIND_LIBUNWIND -#include <errno.h> #include <libunwind.h> #include "perf_regs.h" #include "../../util/unwind.h"
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 2/28 perf tools: Remove FLEX_ARRAY definition
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
We rely on symbol->name[0] since the beginning of tools/perf/, never having received any complaint about it, also all the containers build perf just fine, so remove this git codebase remnant.
--- tools/perf/builtin-help.c | 4 ++-- tools/perf/util/util.h | 22 ---------------------- 2 files changed, 2 insertions(+), 24 deletions(-)
tools/perf/builtin-help.c +2 -2
@@ -15,13 +15,13 @@static struct man_viewer_list {struct man_viewer_list *next; -char name[FLEX_ARRAY ]; +char name[0 ]; } *man_viewer_list;static struct man_viewer_info_list {struct man_viewer_info_list *next;const char *info; -char name[FLEX_ARRAY ]; +char name[0 ]; } *man_viewer_info_list;enum help_format {
tools/perf/util/util.h +0 -22
@@ -1,28 +1,6 @@#ifndef GIT_COMPAT_UTIL_H #define GIT_COMPAT_UTIL_H -#ifndef FLEX_ARRAY -/* -* See if our compiler is known to support flexible array members. -*/ -#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >=199901L ) -# define FLEX_ARRAY /* empty */ -#elif defined(__GNUC__) -# if (__GNUC__ >=3 ) -# define FLEX_ARRAY /* empty */ -# else -# define FLEX_ARRAY 0/* older GNU extension */ -# endif -#endif - -/* -* Otherwise, default to safer but a bit wasteful traditional style -*/ -#ifndef FLEX_ARRAY -# define FLEX_ARRAY 1 -#endif -#endif -#define ARRAY_SIZE (x) (sizeof(x)/sizeof(x[0]))#ifdef __GNUC__
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 3/28 tools include: Introduce linux/bug.h, from the kernel sources
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
With just what we will need in the upcoming changesets, the BUILD_BUG_ON_ZERO() definition.
--- tools/include/linux/bug.h | 10 ++++++++++ tools/perf/MANIFEST | 1 + 2 files changed, 11 insertions(+) create mode 100644 tools/include/linux/bug.h
tools/include/linux/bug.h new file +10 -0
@@ -0,0 +1,10 @@ +#ifndef _TOOLS_PERF_LINUX_BUG_H +#define _TOOLS_PERF_LINUX_BUG_H + +/* Force a compilation error if condition is true, but also produce a +result (of value 0 and type size_t), so the expression can be used +e.g. in a structure initializer (or where-ever else comma expressions +aren't permitted). */ +#define BUILD_BUG_ON_ZERO (e) (sizeof(struct { int:-!!(e); })) + +#endif /* _TOOLS_PERF_LINUX_BUG_H */
tools/perf/MANIFEST +1 -0
@@ -64,6 +64,7 @@ tools/include/linux/bitops.h tools/include/linux/compiler.h tools/include/linux/compiler-gcc.h tools/include/linux/coresight-pmu.h +tools/include/linux/bug.h tools/include/linux/filter.h tools/include/linux/hash.h tools/include/linux/kernel.h
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 4/28 tools include: Adopt __same_type() and __must_be_array() from the kernel
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
Will be used to adopt the more stringent version of ARRAY_SIZE(), the one in the kernel sources.
--- tools/include/linux/compiler-gcc.h | 3 +++ tools/include/linux/compiler.h | 5 +++++ 2 files changed, 8 insertions(+)
tools/include/linux/compiler-gcc.h +3 -0
@@ -16,3 +16,6 @@#if GCC_VERSION >=40300 # define __compiletime_error (message) __attribute__((error(message)))#endif /* GCC_VERSION >= 40300 */ + +/* &a[0] degrades to a pointer: a different type from an array */ +#define __must_be_array (a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
tools/include/linux/compiler.h +5 -0
@@ -17,6 +17,11 @@# define __always_inline inline __attribute__((always_inline))#endif +/* Are two types/vars the same type (ignoring qualifiers)? */ +#ifndef __same_type +# define __same_type (a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) +#endif +#ifdef __ANDROID__/* * FIXME: Big hammer to get rid of tons of:
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 5/28 tools include: Move ARRAY_SIZE() to linux/kernel.h
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
To match the kernel, then look for places redefining it to make it use this version, which checks that its parameter is an array at build time.
--- tools/include/linux/kernel.h | 3 +++ tools/perf/util/util.h | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-)
tools/include/linux/kernel.h +3 -0
@@ -4,6 +4,7 @@#include <stdarg.h> #include <stddef.h> #include <assert.h> +#include <linux/compiler.h> #ifndef UINT_MAX #define UINT_MAX (~0U)
@@ -76,6 +77,8 @@int vscnprintf (char *buf,size_t size,const char *fmt,va_list args);int scnprintf (char * buf,size_t size,const char * fmt, ...); +#define ARRAY_SIZE (arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) +/* * This looks more complex than it should be. But we need to * get the type for the ~ right in round_down (it needs to be
tools/perf/util/util.h +0 -2
@@ -1,8 +1,6 @@#ifndef GIT_COMPAT_UTIL_H #define GIT_COMPAT_UTIL_H -#define ARRAY_SIZE (x) (sizeof(x)/sizeof(x[0])) -#ifdef __GNUC__#define TYPEOF (x) (__typeof__(x))#else
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 6/28 perf tools: Add include <linux/kernel.h> where ARRAY_SIZE() is used
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
To pave the way for further cleanups where linux/kernel.h may stop being included in some header.
--- tools/perf/bench/numa.c | 1 + tools/perf/builtin-help.c | 1 + tools/perf/builtin-kmem.c | 1 + tools/perf/builtin-kvm.c | 1 + tools/perf/builtin-lock.c | 1 + tools/perf/builtin-sched.c | 1 + tools/perf/builtin-script.c | 1 + tools/perf/builtin-timechart.c | 1 + tools/perf/builtin-trace.c | 1 + tools/perf/perf.c | 1 + tools/perf/tests/bpf.c | 1 + tools/perf/tests/builtin-test.c | 1 + tools/perf/tests/clang.c | 1 + tools/perf/tests/code-reading.c | 1 + tools/perf/tests/dso-data.c | 1 + tools/perf/tests/evsel-roundtrip-name.c | 1 + tools/perf/tests/hists_common.c | 1 + tools/perf/tests/hists_cumulate.c | 1 + tools/perf/tests/hists_filter.c | 1 + tools/perf/tests/hists_link.c | 1 + tools/perf/tests/hists_output.c | 1 + tools/perf/tests/is_printable_array.c | 1 + tools/perf/tests/mmap-basic.c | 1 + tools/perf/tests/parse-events.c | 2 +- tools/perf/tests/parse-no-sample-id-all.c | 1 + tools/perf/tests/pmu.c | 1 + tools/perf/tests/sample-parsing.c | 1 + tools/perf/ui/browsers/annotate.c | 1 + tools/perf/ui/tui/setup.c | 1 + tools/perf/util/annotate.c | 1 + tools/perf/util/bpf-loader.c | 1 + tools/perf/util/data-convert-bt.c | 1 + tools/perf/util/dso.c | 1 + tools/perf/util/dwarf-regs.c | 1 + tools/perf/util/event.c | 1 + tools/perf/util/evlist.h | 1 + tools/perf/util/mem-events.c | 1 + tools/perf/util/perf-hooks.c | 1 + tools/perf/util/session.h | 1 + tools/perf/util/sort.c | 1 + tools/perf/util/symbol.c | 1 + tools/perf/util/thread.c | 1 + 42 files changed, 42 insertions(+), 1 deletion(-)
tools/perf/bench/numa.c +1 -0
@@ -30,6 +30,7 @@#include <sys/wait.h> #include <sys/prctl.h> #include <sys/types.h> +#include <linux/kernel.h> #include <linux/time64.h> #include <numa.h>
tools/perf/builtin-help.c +1 -0
@@ -12,6 +12,7 @@#include <subcmd/run-command.h> #include <subcmd/help.h> #include "util/debug.h" +#include <linux/kernel.h> static struct man_viewer_list { struct man_viewer_list *next;
tools/perf/builtin-kmem.c +1 -0
@@ -20,6 +20,7 @@#include "util/debug.h" +#include <linux/kernel.h> #include <linux/rbtree.h> #include <linux/string.h> #include <locale.h>
tools/perf/builtin-kvm.c +1 -0
@@ -24,6 +24,7 @@#include <sys/timerfd.h> #endif +#include <linux/kernel.h> #include <linux/time64.h> #include <termios.h> #include <semaphore.h>
tools/perf/builtin-lock.c +1 -0
@@ -26,6 +26,7 @@#include <linux/list.h> #include <linux/hash.h> +#include <linux/kernel.h> static struct perf_session *session;
tools/perf/builtin-sched.c +1 -0
@@ -22,6 +22,7 @@#include "util/debug.h" +#include <linux/kernel.h> #include <linux/log2.h> #include <sys/prctl.h> #include <sys/resource.h>
tools/perf/builtin-script.c +1 -0
@@ -24,6 +24,7 @@#include "util/thread-stack.h" #include "util/time-utils.h" #include <linux/bitmap.h> +#include <linux/kernel.h> #include <linux/stringify.h> #include <linux/time64.h> #include "asm/bug.h"
tools/perf/builtin-timechart.c +1 -0
@@ -23,6 +23,7 @@#include "util/cache.h" #include "util/evlist.h" #include "util/evsel.h" +#include <linux/kernel.h> #include <linux/rbtree.h> #include <linux/time64.h> #include "util/symbol.h"
tools/perf/builtin-trace.c +1 -0
@@ -45,6 +45,7 @@#include <linux/err.h> #include <linux/filter.h> #include <linux/audit.h> +#include <linux/kernel.h> #include <linux/random.h> #include <linux/stringify.h> #include <linux/time64.h>
tools/perf/perf.c +1 -0
@@ -22,6 +22,7 @@#include <pthread.h> #include <stdlib.h> #include <time.h> +#include <linux/kernel.h> const char perf_usage_string[] ="perf [--version] [--help] [OPTIONS] COMMAND [ARGS]" ;
tools/perf/tests/bpf.c +1 -0
@@ -5,6 +5,7 @@#include <util/evlist.h> #include <linux/bpf.h> #include <linux/filter.h> +#include <linux/kernel.h> #include <api/fs/fs.h> #include <bpf/bpf.h> #include "tests.h"
tools/perf/tests/builtin-test.c +1 -0
@@ -13,6 +13,7 @@#include "color.h" #include <subcmd/parse-options.h> #include "symbol.h" +#include <linux/kernel.h> static bool dont_fork;
tools/perf/tests/clang.c +1 -0
@@ -2,6 +2,7 @@#include "debug.h" #include "util.h" #include "c++/clang-c.h" +#include <linux/kernel.h> static struct { int (*func)(void);
tools/perf/tests/code-reading.c +1 -0
@@ -1,3 +1,4 @@ +#include <linux/kernel.h> #include <linux/types.h> #include <stdlib.h> #include <unistd.h>
tools/perf/tests/dso-data.c +1 -0
@@ -1,4 +1,5 @@#include <stdlib.h> +#include <linux/kernel.h> #include <linux/types.h> #include <sys/stat.h> #include <fcntl.h>
tools/perf/tests/evsel-roundtrip-name.c +1 -0
@@ -3,6 +3,7 @@#include "parse-events.h" #include "tests.h" #include "debug.h" +#include <linux/kernel.h> static int perf_evsel__roundtrip_cache_name_test (void ) {
tools/perf/tests/hists_common.c +1 -0
@@ -7,6 +7,7 @@#include "util/machine.h" #include "util/thread.h" #include "tests/hists_common.h" +#include <linux/kernel.h> static struct { u32 pid;
tools/perf/tests/hists_cumulate.c +1 -0
@@ -9,6 +9,7 @@#include "util/parse-events.h" #include "tests/tests.h" #include "tests/hists_common.h" +#include <linux/kernel.h> struct sample {u32 pid;
tools/perf/tests/hists_filter.c +1 -0
@@ -9,6 +9,7 @@#include "util/parse-events.h" #include "tests/tests.h" #include "tests/hists_common.h" +#include <linux/kernel.h> struct sample {u32 pid;
tools/perf/tests/hists_link.c +1 -0
@@ -9,6 +9,7 @@#include "thread.h" #include "parse-events.h" #include "hists_common.h" +#include <linux/kernel.h> struct sample {u32 pid;
tools/perf/tests/hists_output.c +1 -0
@@ -9,6 +9,7 @@#include "util/parse-events.h" #include "tests/tests.h" #include "tests/hists_common.h" +#include <linux/kernel.h> struct sample {u32 cpu;
tools/perf/tests/is_printable_array.c +1 -0
@@ -1,4 +1,5 @@#include <linux/compiler.h> +#include <linux/kernel.h> #include "tests.h" #include "debug.h" #include "util.h"
tools/perf/tests/mmap-basic.c +1 -0
@@ -7,6 +7,7 @@#include "cpumap.h" #include "tests.h" #include <linux/err.h> +#include <linux/kernel.h> /* * This test will generate random numbers of calls to some getpid syscalls,
tools/perf/tests/parse-events.c +1 -1
@@ -1,4 +1,3 @@ -#include "parse-events.h" #include "evsel.h" #include "evlist.h"
@@ -6,6 +5,7 @@#include "tests.h" #include "debug.h" #include "util.h" +#include <linux/kernel.h> #include <linux/hw_breakpoint.h> #include <api/fs/fs.h>
tools/perf/tests/parse-no-sample-id-all.c +1 -0
@@ -1,3 +1,4 @@ +#include <linux/kernel.h> #include <linux/types.h> #include <stddef.h>
tools/perf/tests/pmu.c +1 -0
@@ -2,6 +2,7 @@#include "pmu.h" #include "util.h" #include "tests.h" +#include <linux/kernel.h> /* Simulated format definitions. */ static struct test_format {
tools/perf/tests/sample-parsing.c +1 -0
@@ -1,4 +1,5 @@#include <stdbool.h> +#include <linux/kernel.h> #include <linux/types.h> #include "util.h"
tools/perf/ui/browsers/annotate.c +1 -0
@@ -10,6 +10,7 @@#include "../../util/evsel.h" #include "../../util/config.h" #include <pthread.h> +#include <linux/kernel.h> struct disasm_line_samples {double percent;
tools/perf/ui/tui/setup.c +1 -0
@@ -1,6 +1,7 @@#include <errno.h> #include <signal.h> #include <stdbool.h> +#include <linux/kernel.h> #ifdef HAVE_BACKTRACE_SUPPORT #include <execinfo.h> #endif
tools/perf/util/annotate.c +1 -0
@@ -22,6 +22,7 @@#include <regex.h> #include <pthread.h> #include <linux/bitops.h> +#include <linux/kernel.h> #include <sys/utsname.h> const char *disassembler_style;
tools/perf/util/bpf-loader.c +1 -0
@@ -9,6 +9,7 @@#include <bpf/libbpf.h> #include <bpf/bpf.h> #include <linux/err.h> +#include <linux/kernel.h> #include <linux/string.h> #include "perf.h" #include "debug.h"
tools/perf/util/data-convert-bt.c +1 -0
@@ -8,6 +8,7 @@*/ #include <linux/compiler.h> +#include <linux/kernel.h> #include <babeltrace/ctf-writer/writer.h> #include <babeltrace/ctf-writer/clock.h> #include <babeltrace/ctf-writer/stream.h>
tools/perf/util/dso.c +1 -0
@@ -1,4 +1,5 @@#include <asm/bug.h> +#include <linux/kernel.h> #include <sys/time.h> #include <sys/resource.h> #include "symbol.h"
tools/perf/util/dwarf-regs.c +1 -0
@@ -8,6 +8,7 @@#include <debug.h> #include <dwarf-regs.h> #include <elf.h> +#include <linux/kernel.h> #ifndef EM_AARCH64 #define EM_AARCH64 183/* ARM 64 bit */
tools/perf/util/event.c +1 -0
@@ -1,3 +1,4 @@ +#include <linux/kernel.h> #include <linux/types.h> #include <uapi/linux/mman.h> /* To get things like MAP_HUGETLB even on older libc headers */ #include <api/fs/fs.h>
tools/perf/util/evlist.h +1 -0
@@ -1,6 +1,7 @@#ifndef __PERF_EVLIST_H#define __PERF_EVLIST_H 1 +#include <linux/kernel.h> #include <linux/refcount.h> #include <linux/list.h> #include <api/fd/array.h>
tools/perf/util/mem-events.c +1 -0
@@ -6,6 +6,7 @@#include <sys/stat.h> #include <unistd.h> #include <api/fs/fs.h> +#include <linux/kernel.h> #include "mem-events.h" #include "debug.h" #include "symbol.h"
tools/perf/util/perf-hooks.c +1 -0
@@ -9,6 +9,7 @@#include <stdlib.h> #include <setjmp.h> #include <linux/err.h> +#include <linux/kernel.h> #include "util/util.h" #include "util/debug.h" #include "util/perf-hooks.h"
tools/perf/util/session.h +1 -0
@@ -9,6 +9,7 @@#include "thread.h" #include "data.h" #include "ordered-events.h" +#include <linux/kernel.h> #include <linux/rbtree.h> #include <linux/perf_event.h>
tools/perf/util/sort.c +1 -0
@@ -7,6 +7,7 @@#include "evlist.h" #include <traceevent/event-parse.h> #include "mem-events.h" +#include <linux/kernel.h> regex_t parent_regex;const char default_parent_pattern[] ="^sys_|^do_page_fault" ;
tools/perf/util/symbol.c +1 -0
@@ -3,6 +3,7 @@#include <stdlib.h> #include <stdio.h> #include <string.h> +#include <linux/kernel.h> #include <sys/types.h> #include <sys/stat.h> #include <sys/param.h>
tools/perf/util/thread.c +1 -0
@@ -2,6 +2,7 @@#include <stdlib.h> #include <stdio.h> #include <string.h> +#include <linux/kernel.h> #include "session.h" #include "thread.h" #include "thread-stack.h"
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 7/28 objtool: Drop ARRAY_SIZE() definition, tools/include/linux/kernel.h has it now
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
And with the goodies present in the kernel.h counterpart, i.e. checking that the parameter is an array at build time.
--- tools/objtool/builtin-check.c | 3 +-- tools/objtool/objtool.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-)
tools/objtool/builtin-check.c +1 -2
@@ -36,8 +36,7 @@#include "warn.h" #include <linux/hashtable.h> - -#define ARRAY_SIZE (x) (sizeof(x) / sizeof((x)[0])) +#include <linux/kernel.h> #define STATE_FP_SAVED 0x1#define STATE_FP_SETUP 0x2
tools/objtool/objtool.c +1 -2
@@ -31,11 +31,10 @@#include <stdlib.h> #include <subcmd/exec-cmd.h> #include <subcmd/pager.h> +#include <linux/kernel.h> #include "builtin.h" -#define ARRAY_SIZE (x) (sizeof(x)/sizeof(x[0])) -struct cmd_struct {const char *name;int (*fn)(int ,const char **);
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 8/28 tools include: Drop ARRAY_SIZE() definition from linux/hashtable.h
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
As tools/include/linux/kernel.h has it now, with the goodies present in the kernel.h counterpart, i.e. checking that the parameter is an array at build time.
--- tools/include/linux/hashtable.h | 4 ---- 1 file changed, 4 deletions(-)
tools/include/linux/hashtable.h +0 -4
@@ -13,10 +13,6 @@#include <linux/hash.h> #include <linux/log2.h> -#ifndef ARRAY_SIZE -#define ARRAY_SIZE (x) (sizeof(x) / sizeof((x)[0])) -#endif -#define DEFINE_HASHTABLE (name, bits) \ struct hlist_head name[1 << (bits)] = \ { [0 ... ((1 << (bits)) - 1)] = HLIST_HEAD_INIT }
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 9/28 perf tools: Remove unused macros from util.h
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
TYPEOF(), for instance, was only used by MSB() that wasn't used at all, besides typeof() is used in many places, should be the preferred way.
--- tools/perf/util/util.h | 12 ------------ 1 file changed, 12 deletions(-)
tools/perf/util/util.h +0 -12
@@ -1,18 +1,6 @@#ifndef GIT_COMPAT_UTIL_H #define GIT_COMPAT_UTIL_H -#ifdef __GNUC__ -#define TYPEOF (x) (__typeof__(x)) -#else -#define TYPEOF (x) -#endif - -#define MSB (x, bits) ((x) & TYPEOF(x)(~0ULL << (sizeof(x) * 8 - (bits)))) -#define HAS_MULTI_BITS (i) ((i) & ((i) - 1))/* checks if an integer has more than 1 bit set */ - -/* Approximation of the length of the decimal representation of this type. */ -#define decimal_length (x) ((int)(sizeof(x) * 2.56 + 0.5) + 1) -#define _ALL_SOURCE 1#define _BSD_SOURCE 1/* glibc 2.20 deprecates _BSD_SOURCE in favour of _DEFAULT_SOURCE */
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 10/28 perf tools: Including missing inttypes.h header
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
Needed to use the PRI[xu](32,64) formatting macros.
--- tools/perf/arch/x86/tests/perf-time-to-tsc.c | 1 + tools/perf/bench/numa.c | 1 + tools/perf/builtin-c2c.c | 1 + tools/perf/builtin-diff.c | 1 + tools/perf/builtin-kallsyms.c | 1 + tools/perf/builtin-kmem.c | 1 + tools/perf/builtin-kvm.c | 1 + tools/perf/builtin-lock.c | 1 + tools/perf/builtin-mem.c | 1 + tools/perf/builtin-record.c | 1 + tools/perf/builtin-report.c | 1 + tools/perf/builtin-sched.c | 1 + tools/perf/builtin-script.c | 1 + tools/perf/builtin-stat.c | 1 + tools/perf/builtin-timechart.c | 1 + tools/perf/builtin-trace.c | 1 + tools/perf/tests/attr.c | 1 + tools/perf/tests/code-reading.c | 1 + tools/perf/tests/dwarf-unwind.c | 1 + tools/perf/tests/event-times.c | 1 + tools/perf/tests/hists_common.c | 1 + tools/perf/tests/mmap-basic.c | 1 + tools/perf/tests/mmap-thread-lookup.c | 1 + tools/perf/tests/openat-syscall-all-cpus.c | 1 + tools/perf/tests/openat-syscall.c | 1 + tools/perf/tests/perf-record.c | 1 + tools/perf/tests/sample-parsing.c | 1 + tools/perf/tests/sw-clock.c | 1 + tools/perf/tests/unit_number__scnprintf.c | 1 + tools/perf/tests/vmlinux-kallsyms.c | 1 + tools/perf/ui/browsers/annotate.c | 1 + tools/perf/ui/browsers/hists.c | 1 + tools/perf/ui/gtk/annotate.c | 2 +- tools/perf/ui/hist.c | 1 + tools/perf/util/annotate.c | 1 + tools/perf/util/auxtrace.c | 1 + tools/perf/util/callchain.c | 1 + tools/perf/util/data-convert-bt.c | 1 + tools/perf/util/debug.c | 1 + tools/perf/util/dwarf-aux.c | 1 + tools/perf/util/event.c | 1 + tools/perf/util/evlist.c | 1 + tools/perf/util/evsel.c | 1 + tools/perf/util/evsel_fprintf.c | 1 + tools/perf/util/header.c | 1 + tools/perf/util/intel-bts.c | 1 + tools/perf/util/intel-pt.c | 1 + tools/perf/util/machine.c | 1 + tools/perf/util/ordered-events.c | 1 + tools/perf/util/probe-event.c | 1 + tools/perf/util/probe-finder.c | 1 + tools/perf/util/scripting-engines/trace-event-perl.c | 1 + tools/perf/util/scripting-engines/trace-event-python.c | 1 + tools/perf/util/session.c | 1 + tools/perf/util/sort.c | 1 + tools/perf/util/srcline.c | 1 + tools/perf/util/stat.c | 1 + tools/perf/util/unwind-libunwind-local.c | 1 + tools/perf/util/util.c | 1 + 59 files changed, 59 insertions(+), 1 deletion(-)
tools/perf/arch/x86/tests/perf-time-to-tsc.c +1 -0
@@ -1,3 +1,4 @@ +#include <inttypes.h> #include <stdio.h> #include <unistd.h> #include <linux/types.h>
tools/perf/bench/numa.c +1 -0
@@ -4,6 +4,7 @@* numa: Simulate NUMA-sensitive workload and measure their NUMA performance */ +#include <inttypes.h> /* For the CLR_() macros */ #include <pthread.h>
tools/perf/builtin-c2c.c +1 -0
@@ -9,6 +9,7 @@* Dick Fowles <[email protected]> * Joe Mario <[email protected]> */ +#include <inttypes.h> #include <linux/compiler.h> #include <linux/kernel.h> #include <linux/stringify.h>
tools/perf/builtin-diff.c +1 -0
@@ -19,6 +19,7 @@#include "util/data.h" #include "util/config.h" +#include <inttypes.h> #include <stdlib.h> #include <math.h>
tools/perf/builtin-kallsyms.c +1 -0
@@ -7,6 +7,7 @@* * Released under the GPL v2. (and only v2, not any later version) */ +#include <inttypes.h> #include "builtin.h" #include <linux/compiler.h> #include <subcmd/parse-options.h>
tools/perf/builtin-kmem.c +1 -0
@@ -23,6 +23,7 @@#include <linux/kernel.h> #include <linux/rbtree.h> #include <linux/string.h> +#include <inttypes.h> #include <locale.h> #include <regex.h>
tools/perf/builtin-kvm.c +1 -0
@@ -26,6 +26,7 @@#include <linux/kernel.h> #include <linux/time64.h> +#include <inttypes.h> #include <termios.h> #include <semaphore.h> #include <pthread.h>
tools/perf/builtin-lock.c +1 -0
@@ -1,3 +1,4 @@ +#include <inttypes.h> #include "builtin.h" #include "perf.h"
tools/perf/builtin-mem.c +1 -0
@@ -1,3 +1,4 @@ +#include <inttypes.h> #include "builtin.h" #include "perf.h"
tools/perf/builtin-record.c +1 -0
@@ -40,6 +40,7 @@#include "util/perf-hooks.h" #include "asm/bug.h" +#include <inttypes.h> #include <unistd.h> #include <sched.h> #include <sys/mman.h>
tools/perf/builtin-report.c +1 -0
@@ -40,6 +40,7 @@#include "util/auxtrace.h" #include <dlfcn.h> +#include <inttypes.h> #include <linux/bitmap.h> #include <linux/stringify.h>
tools/perf/builtin-sched.c +1 -0
@@ -26,6 +26,7 @@#include <linux/log2.h> #include <sys/prctl.h> #include <sys/resource.h> +#include <inttypes.h> #include <semaphore.h> #include <pthread.h>
tools/perf/builtin-script.c +1 -0
@@ -30,6 +30,7 @@#include "asm/bug.h" #include "util/mem-events.h" #include "util/dump-insn.h" +#include <inttypes.h> static char const *script_name;static char const *generate_script_lang;
tools/perf/builtin-stat.c +1 -0
@@ -70,6 +70,7 @@#include <api/fs/fs.h> #include <stdlib.h> #include <sys/prctl.h> +#include <inttypes.h> #include <locale.h> #include <math.h>
tools/perf/builtin-timechart.c +1 -0
@@ -12,6 +12,7 @@* of the License. */ +#include <inttypes.h> #include <traceevent/event-parse.h> #include "builtin.h"
tools/perf/builtin-trace.c +1 -0
@@ -39,6 +39,7 @@#include "syscalltbl.h" #include "rb_resort.h" +#include <inttypes.h> #include <libaudit.h> /* FIXME: Still needed for audit_errno_to_name */ #include <stdlib.h> #include <string.h>
tools/perf/tests/attr.c +1 -0
@@ -18,6 +18,7 @@* permissions. All the event text files are stored there. */ +#include <inttypes.h> #include <stdlib.h> #include <stdio.h> #include <linux/types.h>
tools/perf/tests/code-reading.c +1 -0
@@ -1,5 +1,6 @@#include <linux/kernel.h> #include <linux/types.h> +#include <inttypes.h> #include <stdlib.h> #include <unistd.h> #include <stdio.h>
tools/perf/tests/dwarf-unwind.c +1 -0
@@ -1,5 +1,6 @@#include <linux/compiler.h> #include <linux/types.h> +#include <inttypes.h> #include <unistd.h> #include "tests.h" #include "debug.h"
tools/perf/tests/event-times.c +1 -0
@@ -1,4 +1,5 @@#include <linux/compiler.h> +#include <inttypes.h> #include <string.h> #include "tests.h" #include "evlist.h"
tools/perf/tests/hists_common.c +1 -0
@@ -1,3 +1,4 @@ +#include <inttypes.h> #include "perf.h" #include "util/debug.h" #include "util/symbol.h"
tools/perf/tests/mmap-basic.c +1 -0
@@ -1,3 +1,4 @@ +#include <inttypes.h> /* For the CLR_() macros */ #include <pthread.h>
tools/perf/tests/mmap-thread-lookup.c +1 -0
@@ -1,3 +1,4 @@ +#include <inttypes.h> #include <unistd.h> #include <sys/syscall.h> #include <sys/types.h>
tools/perf/tests/openat-syscall-all-cpus.c +1 -0
@@ -1,3 +1,4 @@ +#include <inttypes.h> /* For the CPU_* macros */ #include <pthread.h>
tools/perf/tests/openat-syscall.c +1 -0
@@ -1,3 +1,4 @@ +#include <inttypes.h> #include <api/fs/tracing_path.h> #include <linux/err.h> #include "thread_map.h"
tools/perf/tests/perf-record.c +1 -0
@@ -1,3 +1,4 @@ +#include <inttypes.h> /* For the CLR_() macros */ #include <pthread.h>
tools/perf/tests/sample-parsing.c +1 -0
@@ -1,4 +1,5 @@#include <stdbool.h> +#include <inttypes.h> #include <linux/kernel.h> #include <linux/types.h>
tools/perf/tests/sw-clock.c +1 -0
@@ -1,3 +1,4 @@ +#include <inttypes.h> #include <unistd.h> #include <stdlib.h> #include <signal.h>
tools/perf/tests/unit_number__scnprintf.c +1 -0
@@ -1,3 +1,4 @@ +#include <inttypes.h> #include <linux/compiler.h> #include <linux/types.h> #include "tests.h"
tools/perf/tests/vmlinux-kallsyms.c +1 -0
@@ -1,5 +1,6 @@#include <linux/compiler.h> #include <linux/rbtree.h> +#include <inttypes.h> #include <string.h> #include "map.h" #include "symbol.h"
tools/perf/ui/browsers/annotate.c +1 -0
@@ -9,6 +9,7 @@#include "../../util/symbol.h" #include "../../util/evsel.h" #include "../../util/config.h" +#include <inttypes.h> #include <pthread.h> #include <linux/kernel.h>
tools/perf/ui/browsers/hists.c +1 -0
@@ -1,3 +1,4 @@ +#include <inttypes.h> #include <stdio.h> #include <stdlib.h> #include <string.h>
tools/perf/ui/gtk/annotate.c +1 -1
@@ -3,7 +3,7 @@#include "util/annotate.h" #include "util/evsel.h" #include "ui/helpline.h" - +#include <inttypes.h> enum {ANN_COL__PERCENT ,
tools/perf/ui/hist.c +1 -0
@@ -1,3 +1,4 @@ +#include <inttypes.h> #include <math.h> #include <linux/compiler.h>
tools/perf/util/annotate.c +1 -0
@@ -7,6 +7,7 @@* Released under the GPL v2. (and only v2, not any later version) */ +#include <inttypes.h> #include "util.h" #include "ui/ui.h" #include "sort.h"
tools/perf/util/auxtrace.c +1 -0
@@ -13,6 +13,7 @@* */ +#include <inttypes.h> #include <sys/types.h> #include <sys/mman.h> #include <stdbool.h>
tools/perf/util/callchain.c +1 -0
@@ -9,6 +9,7 @@* */ +#include <inttypes.h> #include <stdlib.h> #include <stdio.h> #include <stdbool.h>
tools/perf/util/data-convert-bt.c +1 -0
@@ -7,6 +7,7 @@* Released under the GPL v2. (and only v2, not any later version) */ +#include <inttypes.h> #include <linux/compiler.h> #include <linux/kernel.h> #include <babeltrace/ctf-writer/writer.h>
tools/perf/util/debug.c +1 -0
@@ -2,6 +2,7 @@#include "../perf.h" +#include <inttypes.h> #include <string.h> #include <stdarg.h> #include <stdio.h>
tools/perf/util/dwarf-aux.c +1 -0
@@ -17,6 +17,7 @@* */ +#include <inttypes.h> #include <stdbool.h> #include "util.h" #include "debug.h"
tools/perf/util/event.c +1 -0
@@ -1,3 +1,4 @@ +#include <inttypes.h> #include <linux/kernel.h> #include <linux/types.h> #include <uapi/linux/mman.h> /* To get things like MAP_HUGETLB even on older libc headers */
tools/perf/util/evlist.c +1 -0
@@ -8,6 +8,7 @@*/ #include "util.h" #include <api/fs/fs.h> +#include <inttypes.h> #include <poll.h> #include "cpumap.h" #include "thread_map.h"
tools/perf/util/evsel.c +1 -0
@@ -8,6 +8,7 @@*/ #include <byteswap.h> +#include <inttypes.h> #include <linux/bitops.h> #include <api/fs/tracing_path.h> #include <traceevent/event-parse.h>
tools/perf/util/evsel_fprintf.c +1 -0
@@ -1,3 +1,4 @@ +#include <inttypes.h> #include <stdio.h> #include <stdbool.h> #include <traceevent/event-parse.h>
tools/perf/util/header.c +1 -0
@@ -1,3 +1,4 @@ +#include <inttypes.h> #include "util.h" #include <sys/types.h> #include <byteswap.h>
tools/perf/util/intel-bts.c +1 -0
@@ -15,6 +15,7 @@#include <endian.h> #include <byteswap.h> +#include <inttypes.h> #include <linux/kernel.h> #include <linux/types.h> #include <linux/bitops.h>
tools/perf/util/intel-pt.c +1 -0
@@ -13,6 +13,7 @@* */ +#include <inttypes.h> #include <stdio.h> #include <stdbool.h> #include <errno.h>
tools/perf/util/machine.c +1 -0
@@ -1,3 +1,4 @@ +#include <inttypes.h> #include "callchain.h" #include "debug.h" #include "event.h"
tools/perf/util/ordered-events.c +1 -0
@@ -1,3 +1,4 @@ +#include <inttypes.h> #include <linux/list.h> #include <linux/compiler.h> #include <linux/string.h>
tools/perf/util/probe-event.c +1 -0
@@ -19,6 +19,7 @@* */ +#include <inttypes.h> #include <sys/utsname.h> #include <sys/types.h> #include <sys/stat.h>
tools/perf/util/probe-finder.c +1 -0
@@ -19,6 +19,7 @@* */ +#include <inttypes.h> #include <sys/utsname.h> #include <sys/types.h> #include <sys/stat.h>
tools/perf/util/scripting-engines/trace-event-perl.c +1 -0
@@ -19,6 +19,7 @@* */ +#include <inttypes.h> #include <stdio.h> #include <stdlib.h> #include <string.h>
tools/perf/util/scripting-engines/trace-event-python.c +1 -0
@@ -21,6 +21,7 @@#include <Python.h> +#include <inttypes.h> #include <stdio.h> #include <stdlib.h> #include <string.h>
tools/perf/util/session.c +1 -0
@@ -1,3 +1,4 @@ +#include <inttypes.h> #include <linux/kernel.h> #include <traceevent/event-parse.h> #include <api/fs/fs.h>
tools/perf/util/sort.c +1 -0
@@ -1,3 +1,4 @@ +#include <inttypes.h> #include <sys/mman.h> #include "sort.h" #include "hist.h"
tools/perf/util/srcline.c +1 -0
@@ -1,3 +1,4 @@ +#include <inttypes.h> #include <stdio.h> #include <stdlib.h> #include <string.h>
tools/perf/util/stat.c +1 -0
@@ -1,3 +1,4 @@ +#include <inttypes.h> #include <math.h> #include "stat.h" #include "evlist.h"
tools/perf/util/unwind-libunwind-local.c +1 -0
@@ -18,6 +18,7 @@#include <elf.h> #include <gelf.h> #include <fcntl.h> +#include <inttypes.h> #include <string.h> #include <unistd.h> #include <sys/mman.h>
tools/perf/util/util.c +1 -0
@@ -7,6 +7,7 @@#ifdef HAVE_BACKTRACE_SUPPORT #include <execinfo.h> #endif +#include <inttypes.h> #include <stdio.h> #include <stdlib.h> #include <string.h>
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 11/28 perf tools: Remove PRI[xu] macros from perf.h
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
We get them from inttypes.h.
--- tools/perf/util/util.h | 20 -------------------- 1 file changed, 20 deletions(-)
tools/perf/util/util.h +0 -20
@@ -34,7 +34,6 @@#include <poll.h> #include <sys/socket.h> #include <sys/ioctl.h> -#include <inttypes.h> #include <linux/kernel.h> #include <linux/types.h> #include <sys/ttydefaults.h>
@@ -50,25 +49,6 @@ extern const char *spaces;extern const char *dots;extern char buildid_dir[]; -/* On most systems <limits.h> would have given us this, but -* not on some systems (e.g. GNU/Hurd). -*/ -#ifndef PATH_MAX -#define PATH_MAX 4096 -#endif - -#ifndef PRIuMAX -#define PRIuMAX "llu" -#endif - -#ifndef PRIu32 -#define PRIu32 "u" -#endif - -#ifndef PRIx32 -#define PRIx32 "x" -#endif -#ifndef PATH_SEP #define PATH_SEP ':'#endif
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 12/28 perf tools: Replace STR() calls with __stringify()
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
Both do the same thing, the later is the one we get from linux/stringify.h, i.e. we now use the same function name/practice as the kernel sources.
--- tools/perf/arch/arm/util/dwarf-regs.c | 4 ++-- tools/perf/arch/arm64/util/dwarf-regs.c | 3 ++- tools/perf/arch/powerpc/util/dwarf-regs.c | 5 +++-- tools/perf/util/cgroup.c | 5 +++-- tools/perf/util/jitdump.c | 3 ++- tools/perf/util/util.h | 3 --- 6 files changed, 12 insertions(+), 11 deletions(-)
tools/perf/arch/arm/util/dwarf-regs.c +2 -2
@@ -9,6 +9,7 @@*/ #include <stddef.h> +#include <linux/stringify.h> #include <dwarf-regs.h> struct pt_regs_dwarfnum {
@@ -16,10 +17,9 @@ struct pt_regs_dwarfnum {unsigned int dwarfnum; }; -#define STR (s) #s#define REG_DWARFNUM_NAME (r, num) {.name = r, .dwarfnum = num}#define GPR_DWARFNUM_NAME (num) \ - {.name = STR(%r##num), .dwarfnum = num} + {.name = __stringify(%r##num), .dwarfnum = num}#define REG_DWARFNUM_END {.name = NULL, .dwarfnum = 0}/*
tools/perf/arch/arm64/util/dwarf-regs.c +2 -1
@@ -11,6 +11,7 @@#include <stddef.h> #include <dwarf-regs.h> #include <linux/ptrace.h> /* for struct user_pt_regs */ +#include <linux/stringify.h> #include "util.h" struct pt_regs_dwarfnum {
@@ -20,7 +21,7 @@ struct pt_regs_dwarfnum {#define REG_DWARFNUM_NAME (r, num) {.name = r, .dwarfnum = num}#define GPR_DWARFNUM_NAME (num) \ - {.name = STR(%x##num), .dwarfnum = num} + {.name = __stringify(%x##num), .dwarfnum = num}#define REG_DWARFNUM_END {.name = NULL, .dwarfnum = 0}#define DWARFNUM2OFFSET (index) \ (index * sizeof((struct user_pt_regs *)0)->regs[0])
tools/perf/arch/powerpc/util/dwarf-regs.c +3 -2
@@ -15,6 +15,7 @@#include <dwarf-regs.h> #include <linux/ptrace.h> #include <linux/kernel.h> +#include <linux/stringify.h> #include "util.h" struct pt_regs_dwarfnum {
@@ -24,10 +25,10 @@ struct pt_regs_dwarfnum { };#define REG_DWARFNUM_NAME (r, num) \ - {.name = STR(%)STR(r), .dwarfnum = num, \ + {.name = __stringify(%)__stringify(r), .dwarfnum = num, \ .ptregs_offset = offsetof(struct pt_regs, r)}#define GPR_DWARFNUM_NAME (num) \ - {.name = STR(%gpr##num), .dwarfnum = num, \ + {.name = __stringify(%gpr##num), .dwarfnum = num, \ .ptregs_offset = offsetof(struct pt_regs, gpr[num])}#define REG_DWARFNUM_END {.name = NULL, .dwarfnum = 0, .ptregs_offset = 0}
tools/perf/util/cgroup.c +3 -2
@@ -4,6 +4,7 @@#include "evsel.h" #include "cgroup.h" #include "evlist.h" +#include <linux/stringify.h> int nr_cgroups;
@@ -27,8 +28,8 @@ cgroupfs_find_mountpoint(char *buf, size_t maxlen) path_v1[0 ] ='\0' ; path_v2[0 ] ='\0' ; - while (fscanf(fp, "%*s %"STR(PATH_MAX)"s %"STR(PATH_MAX)"s %" - STR(PATH_MAX)"s %*d %*d\n", + while (fscanf(fp, "%*s %"__stringify(PATH_MAX)"s %"__stringify(PATH_MAX)"s %" + __stringify(PATH_MAX)"s %*d %*d\n", mountpoint, type, tokens) ==3 ) {if (!path_v1[0 ] && !strcmp (type,"cgroup" )) {
tools/perf/util/jitdump.c +2 -1
@@ -9,6 +9,7 @@#include <byteswap.h> #include <sys/stat.h> #include <sys/mman.h> +#include <linux/stringify.h> #include "util.h" #include "event.h"
@@ -181,7 +182,7 @@ jit_open(struct jit_buf_desc *jd, const char *name) jd->use_arch_timestamp);if (header.version >JITHEADER_VERSION ) { -pr_err ("wrong jitdump version %u, expected " STR (JITHEADER_VERSION ), +pr_err ("wrong jitdump version %u, expected " __stringify(JITHEADER_VERSION ), header.version); goto error; }
tools/perf/util/util.h +0 -3
@@ -180,9 +180,6 @@ struct perf_event_attr;void event_attr_init (struct perf_event_attr *attr); -#define _STR (x) #x -#define STR (x) _STR(x) -size_t hex_width (u64 v);int hex2u64 (const char *ptr,u64 *val);
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 13/28 perf tools: Ditch unused PATH_SEP, STRIP_EXTENSION
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
Should make sense for windows, where git is supported.
--- tools/perf/perf.c | 10 ---------- tools/perf/util/util.h | 16 ---------------- 2 files changed, 26 deletions(-)
tools/perf/perf.c +0 -10
@@ -328,16 +328,6 @@ static void handle_internal_command(int argc, const char **argv) {const char *cmd = argv[0 ];unsigned int i; -static const char ext[] =STRIP_EXTENSION ; - -if (sizeof (ext) >1 ) { - i =strlen (argv[0 ]) -strlen (ext); -if (i >0 && !strcmp (argv[0 ] + i, ext)) { -char *argv0 =strdup (argv[0 ]); - argv[0 ] = cmd = argv0; - argv0[i] ='\0' ; - } - }/* Turn "perf cmd --help" into "perf help cmd" */ if (argc >1 && !strcmp (argv[1 ],"--help" )) {
tools/perf/util/util.h +0 -16
@@ -49,22 +49,6 @@ extern const char *spaces;extern const char *dots;extern char buildid_dir[]; -#ifndef PATH_SEP -#define PATH_SEP ':' -#endif - -#ifndef STRIP_EXTENSION -#define STRIP_EXTENSION "" -#endif - -#ifndef has_dos_drive_prefix -#define has_dos_drive_prefix (path) 0 -#endif - -#ifndef is_dir_sep -#define is_dir_sep (c) ((c) == '/') -#endif -#ifdef __GNUC__#define NORETURN __attribute__((__noreturn__))#else
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 14/28 perf tools: Move sane ctype stuff from util.h to sane_ctype.h
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
More stuff that came from git, out of the hodge-podge that is util.h
--- tools/lib/symbol/kallsyms.c | 1 + tools/perf/arch/common.c | 2 ++ tools/perf/builtin-kmem.c | 2 ++ tools/perf/builtin-sched.c | 2 ++ tools/perf/builtin-script.c | 2 ++ tools/perf/builtin-stat.c | 2 ++ tools/perf/builtin-top.c | 2 ++ tools/perf/builtin-trace.c | 2 ++ tools/perf/tests/code-reading.c | 3 ++- tools/perf/ui/browser.c | 1 + tools/perf/ui/browsers/hists.c | 2 ++ tools/perf/ui/browsers/map.c | 2 ++ tools/perf/ui/stdio/hist.c | 2 +- tools/perf/util/annotate.c | 2 ++ tools/perf/util/auxtrace.c | 5 ++-- tools/perf/util/build-id.c | 1 + tools/perf/util/config.c | 2 ++ tools/perf/util/cpumap.c | 2 ++ tools/perf/util/ctype.c | 2 +- tools/perf/util/data-convert-bt.c | 1 + tools/perf/util/debug.c | 2 ++ tools/perf/util/demangle-java.c | 2 ++ tools/perf/util/event.c | 1 + tools/perf/util/evsel.c | 2 ++ tools/perf/util/header.c | 2 ++ tools/perf/util/jitdump.c | 2 ++ tools/perf/util/machine.c | 4 ++- tools/perf/util/probe-event.c | 2 ++ tools/perf/util/probe-finder.h | 2 +- tools/perf/util/sane_ctype.h | 51 +++++++++++++++++++++++++++++++++++++ tools/perf/util/strfilter.c | 2 ++ tools/perf/util/string.c | 2 ++ tools/perf/util/symbol-elf.c | 3 ++- tools/perf/util/symbol.c | 1 + tools/perf/util/trace-event-parse.c | 3 ++- tools/perf/util/util.c | 2 ++ tools/perf/util/util.h | 46 --------------------------------- 37 files changed, 114 insertions(+), 55 deletions(-) create mode 100644 tools/perf/util/sane_ctype.h
tools/lib/symbol/kallsyms.c +1 -0
@@ -1,3 +1,4 @@ +#include <ctype.h> #include "symbol/kallsyms.h" #include <stdio.h> #include <stdlib.h>
tools/perf/arch/common.c +2 -0
@@ -4,6 +4,8 @@#include "../util/util.h" #include "../util/debug.h" +#include "sane_ctype.h" +const char *const arm_triplets[] = {"arm-eabi-" ,"arm-linux-androideabi-" ,
tools/perf/builtin-kmem.c +2 -0
@@ -27,6 +27,8 @@#include <locale.h> #include <regex.h> +#include "sane_ctype.h" +static int kmem_slab;static int kmem_page;
tools/perf/builtin-sched.c +2 -0
@@ -34,6 +34,8 @@#include <api/fs/fs.h> #include <linux/time64.h> +#include "sane_ctype.h" +#define PR_SET_NAME 15/* Set process name */ #define MAX_CPUS 4096#define COMM_LEN 20
tools/perf/builtin-script.c +2 -0
@@ -32,6 +32,8 @@#include "util/dump-insn.h" #include <inttypes.h> +#include "sane_ctype.h" +static char const *script_name;static char const *generate_script_lang;static bool debug_mode;
tools/perf/builtin-stat.c +2 -0
@@ -74,6 +74,8 @@#include <locale.h> #include <math.h> +#include "sane_ctype.h" +#define DEFAULT_SEPARATOR " "#define CNTR_NOT_SUPPORTED "<not supported>"#define CNTR_NOT_COUNTED "<not counted>"
tools/perf/builtin-top.c +2 -0
@@ -72,6 +72,8 @@#include <linux/time64.h> #include <linux/types.h> +#include "sane_ctype.h" +static volatile int done;#define HEADER_LINE_NR 5
tools/perf/builtin-trace.c +2 -0
@@ -51,6 +51,8 @@#include <linux/stringify.h> #include <linux/time64.h> +#include "sane_ctype.h" +#ifndef O_CLOEXEC # define O_CLOEXEC 02000000#endif
tools/perf/tests/code-reading.c +2 -1
@@ -4,7 +4,6 @@#include <stdlib.h> #include <unistd.h> #include <stdio.h> -#include <ctype.h> #include <string.h> #include "parse-events.h"
@@ -18,6 +17,8 @@#include "tests.h" +#include "sane_ctype.h" +#define BUFSZ 1024#define READLEN 128
tools/perf/ui/browser.c +1 -0
@@ -13,6 +13,7 @@#include "helpline.h" #include "keysyms.h" #include "../color.h" +#include "sane_ctype.h" static int ui_browser__percent_color (struct ui_browser *browser,double percent,bool current)
tools/perf/ui/browsers/hists.c +2 -0
@@ -20,6 +20,8 @@#include "map.h" #include "annotate.h" +#include "sane_ctype.h" +extern void hist_browser__init_hpp (void ); static int perf_evsel_browser_title(struct hist_browser *browser,
tools/perf/ui/browsers/map.c +2 -0
@@ -11,6 +11,8 @@#include "../keysyms.h" #include "map.h" +#include "sane_ctype.h" +struct map_browser {struct ui_browser b;struct map *map;
tools/perf/ui/stdio/hist.c +1 -1
@@ -4,7 +4,7 @@#include "../../util/hist.h" #include "../../util/sort.h" #include "../../util/evsel.h" - +#include "../../util/sane_ctype.h" static size_t callchain__fprintf_left_margin (FILE *fp,int left_margin) {
tools/perf/util/annotate.c +2 -0
@@ -26,6 +26,8 @@#include <linux/kernel.h> #include <sys/utsname.h> +#include "sane_ctype.h" +const char *disassembler_style;const char *objdump_path;static regex_t file_lineno;
tools/perf/util/auxtrace.c +3 -2
@@ -17,7 +17,6 @@#include <sys/types.h> #include <sys/mman.h> #include <stdbool.h> -#include <ctype.h> #include <string.h> #include <limits.h> #include <errno.h>
@@ -47,7 +46,6 @@#include "cpumap.h" #include "thread_map.h" #include "asm/bug.h" -#include "symbol/kallsyms.h" #include "auxtrace.h" #include <linux/hash.h>
@@ -60,6 +58,9 @@#include "intel-pt.h" #include "intel-bts.h" +#include "sane_ctype.h" +#include "symbol/kallsyms.h" +int auxtrace_mmap__mmap (struct auxtrace_mmap *mm,struct auxtrace_mmap_params *mp,void *userpg,int fd)
tools/perf/util/build-id.c +1 -0
@@ -19,6 +19,7 @@#include "vdso.h" #include "probe-file.h" +#include "sane_ctype.h" static bool no_buildid_cache;
tools/perf/util/config.c +2 -0
@@ -15,6 +15,8 @@#include "util/llvm-utils.h" /* perf_llvm_config */ #include "config.h" +#include "sane_ctype.h" +#define MAXNAME (256)#define DEBUG_CACHE_DIR ".debug"
tools/perf/util/cpumap.c +2 -0
@@ -8,6 +8,8 @@#include <linux/bitmap.h> #include "asm/bug.h" +#include "sane_ctype.h" +static int max_cpu_num;static int max_present_cpu_num;static int max_node_num;
tools/perf/util/ctype.c +1 -1
@@ -3,7 +3,7 @@* * No surprises, and works with signed and unsigned chars. */ -#include "util.h" +#include "sane_ctype.h" enum {S =GIT_SPACE ,
tools/perf/util/data-convert-bt.c +1 -0
@@ -29,6 +29,7 @@#include "evsel.h" #include "machine.h" #include "config.h" +#include "sane_ctype.h" #define pr_N (n, fmt, ...) \ eprintf(n, debug_data_convert, fmt, ##__VA_ARGS__)
tools/perf/util/debug.c +2 -0
@@ -16,6 +16,8 @@#include "util.h" #include "target.h" +#include "sane_ctype.h" +int verbose;bool dump_trace = false, quiet = false;int debug_ordered_events;
tools/perf/util/demangle-java.c +2 -0
@@ -7,6 +7,8 @@#include "demangle-java.h" +#include "sane_ctype.h" +enum {MODE_PREFIX =0 ,MODE_CLASS =1 ,
tools/perf/util/event.c +1 -0
@@ -12,6 +12,7 @@#include "strlist.h" #include "thread.h" #include "thread_map.h" +#include "sane_ctype.h" #include "symbol/kallsyms.h" #include "asm/bug.h" #include "stat.h"
tools/perf/util/evsel.c +2 -0
@@ -31,6 +31,8 @@#include "stat.h" #include "util/parse-branch-options.h" +#include "sane_ctype.h" + static struct { bool sample_id_all; bool exclude_guest;
tools/perf/util/header.c +2 -0
@@ -27,6 +27,8 @@#include <api/fs/fs.h> #include "asm/bug.h" +#include "sane_ctype.h" +/* * magic2 = "PERFILE2" * must be a numerical value to let the endianness
tools/perf/util/jitdump.c +2 -0
@@ -26,6 +26,8 @@#include "genelf.h" #include "../builtin.h" +#include "sane_ctype.h" +struct jit_buf_desc {struct perf_data_file *output;struct perf_session *session;
tools/perf/util/machine.c +3 -1
@@ -11,11 +11,13 @@#include "thread.h" #include "vdso.h" #include <stdbool.h> -#include <symbol/kallsyms.h> #include "unwind.h" #include "linux/hash.h" #include "asm/bug.h" +#include "sane_ctype.h" +#include <symbol/kallsyms.h> +static void __machine__remove_thread (struct machine *machine,struct thread *th,bool lock);static void dsos__init (struct dsos *dsos)
tools/perf/util/probe-event.c +2 -0
@@ -48,6 +48,8 @@#include "probe-file.h" #include "session.h" +#include "sane_ctype.h" +#define PERFPROBE_GROUP "probe"bool probe_event_dry_run;/* Dry run flag */
tools/perf/util/probe-finder.h +1 -1
@@ -2,9 +2,9 @@#define _PROBE_FINDER_H#include <stdbool.h> -#include "util.h" #include "intlist.h" #include "probe-event.h" +#include "sane_ctype.h" #define MAX_PROBE_BUFFER 1024#define MAX_PROBES 128
tools/perf/util/sane_ctype.h new file +51 -0
51 lines not on this page · raw message
tools/perf/util/strfilter.c +2 -0
@@ -2,6 +2,8 @@#include "string.h" #include "strfilter.h" +#include "sane_ctype.h" +/* Operators */ static const char *OP_and ="&" ;/* Logical AND */ static const char *OP_or ="|" ;/* Logical OR */
tools/perf/util/string.c +2 -0
@@ -1,6 +1,8 @@#include "util.h" #include "linux/string.h" +#include "sane_ctype.h" +#define K 1024LL/* * perf_atoll()
tools/perf/util/symbol-elf.c +2 -1
@@ -10,8 +10,9 @@#include "demangle-rust.h" #include "machine.h" #include "vdso.h" -#include <symbol/kallsyms.h> #include "debug.h" +#include "sane_ctype.h" +#include <symbol/kallsyms.h> #ifndef EM_AARCH64 #define EM_AARCH64 183/* ARM 64 bit */
tools/perf/util/symbol.c +1 -0
@@ -19,6 +19,7 @@#include "strlist.h" #include "intlist.h" #include "header.h" +#include "sane_ctype.h" #include <elf.h> #include <limits.h>
tools/perf/util/trace-event-parse.c +2 -1
@@ -21,13 +21,14 @@#include <stdio.h> #include <stdlib.h> #include <string.h> -#include <ctype.h> #include <errno.h> #include "../perf.h" #include "util.h" #include "trace-event.h" +#include "sane_ctype.h" +static int get_common_field (struct scripting_context *context,int *offset,int *size,const char *type) {
tools/perf/util/util.c +2 -0
@@ -21,6 +21,8 @@#include "callchain.h" #include "strlist.h" +#include "sane_ctype.h" +#define CALLCHAIN_PARAM_DEFAULT \ .mode = CHAIN_GRAPH_ABS, \ .min_percent = 0.5, \
tools/perf/util/util.h +0 -46
58 lines not on this page · raw message
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 15/28 tools include: Include missing headers for fls() and types in linux/log2.h
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
--- tools/include/linux/log2.h | 3 +++ 1 file changed, 3 insertions(+)
tools/include/linux/log2.h +3 -0
@@ -12,6 +12,9 @@#ifndef _TOOLS_LINUX_LOG2_H#define _TOOLS_LINUX_LOG2_H +#include <linux/bitops.h> +#include <linux/types.h> +/* * non-constant log of base 2 calculators * - the arch may override these in asm/bitops.h if they can be implemented
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 16/28 perf tools: Move print_binary definitions to separate files
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
Continuing the split of util.[ch] into more manageable bits.
--- tools/perf/builtin-script.c | 1 + tools/perf/builtin-trace.c | 1 + tools/perf/tests/is_printable_array.c | 2 +- tools/perf/util/Build | 1 + tools/perf/util/debug.c | 1 + tools/perf/util/print_binary.c | 55 ++++++++++++++++++++++ tools/perf/util/print_binary.h | 28 +++++++++++ tools/perf/util/python-ext-sources | 1 + tools/perf/util/python.c | 1 + .../util/scripting-engines/trace-event-python.c | 1 + tools/perf/util/util.c | 54 --------------------- tools/perf/util/util.h | 23 --------- 12 files changed, 91 insertions(+), 78 deletions(-) create mode 100644 tools/perf/util/print_binary.c create mode 100644 tools/perf/util/print_binary.h
tools/perf/builtin-script.c +1 -0
@@ -23,6 +23,7 @@#include "util/stat.h" #include "util/thread-stack.h" #include "util/time-utils.h" +#include "print_binary.h" #include <linux/bitmap.h> #include <linux/kernel.h> #include <linux/stringify.h>
tools/perf/builtin-trace.c +1 -0
@@ -36,6 +36,7 @@#include "util/parse-events.h" #include "util/bpf-loader.h" #include "callchain.h" +#include "print_binary.h" #include "syscalltbl.h" #include "rb_resort.h"
tools/perf/tests/is_printable_array.c +1 -1
@@ -2,7 +2,7 @@#include <linux/kernel.h> #include "tests.h" #include "debug.h" -#include "util.h" +#include "print_binary.h" int test__is_printable_array (int subtest__maybe_unused ) {
tools/perf/util/Build +1 -0
@@ -16,6 +16,7 @@ libperf-y += llvm-utils.o libperf-y += parse-events.o libperf-y += perf_regs.o libperf-y += path.o +libperf-y += print_binary.o libperf-y += rbtree.o libperf-y += libstring.o libperf-y += bitmap.o
tools/perf/util/debug.c +1 -0
@@ -13,6 +13,7 @@#include "color.h" #include "event.h" #include "debug.h" +#include "print_binary.h" #include "util.h" #include "target.h"
tools/perf/util/print_binary.c new file +55 -0
55 lines not on this page · raw message
tools/perf/util/print_binary.h new file +28 -0
@@ -0,0 +1,28 @@ +#ifndef PERF_PRINT_BINARY_H +#define PERF_PRINT_BINARY_H + +#include <stddef.h> + +enum binary_printer_ops { +BINARY_PRINT_DATA_BEGIN , +BINARY_PRINT_LINE_BEGIN , +BINARY_PRINT_ADDR , +BINARY_PRINT_NUM_DATA , +BINARY_PRINT_NUM_PAD , +BINARY_PRINT_SEP , +BINARY_PRINT_CHAR_DATA , +BINARY_PRINT_CHAR_PAD , +BINARY_PRINT_LINE_END , +BINARY_PRINT_DATA_END , +}; + +typedef void (*print_binary_t )(enum binary_printer_ops op, +unsigned int val,void *extra); + +void print_binary (unsigned char *data,size_t len, +size_t bytes_per_line,print_binary_t printer, +void *extra); + +int is_printable_array (char *p,unsigned int len); + +#endif /* PERF_PRINT_BINARY_H */
tools/perf/util/python-ext-sources +1 -0
@@ -21,6 +21,7 @@ util/cgroup.c util/parse-branch-options.c util/rblist.c util/counts.c +util/print_binary.c util/strlist.c util/trace-event.c ../lib/rbtree.c
tools/perf/util/python.c +1 -0
@@ -7,6 +7,7 @@#include "evsel.h" #include "event.h" #include "cpumap.h" +#include "print_binary.h" #include "thread_map.h" /*
tools/perf/util/scripting-engines/trace-event-python.c +1 -0
@@ -46,6 +46,7 @@#include "../call-path.h" #include "thread_map.h" #include "cpumap.h" +#include "print_binary.h" #include "stat.h" PyMODINIT_FUNC initperf_trace_context (void );
tools/perf/util/util.c +0 -54
66 lines not on this page · raw message
tools/perf/util/util.h +0 -23
@@ -213,33 +213,10 @@ const char *perf_tip(const char *dirpath);bool is_regular_file (const char *file);int fetch_current_timestamp (char *buf,size_t sz); -enum binary_printer_ops { -BINARY_PRINT_DATA_BEGIN , -BINARY_PRINT_LINE_BEGIN , -BINARY_PRINT_ADDR , -BINARY_PRINT_NUM_DATA , -BINARY_PRINT_NUM_PAD , -BINARY_PRINT_SEP , -BINARY_PRINT_CHAR_DATA , -BINARY_PRINT_CHAR_PAD , -BINARY_PRINT_LINE_END , -BINARY_PRINT_DATA_END , -}; - -typedef void (*print_binary_t )(enum binary_printer_ops , -unsigned int val, -void *extra); - -void print_binary (unsigned char *data,size_t len, -size_t bytes_per_line,print_binary_t printer, -void *extra); -#ifndef HAVE_SCHED_GETCPU_SUPPORT int sched_getcpu (void );#endif -int is_printable_array (char *p,unsigned int len); -int timestamp__scnprintf_usec (u64 timestamp,char *buf,size_t sz);int unit_number__scnprintf (char *buf,size_t size,u64 n);
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 17/28 perf tools: Move srcline definitions to separate header
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
Out of util.h into a new file, srcline.h
--- tools/perf/ui/browsers/hists.c | 1 + tools/perf/ui/stdio/hist.c | 1 + tools/perf/util/hist.c | 1 + tools/perf/util/map.c | 1 + tools/perf/util/sort.h | 1 + tools/perf/util/srcline.c | 1 + tools/perf/util/srcline.h | 34 ++++++++++++++++++++++++++++++++++ tools/perf/util/util.h | 27 --------------------------- 8 files changed, 40 insertions(+), 27 deletions(-) create mode 100644 tools/perf/util/srcline.h
tools/perf/ui/browsers/hists.c +1 -0
@@ -19,6 +19,7 @@#include "../ui.h" #include "map.h" #include "annotate.h" +#include "srcline.h" #include "sane_ctype.h"
tools/perf/ui/stdio/hist.c +1 -0
@@ -4,6 +4,7 @@#include "../../util/hist.h" #include "../../util/sort.h" #include "../../util/evsel.h" +#include "../../util/srcline.h" #include "../../util/sane_ctype.h" static size_t callchain__fprintf_left_margin (FILE *fp,int left_margin)
tools/perf/util/hist.c +1 -0
@@ -8,6 +8,7 @@#include "evlist.h" #include "evsel.h" #include "annotate.h" +#include "srcline.h" #include "ui/progress.h" #include <math.h>
tools/perf/util/map.c +1 -0
@@ -16,6 +16,7 @@#include "debug.h" #include "machine.h" #include <linux/string.h> +#include "srcline.h" #include "unwind.h" static void __maps__insert (struct maps *maps,struct map *map);
tools/perf/util/sort.h +1 -0
@@ -21,6 +21,7 @@#include <subcmd/parse-options.h> #include "parse-events.h" #include "hist.h" +#include "srcline.h" #include "thread.h" extern regex_t parent_regex;
tools/perf/util/srcline.c +1 -0
@@ -9,6 +9,7 @@#include "util/util.h" #include "util/debug.h" #include "util/callchain.h" +#include "srcline.h" #include "symbol.h"
tools/perf/util/srcline.h new file +34 -0
@@ -0,0 +1,34 @@ +#ifndef PERF_SRCLINE_H +#define PERF_SRCLINE_H + +#include <linux/list.h> +#include <linux/types.h> + +struct dso ; +struct symbol ; + +extern bool srcline_full_filename; +char *get_srcline (struct dso *dso,u64 addr,struct symbol *sym, +bool show_sym,bool show_addr); +char *__get_srcline (struct dso *dso,u64 addr,struct symbol *sym, +bool show_sym,bool show_addr,bool unwind_inlines); +void free_srcline (char *srcline); + +#define SRCLINE_UNKNOWN ((char *) "??:0") + +struct inline_list { +char *filename; +char *funcname; +unsigned int line_nr; +struct list_head list; +}; + +struct inline_node { +u64 addr; +struct list_head val; +}; + +struct inline_node *dso__parse_addr_inlines (struct dso *dso,u64 addr); +void inline_node__delete (struct inline_node *node); + +#endif /* PERF_SRCLINE_H */
tools/perf/util/util.h +0 -27
@@ -144,8 +144,6 @@ struct parse_tag {unsigned long parse_tag_value (const char *str,struct parse_tag *tags); -#define SRCLINE_UNKNOWN ((char *) "??:0") -static inline int path__join (char *bf,size_t size,const char *path1,const char *path2) {
@@ -161,16 +159,6 @@ static inline int path__join3(char *bf, size_t size, path2, path2[0] ? "/" : "", path3); } -struct dso ; -struct symbol ; - -extern bool srcline_full_filename; -char *get_srcline (struct dso *dso,u64 addr,struct symbol *sym, -bool show_sym,bool show_addr); -char *__get_srcline (struct dso *dso,u64 addr,struct symbol *sym, -bool show_sym,bool show_addr,bool unwind_inlines); -void free_srcline (char *srcline); -int perf_event_paranoid (void );void mem_bswap_64 (void *src,int byte_size);
@@ -221,19 +209,4 @@ int timestamp__scnprintf_usec(u64 timestamp, char *buf, size_t sz);int unit_number__scnprintf (char *buf,size_t size,u64 n); -struct inline_list { -char *filename; -char *funcname; -unsigned int line_nr; -struct list_head list; -}; - -struct inline_node { -u64 addr; -struct list_head val; -}; - -struct inline_node *dso__parse_addr_inlines (struct dso *dso,u64 addr); -void inline_node__delete (struct inline_node *node); -#endif /* GIT_COMPAT_UTIL_H */
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 18/28 perf tools: Move extra string util functions to util/string2.h
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
Moving them from util.h, where they don't belong. Since libc already have string.h, name it slightly differently, as string2.h.
--- tools/perf/bench/mem-functions.c | 1 + tools/perf/builtin-script.c | 1 + tools/perf/builtin-stat.c | 1 + tools/perf/builtin-trace.c | 1 + tools/perf/ui/browser.c | 1 + tools/perf/ui/browsers/hists.c | 1 + tools/perf/ui/gtk/hists.c | 1 + tools/perf/ui/stdio/hist.c | 1 + tools/perf/util/annotate.c | 1 + tools/perf/util/dso.c | 1 + tools/perf/util/dwarf-aux.c | 1 + tools/perf/util/event.c | 2 +- tools/perf/util/header.c | 1 + tools/perf/util/parse-events.c | 2 +- tools/perf/util/pmu.c | 1 + tools/perf/util/probe-event.c | 1 + tools/perf/util/probe-file.c | 1 + tools/perf/util/probe-finder.c | 1 + tools/perf/util/strfilter.c | 2 +- tools/perf/util/string.c | 16 +++++++++------ tools/perf/util/string2.h | 42 ++++++++++++++++++++++++++++++++++++++++ tools/perf/util/thread_map.c | 1 + tools/perf/util/util.h | 32 ------------------------------ 23 files changed, 72 insertions(+), 41 deletions(-) create mode 100644 tools/perf/util/string2.h
tools/perf/bench/mem-functions.c +1 -0
@@ -12,6 +12,7 @@#include <subcmd/parse-options.h> #include "../util/header.h" #include "../util/cloexec.h" +#include "../util/string2.h" #include "bench.h" #include "mem-memcpy-arch.h" #include "mem-memset-arch.h"
tools/perf/builtin-script.c +1 -0
@@ -21,6 +21,7 @@#include "util/cpumap.h" #include "util/thread_map.h" #include "util/stat.h" +#include "util/string2.h" #include "util/thread-stack.h" #include "util/time-utils.h" #include "print_binary.h"
tools/perf/builtin-stat.c +1 -0
@@ -64,6 +64,7 @@#include "util/session.h" #include "util/tool.h" #include "util/group.h" +#include "util/string2.h" #include "asm/bug.h" #include <linux/time64.h>
tools/perf/builtin-trace.c +1 -0
@@ -37,6 +37,7 @@#include "util/bpf-loader.h" #include "callchain.h" #include "print_binary.h" +#include "string2.h" #include "syscalltbl.h" #include "rb_resort.h"
tools/perf/ui/browser.c +1 -0
@@ -1,4 +1,5 @@#include "../util.h" +#include "../string2.h" #include "../config.h" #include "../../perf.h" #include "libslang.h"
tools/perf/ui/browsers/hists.c +1 -0
@@ -20,6 +20,7 @@#include "map.h" #include "annotate.h" #include "srcline.h" +#include "string2.h" #include "sane_ctype.h"
tools/perf/ui/gtk/hists.c +1 -0
@@ -4,6 +4,7 @@#include "../sort.h" #include "../hist.h" #include "../helpline.h" +#include "../string2.h" #include "gtk.h" #define MAX_COLUMNS 32
tools/perf/ui/stdio/hist.c +1 -0
@@ -5,6 +5,7 @@#include "../../util/sort.h" #include "../../util/evsel.h" #include "../../util/srcline.h" +#include "../../util/string2.h" #include "../../util/sane_ctype.h" static size_t callchain__fprintf_left_margin (FILE *fp,int left_margin)
tools/perf/util/annotate.c +1 -0
@@ -19,6 +19,7 @@#include "annotate.h" #include "evsel.h" #include "block-range.h" +#include "string2.h" #include "arch/common.h" #include <regex.h> #include <pthread.h>
tools/perf/util/dso.c +1 -0
@@ -8,6 +8,7 @@#include "auxtrace.h" #include "util.h" #include "debug.h" +#include "string2.h" #include "vdso.h" static const char *const debuglink_paths[] = {
tools/perf/util/dwarf-aux.c +1 -0
@@ -22,6 +22,7 @@#include "util.h" #include "debug.h" #include "dwarf-aux.h" +#include "string2.h" /** * cu_find_realpath - Find the realpath of the target file
tools/perf/util/event.c +1 -1
@@ -8,7 +8,7 @@#include "hist.h" #include "machine.h" #include "sort.h" -#include "string.h" +#include "string2.h" #include "strlist.h" #include "thread.h" #include "thread_map.h"
tools/perf/util/header.c +1 -0
@@ -1,5 +1,6 @@#include <inttypes.h> #include "util.h" +#include "string2.h" #include <sys/types.h> #include <byteswap.h> #include <unistd.h>
tools/perf/util/parse-events.c +1 -1
@@ -7,7 +7,7 @@#include <subcmd/parse-options.h> #include "parse-events.h" #include <subcmd/exec-cmd.h> -#include "string.h" +#include "string2.h" #include "symbol.h" #include "cache.h" #include "header.h"
tools/perf/util/pmu.c +1 -0
@@ -15,6 +15,7 @@#include "header.h" #include "pmu-events/pmu-events.h" #include "cache.h" +#include "string2.h" struct perf_pmu_format {char *name;
tools/perf/util/probe-event.c +1 -0
@@ -47,6 +47,7 @@#include "probe-finder.h" #include "probe-file.h" #include "session.h" +#include "string2.h" #include "sane_ctype.h"
tools/perf/util/probe-file.c +1 -0
@@ -28,6 +28,7 @@#include "probe-file.h" #include "session.h" #include "perf_regs.h" +#include "string2.h" /* 4096 - 2 ('\n' + '\0') */ #define MAX_CMDLEN 4094
tools/perf/util/probe-finder.c +1 -0
@@ -41,6 +41,7 @@#include "symbol.h" #include "probe-finder.h" #include "probe-file.h" +#include "string2.h" /* Kprobe tracer basic type is up to u64 */ #define MAX_BASIC_TYPE_BITS 64
tools/perf/util/strfilter.c +1 -1
@@ -1,5 +1,5 @@#include "util.h" -#include "string.h" +#include "string2.h" #include "strfilter.h" #include "sane_ctype.h"
tools/perf/util/string.c +10 -6
@@ -1,5 +1,7 @@ -#include "util.h" -#include "linux/string.h" +#include "string2.h" +#include <linux/kernel.h> +#include <linux/string.h> +#include <stdlib.h> #include "sane_ctype.h"
@@ -101,8 +103,10 @@ static int count_argc(const char *str)void argv_free (char **argv) {char **p; -for (p = argv; *p; p++) -zfree (p); +for (p = argv; *p; p++) { +free (*p); + *p =NULL ; + }free (argv); }
@@ -122,7 +126,7 @@ void argv_free(char **argv)char **argv_split (const char *str,int *argcp) {int argc =count_argc (str); -char **argv =zalloc (sizeof (*argv) * (argc+1 )); +char **argv =calloc (argc +1 ,sizeof (*argv));char **argvp;if (argv ==NULL )
@@ -379,7 +383,7 @@ char *asprintf_expr_inout_ints(const char *var, bool in, size_t nints, int *ints goto out_err_overflow;if (i >0 ) - printed +=snprintf (e + printed, size - printed," %s " , or_and); + printed +=scnprintf (e + printed, size - printed," %s " , or_and); printed +=scnprintf (e + printed, size - printed,"%s %s %d" , var, eq_neq, ints[i]); }
tools/perf/util/string2.h new file +42 -0
42 lines not on this page · raw message
tools/perf/util/thread_map.c +1 -0
@@ -6,6 +6,7 @@#include <sys/types.h> #include <sys/stat.h> #include <unistd.h> +#include "string2.h" #include "strlist.h" #include <string.h> #include <api/fs/fs.h>
tools/perf/util/util.h +0 -32
@@ -98,18 +98,6 @@ int copyfile(const char *from, const char *to);int copyfile_mode (const char *from,const char *to,mode_t mode);int copyfile_offset (int fromfd,loff_t from_ofs,int tofd,loff_t to_ofs,u64 size); -s64 perf_atoll (const char *str); -char **argv_split (const char *str,int *argcp); -void argv_free (char **argv); -bool strglobmatch (const char *str,const char *pat); -bool strglobmatch_nocase (const char *str,const char *pat); -bool strlazymatch (const char *str,const char *pat); -static inline bool strisglob (const char *str) -{ -return strpbrk (str,"*?[" ) !=NULL ; -} -int strtailcmp (const char *s1,const char *s2); -char *strxfrchar (char *s,char from,char to);unsigned long convert_unit (unsigned long value,char *unit);ssize_t readn (int fd,void *buf,size_t n);ssize_t writen (int fd,void *buf,size_t n);
@@ -121,14 +109,6 @@ void event_attr_init(struct perf_event_attr *attr);size_t hex_width (u64 v);int hex2u64 (const char *ptr,u64 *val); -char *ltrim (char *s); -char *rtrim (char *s); - -static inline char *trim (char *s) -{ -return ltrim (rtrim (s)); -} -void dump_stack (void );void sighandler_dump_stack (int sig);
@@ -175,18 +155,6 @@ int gzip_decompress_to_file(const char *input, int output_fd);int lzma_decompress_to_file (const char *input,int output_fd);#endif -char *asprintf_expr_inout_ints (const char *var,bool in,size_t nints,int *ints); - -static inline char *asprintf_expr_in_ints (const char *var,size_t nints,int *ints) -{ -return asprintf_expr_inout_ints (var, true, nints, ints); -} - -static inline char *asprintf_expr_not_in_ints (const char *var,size_t nints,int *ints) -{ -return asprintf_expr_inout_ints (var, false, nints, ints); -} -int get_stack_size (const char *str,unsigned long *_size); int fetch_kernel_version(unsigned int *puint,
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 19/28 perf tools: Include errno.h where needed
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
Removing it from util.h, part of an effort to disentangle the includes hell, that makes changes to util.h or something included by it to cause a complete rebuild of the tools.
--- tools/perf/arch/arm64/util/dwarf-regs.c | 1 + tools/perf/arch/powerpc/util/kvm-stat.c | 1 + tools/perf/arch/powerpc/util/perf_regs.c | 1 + tools/perf/arch/s390/util/kvm-stat.c | 1 + tools/perf/arch/x86/tests/intel-cqm.c | 1 + tools/perf/arch/x86/tests/perf-time-to-tsc.c | 1 + tools/perf/arch/x86/util/auxtrace.c | 1 + tools/perf/arch/x86/util/intel-bts.c | 1 + tools/perf/arch/x86/util/intel-pt.c | 1 + tools/perf/arch/x86/util/kvm-stat.c | 1 + tools/perf/arch/x86/util/perf_regs.c | 1 + tools/perf/builtin-annotate.c | 1 + tools/perf/builtin-buildid-cache.c | 1 + tools/perf/builtin-buildid-list.c | 1 + tools/perf/builtin-c2c.c | 1 + tools/perf/builtin-diff.c | 1 + tools/perf/builtin-ftrace.c | 1 + tools/perf/builtin-help.c | 1 + tools/perf/builtin-inject.c | 1 + tools/perf/builtin-kmem.c | 1 + tools/perf/builtin-kvm.c | 1 + tools/perf/builtin-lock.c | 1 + tools/perf/builtin-record.c | 1 + tools/perf/builtin-report.c | 1 + tools/perf/builtin-sched.c | 1 + tools/perf/builtin-script.c | 1 + tools/perf/builtin-stat.c | 1 + tools/perf/builtin-timechart.c | 1 + tools/perf/builtin-trace.c | 1 + tools/perf/perf.c | 1 + tools/perf/tests/attr.c | 1 + tools/perf/tests/backward-ring-buffer.c | 1 + tools/perf/tests/bpf.c | 1 + tools/perf/tests/builtin-test.c | 1 + tools/perf/tests/code-reading.c | 1 + tools/perf/tests/event-times.c | 1 + tools/perf/tests/evsel-roundtrip-name.c | 1 + tools/perf/tests/hists_link.c | 1 + tools/perf/tests/mmap-basic.c | 1 + tools/perf/tests/openat-syscall-all-cpus.c | 1 + tools/perf/tests/openat-syscall-tp-fields.c | 1 + tools/perf/tests/openat-syscall.c | 1 + tools/perf/tests/parse-events.c | 1 + tools/perf/tests/perf-record.c | 1 + tools/perf/tests/pmu.c | 1 + tools/perf/tests/sdt.c | 1 + tools/perf/tests/sw-clock.c | 1 + tools/perf/tests/switch-tracking.c | 1 + tools/perf/tests/task-exit.c | 1 + tools/perf/ui/browsers/hists.c | 1 + tools/perf/util/annotate.c | 1 + tools/perf/util/auxtrace.h | 1 + tools/perf/util/bpf-loader.c | 1 + tools/perf/util/bpf-loader.h | 2 ++ tools/perf/util/bpf-prologue.c | 1 + tools/perf/util/bpf-prologue.h | 2 ++ tools/perf/util/build-id.c | 1 + tools/perf/util/c++/clang-c.h | 1 + tools/perf/util/cloexec.c | 1 + tools/perf/util/comm.c | 1 + tools/perf/util/config.c | 1 + tools/perf/util/counts.c | 1 + tools/perf/util/data-convert-bt.c | 1 + tools/perf/util/data.c | 1 + tools/perf/util/drv_configs.c | 1 + tools/perf/util/dso.c | 1 + tools/perf/util/dwarf-aux.c | 1 + tools/perf/util/env.c | 1 + tools/perf/util/event.c | 1 + tools/perf/util/evlist.c | 1 + tools/perf/util/evsel.c | 1 + tools/perf/util/header.c | 1 + tools/perf/util/hist.c | 1 + tools/perf/util/intel-bts.c | 1 + tools/perf/util/jitdump.c | 1 + tools/perf/util/lzma.c | 1 + tools/perf/util/machine.c | 1 + tools/perf/util/ordered-events.c | 1 + tools/perf/util/parse-events.c | 1 + tools/perf/util/pmu.c | 1 + tools/perf/util/probe-file.c | 1 + tools/perf/util/quote.c | 1 + tools/perf/util/record.c | 1 + tools/perf/util/session.c | 1 + tools/perf/util/sort.c | 1 + tools/perf/util/stat.c | 1 + tools/perf/util/strbuf.c | 1 + tools/perf/util/strfilter.c | 1 + tools/perf/util/symbol-minimal.c | 1 + tools/perf/util/thread-stack.c | 1 + tools/perf/util/thread.c | 1 + tools/perf/util/thread_map.c | 1 + tools/perf/util/unwind-libunwind-local.c | 1 + tools/perf/util/util.h | 1 - tools/perf/util/vdso.c | 2 +- 95 files changed, 96 insertions(+), 2 deletions(-)
tools/perf/arch/arm64/util/dwarf-regs.c +1 -0
@@ -8,6 +8,7 @@* published by the Free Software Foundation. */ +#include <errno.h> #include <stddef.h> #include <dwarf-regs.h> #include <linux/ptrace.h> /* for struct user_pt_regs */
tools/perf/arch/powerpc/util/kvm-stat.c +1 -0
@@ -1,3 +1,4 @@ +#include <errno.h> #include "util/kvm-stat.h" #include "util/parse-events.h" #include "util/debug.h"
tools/perf/arch/powerpc/util/perf_regs.c +1 -0
@@ -1,3 +1,4 @@ +#include <errno.h> #include <string.h> #include <regex.h>
tools/perf/arch/s390/util/kvm-stat.c +1 -0
@@ -9,6 +9,7 @@* as published by the Free Software Foundation. */ +#include <errno.h> #include "../../util/kvm-stat.h" #include <asm/sie.h>
tools/perf/arch/x86/tests/intel-cqm.c +1 -0
@@ -7,6 +7,7 @@#include "arch-tests.h" #include <sys/mman.h> +#include <errno.h> #include <string.h> static pid_t spawn (void )
tools/perf/arch/x86/tests/perf-time-to-tsc.c +1 -0
@@ -1,3 +1,4 @@ +#include <errno.h> #include <inttypes.h> #include <stdio.h> #include <unistd.h>
tools/perf/arch/x86/util/auxtrace.c +1 -0
@@ -13,6 +13,7 @@* */ +#include <errno.h> #include <stdbool.h> #include "../../util/header.h"
tools/perf/arch/x86/util/intel-bts.c +1 -0
@@ -13,6 +13,7 @@* */ +#include <errno.h> #include <linux/kernel.h> #include <linux/types.h> #include <linux/bitops.h>
tools/perf/arch/x86/util/intel-pt.c +1 -0
@@ -13,6 +13,7 @@* */ +#include <errno.h> #include <stdbool.h> #include <linux/kernel.h> #include <linux/types.h>
tools/perf/arch/x86/util/kvm-stat.c +1 -0
@@ -1,3 +1,4 @@ +#include <errno.h> #include "../../util/kvm-stat.h" #include <asm/svm.h> #include <asm/vmx.h>
tools/perf/arch/x86/util/perf_regs.c +1 -0
@@ -1,3 +1,4 @@ +#include <errno.h> #include <string.h> #include <regex.h>
tools/perf/builtin-annotate.c +1 -0
@@ -33,6 +33,7 @@#include "util/block-range.h" #include <dlfcn.h> +#include <errno.h> #include <linux/bitmap.h> struct perf_annotate {
tools/perf/builtin-buildid-cache.c +1 -0
@@ -10,6 +10,7 @@#include <sys/time.h> #include <time.h> #include <dirent.h> +#include <errno.h> #include <unistd.h> #include "builtin.h" #include "perf.h"
tools/perf/builtin-buildid-list.c +1 -0
@@ -16,6 +16,7 @@#include "util/session.h" #include "util/symbol.h" #include "util/data.h" +#include <errno.h> static int sysfs__fprintf_build_id (FILE *fp) {
tools/perf/builtin-c2c.c +1 -0
@@ -9,6 +9,7 @@* Dick Fowles <[email protected]> * Joe Mario <[email protected]> */ +#include <errno.h> #include <inttypes.h> #include <linux/compiler.h> #include <linux/kernel.h>
tools/perf/builtin-diff.c +1 -0
@@ -19,6 +19,7 @@#include "util/data.h" #include "util/config.h" +#include <errno.h> #include <inttypes.h> #include <stdlib.h> #include <math.h>
tools/perf/builtin-ftrace.c +1 -0
@@ -9,6 +9,7 @@#include "builtin.h" #include "perf.h" +#include <errno.h> #include <unistd.h> #include <signal.h> #include <fcntl.h>
tools/perf/builtin-help.c +1 -0
@@ -13,6 +13,7 @@#include <subcmd/help.h> #include "util/debug.h" #include <linux/kernel.h> +#include <errno.h> static struct man_viewer_list { struct man_viewer_list *next;
tools/perf/builtin-inject.c +1 -0
@@ -22,6 +22,7 @@#include <subcmd/parse-options.h> #include <linux/list.h> +#include <errno.h> struct perf_inject {struct perf_tool tool;
tools/perf/builtin-kmem.c +1 -0
@@ -23,6 +23,7 @@#include <linux/kernel.h> #include <linux/rbtree.h> #include <linux/string.h> +#include <errno.h> #include <inttypes.h> #include <locale.h> #include <regex.h>
tools/perf/builtin-kvm.c +1 -0
@@ -26,6 +26,7 @@#include <linux/kernel.h> #include <linux/time64.h> +#include <errno.h> #include <inttypes.h> #include <termios.h> #include <semaphore.h>
tools/perf/builtin-lock.c +1 -0
@@ -1,3 +1,4 @@ +#include <errno.h> #include <inttypes.h> #include "builtin.h" #include "perf.h"
tools/perf/builtin-record.c +1 -0
@@ -40,6 +40,7 @@#include "util/perf-hooks.h" #include "asm/bug.h" +#include <errno.h> #include <inttypes.h> #include <unistd.h> #include <sched.h>
tools/perf/builtin-report.c +1 -0
@@ -40,6 +40,7 @@#include "util/auxtrace.h" #include <dlfcn.h> +#include <errno.h> #include <inttypes.h> #include <linux/bitmap.h> #include <linux/stringify.h>
tools/perf/builtin-sched.c +1 -0
@@ -28,6 +28,7 @@#include <sys/resource.h> #include <inttypes.h> +#include <errno.h> #include <semaphore.h> #include <pthread.h> #include <math.h>
tools/perf/builtin-script.c +1 -0
@@ -32,6 +32,7 @@#include "asm/bug.h" #include "util/mem-events.h" #include "util/dump-insn.h" +#include <errno.h> #include <inttypes.h> #include "sane_ctype.h"
tools/perf/builtin-stat.c +1 -0
@@ -69,6 +69,7 @@#include <linux/time64.h> #include <api/fs/fs.h> +#include <errno.h> #include <stdlib.h> #include <sys/prctl.h> #include <inttypes.h>
tools/perf/builtin-timechart.c +1 -0
@@ -12,6 +12,7 @@* of the License. */ +#include <errno.h> #include <inttypes.h> #include <traceevent/event-parse.h>
tools/perf/builtin-trace.c +1 -0
@@ -41,6 +41,7 @@#include "syscalltbl.h" #include "rb_resort.h" +#include <errno.h> #include <inttypes.h> #include <libaudit.h> /* FIXME: Still needed for audit_errno_to_name */ #include <stdlib.h>
tools/perf/perf.c +1 -0
@@ -19,6 +19,7 @@#include "util/debug.h" #include <api/fs/fs.h> #include <api/fs/tracing_path.h> +#include <errno.h> #include <pthread.h> #include <stdlib.h> #include <time.h>
tools/perf/tests/attr.c +1 -0
@@ -18,6 +18,7 @@* permissions. All the event text files are stored there. */ +#include <errno.h> #include <inttypes.h> #include <stdlib.h> #include <stdio.h>
tools/perf/tests/backward-ring-buffer.c +1 -0
@@ -8,6 +8,7 @@#include <sys/prctl.h> #include "tests.h" #include "debug.h" +#include <errno.h> #define NR_ITERS 111
tools/perf/tests/bpf.c +1 -0
@@ -1,3 +1,4 @@ +#include <errno.h> #include <stdio.h> #include <sys/epoll.h> #include <util/util.h>
tools/perf/tests/builtin-test.c +1 -0
@@ -3,6 +3,7 @@* * Builtin regression testing command: ever growing number of sanity tests */ +#include <errno.h> #include <unistd.h> #include <string.h> #include "builtin.h"
tools/perf/tests/code-reading.c +1 -0
@@ -1,3 +1,4 @@ +#include <errno.h> #include <linux/kernel.h> #include <linux/types.h> #include <inttypes.h>
tools/perf/tests/event-times.c +1 -0
@@ -1,4 +1,5 @@#include <linux/compiler.h> +#include <errno.h> #include <inttypes.h> #include <string.h> #include "tests.h"
tools/perf/tests/evsel-roundtrip-name.c +1 -0
@@ -3,6 +3,7 @@#include "parse-events.h" #include "tests.h" #include "debug.h" +#include <errno.h> #include <linux/kernel.h> static int perf_evsel__roundtrip_cache_name_test (void )
tools/perf/tests/hists_link.c +1 -0
@@ -9,6 +9,7 @@#include "thread.h" #include "parse-events.h" #include "hists_common.h" +#include <errno.h> #include <linux/kernel.h> struct sample {
tools/perf/tests/mmap-basic.c +1 -0
@@ -1,3 +1,4 @@ +#include <errno.h> #include <inttypes.h> /* For the CLR_() macros */ #include <pthread.h>
tools/perf/tests/openat-syscall-all-cpus.c +1 -0
@@ -1,3 +1,4 @@ +#include <errno.h> #include <inttypes.h> /* For the CPU_* macros */ #include <pthread.h>
tools/perf/tests/openat-syscall-tp-fields.c +1 -0
@@ -5,6 +5,7 @@#include "thread_map.h" #include "tests.h" #include "debug.h" +#include <errno.h> #ifndef O_DIRECTORY #define O_DIRECTORY 00200000
tools/perf/tests/openat-syscall.c +1 -0
@@ -1,3 +1,4 @@ +#include <errno.h> #include <inttypes.h> #include <api/fs/tracing_path.h> #include <linux/err.h>
tools/perf/tests/parse-events.c +1 -0
@@ -5,6 +5,7 @@#include "tests.h" #include "debug.h" #include "util.h" +#include <errno.h> #include <linux/kernel.h> #include <linux/hw_breakpoint.h> #include <api/fs/fs.h>
tools/perf/tests/perf-record.c +1 -0
@@ -1,3 +1,4 @@ +#include <errno.h> #include <inttypes.h> /* For the CLR_() macros */ #include <pthread.h>
tools/perf/tests/pmu.c +1 -0
@@ -2,6 +2,7 @@#include "pmu.h" #include "util.h" #include "tests.h" +#include <errno.h> #include <linux/kernel.h> /* Simulated format definitions. */
tools/perf/tests/sdt.c +1 -0
@@ -1,3 +1,4 @@ +#include <errno.h> #include <stdio.h> #include <sys/epoll.h> #include <util/util.h>
tools/perf/tests/sw-clock.c +1 -0
@@ -1,3 +1,4 @@ +#include <errno.h> #include <inttypes.h> #include <unistd.h> #include <stdlib.h>
tools/perf/tests/switch-tracking.c +1 -0
@@ -1,5 +1,6 @@#include <sys/time.h> #include <sys/prctl.h> +#include <errno.h> #include <time.h> #include <stdlib.h>
tools/perf/tests/task-exit.c +1 -0
@@ -4,6 +4,7 @@#include "cpumap.h" #include "tests.h" +#include <errno.h> #include <signal.h> static int exited;
tools/perf/ui/browsers/hists.c +1 -0
@@ -1,3 +1,4 @@ +#include <errno.h> #include <inttypes.h> #include <stdio.h> #include <stdlib.h>
tools/perf/util/annotate.c +1 -0
@@ -7,6 +7,7 @@* Released under the GPL v2. (and only v2, not any later version) */ +#include <errno.h> #include <inttypes.h> #include "util.h" #include "ui/ui.h"
tools/perf/util/auxtrace.h +1 -0
@@ -17,6 +17,7 @@#define __PERF_AUXTRACE_H#include <sys/types.h> +#include <errno.h> #include <stdbool.h> #include <stddef.h> #include <linux/list.h>
tools/perf/util/bpf-loader.c +1 -0
@@ -11,6 +11,7 @@#include <linux/err.h> #include <linux/kernel.h> #include <linux/string.h> +#include <errno.h> #include "perf.h" #include "debug.h" #include "bpf-loader.h"
tools/perf/util/bpf-loader.h +2 -0
@@ -85,6 +85,8 @@ int bpf__strerror_setup_stdout(struct perf_evlist *evlist, int err, char *buf, size_t size);#else +#include <errno.h> +static inline struct bpf_object *bpf__prepare_load (const char *filename__maybe_unused ,bool source__maybe_unused )
tools/perf/util/bpf-prologue.c +1 -0
@@ -12,6 +12,7 @@#include "bpf-loader.h" #include "bpf-prologue.h" #include "probe-finder.h" +#include <errno.h> #include <dwarf-regs.h> #include <linux/filter.h>
tools/perf/util/bpf-prologue.h +2 -0
@@ -18,6 +18,8 @@ int bpf__gen_prologue(struct probe_trace_arg *args, int nargs, struct bpf_insn *new_prog, size_t *new_cnt, size_t cnt_space);#else +#include <errno.h> + static inline int bpf__gen_prologue(struct probe_trace_arg *args __maybe_unused, int nargs __maybe_unused,
tools/perf/util/build-id.c +1 -0
@@ -7,6 +7,7 @@* Copyright (C) 2009, 2010 Arnaldo Carvalho de Melo <[email protected]> */ #include "util.h" +#include <errno.h> #include <stdio.h> #include "build-id.h" #include "event.h"
tools/perf/util/c++/clang-c.h +1 -0
@@ -20,6 +20,7 @@ extern int perf_clang__compile_bpf(const char *filename, size_t *p_obj_buf_sz);#else +#include <errno.h> static inline void perf_clang__init (void ) { }static inline void perf_clang__cleanup (void ) { }
tools/perf/util/cloexec.c +1 -0
@@ -1,3 +1,4 @@ +#include <errno.h> #include <sched.h> #include "util.h" #include "../perf.h"
tools/perf/util/comm.c +1 -0
@@ -1,5 +1,6 @@#include "comm.h" #include "util.h" +#include <errno.h> #include <stdlib.h> #include <stdio.h> #include <linux/refcount.h>
tools/perf/util/config.c +1 -0
@@ -8,6 +8,7 @@* Copyright (C) Johannes Schindelin, 2005 * */ +#include <errno.h> #include "util.h" #include "cache.h" #include <subcmd/exec-cmd.h>
tools/perf/util/counts.c +1 -0
@@ -1,3 +1,4 @@ +#include <errno.h> #include <stdlib.h> #include "evsel.h" #include "counts.h"
tools/perf/util/data-convert-bt.c +1 -0
@@ -7,6 +7,7 @@* Released under the GPL v2. (and only v2, not any later version) */ +#include <errno.h> #include <inttypes.h> #include <linux/compiler.h> #include <linux/kernel.h>
tools/perf/util/data.c +1 -0
@@ -2,6 +2,7 @@#include <linux/kernel.h> #include <sys/types.h> #include <sys/stat.h> +#include <errno.h> #include <unistd.h> #include <string.h>
tools/perf/util/drv_configs.c +1 -0
@@ -17,6 +17,7 @@#include "evlist.h" #include "evsel.h" #include "pmu.h" +#include <errno.h> static int perf_evsel__apply_drv_configs(struct perf_evsel *evsel,
tools/perf/util/dso.c +1 -0
@@ -2,6 +2,7 @@#include <linux/kernel.h> #include <sys/time.h> #include <sys/resource.h> +#include <errno.h> #include "symbol.h" #include "dso.h" #include "machine.h"
tools/perf/util/dwarf-aux.c +1 -0
@@ -17,6 +17,7 @@* */ +#include <errno.h> #include <inttypes.h> #include <stdbool.h> #include "util.h"
tools/perf/util/env.c +1 -0
@@ -1,6 +1,7 @@#include "cpumap.h" #include "env.h" #include "util.h" +#include <errno.h> struct perf_env perf_env;
tools/perf/util/event.c +1 -0
@@ -1,3 +1,4 @@ +#include <errno.h> #include <inttypes.h> #include <linux/kernel.h> #include <linux/types.h>
tools/perf/util/evlist.c +1 -0
@@ -8,6 +8,7 @@*/ #include "util.h" #include <api/fs/fs.h> +#include <errno.h> #include <inttypes.h> #include <poll.h> #include "cpumap.h"
tools/perf/util/evsel.c +1 -0
@@ -8,6 +8,7 @@*/ #include <byteswap.h> +#include <errno.h> #include <inttypes.h> #include <linux/bitops.h> #include <api/fs/tracing_path.h>
tools/perf/util/header.c +1 -0
@@ -1,3 +1,4 @@ +#include <errno.h> #include <inttypes.h> #include "util.h" #include "string2.h"
tools/perf/util/hist.c +1 -0
@@ -10,6 +10,7 @@#include "annotate.h" #include "srcline.h" #include "ui/progress.h" +#include <errno.h> #include <math.h> static bool hists__filter_entry_by_dso(struct hists *hists,
tools/perf/util/intel-bts.c +1 -0
@@ -14,6 +14,7 @@*/ #include <endian.h> +#include <errno.h> #include <byteswap.h> #include <inttypes.h> #include <linux/kernel.h>
tools/perf/util/jitdump.c +1 -0
@@ -1,5 +1,6 @@#include <sys/sysmacros.h> #include <sys/types.h> +#include <errno.h> #include <stdio.h> #include <stdlib.h> #include <string.h>
tools/perf/util/lzma.c +1 -0
@@ -1,3 +1,4 @@ +#include <errno.h> #include <lzma.h> #include <stdio.h> #include <linux/compiler.h>
tools/perf/util/machine.c +1 -0
@@ -1,3 +1,4 @@ +#include <errno.h> #include <inttypes.h> #include "callchain.h" #include "debug.h"
tools/perf/util/ordered-events.c +1 -0
@@ -1,3 +1,4 @@ +#include <errno.h> #include <inttypes.h> #include <linux/list.h> #include <linux/compiler.h>
tools/perf/util/parse-events.c +1 -0
@@ -1,5 +1,6 @@#include <linux/hw_breakpoint.h> #include <linux/err.h> +#include <errno.h> #include "util.h" #include "../perf.h" #include "evlist.h"
tools/perf/util/pmu.c +1 -0
@@ -1,6 +1,7 @@#include <linux/list.h> #include <linux/compiler.h> #include <sys/types.h> +#include <errno.h> #include <unistd.h> #include <stdio.h> #include <stdbool.h>
tools/perf/util/probe-file.c +1 -0
@@ -14,6 +14,7 @@* GNU General Public License for more details. * */ +#include <errno.h> #include <sys/uio.h> #include "util.h" #include "event.h"
tools/perf/util/quote.c +1 -0
@@ -1,3 +1,4 @@ +#include <errno.h> #include <stdlib.h> #include "strbuf.h" #include "quote.h"
tools/perf/util/record.c +1 -0
@@ -2,6 +2,7 @@#include "evsel.h" #include "cpumap.h" #include "parse-events.h" +#include <errno.h> #include <api/fs/fs.h> #include "util.h" #include "cloexec.h"
tools/perf/util/session.c +1 -0
@@ -1,3 +1,4 @@ +#include <errno.h> #include <inttypes.h> #include <linux/kernel.h> #include <traceevent/event-parse.h>
tools/perf/util/sort.c +1 -0
@@ -1,3 +1,4 @@ +#include <errno.h> #include <inttypes.h> #include <sys/mman.h> #include "sort.h"
tools/perf/util/stat.c +1 -0
@@ -1,3 +1,4 @@ +#include <errno.h> #include <inttypes.h> #include <math.h> #include "stat.h"
tools/perf/util/strbuf.c +1 -0
@@ -1,6 +1,7 @@#include "debug.h" #include "util.h" #include <linux/kernel.h> +#include <errno.h> int prefixcmp (const char *str,const char *prefix) {
tools/perf/util/strfilter.c +1 -0
@@ -2,6 +2,7 @@#include "string2.h" #include "strfilter.h" +#include <errno.h> #include "sane_ctype.h" /* Operators */
tools/perf/util/symbol-minimal.c +1 -0
@@ -1,6 +1,7 @@#include "symbol.h" #include "util.h" +#include <errno.h> #include <stdio.h> #include <fcntl.h> #include <string.h>
tools/perf/util/thread-stack.c +1 -0
@@ -15,6 +15,7 @@#include <linux/rbtree.h> #include <linux/list.h> +#include <errno.h> #include "thread.h" #include "event.h" #include "machine.h"
tools/perf/util/thread.c +1 -0
@@ -1,4 +1,5 @@#include "../perf.h" +#include <errno.h> #include <stdlib.h> #include <stdio.h> #include <string.h>
tools/perf/util/thread_map.c +1 -0
@@ -1,4 +1,5 @@#include <dirent.h> +#include <errno.h> #include <limits.h> #include <stdbool.h> #include <stdlib.h>
tools/perf/util/unwind-libunwind-local.c +1 -0
@@ -16,6 +16,7 @@*/ #include <elf.h> +#include <errno.h> #include <gelf.h> #include <fcntl.h> #include <inttypes.h>
tools/perf/util/util.h +0 -1
@@ -18,7 +18,6 @@#include <stdarg.h> #include <string.h> #include <term.h> -#include <errno.h> #include <limits.h> #include <sys/param.h> #include <sys/types.h>
tools/perf/util/vdso.c +1 -1
@@ -1,4 +1,4 @@ - +#include <errno.h> #include <unistd.h> #include <stdio.h> #include <string.h>
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 20/28 perf str{filter,list}: Disentangle headers
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
There are places where we just need a forward declaration, and others were we need to include strlist.h and/or strfilter.h, reducing the impact of changes in headers on the build time, do it.
--- tools/perf/builtin-report.c | 1 - tools/perf/builtin-timechart.c | 1 - tools/perf/util/bpf-loader.c | 1 + tools/perf/util/build-id.c | 1 + tools/perf/util/build-id.h | 4 +++- tools/perf/util/evsel_fprintf.c | 1 + tools/perf/util/jitdump.c | 1 - tools/perf/util/map.c | 1 - tools/perf/util/parse-events.c | 1 + tools/perf/util/probe-event.c | 1 + tools/perf/util/probe-event.h | 7 +++++-- tools/perf/util/probe-file.c | 1 + tools/perf/util/probe-file.h | 6 ++++-- tools/perf/util/probe-finder.c | 1 + tools/perf/util/sort.c | 1 + tools/perf/util/sort.h | 1 - tools/perf/util/util.h | 3 ++- 17 files changed, 22 insertions(+), 11 deletions(-)
tools/perf/builtin-report.c +0 -1
@@ -16,7 +16,6 @@#include <linux/rbtree.h> #include "util/symbol.h" #include "util/callchain.h" -#include "util/strlist.h" #include "util/values.h" #include "perf.h"
tools/perf/builtin-timechart.c +0 -1
@@ -30,7 +30,6 @@#include <linux/time64.h> #include "util/symbol.h" #include "util/callchain.h" -#include "util/strlist.h" #include "perf.h" #include "util/header.h"
tools/perf/util/bpf-loader.c +1 -0
@@ -19,6 +19,7 @@#include "probe-event.h" #include "probe-finder.h" // for MAX_PROBES #include "parse-events.h" +#include "strfilter.h" #include "llvm-utils.h" #include "c++/clang-c.h"
tools/perf/util/build-id.c +1 -0
@@ -19,6 +19,7 @@#include "header.h" #include "vdso.h" #include "probe-file.h" +#include "strlist.h" #include "sane_ctype.h"
tools/perf/util/build-id.h +3 -1
@@ -5,7 +5,6 @@#define SBUILD_ID_SIZE (BUILD_ID_SIZE * 2 + 1)#include "tool.h" -#include "strlist.h" #include <linux/types.h> extern struct perf_tool build_id__mark_dso_hit_ops;
@@ -34,6 +33,9 @@ char *build_id_cache__origname(const char *sbuild_id);char *build_id_cache__linkname (const char *sbuild_id,char *bf,size_t size);char *build_id_cache__cachedir (const char *sbuild_id,const char *name,bool is_kallsyms,bool is_vdso); + +struct strlist ; +struct strlist *build_id_cache__list_all (bool validonly);char *build_id_cache__complement (const char *incomplete_sbuild_id); int build_id_cache__list_build_ids(const char *pathname,
tools/perf/util/evsel_fprintf.c +1 -0
@@ -5,6 +5,7 @@#include "evsel.h" #include "callchain.h" #include "map.h" +#include "strlist.h" #include "symbol.h" static int comma_fprintf (FILE *fp,bool *first,const char *fmt, ...)
tools/perf/util/jitdump.c +0 -1
@@ -17,7 +17,6 @@#include "debug.h" #include "evlist.h" #include "symbol.h" -#include "strlist.h" #include <elf.h> #include "tsc.h"
tools/perf/util/map.c +0 -1
@@ -9,7 +9,6 @@#include <uapi/linux/mman.h> /* To get things like MAP_HUGETLB even on older libc headers */ #include "map.h" #include "thread.h" -#include "strlist.h" #include "vdso.h" #include "build-id.h" #include "util.h"
tools/perf/util/parse-events.c +1 -0
@@ -9,6 +9,7 @@#include "parse-events.h" #include <subcmd/exec-cmd.h> #include "string2.h" +#include "strlist.h" #include "symbol.h" #include "cache.h" #include "header.h"
tools/perf/util/probe-event.c +1 -0
@@ -36,6 +36,7 @@#include "util.h" #include "event.h" #include "strlist.h" +#include "strfilter.h" #include "debug.h" #include "cache.h" #include "color.h"
tools/perf/util/probe-event.h +5 -2
@@ -3,8 +3,6 @@#include <stdbool.h> #include "intlist.h" -#include "strlist.h" -#include "strfilter.h" /* Probe related configurations */ struct probe_conf {
@@ -107,6 +105,8 @@ struct line_range {struct intlist *line_list;/* Visible lines */ }; +struct strlist ; +/* List of variables */ struct variable_list {struct probe_trace_point point;/* Actual probepoint */
@@ -153,6 +153,9 @@ int convert_perf_probe_events(struct perf_probe_event *pevs, int npevs);int apply_perf_probe_events (struct perf_probe_event *pevs,int npevs);int show_probe_trace_events (struct perf_probe_event *pevs,int npevs);void cleanup_perf_probe_events (struct perf_probe_event *pevs,int npevs); + +struct strfilter ; +int del_perf_probe_events (struct strfilter *filter); int show_perf_probe_event(const char *group, const char *event,
tools/perf/util/probe-file.c +1 -0
@@ -19,6 +19,7 @@#include "util.h" #include "event.h" #include "strlist.h" +#include "strfilter.h" #include "debug.h" #include "cache.h" #include "color.h"
tools/perf/util/probe-file.h +4 -2
@@ -1,10 +1,11 @@ #ifndef __PROBE_FILE_H #define __PROBE_FILE_H -#include "strlist.h" -#include "strfilter.h" #include "probe-event.h" +struct strlist; +struct strfilter; + /* Cache of probe definitions */ struct probe_cache_entry { struct list_head node;
@@ -41,6 +42,7 @@ int probe_file__open_both(int *kfd, int *ufd, int flag);struct strlist *probe_file__get_namelist (int fd);struct strlist *probe_file__get_rawlist (int fd);int probe_file__add_event (int fd,struct probe_trace_event *tev); +int probe_file__del_events (int fd,struct strfilter *filter);int probe_file__get_events (int fd,struct strfilter *filter,struct strlist *plist);
tools/perf/util/probe-finder.c +1 -0
@@ -38,6 +38,7 @@#include "debug.h" #include "intlist.h" #include "util.h" +#include "strlist.h" #include "symbol.h" #include "probe-finder.h" #include "probe-file.h"
tools/perf/util/sort.c +1 -0
@@ -7,6 +7,7 @@#include "symbol.h" #include "evsel.h" #include "evlist.h" +#include "strlist.h" #include <traceevent/event-parse.h> #include "mem-events.h" #include <linux/kernel.h>
tools/perf/util/sort.h +0 -1
@@ -11,7 +11,6 @@#include "symbol.h" #include "string.h" #include "callchain.h" -#include "strlist.h" #include "values.h" #include "../perf.h"
tools/perf/util/util.h +2 -1
@@ -40,7 +40,6 @@#include <termios.h> #include <linux/bitops.h> #include <termios.h> -#include "strlist.h" extern char buildid_dir[];
@@ -89,6 +88,8 @@ static inline void *zalloc(size_t size)#define zfree (ptr) ({ free(*ptr); *ptr = NULL; }) +struct strlist ; +int mkdir_p (char *path,mode_t mode);int rm_rf (const char *path);struct strlist *lsdir (const char *name,bool (*filter)(const char *,struct dirent *));
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 21/28 perf tools: Don't include terminal handling headers in util.h
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
Continuing the disentanglement, mostly the TUI needs CTRL(c), that is in sys/ttydefaults.h and term.c needs the termios headers.
And term.h needs to be added to a few places too.
--- tools/perf/builtin-kvm.c | 1 + tools/perf/builtin-top.c | 1 + tools/perf/ui/browsers/annotate.c | 1 + tools/perf/ui/browsers/header.c | 2 ++ tools/perf/ui/browsers/hists.c | 1 + tools/perf/util/parse-events.c | 2 +- tools/perf/util/term.c | 6 +++++- tools/perf/util/util.h | 4 ---- 8 files changed, 12 insertions(+), 6 deletions(-)
tools/perf/builtin-kvm.c +1 -0
@@ -3,6 +3,7 @@#include "util/evsel.h" #include "util/evlist.h" +#include "util/term.h" #include "util/util.h" #include "util/cache.h" #include "util/symbol.h"
tools/perf/builtin-top.c +1 -0
@@ -40,6 +40,7 @@#include "util/cpumap.h" #include "util/xyarray.h" #include "util/sort.h" +#include "util/term.h" #include "util/intlist.h" #include "util/parse-branch-options.h" #include "arch/common.h"
tools/perf/ui/browsers/annotate.c +1 -0
@@ -12,6 +12,7 @@#include <inttypes.h> #include <pthread.h> #include <linux/kernel.h> +#include <sys/ttydefaults.h> struct disasm_line_samples {double percent;
tools/perf/ui/browsers/header.c +2 -0
@@ -8,6 +8,8 @@#include "util/header.h" #include "util/session.h" +#include <sys/ttydefaults.h> +static void ui_browser__argv_write (struct ui_browser *browser,void *entry,int row) {
tools/perf/ui/browsers/hists.c +1 -0
@@ -4,6 +4,7 @@#include <stdlib.h> #include <string.h> #include <linux/rbtree.h> +#include <sys/ttydefaults.h> #include "../../util/evsel.h" #include "../../util/evlist.h"
tools/perf/util/parse-events.c +1 -1
@@ -1,7 +1,7 @@#include <linux/hw_breakpoint.h> #include <linux/err.h> #include <errno.h> -#include "util.h" +#include "term.h" #include "../perf.h" #include "evlist.h" #include "evsel.h"
tools/perf/util/term.c +5 -1
@@ -1,4 +1,8 @@ -#include "util.h" +#include "term.h" +#include <stdlib.h> +#include <termios.h> +#include <unistd.h> +#include <sys/ioctl.h> void get_term_dimensions (struct winsize *ws) {
tools/perf/util/util.h +0 -4
@@ -17,7 +17,6 @@#include <stdlib.h> #include <stdarg.h> #include <string.h> -#include <term.h> #include <limits.h> #include <sys/param.h> #include <sys/types.h>
@@ -35,11 +34,8 @@#include <sys/ioctl.h> #include <linux/kernel.h> #include <linux/types.h> -#include <sys/ttydefaults.h> #include <api/fs/tracing_path.h> -#include <termios.h> #include <linux/bitops.h> -#include <termios.h> extern char buildid_dir[];
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 22/28 perf tools: Move path related functions to util/path.h
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
Disentangling util.h header mess a bit more.
--- tools/perf/builtin-trace.c | 1 + tools/perf/tests/mmap-thread-lookup.c | 1 + tools/perf/tests/openat-syscall-all-cpus.c | 4 ++++ tools/perf/tests/openat-syscall.c | 3 +++ tools/perf/ui/setup.c | 1 + tools/perf/util/build-id.c | 1 + tools/perf/util/counts.c | 1 + tools/perf/util/dso.c | 1 + tools/perf/util/path.c | 28 +++++++++++++++++++++++++++- tools/perf/util/path.h | 9 +++++++++ tools/perf/util/symbol.c | 1 + tools/perf/util/symbol.h | 2 +- tools/perf/util/unwind-libdw.c | 1 + tools/perf/util/util.c | 10 ---------- tools/perf/util/util.h | 16 ---------------- 15 files changed, 52 insertions(+), 28 deletions(-) create mode 100644 tools/perf/util/path.h
tools/perf/builtin-trace.c +1 -0
@@ -24,6 +24,7 @@#include "util/evlist.h" #include <subcmd/exec-cmd.h> #include "util/machine.h" +#include "util/path.h" #include "util/session.h" #include "util/thread.h" #include <subcmd/parse-options.h>
tools/perf/tests/mmap-thread-lookup.c +1 -0
@@ -12,6 +12,7 @@#include "thread_map.h" #include "symbol.h" #include "thread.h" +#include "util.h" #define THREADS 4
tools/perf/tests/openat-syscall-all-cpus.c +4 -0
@@ -3,8 +3,12 @@/* For the CPU_* macros */ #include <pthread.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> #include <api/fs/fs.h> #include <linux/err.h> +#include <api/fs/tracing_path.h> #include "evsel.h" #include "tests.h" #include "thread_map.h"
tools/perf/tests/openat-syscall.c +3 -0
@@ -2,6 +2,9 @@#include <inttypes.h> #include <api/fs/tracing_path.h> #include <linux/err.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> #include "thread_map.h" #include "evsel.h" #include "debug.h"
tools/perf/ui/setup.c +1 -0
@@ -4,6 +4,7 @@#include "../util/cache.h" #include "../util/debug.h" #include "../util/hist.h" +#include "../util/util.h" pthread_mutex_t ui__lock =PTHREAD_MUTEX_INITIALIZER ;void *perf_gtk_handle;
tools/perf/util/build-id.c +1 -0
@@ -18,6 +18,7 @@#include "tool.h" #include "header.h" #include "vdso.h" +#include "path.h" #include "probe-file.h" #include "strlist.h"
tools/perf/util/counts.c +1 -0
@@ -2,6 +2,7 @@#include <stdlib.h> #include "evsel.h" #include "counts.h" +#include "util.h" struct perf_counts *perf_counts__new (int ncpus,int nthreads) {
tools/perf/util/dso.c +1 -0
@@ -3,6 +3,7 @@#include <sys/time.h> #include <sys/resource.h> #include <errno.h> +#include "path.h" #include "symbol.h" #include "dso.h" #include "machine.h"
tools/perf/util/path.c +27 -1
@@ -11,8 +11,13 @@* which is what it's designed for. */ #include "cache.h" -#include "util.h" +#include "path.h" +#include <linux/kernel.h> #include <limits.h> +#include <stdio.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <unistd.h> static char bad_path[] ="/bad-path/" ;/*
@@ -50,3 +55,24 @@ char *mkpath(const char *fmt, ...)return bad_path;return cleanup_path (pathname); } + +int path__join (char *bf,size_t size,const char *path1,const char *path2) +{ +return scnprintf (bf, size,"%s%s%s" , path1, path1[0 ] ?"/" :"" , path2); +} + +int path__join3 (char *bf,size_t size,const char *path1,const char *path2,const char *path3) +{ +return scnprintf (bf, size,"%s%s%s%s%s" , path1, path1[0 ] ?"/" :"" , + path2, path2[0 ] ?"/" :"" , path3); +} + +bool is_regular_file (const char *file) +{ +struct stat st; + +if (stat (file, &st)) +return false; + +return S_ISREG (st.st_mode); +}
tools/perf/util/path.h new file +9 -0
@@ -0,0 +1,9 @@ +#ifndef _PERF_PATH_H +#define _PERF_PATH_H + +int path__join (char *bf,size_t size,const char *path1,const char *path2); +int path__join3 (char *bf,size_t size,const char *path1,const char *path2,const char *path3); + +bool is_regular_file (const char *file); + +#endif /* _PERF_PATH_H */
tools/perf/util/symbol.c +1 -0
@@ -19,6 +19,7 @@#include "strlist.h" #include "intlist.h" #include "header.h" +#include "path.h" #include "sane_ctype.h" #include <elf.h>
tools/perf/util/symbol.h +1 -1
@@ -13,7 +13,7 @@#include <libgen.h> #include "build-id.h" #include "event.h" -#include "util.h" +#include "path.h" #ifdef HAVE_LIBELF_SUPPORT #include <libelf.h>
tools/perf/util/unwind-libdw.c +1 -0
@@ -12,6 +12,7 @@#include "event.h" #include "perf_regs.h" #include "callchain.h" +#include "util.h" static char *debuginfo_path;
tools/perf/util/util.c +0 -10
@@ -713,16 +713,6 @@ const char *perf_tip(const char *dirpath)return tip; } -bool is_regular_file (const char *file) -{ -struct stat st; - -if (stat (file, &st)) -return false; - -return S_ISREG (st.st_mode); -} -int fetch_current_timestamp (char *buf,size_t sz) {struct timeval tv;
tools/perf/util/util.h +0 -16
@@ -120,21 +120,6 @@ struct parse_tag {unsigned long parse_tag_value (const char *str,struct parse_tag *tags); -static inline int path__join (char *bf,size_t size, -const char *path1,const char *path2) -{ -return scnprintf (bf, size,"%s%s%s" , path1, path1[0 ] ?"/" :"" , path2); -} - -static inline int path__join3 (char *bf,size_t size, -const char *path1,const char *path2, -const char *path3) -{ -return scnprintf (bf, size,"%s%s%s%s%s" , - path1, path1[0 ] ?"/" :"" , - path2, path2[0 ] ?"/" :"" , path3); -} -int perf_event_paranoid (void );void mem_bswap_64 (void *src,int byte_size);
@@ -162,7 +147,6 @@ int fetch_kernel_version(unsigned int *puint,#define KVER_PARAM (x) KVER_VERSION(x), KVER_PATCHLEVEL(x), KVER_SUBLEVEL(x)const char *perf_tip (const char *dirpath); -bool is_regular_file (const char *file);int fetch_current_timestamp (char *buf,size_t sz);#ifndef HAVE_SCHED_GETCPU_SUPPORT
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 23/28 perf tools: No need to include bitops.h in util.h
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
When we switched to the kernel's roundup_pow_of_two we forgot to remove this include from util.h, do it now.
--- tools/perf/util/util.h | 1 - 1 file changed, 1 deletion(-)
tools/perf/util/util.h +0 -1
@@ -35,7 +35,6 @@#include <linux/kernel.h> #include <linux/types.h> #include <api/fs/tracing_path.h> -#include <linux/bitops.h> extern char buildid_dir[];
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 24/28 perf tools: Use api/fs/tracing_path.h where needed
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
Instead of getting it out of luck from util.h, where it isn't needed at all.
--- tools/perf/builtin-ftrace.c | 1 + tools/perf/tests/parse-events.c | 1 + tools/perf/util/util.h | 1 - 3 files changed, 2 insertions(+), 1 deletion(-)
tools/perf/builtin-ftrace.c +1 -0
@@ -16,6 +16,7 @@#include "debug.h" #include <subcmd/parse-options.h> +#include <api/fs/tracing_path.h> #include "evlist.h" #include "target.h" #include "cpumap.h"
tools/perf/tests/parse-events.c +1 -0
@@ -9,6 +9,7 @@#include <linux/kernel.h> #include <linux/hw_breakpoint.h> #include <api/fs/fs.h> +#include <api/fs/tracing_path.h> #define PERF_TP_SAMPLE_TYPE (PERF_SAMPLE_RAW | PERF_SAMPLE_TIME | \ PERF_SAMPLE_CPU | PERF_SAMPLE_PERIOD)
tools/perf/util/util.h +0 -1
@@ -34,7 +34,6 @@#include <sys/ioctl.h> #include <linux/kernel.h> #include <linux/types.h> -#include <api/fs/tracing_path.h> extern char buildid_dir[];
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 25/28 perf tools: Remove misplaced __maybe_unused in some functions
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
Those args _are_ being used.
--- tools/perf/util/build-id.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/util/build-id.c +2 -2
@@ -451,14 +451,14 @@ void disable_buildid_cache(void) }static bool lsdir_bid_head_filter (const char *name__maybe_unused , -struct dirent *d__maybe_unused ) +struct dirent *d) {return (strlen (d->d_name) ==2 ) &&isxdigit (d->d_name[0 ]) &&isxdigit (d->d_name[1 ]); }static bool lsdir_bid_tail_filter (const char *name__maybe_unused , -struct dirent *d__maybe_unused ) +struct dirent *d) {int i =0 ;while (isxdigit (d->d_name[i]) && i <SBUILD_ID_SIZE -3 )
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 26/28 perf tools: Remove include dirent.h from util.h
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
The files using the dirent.h routines should instead include it, reducing the includes hell that lead to longer build times.
--- tools/perf/builtin-script.c | 1 + tools/perf/tests/dso-data.c | 1 + tools/perf/tests/parse-events.c | 1 + tools/perf/ui/browsers/hists.c | 1 + tools/perf/util/build-id.c | 1 + tools/perf/util/cpumap.c | 1 + tools/perf/util/event.c | 1 + tools/perf/util/machine.c | 1 + tools/perf/util/parse-events.c | 1 + tools/perf/util/util.c | 1 + tools/perf/util/util.h | 2 +- 11 files changed, 11 insertions(+), 1 deletion(-)
tools/perf/builtin-script.c +1 -0
@@ -32,6 +32,7 @@#include "asm/bug.h" #include "util/mem-events.h" #include "util/dump-insn.h" +#include <dirent.h> #include <errno.h> #include <inttypes.h>
tools/perf/tests/dso-data.c +1 -0
@@ -1,3 +1,4 @@ +#include <dirent.h> #include <stdlib.h> #include <linux/kernel.h> #include <linux/types.h>
tools/perf/tests/parse-events.c +1 -0
@@ -5,6 +5,7 @@#include "tests.h" #include "debug.h" #include "util.h" +#include <dirent.h> #include <errno.h> #include <linux/kernel.h> #include <linux/hw_breakpoint.h>
tools/perf/ui/browsers/hists.c +1 -0
@@ -1,3 +1,4 @@ +#include <dirent.h> #include <errno.h> #include <inttypes.h> #include <stdio.h>
tools/perf/util/build-id.c +1 -0
@@ -7,6 +7,7 @@* Copyright (C) 2009, 2010 Arnaldo Carvalho de Melo <[email protected]> */ #include "util.h" +#include <dirent.h> #include <errno.h> #include <stdio.h> #include "build-id.h"
tools/perf/util/cpumap.c +1 -0
@@ -3,6 +3,7 @@#include "../perf.h" #include "cpumap.h" #include <assert.h> +#include <dirent.h> #include <stdio.h> #include <stdlib.h> #include <linux/bitmap.h>
tools/perf/util/event.c +1 -0
@@ -1,3 +1,4 @@ +#include <dirent.h> #include <errno.h> #include <inttypes.h> #include <linux/kernel.h>
tools/perf/util/machine.c +1 -0
@@ -1,3 +1,4 @@ +#include <dirent.h> #include <errno.h> #include <inttypes.h> #include "callchain.h"
tools/perf/util/parse-events.c +1 -0
@@ -1,5 +1,6 @@#include <linux/hw_breakpoint.h> #include <linux/err.h> +#include <dirent.h> #include <errno.h> #include "term.h" #include "../perf.h"
tools/perf/util/util.c +1 -0
@@ -7,6 +7,7 @@#ifdef HAVE_BACKTRACE_SUPPORT #include <execinfo.h> #endif +#include <dirent.h> #include <inttypes.h> #include <stdio.h> #include <stdlib.h>
tools/perf/util/util.h +1 -1
@@ -20,7 +20,6 @@#include <limits.h> #include <sys/param.h> #include <sys/types.h> -#include <dirent.h> #include <sys/time.h> #include <time.h> #include <signal.h>
@@ -82,6 +81,7 @@ static inline void *zalloc(size_t size)#define zfree (ptr) ({ free(*ptr); *ptr = NULL; }) +struct dirent ;struct strlist ;int mkdir_p (char *path,mode_t mode);
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 27/28 perf tools: Remove regex.h and fnmatch.h from util.h
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
The users of regex and fnmatch functions should include those headers instead.
--- tools/perf/builtin-report.c | 1 + tools/perf/util/machine.c | 1 + tools/perf/util/sort.c | 1 + tools/perf/util/sort.h | 2 +- tools/perf/util/util.h | 2 -- 5 files changed, 4 insertions(+), 3 deletions(-)
tools/perf/builtin-report.c +1 -0
@@ -41,6 +41,7 @@#include <dlfcn.h> #include <errno.h> #include <inttypes.h> +#include <regex.h> #include <linux/bitmap.h> #include <linux/stringify.h>
tools/perf/util/machine.c +1 -0
@@ -1,6 +1,7 @@#include <dirent.h> #include <errno.h> #include <inttypes.h> +#include <regex.h> #include "callchain.h" #include "debug.h" #include "event.h"
tools/perf/util/sort.c +1 -0
@@ -1,5 +1,6 @@#include <errno.h> #include <inttypes.h> +#include <regex.h> #include <sys/mman.h> #include "sort.h" #include "hist.h"
tools/perf/util/sort.h +1 -1
@@ -2,7 +2,7 @@#define __PERF_SORT_H#include "../builtin.h" -#include "util.h" +#include <regex.h> #include "color.h" #include <linux/list.h>
tools/perf/util/util.h +0 -2
@@ -23,9 +23,7 @@#include <sys/time.h> #include <time.h> #include <signal.h> -#include <fnmatch.h> #include <assert.h> -#include <regex.h> #include <utime.h> #include <sys/wait.h> #include <poll.h>
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 28/28 perf tools: Ditch unused strchrnul() reimplementation
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
Remnants from the git codebase.
--- tools/perf/util/util.h | 16 ---------------- 1 file changed, 16 deletions(-)
tools/perf/util/util.h +0 -16
@@ -56,22 +56,6 @@ void set_warning_routine(void (*routine)(const char *err, va_list params));int prefixcmp (const char *str,const char *prefix);void set_buildid_dir (const char *dir); -#ifdef __GLIBC_PREREQ -#if __GLIBC_PREREQ (2 ,1 ) -#define HAVE_STRCHRNUL -#endif -#endif - -#ifndef HAVE_STRCHRNUL -#define strchrnul gitstrchrnul -static inline char *gitstrchrnul (const char *s,int c) -{ -while (*s && *s != c) - s++; -return (char *)s; -} -#endif -static inline void *zalloc (size_t size) {return calloc (1 , size);
Signature · 1 line
2.9.3
Quoted 255 lines · Arnaldo Carvalho de Melo
Hi Ingo,
Please consider pulling,
- Arnaldo
Test results at the end of this message, as usual.
The following changes since commit
e720c19e0d5412f45736d62258d21dc7b056c4ad:Merge tag 'perf-core-for-mingo-4.12-20170413' of
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linuxinto perf/core (2017-04-17 10:11:09 +0200)are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.gittags/perf-core-for-mingo-4.12-20170419for you to fetch changes up to
1b5ad16c7aa7177512ce141e345ff36b9f1a6136:perf tools: Ditch unused
strchrnul()reimplementation (2017-04-19 13:01:57 -0300)----------------------------------------------------------------
perf/core cleanups: (Arnaldo Carvalho de Melo). Introduce new header files out of the hodge-podge that
util/util.h
became, trying to disentangle the includes hell that all C projects end up growing. This should help in build times, as changes to seemingly unrelated files (util.hincluded tons of headers) won't trigger a rebuild of most object files.. Use equivalent facilities found in the kernel source code base
originatedtools/include/header files, such as__stringify(),ARRAY_SIZE, that has extra checks (__must_be_array()), etc.. For that get some more files from the kernel sources, like
include/linux/bug.h, some just with the bits needed at this time.. Use the headers where facilities declared in them are used, such
asPRIxu(32,64)macros (inttypes.h), errno defines (errno.h), etc.. Remove various leftovers from the initial code base we copied from
git.git:FLEX_ARRAY, etc.Signed-off-by Arnaldo Carvalho de Melo <[email protected]>----------------------------------------------------------------
Arnaldo Carvalho de Melo (28):
perf unwind arm64: Add missingerrno.hheader
perf tools: RemoveFLEX_ARRAYdefinition
tools include: Introducelinux/bug.h, from the kernel sources tools include: Adopt__same_type()and__must_be_array()from the kernel tools include: MoveARRAY_SIZE()tolinux/kernel.h
perf tools: Add include <linux/kernel.h> whereARRAY_SIZE()is used
objtool: DropARRAY_SIZE()definition,tools/include/linux/kernel.hhas it now tools include: DropARRAY_SIZE()definition fromlinux/hashtable.hperf tools: Remove unused macros fromutil.h
perf tools: Including missinginttypes.hheader
perf tools: Remove PRI[xu] macros fromperf.h
perf tools: ReplaceSTR()calls with__stringify()
perf tools: Ditch unusedPATH_SEP,STRIP_EXTENSION
perf tools: Move sane ctype stuff fromutil.htosane_ctype.htools include: Include missing headers forfls()and types inlinux/log2.hperf tools: Moveprint_binarydefinitions to separate files
perf tools: Move srcline definitions to separate header
perf tools: Move extra string util functions toutil/string2.hperf tools: Includeerrno.hwhere needed
perf str{filter,list}: Disentangle headers
perf tools: Don't include terminal handling headers inutil.hperf tools: Move path related functions toutil/path.h
perf tools: No need to includebitops.hinutil.h
perf tools: Useapi/fs/tracing_path.hwhere needed
perf tools: Remove misplaced__maybe_unusedin some functions perf tools: Remove includedirent.hfromutil.h
perf tools: Removeregex.handfnmatch.hfromutil.h
perf tools: Ditch unusedstrchrnul()reimplementationtools/include/linux/bug.h | 10 + tools/include/linux/compiler-gcc.h | 3 + tools/include/linux/compiler.h | 5 + tools/include/linux/hashtable.h | 4 - tools/include/linux/kernel.h | 3 + tools/include/linux/log2.h | 3 + tools/lib/symbol/kallsyms.c | 1 + tools/objtool/builtin-check.c | 3 +- tools/objtool/objtool.c | 3 +- tools/perf/MANIFEST | 1 + tools/perf/arch/arm/util/dwarf-regs.c | 4 +- tools/perf/arch/arm64/util/dwarf-regs.c | 4 +- tools/perf/arch/arm64/util/unwind-libunwind.c | 2 +- tools/perf/arch/common.c | 2 + tools/perf/arch/powerpc/util/dwarf-regs.c | 5 +- tools/perf/arch/powerpc/util/kvm-stat.c | 1 + tools/perf/arch/powerpc/util/perf_regs.c | 1 + tools/perf/arch/s390/util/kvm-stat.c | 1 + tools/perf/arch/x86/tests/intel-cqm.c | 1 + tools/perf/arch/x86/tests/perf-time-to-tsc.c | 2 + tools/perf/arch/x86/util/auxtrace.c | 1 + tools/perf/arch/x86/util/intel-bts.c | 1 + tools/perf/arch/x86/util/intel-pt.c | 1 + tools/perf/arch/x86/util/kvm-stat.c | 1 + tools/perf/arch/x86/util/perf_regs.c | 1 + tools/perf/bench/mem-functions.c | 1 + tools/perf/bench/numa.c | 2 + tools/perf/builtin-annotate.c | 1 + tools/perf/builtin-buildid-cache.c | 1 + tools/perf/builtin-buildid-list.c | 1 + tools/perf/builtin-c2c.c | 2 + tools/perf/builtin-diff.c | 2 + tools/perf/builtin-ftrace.c | 2 + tools/perf/builtin-help.c | 6 +- tools/perf/builtin-inject.c | 1 + tools/perf/builtin-kallsyms.c | 1 + tools/perf/builtin-kmem.c | 5 + tools/perf/builtin-kvm.c | 4 + tools/perf/builtin-lock.c | 3 + tools/perf/builtin-mem.c | 1 + tools/perf/builtin-record.c | 2 + tools/perf/builtin-report.c | 4 +- tools/perf/builtin-sched.c | 5 + tools/perf/builtin-script.c | 8 + tools/perf/builtin-stat.c | 5 + tools/perf/builtin-timechart.c | 4 +- tools/perf/builtin-top.c | 3 + tools/perf/builtin-trace.c | 8 + tools/perf/perf.c | 12 +- tools/perf/tests/attr.c | 2 + tools/perf/tests/backward-ring-buffer.c | 1 + tools/perf/tests/bpf.c | 2 + tools/perf/tests/builtin-test.c | 2 + tools/perf/tests/clang.c | 1 + tools/perf/tests/code-reading.c | 6 +- tools/perf/tests/dso-data.c | 2 + tools/perf/tests/dwarf-unwind.c | 1 + tools/perf/tests/event-times.c | 2 + tools/perf/tests/evsel-roundtrip-name.c | 2 + tools/perf/tests/hists_common.c | 2 + tools/perf/tests/hists_cumulate.c | 1 + tools/perf/tests/hists_filter.c | 1 + tools/perf/tests/hists_link.c | 2 + tools/perf/tests/hists_output.c | 1 + tools/perf/tests/is_printable_array.c | 3 +- tools/perf/tests/mmap-basic.c | 3 + tools/perf/tests/mmap-thread-lookup.c | 2 + tools/perf/tests/openat-syscall-all-cpus.c | 6 + tools/perf/tests/openat-syscall-tp-fields.c | 1 + tools/perf/tests/openat-syscall.c | 5 + tools/perf/tests/parse-events.c | 5 +- tools/perf/tests/parse-no-sample-id-all.c | 1 + tools/perf/tests/perf-record.c | 2 + tools/perf/tests/pmu.c | 2 + tools/perf/tests/sample-parsing.c | 2 + tools/perf/tests/sdt.c | 1 + tools/perf/tests/sw-clock.c | 2 + tools/perf/tests/switch-tracking.c | 1 + tools/perf/tests/task-exit.c | 1 + tools/perf/tests/unit_number__scnprintf.c | 1 + tools/perf/tests/vmlinux-kallsyms.c | 1 + tools/perf/ui/browser.c | 2 + tools/perf/ui/browsers/annotate.c | 3 + tools/perf/ui/browsers/header.c | 2 + tools/perf/ui/browsers/hists.c | 8 + tools/perf/ui/browsers/map.c | 2 + tools/perf/ui/gtk/annotate.c | 2 +- tools/perf/ui/gtk/hists.c | 1 + tools/perf/ui/hist.c | 1 + tools/perf/ui/setup.c | 1 + tools/perf/ui/stdio/hist.c | 4 +- tools/perf/ui/tui/setup.c | 1 + tools/perf/util/Build | 1 + tools/perf/util/annotate.c | 6 + tools/perf/util/auxtrace.c | 6 +- tools/perf/util/auxtrace.h | 1 + tools/perf/util/bpf-loader.c | 3 + tools/perf/util/bpf-loader.h | 2 + tools/perf/util/bpf-prologue.c | 1 + tools/perf/util/bpf-prologue.h | 2 + tools/perf/util/build-id.c | 9 +- tools/perf/util/build-id.h | 4 +- tools/perf/util/c++/clang-c.h | 1 + tools/perf/util/callchain.c | 1 + tools/perf/util/cgroup.c | 5 +- tools/perf/util/cloexec.c | 1 + tools/perf/util/comm.c | 1 + tools/perf/util/config.c | 3 + tools/perf/util/counts.c | 2 + tools/perf/util/cpumap.c | 3 + tools/perf/util/ctype.c | 2 +- tools/perf/util/data-convert-bt.c | 4 + tools/perf/util/data.c | 1 + tools/perf/util/debug.c | 4 + tools/perf/util/demangle-java.c | 2 + tools/perf/util/drv_configs.c | 1 + tools/perf/util/dso.c | 4 + tools/perf/util/dwarf-aux.c | 3 + tools/perf/util/dwarf-regs.c | 1 + tools/perf/util/env.c | 1 + tools/perf/util/event.c | 7 +- tools/perf/util/evlist.c | 2 + tools/perf/util/evlist.h | 1 + tools/perf/util/evsel.c | 4 + tools/perf/util/evsel_fprintf.c | 2 + tools/perf/util/header.c | 5 + tools/perf/util/hist.c | 2 + tools/perf/util/intel-bts.c | 2 + tools/perf/util/intel-pt.c | 1 + tools/perf/util/jitdump.c | 7 +- tools/perf/util/lzma.c | 1 + tools/perf/util/machine.c | 8 +- tools/perf/util/map.c | 2 +- tools/perf/util/mem-events.c | 1 + tools/perf/util/ordered-events.c | 2 + tools/perf/util/parse-events.c | 7 +- tools/perf/util/path.c | 28 ++- tools/perf/util/path.h | 9 + tools/perf/util/perf-hooks.c | 1 + tools/perf/util/pmu.c | 2 + tools/perf/util/print_binary.c | 55 +++++ tools/perf/util/print_binary.h | 28 +++ tools/perf/util/probe-event.c | 5 + tools/perf/util/probe-event.h | 7 +- tools/perf/util/probe-file.c | 3 + tools/perf/util/probe-file.h | 6 +- tools/perf/util/probe-finder.c | 3 + tools/perf/util/probe-finder.h | 2 +- tools/perf/util/python-ext-sources | 1 + tools/perf/util/python.c | 1 + tools/perf/util/quote.c | 1 + tools/perf/util/record.c | 1 + tools/perf/util/sane_ctype.h | 51 +++++ .../perf/util/scripting-engines/trace-event-perl.c | 1 + .../util/scripting-engines/trace-event-python.c | 2 + tools/perf/util/session.c | 2 + tools/perf/util/session.h | 1 + tools/perf/util/sort.c | 5 + tools/perf/util/sort.h | 4 +- tools/perf/util/srcline.c | 2 + tools/perf/util/srcline.h | 34 +++ tools/perf/util/stat.c | 2 + tools/perf/util/strbuf.c | 1 + tools/perf/util/strfilter.c | 5 +- tools/perf/util/string.c | 18 +- tools/perf/util/string2.h | 42 ++++ tools/perf/util/symbol-elf.c | 3 +- tools/perf/util/symbol-minimal.c | 1 + tools/perf/util/symbol.c | 3 + tools/perf/util/symbol.h | 2 +- tools/perf/util/term.c | 6 +- tools/perf/util/thread-stack.c | 1 + tools/perf/util/thread.c | 2 + tools/perf/util/thread_map.c | 2 + tools/perf/util/trace-event-parse.c | 3 +- tools/perf/util/unwind-libdw.c | 1 + tools/perf/util/unwind-libunwind-local.c | 2 + tools/perf/util/util.c | 64 +----- tools/perf/util/util.h | 249 +-------------------- tools/perf/util/vdso.c | 2 +-
Quoted 8 lines
180 files changed, 659 insertions(+), 376 deletions(-) create mode 100644 tools/include/linux/bug.h create mode 100644 tools/perf/util/path.h create mode 100644 tools/perf/util/print_binary.c create mode 100644 tools/perf/util/print_binary.h create mode 100644 tools/perf/util/sane_ctype.h create mode 100644 tools/perf/util/srcline.h create mode 100644 tools/perf/util/string2.h
Pulled, thanks a lot Arnaldo!
Quoted 5 lines
For this specific pull request the
samples/bpf/was disabled, as 'makeheaders_install' is failing with the following error, in this case in fedora:rawhide:INSTALL
usr/include/uapi/(0 file)
/git/linux/scripts/Makefile.headersinst:62: *** Missing generated UAPI file
./arch/x86/include/generated/uapi/asm/unistd_32.h. Stop.
Quoted 4 lines
make[1]: *** [/git/linux/Makefile:1151:
headers_install] Error 2 make[1]: Leaving directory '/tmp/build/linux'
make: *** [Makefile:152: sub-make] Error 2
make: Leaving directory '/git/linux'
Beyond this build fix, could we also do a header file synchronization round:
Warning: include/uapi/linux/stat.h differs from kernel
Warning: arch/x86/include/asm/cpufeatures.h differs from kernel
Warning: arch/x86/lib/memcpy_64.S differs from kernel
... so that Linus does not see these warnings when pulling these bits in the merge window?
Thanks,
Ingo
Arnaldo Carvalho de Melo
maintainerEm Thu, Apr 20, 2017 at 10:10:49AM +0200, Ingo Molnar escreveu:
Quoted 8 lines · Arnaldo Carvalho de Melo
Pulled, thanks a lot Arnaldo!
Quoted 5 lines
For this specific pull request the
samples/bpf/was disabled, as 'makeheaders_install' is failing with the following error, in this case in fedora:rawhide:INSTALL
usr/include/uapi/(0 file)
/git/linux/scripts/Makefile.headersinst:62: *** Missing generated UAPI file
Quoted 7 lines
./arch/x86/include/generated/uapi/asm/unistd_32.h. Stop.Quoted 4 lines
make[1]: *** [/git/linux/Makefile:1151:
headers_install] Error 2 make[1]: Leaving directory '/tmp/build/linux'
make: *** [Makefile:152: sub-make] Error 2
make: Leaving directory '/git/linux'Beyond this build fix,
I haven't checked this lately, will do, hopefully this was already taken care of by someone dealing with the headers_install code.
Quoted 7 lines
could we also do a header file synchronization round:
Warning:include/uapi/linux/stat.hdiffers from kernel
Warning:arch/x86/include/asm/cpufeatures.hdiffers from kernel
Warning:arch/x86/lib/memcpy_64.Sdiffers from kernel... so that Linus does not see these warnings when pulling these bits in the merge window?
Sure, will do.
- Arnaldo
Quoted 15 lines · Arnaldo Carvalho de Melo
Em Thu, Apr 20, 2017 at 10:10:49AM +0200, Ingo Molnar escreveu:
Quoted 14 lines · Arnaldo Carvalho de Melo
Pulled, thanks a lot Arnaldo!
Quoted 5 lines
For this specific pull request the
samples/bpf/was disabled, as 'makeheaders_install' is failing with the following error, in this case in fedora:rawhide:INSTALL
usr/include/uapi/(0 file)
/git/linux/scripts/Makefile.headersinst:62: *** Missing generated UAPI file
./arch/x86/include/generated/uapi/asm/unistd_32.h. Stop.Quoted 4 lines
make[1]: *** [/git/linux/Makefile:1151:
headers_install] Error 2 make[1]: Leaving directory '/tmp/build/linux'
make: *** [Makefile:152: sub-make] Error 2
make: Leaving directory '/git/linux'
Quoted 4 lines
Quoted 1 line
Beyond this build fix,
I haven't checked this lately, will do, hopefully this was already taken care of by someone dealing with the
headers_installcode.
Ah, sorry, I thought it's a problem introduced by perf - if it's an existing upstream bug then never mind!
Thanks,
Ingo
Arnaldo Carvalho de Melo
maintainerEm Thu, Apr 20, 2017 at 01:29:26PM +0200, Ingo Molnar escreveu:
Quoted 18 lines · Arnaldo Carvalho de Melo
Quoted 16 lines
Em Thu, Apr 20, 2017 at 10:10:49AM +0200, Ingo Molnar escreveu:
Quoted 14 lines · Arnaldo Carvalho de Melo
Pulled, thanks a lot Arnaldo!
Quoted 5 lines
For this specific pull request the
samples/bpf/was disabled, as 'makeheaders_install' is failing with the following error, in this case in fedora:rawhide:INSTALL
usr/include/uapi/(0 file)
/git/linux/scripts/Makefile.headersinst:62: *** Missing generated UAPI file
./arch/x86/include/generated/uapi/asm/unistd_32.h. Stop.Quoted 4 lines
make[1]: *** [/git/linux/Makefile:1151:
headers_install] Error 2 make[1]: Leaving directory '/tmp/build/linux'
make: *** [Makefile:152: sub-make] Error 2
make: Leaving directory '/git/linux'
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
Beyond this build fix,
I haven't checked this lately, will do, hopefully this was already taken care of by someone dealing with the
headers_installcode.Ah, sorry, I thought it's a problem introduced by perf - if it's an existing upstream bug then never mind!
Checking it now, this is what I disabled in the recent containers with recent enough distros/tollchains to build this, like debian:experimental:
+# make -C /git/linux O=/tmp/build/linux allmodconfig && \ +# make -C /git/linux O=/tmp/build/linux headers_install && \ +# make -C /git/linux O=/tmp/build/linux samples/bpf/o
[root@jouet bin]# dsh debian:experimental
$ bash perfbuilder@91b0b6879760:/$ make -C /git/linux O=/tmp/build/linux allmodconfig make: Entering directory '/git/linux' make[1]: Entering directory '/tmp/build/linux' HOSTCC scripts/basic/fixdep GEN ./Makefile HOSTCC scripts/kconfig/conf.o SHIPPED scripts/kconfig/zconf.tab.c SHIPPED scripts/kconfig/zconf.lex.c SHIPPED scripts/kconfig/zconf.hash.c HOSTCC scripts/kconfig/zconf.tab.o HOSTLD scripts/kconfig/conf scripts/kconfig/conf --allmodconfig Kconfig # # configuration written to .config # make[1]: Leaving directory '/tmp/build/linux' make: Leaving directory '/git/linux' perfbuilder@91b0b6879760:/$ make -C /git/linux O=/tmp/build/linux headers_install make: Entering directory '/git/linux' make[1]: Entering directory '/tmp/build/linux' CHK include/generated/uapi/linux/version.h UPD include/generated/uapi/linux/version.h SYSTBL arch/x86/entry/syscalls/../../include/generated/asm/syscalls_32.h SYSHDR arch/x86/entry/syscalls/../../include/generated/uapi/asm/unistd_32.h HOSTCC arch/x86/tools/relocs_32.o HOSTCC arch/x86/tools/relocs_64.o HOSTCC arch/x86/tools/relocs_common.o HOSTLD arch/x86/tools/relocs HOSTCC scripts/unifdef INSTALL usr/include/asm-generic/ (35 files) INSTALL usr/include/drm/ (22 files) INSTALL usr/include/linux/android/ (1 file) INSTALL usr/include/linux/byteorder/ (2 files) INSTALL usr/include/linux/caif/ (2 files) INSTALL usr/include/linux/can/ (5 files) INSTALL usr/include/linux/dvb/ (8 files) INSTALL usr/include/linux/hdlc/ (1 file) INSTALL usr/include/linux/hsi/ (2 files) INSTALL usr/include/linux/iio/ (2 files) INSTALL usr/include/linux/isdn/ (1 file) INSTALL usr/include/linux/mmc/ (1 file) INSTALL usr/include/linux/netfilter/ipset/ (4 files) INSTALL usr/include/linux/netfilter/ (87 files) INSTALL usr/include/linux/netfilter_arp/ (2 files) INSTALL usr/include/linux/netfilter_bridge/ (17 files) INSTALL usr/include/linux/netfilter_ipv4/ (9 files) INSTALL usr/include/linux/netfilter_ipv6/ (12 files) INSTALL usr/include/linux/nfsd/ (5 files) INSTALL usr/include/linux/raid/ (2 files) INSTALL usr/include/linux/spi/ (1 file) INSTALL usr/include/linux/sunrpc/ (1 file) INSTALL usr/include/linux/tc_act/ (15 files) INSTALL usr/include/linux/tc_ematch/ (4 files) INSTALL usr/include/linux/usb/ (11 files) INSTALL usr/include/linux/wimax/ (1 file) INSTALL usr/include/linux/ (452 files) INSTALL usr/include/misc/ (1 file) INSTALL usr/include/mtd/ (5 files) INSTALL usr/include/rdma/hfi/ (2 files) INSTALL usr/include/rdma/ (18 files) INSTALL usr/include/scsi/fc/ (4 files) INSTALL usr/include/scsi/ (4 files) INSTALL usr/include/sound/ (15 files) INSTALL usr/include/video/ (3 files) INSTALL usr/include/xen/ (4 files) INSTALL usr/include/uapi/ (0 file) /git/linux/scripts/Makefile.headersinst:62: *** Missing generated UAPI file ./arch/x86/include/generated/uapi/asm/unistd_64.h. Stop. /git/linux/Makefile:1149: recipe for target 'headers_install' failed make[1]: *** [headers_install] Error 2 make[1]: Leaving directory '/tmp/build/linux' Makefile:152: recipe for target 'sub-make' failed make: *** [sub-make] Error 2 make: Leaving directory '/git/linux' perfbuilder@91b0b6879760:/$
Now if I try outside the container, on a fedora:25 system, same result:
[acme@jouet linux]$ rm -rf /tmp/build/linux [acme@jouet linux]$ mkdir /tmp/build/linux [acme@jouet linux]$ make O=/tmp/build/linux allmodconfig make[1]: Entering directory '/tmp/build/linux'
HOSTCC scripts/basic/fixdep GEN ./Makefile HOSTCC scripts/kconfig/conf.o
SHIPPED scripts/kconfig/zconf.tab.c
SHIPPED scripts/kconfig/zconf.lex.c
SHIPPED scripts/kconfig/zconf.hash.c
HOSTCC scripts/kconfig/zconf.tab.o
HOSTLD scripts/kconfig/confscripts/kconfig/conf --allmodconfig Kconfig
#
# configuration written to .config # make[1]: Leaving directory '/tmp/build/linux' [acme@jouet linux]$ make O=/tmp/build/linux headers_install make[1]: Entering directory '/tmp/build/linux' CHK include/generated/uapi/linux/version.h UPD include/generated/uapi/linux/version.h SYSTBL arch/x86/entry/syscalls/../../include/generated/asm/syscalls_32.h SYSHDR arch/x86/entry/syscalls/../../include/generated/uapi/asm/unistd_32.h HOSTCC arch/x86/tools/relocs_32.o HOSTCC arch/x86/tools/relocs_64.o HOSTCC arch/x86/tools/relocs_common.o HOSTLD arch/x86/tools/relocs HOSTCC scripts/unifdef INSTALL usr/include/asm-generic/ (35 files) INSTALL usr/include/drm/ (22 files) INSTALL usr/include/linux/android/ (1 file) INSTALL usr/include/linux/byteorder/ (2 files) INSTALL usr/include/linux/caif/ (2 files) INSTALL usr/include/linux/can/ (5 files) INSTALL usr/include/linux/dvb/ (8 files) INSTALL usr/include/linux/hdlc/ (1 file) INSTALL usr/include/linux/hsi/ (2 files) INSTALL usr/include/linux/iio/ (2 files) INSTALL usr/include/linux/isdn/ (1 file) INSTALL usr/include/linux/mmc/ (1 file) INSTALL usr/include/linux/netfilter/ipset/ (4 files) INSTALL usr/include/linux/netfilter/ (87 files) INSTALL usr/include/linux/netfilter_arp/ (2 files) INSTALL usr/include/linux/netfilter_bridge/ (17 files) INSTALL usr/include/linux/netfilter_ipv4/ (9 files) INSTALL usr/include/linux/netfilter_ipv6/ (12 files) INSTALL usr/include/linux/nfsd/ (5 files) INSTALL usr/include/linux/raid/ (2 files) INSTALL usr/include/linux/spi/ (1 file) INSTALL usr/include/linux/sunrpc/ (1 file) INSTALL usr/include/linux/tc_act/ (15 files) INSTALL usr/include/linux/tc_ematch/ (4 files) INSTALL usr/include/linux/usb/ (11 files) INSTALL usr/include/linux/wimax/ (1 file) INSTALL usr/include/linux/ (452 files) INSTALL usr/include/misc/ (1 file) INSTALL usr/include/mtd/ (5 files) INSTALL usr/include/rdma/hfi/ (2 files) INSTALL usr/include/rdma/ (18 files) INSTALL usr/include/scsi/fc/ (4 files) INSTALL usr/include/scsi/ (4 files) INSTALL usr/include/sound/ (15 files) INSTALL usr/include/video/ (3 files) INSTALL usr/include/xen/ (4 files) INSTALL usr/include/uapi/ (0 file) /home/acme/git/linux/scripts/Makefile.headersinst:62: *** Missing generated UAPI file ./arch/x86/include/generated/uapi/asm/unistd_64.h. Stop. /home/acme/git/linux/Makefile:1149: recipe for target 'headers_install' failed make[1]: *** [headers_install] Error 2 make[1]: Leaving directory '/tmp/build/linux' Makefile:152: recipe for target 'sub-make' failed make: *** [sub-make] Error 2 [acme@jouet linux]$
Trying to investigate this further now... Perhaps I'm missing something :-\
- Arnaldo
Arnaldo Carvalho de Melo
maintainerEm Thu, Apr 20, 2017 at 02:10:58PM -0300, Arnaldo Carvalho de Melo escreveu:
Quoted 57 lines
Em Thu, Apr 20, 2017 at 01:29:26PM +0200, Ingo Molnar escreveu:
Quoted 16 lines · Arnaldo Carvalho de Melo
Quoted 15 lines
Em Thu, Apr 20, 2017 at 10:10:49AM +0200, Ingo Molnar escreveu:
Quoted 14 lines · Arnaldo Carvalho de Melo
Pulled, thanks a lot Arnaldo!
Quoted 5 lines
For this specific pull request the
samples/bpf/was disabled, as 'makeheaders_install' is failing with the following error, in this case in fedora:rawhide:INSTALL
usr/include/uapi/(0 file)
/git/linux/scripts/Makefile.headersinst:62: *** Missing generated UAPI file
./arch/x86/include/generated/uapi/asm/unistd_32.h. Stop.Quoted 4 lines
make[1]: *** [/git/linux/Makefile:1151:
headers_install] Error 2 make[1]: Leaving directory '/tmp/build/linux'
make: *** [Makefile:152: sub-make] Error 2
make: Leaving directory '/git/linux'Quoted 7 lines
Quoted 4 lines
Quoted 1 line
Beyond this build fix,
I haven't checked this lately, will do, hopefully this was already taken care of by someone dealing with the
headers_installcode.Ah, sorry, I thought it's a problem introduced by perf - if it's an existing upstream bug then never mind!
Now if I try outside the container, on a fedora:25 system, same result:
[acme@jouet linux]$ rm -rf
/tmp/build/linux[acme@jouet linux]$ mkdir/tmp/build/linux[acme@jouet linux]$ make O=/tmp/build/linux allmodconfig make[1]: Entering directory '/tmp/build/linux'HOSTCC scripts/basic/fixdep GEN ./Makefile HOSTCC scripts/kconfig/conf.oSHIPPED
scripts/kconfig/zconf.tab.c
SHIPPEDscripts/kconfig/zconf.lex.c
SHIPPEDscripts/kconfig/zconf.hash.c
HOSTCCscripts/kconfig/zconf.tab.o
HOSTLDscripts/kconfig/confscripts/kconfig/conf--allmodconfigKconfig
## configuration written to .config # make[1]: Leaving directory '/tmp/build/linux' [acme@jouet linux]$ make O=/tmp/build/linux headers_install make[1]: Entering directory '/tmp/build/linux' INSTALL usr/include/sound/ (15 files) INSTALL usr/include/video/ (3 files) /home/acme/git/linux/scripts/Makefile.headersinst:62: *** Missing generated UAPI file ./arch/x86/include/generated/uapi/asm/unistd_64.h. Stop. /home/acme/git/linux/Makefile:1149: recipe for target 'headers_install' failed make[1]: *** [headers_install] Error 2 make[1]: Leaving directory '/tmp/build/linux' Makefile:152: recipe for target 'sub-make' failed make: *** [sub-make] Error 2 [acme@jouet linux]$
Quoted 2 lines
Trying to investigate this further now... Perhaps I'm missing something :-\
So, it seems that headers_install needs to have as a dependency the target that generates those headers (/generated/), as it works if I actually start building the kernel and then do the headers_install step.
that or allmodconfig
is broken, probably the former, checking...
- Arnaldo
Arnaldo Carvalho de Melo
maintainerEm Thu, Apr 20, 2017 at 03:29:54PM -0300, Arnaldo Carvalho de Melo escreveu:
Quoted 32 lines
Em Thu, Apr 20, 2017 at 02:10:58PM -0300, Arnaldo Carvalho de Melo escreveu:
Quoted 31 lines
Em Thu, Apr 20, 2017 at 01:29:26PM +0200, Ingo Molnar escreveu:
Quoted 16 lines · Arnaldo Carvalho de Melo
Quoted 15 lines
Em Thu, Apr 20, 2017 at 10:10:49AM +0200, Ingo Molnar escreveu:
Quoted 14 lines · Arnaldo Carvalho de Melo
Pulled, thanks a lot Arnaldo!
Quoted 5 lines
For this specific pull request the
samples/bpf/was disabled, as 'makeheaders_install' is failing with the following error, in this case in fedora:rawhide:INSTALL
usr/include/uapi/(0 file)
/git/linux/scripts/Makefile.headersinst:62: *** Missing generated UAPI file
./arch/x86/include/generated/uapi/asm/unistd_32.h. Stop.Quoted 4 lines
make[1]: *** [/git/linux/Makefile:1151:
headers_install] Error 2 make[1]: Leaving directory '/tmp/build/linux'
make: *** [Makefile:152: sub-make] Error 2
make: Leaving directory '/git/linux'Quoted 7 lines
Quoted 4 lines
Quoted 1 line
Beyond this build fix,
I haven't checked this lately, will do, hopefully this was already taken care of by someone dealing with the
headers_installcode.Ah, sorry, I thought it's a problem introduced by perf - if it's an existing upstream bug then never mind!
Now if I try outside the container, on a fedora:25 system, same result:
[acme@jouet linux]$ rm -rf
/tmp/build/linux[acme@jouet linux]$ mkdir/tmp/build/linux[acme@jouet linux]$ make O=/tmp/build/linux allmodconfig
<SNIP>
Quoted 11 lines
Quoted 10 lines
/home/acme/git/linux/scripts/Makefile.headersinst:62: *** Missing generated UAPI file./arch/x86/include/generated/uapi/asm/unistd_64.h. Stop./home/acme/git/linux/Makefile:1149: recipe for target 'headers_install' failed
make[1]: *** [headers_install] Error 2
make[1]: Leaving directory '/tmp/build/linux'
Makefile:152: recipe for target 'sub-make' failed
make: *** [sub-make] Error 2
[acme@jouet linux]$Trying to investigate this further now... Perhaps I'm missing something :-\
Quoted 6 lines
So, it seems that
headers_installneeds to have as a dependency the target that generates those headers (/generated/), as it works if I actually start building the kernel and then do theheaders_installstep.that or allmodconfig is broken, probably the former, checking...
Well, I tried using 'make defconfig' instead of 'make allmodconfig' and things are back working...
Now debian:experimental is again building all the tests.
Will use that and reenable building samples/bpf/ in all the recent enough distro containers.
- Arnaldo