Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b21daaed authored by Ingo Molnar's avatar Ingo Molnar
Browse files

Merge tag 'perf-core-for-mingo-2.1' of...

Merge tag 'perf-core-for-mingo-2.1' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux

 into perf/core

Pull perf/core improvements from Arnaldo Carvalho de Melo:

User visible changes:

  - Add record.build-id config option to 'perf record', to allow configuring
    in the ~/.perfconfig file if and how build-ids should be processed, allowing
    a permanent setting for options such as -B and -N: (Namhyung Kim)

    $ perf record -h -B -N

     Usage: perf record [<options>] [<command>]
        or: perf record [<options>] -- <command> [<options>]

        -B, --no-buildid       do not collect buildids in perf.data
        -N, --no-buildid-cache do not update the buildid cache

    $

Infrastructure changes:

  - Move code for options parsing and subcommand handling from tools/perf/
    to tools/lib/subcmd/, so that it can be used by other tools/ living
    utilities (Josh Poimboeuf)

Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
parents 0d76ded5 1843b4e0
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@ endif

feature_check = $(eval $(feature_check_code))
define feature_check_code
  feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) CFLAGS="$(EXTRA_CFLAGS) $(FEATURE_CHECK_CFLAGS-$(1))" LDFLAGS="$(LDFLAGS) $(FEATURE_CHECK_LDFLAGS-$(1))" -C $(feature_dir) test-$1.bin >/dev/null 2>/dev/null && echo 1 || echo 0)
  feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) CFLAGS="$(EXTRA_CFLAGS) $(FEATURE_CHECK_CFLAGS-$(1))" LDFLAGS="$(LDFLAGS) $(FEATURE_CHECK_LDFLAGS-$(1))" -C $(feature_dir) $(OUTPUT_FEATURES)test-$1.bin >/dev/null 2>/dev/null && echo 1 || echo 0)
endef

feature_set = $(eval $(feature_set_code))
@@ -101,7 +101,6 @@ ifeq ($(feature-all), 1)
  #
  $(foreach feat,$(FEATURE_TESTS),$(call feature_set,$(feat)))
else
  $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) CFLAGS="$(EXTRA_CFLAGS)" LDFLAGS=$(LDFLAGS) -i -j -C $(feature_dir) $(addsuffix .bin,$(FEATURE_TESTS)) >/dev/null 2>&1)
  $(foreach feat,$(FEATURE_TESTS),$(call feature_check,$(feat)))
endif

+47 −46
Original line number Diff line number Diff line

FILES=					\
	test-all.bin			\
	test-backtrace.bin		\
@@ -38,38 +37,40 @@ FILES= \
	test-bpf.bin			\
	test-get_cpuid.bin

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

CC := $(CROSS_COMPILE)gcc -MD
PKG_CONFIG := $(CROSS_COMPILE)pkg-config

all: $(FILES)

__BUILD = $(CC) $(CFLAGS) -Wall -Werror -o $(OUTPUT)$@ $(patsubst %.bin,%.c,$@) $(LDFLAGS)
  BUILD = $(__BUILD) > $(OUTPUT)$(@:.bin=.make.output) 2>&1
__BUILD = $(CC) $(CFLAGS) -Wall -Werror -o $@ $(patsubst %.bin,%.c,$(@F)) $(LDFLAGS)
  BUILD = $(__BUILD) > $(@:.bin=.make.output) 2>&1

###############################

test-all.bin:
$(OUTPUT)test-all.bin:
	$(BUILD) -fstack-protector-all -O2 -D_FORTIFY_SOURCE=2 -ldw -lelf -lnuma -lelf -laudit -I/usr/include/slang -lslang $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null) $(FLAGS_PERL_EMBED) $(FLAGS_PYTHON_EMBED) -DPACKAGE='"perf"' -lbfd -ldl -lz -llzma

test-hello.bin:
$(OUTPUT)test-hello.bin:
	$(BUILD)

test-pthread-attr-setaffinity-np.bin:
$(OUTPUT)test-pthread-attr-setaffinity-np.bin:
	$(BUILD) -D_GNU_SOURCE -lpthread

test-stackprotector-all.bin:
$(OUTPUT)test-stackprotector-all.bin:
	$(BUILD) -fstack-protector-all

test-fortify-source.bin:
$(OUTPUT)test-fortify-source.bin:
	$(BUILD) -O2 -D_FORTIFY_SOURCE=2

test-bionic.bin:
$(OUTPUT)test-bionic.bin:
	$(BUILD)

test-libelf.bin:
$(OUTPUT)test-libelf.bin:
	$(BUILD) -lelf

test-glibc.bin:
$(OUTPUT)test-glibc.bin:
	$(BUILD)

DWARFLIBS := -ldw
@@ -77,37 +78,37 @@ ifeq ($(findstring -static,${LDFLAGS}),-static)
DWARFLIBS += -lelf -lebl -lz -llzma -lbz2
endif

test-dwarf.bin:
$(OUTPUT)test-dwarf.bin:
	$(BUILD) $(DWARFLIBS)

test-libelf-mmap.bin:
$(OUTPUT)test-libelf-mmap.bin:
	$(BUILD) -lelf

test-libelf-getphdrnum.bin:
$(OUTPUT)test-libelf-getphdrnum.bin:
	$(BUILD) -lelf

test-libnuma.bin:
$(OUTPUT)test-libnuma.bin:
	$(BUILD) -lnuma

test-numa_num_possible_cpus.bin:
$(OUTPUT)test-numa_num_possible_cpus.bin:
	$(BUILD) -lnuma

test-libunwind.bin:
$(OUTPUT)test-libunwind.bin:
	$(BUILD) -lelf

test-libunwind-debug-frame.bin:
$(OUTPUT)test-libunwind-debug-frame.bin:
	$(BUILD) -lelf

test-libaudit.bin:
$(OUTPUT)test-libaudit.bin:
	$(BUILD) -laudit

test-libslang.bin:
$(OUTPUT)test-libslang.bin:
	$(BUILD) -I/usr/include/slang -lslang

test-gtk2.bin:
$(OUTPUT)test-gtk2.bin:
	$(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null)

test-gtk2-infobar.bin:
$(OUTPUT)test-gtk2-infobar.bin:
	$(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null)

grep-libs  = $(filter -l%,$(1))
@@ -119,63 +120,63 @@ PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS))
PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null`
FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)

test-libperl.bin:
$(OUTPUT)test-libperl.bin:
	$(BUILD) $(FLAGS_PERL_EMBED)

test-libpython.bin:
$(OUTPUT)test-libpython.bin:
	$(BUILD)

test-libpython-version.bin:
$(OUTPUT)test-libpython-version.bin:
	$(BUILD)

test-libbfd.bin:
$(OUTPUT)test-libbfd.bin:
	$(BUILD) -DPACKAGE='"perf"' -lbfd -lz -liberty -ldl

test-liberty.bin:
	$(CC) $(CFLAGS) -Wall -Werror -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' $(LDFLAGS) -lbfd -ldl -liberty
$(OUTPUT)test-liberty.bin:
	$(CC) $(CFLAGS) -Wall -Werror -o $@ test-libbfd.c -DPACKAGE='"perf"' $(LDFLAGS) -lbfd -ldl -liberty

test-liberty-z.bin:
	$(CC) $(CFLAGS) -Wall -Werror -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' $(LDFLAGS) -lbfd -ldl -liberty -lz
$(OUTPUT)test-liberty-z.bin:
	$(CC) $(CFLAGS) -Wall -Werror -o $@ test-libbfd.c -DPACKAGE='"perf"' $(LDFLAGS) -lbfd -ldl -liberty -lz

test-cplus-demangle.bin:
$(OUTPUT)test-cplus-demangle.bin:
	$(BUILD) -liberty

test-backtrace.bin:
$(OUTPUT)test-backtrace.bin:
	$(BUILD)

test-timerfd.bin:
$(OUTPUT)test-timerfd.bin:
	$(BUILD)

test-libdw-dwarf-unwind.bin:
$(OUTPUT)test-libdw-dwarf-unwind.bin:
	$(BUILD) # -ldw provided by $(FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind)

test-libbabeltrace.bin:
$(OUTPUT)test-libbabeltrace.bin:
	$(BUILD) # -lbabeltrace provided by $(FEATURE_CHECK_LDFLAGS-libbabeltrace)

test-sync-compare-and-swap.bin:
$(OUTPUT)test-sync-compare-and-swap.bin:
	$(BUILD)

test-compile-32.bin:
	$(CC) -m32 -o $(OUTPUT)$@ test-compile.c
$(OUTPUT)test-compile-32.bin:
	$(CC) -m32 -o $@ test-compile.c

test-compile-x32.bin:
	$(CC) -mx32 -o $(OUTPUT)$@ test-compile.c
$(OUTPUT)test-compile-x32.bin:
	$(CC) -mx32 -o $@ test-compile.c

test-zlib.bin:
$(OUTPUT)test-zlib.bin:
	$(BUILD) -lz

test-lzma.bin:
$(OUTPUT)test-lzma.bin:
	$(BUILD) -llzma

test-get_cpuid.bin:
$(OUTPUT)test-get_cpuid.bin:
	$(BUILD)

test-bpf.bin:
$(OUTPUT)test-bpf.bin:
	$(BUILD)

-include *.d
-include $(OUTPUT)*.d

###############################

clean:
	rm -f $(FILES) *.d $(FILES:.bin=.make.output)
	rm -f $(FILES) $(OUTPUT)*.d $(FILES:.bin=.make.output)
+4 −0
Original line number Diff line number Diff line
@@ -8,4 +8,8 @@ void *memdup(const void *src, size_t len);

int strtobool(const char *s, bool *res);

#ifndef __UCLIBC__
extern size_t strlcpy(char *dest, const char *src, size_t size);
#endif

#endif /* _LINUX_STRING_H_ */
+27 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@
#include <string.h>
#include <errno.h>
#include <linux/string.h>
#include <linux/compiler.h>

/**
 * memdup - duplicate region of memory
@@ -60,3 +61,29 @@ int strtobool(const char *s, bool *res)
	}
	return 0;
}

/**
 * strlcpy - Copy a C-string into a sized buffer
 * @dest: Where to copy the string to
 * @src: Where to copy the string from
 * @size: size of destination buffer
 *
 * Compatible with *BSD: the result is always a valid
 * NUL-terminated string that fits in the buffer (unless,
 * of course, the buffer size is zero). It does not pad
 * out the result like strncpy() does.
 *
 * If libc has strlcpy() then that version will override this
 * implementation:
 */
size_t __weak strlcpy(char *dest, const char *src, size_t size)
{
	size_t ret = strlen(src);

	if (size) {
		size_t len = (ret >= size) ? size - 1 : ret;
		memcpy(dest, src, len);
		dest[len] = '\0';
	}
	return ret;
}

tools/lib/subcmd/Build

0 → 100644
+7 −0
Original line number Diff line number Diff line
libsubcmd-y += exec-cmd.o
libsubcmd-y += help.o
libsubcmd-y += pager.o
libsubcmd-y += parse-options.o
libsubcmd-y += run-command.o
libsubcmd-y += sigchain.o
libsubcmd-y += subcmd-config.o
Loading