tools/perf: Speed up the build system
cover tools/perf: Speed up the build system
This series improves various aspects of the tools/perf build system.
The biggest change is the rewrite of the feature detection framework and a conversion of all feature testcases to the new method. The new feature detection machinery relies on three new methods:
- split-out, independent testcases that allow "make -j" parallel builds [ the old build system built the 20+ testcases serially, greatly slowing down the build. ]
- dependency auto-generation via gcc's -MD feature, which allows the 'caching' of testcases.
- a 'test-all' testcase that contains all the other testcases and allows a fast check for the typical 'all dependencies are installed' case.
The series also includes a number of fixes and convenience features:
- auto-detect the number of CPUs on the system and add the -j<cpus> option automatically
- Fix 'make O=/some/dir/ perf.o' type of rules to work in the $(OUTPUT) directory
- Improve documentation builds/install to not require feature-detection
- speed up linking, eliminate spurious rebuilds
Altogether build speed on my testsystem improved by a factor of 2.1x:
[BEFORE]
$ cd tools/perf
$ time make -j12 install
... real 0m27.522s
user 1m59.478s
sys 0m9.714s[AFTER]
$ cd tools/perf
$ time make install
... real 0m12.658s
user 1m39.507s
sys 0m7.706sRe-build speed, which is important to perf developers, increased 5.0x:
[BEFORE]
$ touch perf.c
$ time make
... real 0m9.368s
user 0m8.166s
sys 0m1.015s[AFTER]
$ touch perf.c
$ time make
BUILD: Doing 'make -j12' parallel build
CC perf.o
LINK perf real 0m1.857s
user 0m1.522s
sys 0m0.295sEmpty build speed of 'make' in an already built tree - often done by developers to see whether they are testing the latest binary, increased more than 50-fold:
[BEFORE]
$ time make
... real 0m9.105s
user 0m7.975s
sys 0m0.949s[AFTER]
$ time make
$ time make
BUILD: Doing 'make -j12' parallel build real 0m0.172s
user 0m0.119s
sys 0m0.029sThanks,
Ingo
=============>
Ingo Molnar (50):
tools/perf: Standardize feature support define names to: HAVE_{FEATURE}_SUPPORT tools/perf/build: Add feature check core code
tools/perf/build: Add 'autodep' functionality, generate feature test dependencies automatically tools/perf/build: Split out feature check: 'libnuma'
tools/perf/build: Split out feature check: 'stackprotector-all' tools/perf/build: Split out feature check: 'stackprotector'
tools/perf/build: Split out feature check: 'volatile-register-var' tools/perf/build: Split out feature check: 'fortify-source'
tools/perf/build: Split out feature check: 'bionic'
tools/perf/build: Clean up the libelf logic in config/Makefile tools/perf/build: Split out feature check: 'libelf'
tools/perf/build: Split out feature check: 'glibc'
tools/perf/build: Split out feature check: 'dwarf'
tools/perf/build: Clean up the mmap logic in config/Makefile
tools/perf/build: Split out feature check: 'libelf-mmap'
tools/perf/build: Split out feature check: 'libelf-getphdrnum' tools/perf/build: Clean up the libunwind logic in config/Makefile tools/perf/build: Split out feature check: 'libunwind'
tools/perf/build: Split out feature check: 'libaudit'
tools/perf/build: Split out feature check: 'libslang'
tools/perf/build: Split out feature check: 'gtk2'
tools/perf/build: Split out feature check: 'gtk2-infobar'
tools/perf/build: Split out feature check: 'libperl'
tools/perf/build: Split out feature check: 'libpython'
tools/perf/build: Split out feature check: 'libpython-version' tools/perf/build: Split out feature check: 'libbfd'
tools/perf/build: Split out feature check: 'on-exit'
tools/perf/build: Split out feature check: 'backtrace'
tools/perf: Clean up util/include/linux/compiler.h
tools/perf: Turn strlcpy() into a __weak function
tools/perf/build: Speed up auto-detection of features by adding a 'test-all' target tools/perf/build: Speed up git-version test on re-make
tools/perf/build: Speed up the final link
tools/perf: Fix double/triple-build of the feature detection logic during 'make install' et al tools/perf/build: Invoke feature-checks 'clean' target from the main Makefile tools/perf/build: Speed up auto-detection
tools/perf/build: Improve printout-of auto-detected features
tools/perf/build: Automatically build in parallel, based on number of CPUs in the system tools/perf/build: Flip Makefile.parallel and Makefile.perf
tools/perf/build: Standardize the various messages output by parallel make tools/perf/build: Split out feature checks: 'liberty', 'liberty-z', 'cplus-demangle' tools/perf/build: Remove unused config/feature-tests.mak
tools/perf/build: Clean up various testcases
tools/perf/build: Collapse the test-all.c testcase
tools/perf/build: Pass through all targets to Makefile.perf
tools/perf/build: Make sure autodep feature binaries honor the O= setting tools/perf/build: Exclude MAKEFLAGS from nested invocation
tools/perf/build: Fix non-canonical directory names in O=
tools/perf/build: Fix O=/some/dir perf.o type of targets
tools/perf/build: Harmonize the style of the feature testcases
tools/perf/Documentation/Makefile | 19 +- tools/perf/Makefile | 840 ++--------------------------- tools/perf/Makefile.perf | 855 ++++++++++++++++++++++++++++++ tools/perf/arch/x86/include/perf_regs.h | 6 +- tools/perf/arch/x86/util/unwind.c | 4 +- tools/perf/bench/mem-memcpy-arch.h | 2 +- tools/perf/bench/mem-memcpy.c | 2 +- tools/perf/bench/mem-memset-arch.h | 2 +- tools/perf/bench/mem-memset.c | 2 +- tools/perf/builtin-bench.c | 4 +- tools/perf/builtin-inject.c | 2 +- tools/perf/builtin-probe.c | 14 +- tools/perf/builtin-record.c | 12 +- tools/perf/config/Makefile | 326 +++++++----- tools/perf/config/feature-checks/Makefile | 148 ++++++ tools/perf/config/feature-checks/test-all.c | 106 ++++ tools/perf/config/feature-checks/test-backtrace.c | 13 + tools/perf/config/feature-checks/test-bionic.c | 6 + tools/perf/config/feature-checks/test-cplus-demangle.c | 14 + tools/perf/config/feature-checks/test-dwarf.c | 10 + tools/perf/config/feature-checks/test-fortify-source.c | 6 + tools/perf/config/feature-checks/test-glibc.c | 8 + tools/perf/config/feature-checks/test-gtk2-infobar.c | 11 + tools/perf/config/feature-checks/test-gtk2.c | 10 + tools/perf/config/feature-checks/test-hello.c | 6 + tools/perf/config/feature-checks/test-libaudit.c | 10 + tools/perf/config/feature-checks/test-libbfd.c | 15 + tools/perf/config/feature-checks/test-libelf-getphdrnum.c | 8 + tools/perf/config/feature-checks/test-libelf-mmap.c | 8 + tools/perf/config/feature-checks/test-libelf.c | 8 + tools/perf/config/feature-checks/test-libnuma.c | 9 + tools/perf/config/feature-checks/test-libperl.c | 9 + tools/perf/config/feature-checks/test-libpython-version.c | 10 + tools/perf/config/feature-checks/test-libpython.c | 8 + tools/perf/config/feature-checks/test-libslang.c | 6 + tools/perf/config/feature-checks/test-libunwind.c | 27 + tools/perf/config/feature-checks/test-on-exit.c | 15 + tools/perf/config/feature-checks/test-stackprotector-all.c | 6 + tools/perf/config/feature-checks/test-stackprotector.c | 6 + tools/perf/config/feature-checks/test-volatile-register-var.c | 6 + tools/perf/config/feature-tests.mak | 246 --------- tools/perf/config/utilities.mak | 14 - tools/perf/perf.c | 4 +- tools/perf/ui/gtk/browser.c | 2 +- tools/perf/ui/gtk/gtk.h | 4 +- tools/perf/ui/gtk/util.c | 4 +- tools/perf/ui/ui.h | 4 +- tools/perf/util/annotate.h | 4 +- tools/perf/util/cache.h | 3 +- tools/perf/util/generate-cmdlist.sh | 4 +- tools/perf/util/hist.h | 4 +- tools/perf/util/include/dwarf-regs.h | 2 +- tools/perf/util/include/linux/compiler.h | 19 +- tools/perf/util/map.c | 2 +- tools/perf/util/path.c | 10 +- tools/perf/util/perf_regs.h | 4 +- tools/perf/util/probe-event.c | 4 +- tools/perf/util/probe-finder.h | 4 +- tools/perf/util/symbol-elf.c | 2 +- tools/perf/util/symbol.h | 8 +- tools/perf/util/unwind.h | 4 +- tools/perf/util/util.c | 4 +- 62 files changed, 1678 insertions(+), 1257 deletions(-) create mode 100644 tools/perf/Makefile.perf create mode 100644 tools/perf/config/feature-checks/Makefile create mode 100644 tools/perf/config/feature-checks/test-all.c create mode 100644 tools/perf/config/feature-checks/test-backtrace.c create mode 100644 tools/perf/config/feature-checks/test-bionic.c create mode 100644 tools/perf/config/feature-checks/test-cplus-demangle.c create mode 100644 tools/perf/config/feature-checks/test-dwarf.c create mode 100644 tools/perf/config/feature-checks/test-fortify-source.c create mode 100644 tools/perf/config/feature-checks/test-glibc.c create mode 100644 tools/perf/config/feature-checks/test-gtk2-infobar.c create mode 100644 tools/perf/config/feature-checks/test-gtk2.c create mode 100644 tools/perf/config/feature-checks/test-hello.c create mode 100644 tools/perf/config/feature-checks/test-libaudit.c create mode 100644 tools/perf/config/feature-checks/test-libbfd.c create mode 100644 tools/perf/config/feature-checks/test-libelf-getphdrnum.c create mode 100644 tools/perf/config/feature-checks/test-libelf-mmap.c create mode 100644 tools/perf/config/feature-checks/test-libelf.c create mode 100644 tools/perf/config/feature-checks/test-libnuma.c create mode 100644 tools/perf/config/feature-checks/test-libperl.c create mode 100644 tools/perf/config/feature-checks/test-libpython-version.c create mode 100644 tools/perf/config/feature-checks/test-libpython.c create mode 100644 tools/perf/config/feature-checks/test-libslang.c create mode 100644 tools/perf/config/feature-checks/test-libunwind.c create mode 100644 tools/perf/config/feature-checks/test-on-exit.c create mode 100644 tools/perf/config/feature-checks/test-stackprotector-all.c create mode 100644 tools/perf/config/feature-checks/test-stackprotector.c create mode 100644 tools/perf/config/feature-checks/test-volatile-register-var.c delete mode 100644 tools/perf/config/feature-tests.mak
Signature · 1 line
1.7.11.7
PATCH 1/50 tools/perf: Standardize feature support define names to: HAVE_{FEATURE}_SUPPORT
Standardize all the feature flags based on the HAVE_{FEATURE}_SUPPORT naming convention:
HAVE_ARCH_X86_64_SUPPORT HAVE_BACKTRACE_SUPPORT HAVE_CPLUS_DEMANGLE_SUPPORT HAVE_DWARF_SUPPORT HAVE_ELF_GETPHDRNUM_SUPPORT HAVE_GTK2_SUPPORT HAVE_GTK_INFO_BAR_SUPPORT HAVE_LIBAUDIT_SUPPORT HAVE_LIBELF_MMAP_SUPPORT HAVE_LIBELF_SUPPORT HAVE_LIBNUMA_SUPPORT HAVE_LIBUNWIND_SUPPORT HAVE_ON_EXIT_SUPPORT HAVE_PERF_REGS_SUPPORT HAVE_SLANG_SUPPORT HAVE_STRLCPY_SUPPORT
--- tools/perf/arch/x86/include/perf_regs.h | 6 +++--- tools/perf/arch/x86/util/unwind.c | 4 ++-- tools/perf/bench/mem-memcpy-arch.h | 2 +- tools/perf/bench/mem-memcpy.c | 2 +- tools/perf/bench/mem-memset-arch.h | 2 +- tools/perf/bench/mem-memset.c | 2 +- tools/perf/builtin-bench.c | 4 ++-- tools/perf/builtin-inject.c | 2 +- tools/perf/builtin-probe.c | 14 +++++++------- tools/perf/builtin-record.c | 12 ++++++------ tools/perf/config/Makefile | 54 ++++++++++++++++++++++++++--------------------------- tools/perf/perf.c | 4 ++-- tools/perf/ui/gtk/browser.c | 2 +- tools/perf/ui/gtk/gtk.h | 4 ++-- tools/perf/ui/gtk/util.c | 4 ++-- tools/perf/ui/ui.h | 4 ++-- tools/perf/util/annotate.h | 4 ++-- tools/perf/util/cache.h | 2 +- tools/perf/util/generate-cmdlist.sh | 4 ++-- tools/perf/util/hist.h | 4 ++-- tools/perf/util/include/dwarf-regs.h | 2 +- tools/perf/util/map.c | 2 +- tools/perf/util/path.c | 2 +- tools/perf/util/perf_regs.h | 4 ++-- tools/perf/util/probe-event.c | 4 ++-- tools/perf/util/probe-finder.h | 4 ++-- tools/perf/util/symbol-elf.c | 2 +- tools/perf/util/symbol.h | 8 ++++---- tools/perf/util/unwind.h | 4 ++-- tools/perf/util/util.c | 4 ++-- 30 files changed, 86 insertions(+), 86 deletions(-)
tools/perf/arch/x86/include/perf_regs.h +3 -3
@@ -5,7 +5,7 @@#include "../../util/types.h" #include <asm/perf_regs.h> -#ifndef ARCH_X86_64 +#ifndef HAVE_ARCH_X86_64_SUPPORT #define PERF_REGS_MASK ((1ULL << PERF_REG_X86_32_MAX) - 1)#else #define REG_NOSUPPORT ((1ULL << PERF_REG_X86_DS) | \
@@ -52,7 +52,7 @@ static inline const char *perf_reg_name(int id)return "FS" ;case PERF_REG_X86_GS :return "GS" ; -#ifdef ARCH_X86_64 +#ifdef HAVE_ARCH_X86_64_SUPPORT case PERF_REG_X86_R8 :return "R8" ;case PERF_REG_X86_R9 :
@@ -69,7 +69,7 @@ static inline const char *perf_reg_name(int id)return "R14" ;case PERF_REG_X86_R15 :return "R15" ; -#endif /* ARCH_X86_64 */ +#endif /* HAVE_ARCH_X86_64_SUPPORT */ default :return NULL ; }
tools/perf/arch/x86/util/unwind.c +2 -2
@@ -4,7 +4,7 @@#include "perf_regs.h" #include "../../util/unwind.h" -#ifdef ARCH_X86_64 +#ifdef HAVE_ARCH_X86_64_SUPPORT int unwind__arch_reg_id (int regnum) {int id;
@@ -108,4 +108,4 @@ int unwind__arch_reg_id(int regnum) return id; } -#endif /* ARCH_X86_64 */ +#endif /* HAVE_ARCH_X86_64_SUPPORT */
tools/perf/bench/mem-memcpy-arch.h +1 -1
@@ -1,5 +1,5 @@ -#ifdef ARCH_X86_64 +#ifdef HAVE_ARCH_X86_64_SUPPORT #define MEMCPY_FN (fn, name, desc) \ extern void *fn(void *, const void *, size_t);
tools/perf/bench/mem-memcpy.c +1 -1
@@ -58,7 +58,7 @@ struct routine routines[] = { {"default" ,"Default memcpy() provided by glibc" , memcpy }, -#ifdef ARCH_X86_64 +#ifdef HAVE_ARCH_X86_64_SUPPORT #define MEMCPY_FN(fn, name, desc) { name, desc, fn }, #include "mem-memcpy-x86-64-asm-def.h"
tools/perf/bench/mem-memset-arch.h +1 -1
@@ -1,5 +1,5 @@ -#ifdef ARCH_X86_64 +#ifdef HAVE_ARCH_X86_64_SUPPORT #define MEMSET_FN (fn, name, desc) \ extern void *fn(void *, int, size_t);
tools/perf/bench/mem-memset.c +1 -1
@@ -58,7 +58,7 @@ static const struct routine routines[] = { {"default" ,"Default memset() provided by glibc" , memset }, -#ifdef ARCH_X86_64 +#ifdef HAVE_ARCH_X86_64_SUPPORT #define MEMSET_FN(fn, name, desc) { name, desc, fn }, #include "mem-memset-x86-64-asm-def.h"
tools/perf/builtin-bench.c +2 -2
@@ -35,7 +35,7 @@ struct bench_suite {/* sentinel: easy for help */ #define suite_all { "all", "Test all benchmark suites", NULL } -#ifdef LIBNUMA_SUPPORT +#ifdef HAVE_LIBNUMA_SUPPORT static struct bench_suite numa_suites[] = { { "mem", "Benchmark for NUMA workloads",
@@ -80,7 +80,7 @@ struct bench_subsys { }; static struct bench_subsys subsystems[] = { -#ifdef LIBNUMA_SUPPORT +#ifdef HAVE_LIBNUMA_SUPPORT {"numa" ,"NUMA scheduling and MM behavior" , numa_suites },
tools/perf/builtin-inject.c +1 -1
@@ -231,7 +231,7 @@ static int perf_event__inject_buildid(struct perf_tool *tool,* account this as unresolved. */ }else { -#ifdef LIBELF_SUPPORT +#ifdef HAVE_LIBELF_SUPPORT pr_warning ("no symbols found in %s, maybe " "install a debug package?\n" , al.map->dso->long_name);
tools/perf/builtin-probe.c +7 -7
@@ -173,7 +173,7 @@ static int opt_set_target(const struct option *opt, const char *str,if (str && !params.target) {if (!strcmp (opt->long_name,"exec" )) params.uprobes = true; -#ifdef DWARF_SUPPORT +#ifdef HAVE_DWARF_SUPPORT else if (!strcmp(opt->long_name, "module")) params.uprobes = false;#endif
@@ -187,7 +187,7 @@ static int opt_set_target(const struct option *opt, const char *str,return ret; } -#ifdef DWARF_SUPPORT +#ifdef HAVE_DWARF_SUPPORT static int opt_show_lines (const struct option *opt__maybe_unused ,const char *str,int unset__maybe_unused ) {
@@ -257,7 +257,7 @@ int cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused)"perf probe [<options>] --add 'PROBEDEF' [--add 'PROBEDEF' ...]" ,"perf probe [<options>] --del '[GROUP:]EVENT' ..." ,"perf probe --list" , -#ifdef DWARF_SUPPORT +#ifdef HAVE_DWARF_SUPPORT"perf probe [<options>] --line 'LINEDESC'" , "perf probe [<options>] --vars 'PROBEPOINT'", #endif
@@ -271,7 +271,7 @@ int cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused)OPT_CALLBACK ('d' ,"del" ,NULL ,"[GROUP:]EVENT" ,"delete a probe event." , opt_del_probe_event), OPT_CALLBACK('a', "add", NULL, -#ifdef DWARF_SUPPORT +#ifdef HAVE_DWARF_SUPPORT "[EVENT=]FUNC[@SRC][+OFF|%return|:RL|;PT]|SRC:AL|SRC;PT" " [[NAME=]ARG ...]", #else
@@ -283,7 +283,7 @@ int cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused)"\t\tFUNC:\tFunction name\n" "\t\tOFF:\tOffset from function entry (in byte)\n" "\t\t%return:\tPut the probe at function return\n" -#ifdef DWARF_SUPPORT +#ifdef HAVE_DWARF_SUPPORT"\t\tSRC:\tSource code path\n" "\t\tRL:\tRelative line number from function entry.\n" "\t\tAL:\tAbsolute line number in file.\n"
@@ -296,7 +296,7 @@ int cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused) opt_add_probe_event),OPT_BOOLEAN ('f' ,"force" , ¶ms.force_add,"forcibly add events" " with existing name" ), -#ifdef DWARF_SUPPORT +#ifdef HAVE_DWARF_SUPPORTOPT_CALLBACK ('L' ,"line" ,NULL ,"FUNC[:RLN[+NUM|-RLN2]]|SRC:ALN[+NUM|-ALN2]" , "Show source code lines.", opt_show_lines),
@@ -408,7 +408,7 @@ int cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused)return ret; } -#ifdef DWARF_SUPPORT +#ifdef HAVE_DWARF_SUPPORT if (params.show_lines && !params.uprobes) {if (params.mod_events) { pr_err(" Error: Don't use --line with"
tools/perf/builtin-record.c +6 -6
@@ -29,7 +29,7 @@#include <sched.h> #include <sys/mman.h> -#ifndef HAVE_ON_EXIT +#ifndef HAVE_ON_EXIT_SUPPORT #ifndef ATEXIT_MAX #define ATEXIT_MAX 32#endif
@@ -687,7 +687,7 @@ error:return ret; } -#ifdef LIBUNWIND_SUPPORT +#ifdef HAVE_LIBUNWIND_SUPPORT static int get_stack_size (char *str,unsigned long *_size) {char *endptr;
@@ -713,7 +713,7 @@ static int get_stack_size(char *str, unsigned long *_size) max_size, str); return -1; } -#endif /* LIBUNWIND_SUPPORT */ +#endif /* HAVE_LIBUNWIND_SUPPORT */ int record_parse_callchain_opt (const struct option *opt,const char *arg,int unset)
@@ -751,7 +751,7 @@ int record_parse_callchain_opt(const struct option *opt, "needed for -g fp\n");break ; -#ifdef LIBUNWIND_SUPPORT +#ifdef HAVE_LIBUNWIND_SUPPORT /* Dwarf style */ }else if (!strncmp (name,"dwarf" ,sizeof ("dwarf" ))) {const unsigned long default_stack_dump_size =8192 ;
@@ -771,7 +771,7 @@ int record_parse_callchain_opt(const struct option *opt,if (!ret)pr_debug ("callchain: stack dump size %d\n" , opts->stack_dump_size); -#endif /* LIBUNWIND_SUPPORT */ +#endif /* HAVE_LIBUNWIND_SUPPORT */ }else {pr_err ("callchain: Unknown -g option " "value: %s\n" , arg);
@@ -818,7 +818,7 @@ static struct perf_record record = {#define CALLCHAIN_HELP "do call-graph (stack chain/backtrace) recording: " -#ifdef LIBUNWIND_SUPPORT +#ifdef HAVE_LIBUNWIND_SUPPORT const char record_callchain_help[] =CALLCHAIN_HELP "[fp] dwarf" ;#else const char record_callchain_help[] =CALLCHAIN_HELP "[fp]" ;
tools/perf/config/Makefile +27 -27
145 lines not on this page · raw message
tools/perf/perf.c +2 -2
@@ -49,14 +49,14 @@ static struct cmd_struct commands[] = { { "version", cmd_version, 0 }, { "script", cmd_script, 0 }, { "sched", cmd_sched, 0 }, -#ifdef LIBELF_SUPPORT +#ifdef HAVE_LIBELF_SUPPORT { "probe", cmd_probe, 0 }, #endif { "kmem", cmd_kmem, 0 }, { "lock", cmd_lock, 0 }, { "kvm", cmd_kvm, 0 }, { "test", cmd_test, 0 }, -#ifdef LIBAUDIT_SUPPORT +#ifdef HAVE_LIBAUDIT_SUPPORT { "trace", cmd_trace, 0 }, #endif { "inject", cmd_inject, 0 },
tools/perf/ui/gtk/browser.c +1 -1
@@ -43,7 +43,7 @@ const char *perf_gtk__get_percent_color(double percent)return NULL ; } -#ifdef HAVE_GTK_INFO_BAR +#ifdef HAVE_GTK_INFO_BAR_SUPPORT GtkWidget *perf_gtk__setup_info_bar (void ) {GtkWidget *info_bar;
tools/perf/ui/gtk/gtk.h +2 -2
@@ -12,7 +12,7 @@ struct perf_gtk_context {GtkWidget *main_window;GtkWidget *notebook; -#ifdef HAVE_GTK_INFO_BAR +#ifdef HAVE_GTK_INFO_BAR_SUPPORT GtkWidget *info_bar;GtkWidget *message_label;#endif
@@ -39,7 +39,7 @@ void perf_gtk__resize_window(GtkWidget *window);const char *perf_gtk__get_percent_color (double percent);GtkWidget *perf_gtk__setup_statusbar (void ); -#ifdef HAVE_GTK_INFO_BAR +#ifdef HAVE_GTK_INFO_BAR_SUPPORT GtkWidget *perf_gtk__setup_info_bar (void );#else static inline GtkWidget *perf_gtk__setup_info_bar (void )
tools/perf/ui/gtk/util.c +2 -2
@@ -53,7 +53,7 @@ static int perf_gtk__error(const char *format, va_list args)return 0 ; } -#ifdef HAVE_GTK_INFO_BAR +#ifdef HAVE_GTK_INFO_BAR_SUPPORT static int perf_gtk__warning_info_bar (const char *format,va_list args) {char *msg;
@@ -105,7 +105,7 @@ static int perf_gtk__warning_statusbar(const char *format, va_list args)struct perf_error_ops perf_gtk_eops = { .error = perf_gtk__error, -#ifdef HAVE_GTK_INFO_BAR +#ifdef HAVE_GTK_INFO_BAR_SUPPORT .warning = perf_gtk__warning_info_bar, #else .warning = perf_gtk__warning_statusbar,
tools/perf/ui/ui.h +2 -2
@@ -12,7 +12,7 @@ extern int use_browser;void setup_browser (bool fallback_to_pager);void exit_browser (bool wait_for_ok); -#ifdef SLANG_SUPPORT +#ifdef HAVE_SLANG_SUPPORT int ui__init (void );void ui__exit (bool wait_for_ok);#else
@@ -23,7 +23,7 @@ static inline int ui__init(void)static inline void ui__exit (bool wait_for_ok__maybe_unused ) {}#endif -#ifdef GTK2_SUPPORT +#ifdef HAVE_GTK2_SUPPORT int perf_gtk__init (void );void perf_gtk__exit (bool wait_for_ok);#else
tools/perf/util/annotate.h +2 -2
@@ -150,7 +150,7 @@ int symbol__tty_annotate(struct symbol *sym, struct map *map, struct perf_evsel *evsel, bool print_lines, bool full_paths, int min_pcnt, int max_lines); -#ifdef SLANG_SUPPORT +#ifdef HAVE_SLANG_SUPPORT int symbol__tui_annotate (struct symbol *sym,struct map *map,struct perf_evsel *evsel,struct hist_browser_timer *hbt);
@@ -165,7 +165,7 @@ static inline int symbol__tui_annotate(struct symbol *sym __maybe_unused, }#endif -#ifdef GTK2_SUPPORT +#ifdef HAVE_GTK2_SUPPORT int symbol__gtk_annotate (struct symbol *sym,struct map *map,struct perf_evsel *evsel,struct hist_browser_timer *hbt);
tools/perf/util/cache.h +1 -1
@@ -70,7 +70,7 @@ extern char *perf_path(const char *fmt, ...) __attribute__((format (printf, 1, 2extern char *perf_pathdup (const char *fmt, ...) __attribute__((format (printf,1 ,2 ))); -#ifndef HAVE_STRLCPY +#ifndef HAVE_STRLCPY_SUPPORT extern size_t strlcpy (char *dest,const char *src,size_t size);#endif
tools/perf/util/generate-cmdlist.sh +2 -2
@@ -22,7 +22,7 @@ do }' "Documentation/perf-$cmd.txt" done -echo "#ifdef LIBELF_SUPPORT" +echo "#ifdef HAVE_LIBELF_SUPPORT" sed -n -e 's/^perf-\([^ ]*\)[ ].* full.*/\1/p' command-list.txt | sort | while read cmd
@@ -35,5 +35,5 @@ do p }' "Documentation/perf-$cmd.txt" done -echo "#endif /* LIBELF_SUPPORT */" +echo "#endif /* HAVE_LIBELF_SUPPORT */" echo "};"
tools/perf/util/hist.h +2 -2
@@ -187,7 +187,7 @@ struct hist_browser_timer {int refresh; }; -#ifdef SLANG_SUPPORT +#ifdef HAVE_SLANG_SUPPORT #include "../ui/keysyms.h" int hist_entry__tui_annotate (struct hist_entry *he,struct perf_evsel *evsel,struct hist_browser_timer *hbt);
@@ -228,7 +228,7 @@ static inline int script_browse(const char *script_opt __maybe_unused)#define K_SWITCH_INPUT_DATA -3000#endif -#ifdef GTK2_SUPPORT +#ifdef HAVE_GTK2_SUPPORT int perf_evlist__gtk_browse_hists (struct perf_evlist *evlist,const char *help,struct hist_browser_timer *hbt__maybe_unused ,float min_pcnt);
tools/perf/util/include/dwarf-regs.h +1 -1
@@ -1,7 +1,7 @@#ifndef _PERF_DWARF_REGS_H_#define _PERF_DWARF_REGS_H_ -#ifdef DWARF_SUPPORT +#ifdef HAVE_DWARF_SUPPORT const char *get_arch_regstr (unsigned int n);#endif
tools/perf/util/map.c +1 -1
@@ -172,7 +172,7 @@ int map__load(struct map *map, symbol_filter_t filter)pr_warning (", continuing without symbols\n" );return -1 ; }else if (nr ==0 ) { -#ifdef LIBELF_SUPPORT +#ifdef HAVE_LIBELF_SUPPORT const size_t len =strlen (name);const size_t real_len = len -sizeof (DSO__DELETED );
tools/perf/util/path.c +1 -1
@@ -22,7 +22,7 @@ static const char *get_perf_dir(void)return "." ; } -#ifndef HAVE_STRLCPY +#ifndef HAVE_STRLCPY_SUPPORT size_t strlcpy (char *dest,const char *src,size_t size) {size_t ret =strlen (src);
tools/perf/util/perf_regs.h +2 -2
@@ -1,7 +1,7 @@#ifndef __PERF_REGS_H#define __PERF_REGS_H -#ifdef HAVE_PERF_REGS +#ifdef HAVE_PERF_REGS_SUPPORT #include <perf_regs.h> #else #define PERF_REGS_MASK 0
@@ -10,5 +10,5 @@ static inline const char *perf_reg_name(int id __maybe_unused) {return NULL ; } -#endif /* HAVE_PERF_REGS */ +#endif /* HAVE_PERF_REGS_SUPPORT */ #endif /* __PERF_REGS_H */
tools/perf/util/probe-event.c +2 -2
@@ -201,7 +201,7 @@ static int convert_to_perf_probe_point(struct probe_trace_point *tp,return 0 ; } -#ifdef DWARF_SUPPORT +#ifdef HAVE_DWARF_SUPPORT /* Open new debuginfo of given module */ static struct debuginfo *open_debuginfo (const char *module) {
@@ -630,7 +630,7 @@ int show_available_vars(struct perf_probe_event *pevs, int npevs, return ret; } -#else /* !DWARF_SUPPORT */ +#else /* !HAVE_DWARF_SUPPORT */ static int kprobe_convert_to_perf_probe (struct probe_trace_point *tp,struct perf_probe_point *pp)
tools/perf/util/probe-finder.h +2 -2
@@ -14,7 +14,7 @@ static inline int is_c_varname(const char *name)return isalpha (name[0 ]) || name[0 ] =='_' ; } -#ifdef DWARF_SUPPORT +#ifdef HAVE_DWARF_SUPPORT #include "dwarf-aux.h"
@@ -105,6 +105,6 @@ struct line_finder {int found; }; -#endif /* DWARF_SUPPORT */ +#endif /* HAVE_DWARF_SUPPORT */ #endif /*_PROBE_FINDER_H */
tools/perf/util/symbol-elf.c +1 -1
@@ -8,7 +8,7 @@#include "symbol.h" #include "debug.h" -#ifndef HAVE_ELF_GETPHDRNUM +#ifndef HAVE_ELF_GETPHDRNUM_SUPPORT static int elf_getphdrnum (Elf *elf,size_t *dst) {GElf_Ehdr gehdr;
tools/perf/util/symbol.h +4 -4
@@ -13,7 +13,7 @@#include <libgen.h> #include "build-id.h" -#ifdef LIBELF_SUPPORT +#ifdef HAVE_LIBELF_SUPPORT #include <libelf.h> #include <gelf.h> #endif
@@ -21,7 +21,7 @@#include "dso.h" -#ifdef HAVE_CPLUS_DEMANGLE +#ifdef HAVE_CPLUS_DEMANGLE_SUPPORT extern char *cplus_demangle (const char *,int );static inline char *bfd_demangle (void __maybe_unused *v,const char *c,int i)
@@ -46,7 +46,7 @@ static inline char *bfd_demangle(void __maybe_unused *v,* libelf 0.8.x and earlier do not support ELF_C_READ_MMAP; * for newer versions we can use mmap to reduce memory usage: */ -#ifdef LIBELF_MMAP +#ifdef HAVE_LIBELF_MMAP_SUPPORT # define PERF_ELF_C_READ_MMAP ELF_C_READ_MMAP#else # define PERF_ELF_C_READ_MMAP ELF_C_READ
@@ -178,7 +178,7 @@ struct symsrc {int fd;enum dso_binary_type type; -#ifdef LIBELF_SUPPORT +#ifdef HAVE_LIBELF_SUPPORT Elf *elf;GElf_Ehdr ehdr;
tools/perf/util/unwind.h +2 -2
@@ -13,7 +13,7 @@ struct unwind_entry {typedef int (*unwind_entry_cb_t )(struct unwind_entry *entry,void *arg); -#ifdef LIBUNWIND_SUPPORT +#ifdef HAVE_LIBUNWIND_SUPPORT int unwind__get_entries(unwind_entry_cb_t cb, void *arg, struct machine *machine, struct thread *thread,
@@ -31,5 +31,5 @@ unwind__get_entries(unwind_entry_cb_t cb __maybe_unused, {return 0 ; } -#endif /* LIBUNWIND_SUPPORT */ +#endif /* HAVE_LIBUNWIND_SUPPORT */ #endif /* __UNWIND_H */
tools/perf/util/util.c +2 -2
@@ -1,7 +1,7 @@#include "../perf.h" #include "util.h" #include <sys/mman.h> -#ifdef BACKTRACE_SUPPORT +#ifdef HAVE_BACKTRACE_SUPPORT #include <execinfo.h> #endif #include <stdio.h>
@@ -204,7 +204,7 @@ int hex2u64(const char *ptr, u64 *long_val) }/* Obtain a backtrace and print it to stdout. */ -#ifdef BACKTRACE_SUPPORT +#ifdef HAVE_BACKTRACE_SUPPORT void dump_stack (void ) {void *array[16 ];
Signature · 1 line
1.7.11.7
PATCH 2/50 tools/perf/build: Add feature check core code
In reply to Ingo MolnarStart the split-out of the feature check code by adding a list of features to be tested, and rules to process that list by building its matching feature-check file in config/feature-checks/test-<feature>.c.
Add 'hello' as the initial feature.
This structure will allow us to build split-out feature checks in parallel and thus speed up feature detection dramatically.
No change in functionality: no feature check is used by the build rules yet.
--- tools/perf/config/Makefile | 16 ++++++++++++++++ tools/perf/config/feature-checks/Makefile | 16 ++++++++++++++++ tools/perf/config/feature-checks/test-hello.c | 6 ++++++ 3 files changed, 38 insertions(+)
tools/perf/config/Makefile +16 -0
@@ -89,6 +89,22 @@ CFLAGS += -std=gnu99 EXTLIBS = -lelf -lpthread -lrt -lm -ldl +feature_check = $(eval $(feature_check_code)); $(info CHK: config/feature-checks/test-$(1)) +define feature_check_code + feature-$(2) := $(shell make -C config/feature-checks test-$1 >/dev/null 2>/dev/null && echo 1 || echo 0) +endef + +# +# Build the feature check binaries in parallel, ignore errors, ignore return value and suppress output: +# +$(info Testing features:) +$(shell make -i -j -C config/feature-checks >/dev/null 2>&1) +$(info done) + +FEATURE_TESTS = hello + +$(foreach test,$(FEATURE_TESTS),$(call feature_check,$(test),$(test))) + ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -fstack-protector-all,-fstack-protector-all),y) CFLAGS += -fstack-protector-all endif
tools/perf/config/feature-checks/Makefile new file +16 -0
@@ -0,0 +1,16 @@ + +FILES=test-hello + +all: $(FILES) + +BUILD = $(CC) -o $(OUTPUT)$@ [email protected] + +############################### + +test-hello: test-hello.c + $(BUILD) + +############################### + +clean: + rm -f $(FILES)
tools/perf/config/feature-checks/test-hello.c new file +6 -0
@@ -0,0 +1,6 @@ +#include <stdio.h> + +int main (void ) +{ +return puts ("hi" ); +}
Signature · 1 line
1.7.11.7
PATCH 3/50 tools/perf/build: Add 'autodep' functionality, generate feature test dependencies automatically
In reply to Ingo MolnarUse GCC's -MD feature to generate a dependency file for each feature test .c file, and include that .d file in the config/feature-checks/Makefile.
This allows us to do two things:
- speed up feature tests
- detect removal or changes in build dependencies - including system libraries/headers
--- tools/perf/config/feature-checks/Makefile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
tools/perf/config/feature-checks/Makefile +6 -2
@@ -1,16 +1,20 @@ FILES=test-hello +CC := $(CC) -MD + all: $(FILES) BUILD = $(CC) -o $(OUTPUT)$@ [email protected] ############################### -test-hello: test-hello.c +test-hello: $(BUILD) +-include *.d */*.d + ############################### clean: - rm -f $(FILES) + rm -f $(FILES) *.d
Signature · 1 line
1.7.11.7
PATCH 4/50 tools/perf/build: Split out feature check: 'libnuma'
In reply to Ingo Molnar--- tools/perf/config/Makefile | 7 ++++--- tools/perf/config/feature-checks/Makefile | 7 ++++++- tools/perf/config/feature-checks/test-libnuma.c | 8 ++++++++ 3 files changed, 18 insertions(+), 4 deletions(-)
tools/perf/config/Makefile +4 -3
@@ -101,7 +101,9 @@ $(info Testing features:) $(shell make -i -j -C config/feature-checks >/dev/null 2>&1) $(info done) -FEATURE_TESTS = hello +FEATURE_TESTS = \ + hello \ + libnuma $(foreach test,$(FEATURE_TESTS),$(call feature_check,$(test),$(test)))
@@ -434,8 +436,7 @@ ifndef NO_BACKTRACE endif ifndef NO_LIBNUMA - FLAGS_LIBNUMA = $(CFLAGS) $(LDFLAGS) -lnuma - ifneq ($(call try-cc,$(SOURCE_LIBNUMA),$(FLAGS_LIBNUMA),libnuma),y) + ifeq ($(feature-libnuma), 0) msg := $(warning No numa.h found, disables 'perf bench numa mem' benchmark, please install numa-libs-devel or libnuma-dev); NO_LIBNUMA := 1 else
tools/perf/config/feature-checks/Makefile +6 -1
@@ -1,5 +1,7 @@ -FILES=test-hello +FILES= \ + test-hello \ + test-libnuma CC := $(CC) -MD
@@ -12,6 +14,9 @@ BUILD = $(CC) -o $(OUTPUT)$@ [email protected] test-hello: $(BUILD) +test-libnuma: + $(BUILD) -lnuma + -include *.d */*.d ###############################
tools/perf/config/feature-checks/test-libnuma.c new file +8 -0
@@ -0,0 +1,8 @@ +#include <numa.h> +#include <numaif.h> + +int main (void ) +{ +numa_available (); +return 0 ; +}
Signature · 1 line
1.7.11.7
PATCH 5/50 tools/perf/build: Split out feature check: 'stackprotector-all'
In reply to Ingo Molnar--- tools/perf/config/Makefile | 3 ++- tools/perf/config/feature-checks/Makefile | 4 ++++ tools/perf/config/feature-checks/test-stackprotector-all.c | 6 ++++++ 3 files changed, 12 insertions(+), 1 deletion(-)
tools/perf/config/Makefile +2 -1
@@ -103,11 +103,12 @@ $(info done) FEATURE_TESTS = \ hello \ + stackprotector-all \ libnuma $(foreach test,$(FEATURE_TESTS),$(call feature_check,$(test),$(test))) -ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -fstack-protector-all,-fstack-protector-all),y) +ifeq ($(stackprotector-all), 1) CFLAGS += -fstack-protector-all endif
tools/perf/config/feature-checks/Makefile +4 -0
@@ -1,6 +1,7 @@ FILES= \ test-hello \ + test-stackprotector-all \ test-libnuma CC := $(CC) -MD
@@ -14,6 +15,9 @@ BUILD = $(CC) -o $(OUTPUT)$@ [email protected] test-hello: $(BUILD) +test-stackprotector-all: + $(BUILD) -Werror -fstack-protector-all + test-libnuma: $(BUILD) -lnuma
tools/perf/config/feature-checks/test-stackprotector-all.c new file +6 -0
@@ -0,0 +1,6 @@ +#include <stdio.h> + +int main (void ) +{ +return puts ("hi" ); +}
Signature · 1 line
1.7.11.7
PATCH 6/50 tools/perf/build: Split out feature check: 'stackprotector'
In reply to Ingo Molnar--- tools/perf/config/Makefile | 3 ++- tools/perf/config/feature-checks/Makefile | 4 ++++ tools/perf/config/feature-checks/test-stackprotector.c | 6 ++++++ 3 files changed, 12 insertions(+), 1 deletion(-)
tools/perf/config/Makefile +2 -1
@@ -104,6 +104,7 @@ $(info done) FEATURE_TESTS = \ hello \ stackprotector-all \ + stackprotector \ libnuma $(foreach test,$(FEATURE_TESTS),$(call feature_check,$(test),$(test)))
@@ -112,7 +113,7 @@ ifeq ($(stackprotector-all), 1) CFLAGS += -fstack-protector-all endif -ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -Wstack-protector,-Wstack-protector),y) +ifeq ($(feature-stackprotector), 1) CFLAGS += -Wstack-protector endif
tools/perf/config/feature-checks/Makefile +4 -0
@@ -2,6 +2,7 @@ FILES= \ test-hello \ test-stackprotector-all \ + test-stackprotector \ test-libnuma CC := $(CC) -MD
@@ -18,6 +19,9 @@ test-hello: test-stackprotector-all: $(BUILD) -Werror -fstack-protector-all +test-stackprotector: + $(BUILD) -Werror -fstack-protector + test-libnuma: $(BUILD) -lnuma
tools/perf/config/feature-checks/test-stackprotector.c new file +6 -0
@@ -0,0 +1,6 @@ +#include <stdio.h> + +int main (void ) +{ +return puts ("hi" ); +}
Signature · 1 line
1.7.11.7
PATCH 7/50 tools/perf/build: Split out feature check: 'volatile-register-var'
In reply to Ingo Molnar--- tools/perf/config/Makefile | 3 ++- tools/perf/config/feature-checks/Makefile | 4 ++++ tools/perf/config/feature-checks/test-volatile-register-var.c | 6 ++++++ 3 files changed, 12 insertions(+), 1 deletion(-)
tools/perf/config/Makefile +2 -1
@@ -105,6 +105,7 @@ FEATURE_TESTS = \ hello \ stackprotector-all \ stackprotector \ + volatile-register-var \ libnuma $(foreach test,$(FEATURE_TESTS),$(call feature_check,$(test),$(test)))
@@ -117,7 +118,7 @@ ifeq ($(feature-stackprotector), 1) CFLAGS += -Wstack-protector endif -ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -Wvolatile-register-var,-Wvolatile-register-var),y) +ifeq ($(feature-volatile-register-var), 1) CFLAGS += -Wvolatile-register-var endif
tools/perf/config/feature-checks/Makefile +4 -0
@@ -3,6 +3,7 @@ FILES= \ test-hello \ test-stackprotector-all \ test-stackprotector \ + test-volatile-register-var \ test-libnuma CC := $(CC) -MD
@@ -22,6 +23,9 @@ test-stackprotector-all: test-stackprotector: $(BUILD) -Werror -fstack-protector +test-volatile-register-var: + $(BUILD) -Werror -Wvolatile-register-var + test-libnuma: $(BUILD) -lnuma
tools/perf/config/feature-checks/test-volatile-register-var.c new file +6 -0
@@ -0,0 +1,6 @@ +#include <stdio.h> + +int main (void ) +{ +return puts ("hi" ); +}
Signature · 1 line
1.7.11.7
PATCH 8/50 tools/perf/build: Split out feature check: 'fortify-source'
In reply to Ingo Molnar--- tools/perf/config/Makefile | 3 ++- tools/perf/config/feature-checks/Makefile | 4 ++++ tools/perf/config/feature-checks/test-fortify-source.c | 6 ++++++ 3 files changed, 12 insertions(+), 1 deletion(-)
tools/perf/config/Makefile +2 -1
@@ -106,6 +106,7 @@ FEATURE_TESTS = \ stackprotector-all \ stackprotector \ volatile-register-var \ + fortify-source \ libnuma $(foreach test,$(FEATURE_TESTS),$(call feature_check,$(test),$(test)))
@@ -123,7 +124,7 @@ ifeq ($(feature-volatile-register-var), 1) endif ifndef PERF_DEBUG - ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -D_FORTIFY_SOURCE=2,-D_FORTIFY_SOURCE=2),y) + ifeq ($(feature-fortify-source), 1) CFLAGS += -D_FORTIFY_SOURCE=2 endif endif
tools/perf/config/feature-checks/Makefile +4 -0
@@ -4,6 +4,7 @@ FILES= \ test-stackprotector-all \ test-stackprotector \ test-volatile-register-var \ + test-fortify-source \ test-libnuma CC := $(CC) -MD
@@ -26,6 +27,9 @@ test-stackprotector: test-volatile-register-var: $(BUILD) -Werror -Wvolatile-register-var +test-fortify-source: + $(BUILD) -O2 -Werror -D_FORTIFY_SOURCE=2 + test-libnuma: $(BUILD) -lnuma
tools/perf/config/feature-checks/test-fortify-source.c new file +6 -0
@@ -0,0 +1,6 @@ +#include <stdio.h> + +int main (void ) +{ +return puts ("hi" ); +}
Signature · 1 line
1.7.11.7
PATCH 9/50 tools/perf/build: Split out feature check: 'bionic'
In reply to Ingo Molnar--- tools/perf/config/Makefile | 11 ++++++----- tools/perf/config/feature-checks/Makefile | 4 ++++ tools/perf/config/feature-checks/test-bionic.c | 6 ++++++ 3 files changed, 16 insertions(+), 5 deletions(-)
tools/perf/config/Makefile +6 -5
@@ -107,6 +107,7 @@ FEATURE_TESTS = \ stackprotector \ volatile-register-var \ fortify-source \ + bionic \ libnuma $(foreach test,$(FEATURE_TESTS),$(call feature_check,$(test),$(test)))
@@ -150,12 +151,12 @@ CFLAGS += -I$(LIB_INCLUDE) CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE ifndef NO_BIONIC -ifeq ($(call try-cc,$(SOURCE_BIONIC),$(CFLAGS),bionic),y) - BIONIC := 1 - EXTLIBS := $(filter-out -lrt,$(EXTLIBS)) - EXTLIBS := $(filter-out -lpthread,$(EXTLIBS)) + ifeq ($(feature-bionic), 1) + BIONIC := 1 + EXTLIBS := $(filter-out -lrt,$(EXTLIBS)) + EXTLIBS := $(filter-out -lpthread,$(EXTLIBS)) + endif endif -endif # NO_BIONIC ifdef NO_LIBELF NO_DWARF := 1
tools/perf/config/feature-checks/Makefile +4 -0
@@ -5,6 +5,7 @@ FILES= \ test-stackprotector \ test-volatile-register-var \ test-fortify-source \ + test-bionic \ test-libnuma CC := $(CC) -MD
@@ -30,6 +31,9 @@ test-volatile-register-var: test-fortify-source: $(BUILD) -O2 -Werror -D_FORTIFY_SOURCE=2 +test-bionic: + $(BUILD) + test-libnuma: $(BUILD) -lnuma
tools/perf/config/feature-checks/test-bionic.c new file +6 -0
@@ -0,0 +1,6 @@ +#include <android/api-level.h> + +int main (void ) +{ +return __ANDROID_API__; +}
Signature · 1 line
1.7.11.7
PATCH 10/50 tools/perf/build: Clean up the libelf logic in config/Makefile
In reply to Ingo MolnarNest the rules properly. No change in functionality.
--- tools/perf/config/Makefile | 58 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 29 insertions(+), 29 deletions(-)
tools/perf/config/Makefile +29 -29
@@ -163,38 +163,38 @@ ifdef NO_LIBELF NO_DEMANGLE := 1 NO_LIBUNWIND := 1 else -FLAGS_LIBELF=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) -ifneq ($(call try-cc,$(SOURCE_LIBELF),$(FLAGS_LIBELF),libelf),y) - FLAGS_GLIBC=$(CFLAGS) $(LDFLAGS) - ifeq ($(call try-cc,$(SOURCE_GLIBC),$(FLAGS_GLIBC),glibc),y) - LIBC_SUPPORT := 1 - endif - ifeq ($(BIONIC),1) - LIBC_SUPPORT := 1 - endif - ifeq ($(LIBC_SUPPORT),1) - msg := $(warning No libelf found, disables 'probe' tool, please install elfutils-libelf-devel/libelf-dev); + FLAGS_LIBELF=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) + ifneq ($(call try-cc,$(SOURCE_LIBELF),$(FLAGS_LIBELF),libelf),y) + FLAGS_GLIBC=$(CFLAGS) $(LDFLAGS) + ifeq ($(call try-cc,$(SOURCE_GLIBC),$(FLAGS_GLIBC),glibc),y) + LIBC_SUPPORT := 1 + endif + ifeq ($(BIONIC),1) + LIBC_SUPPORT := 1 + endif + ifeq ($(LIBC_SUPPORT),1) + msg := $(warning No libelf found, disables 'probe' tool, please install elfutils-libelf-devel/libelf-dev); - NO_LIBELF := 1 - NO_DWARF := 1 - NO_DEMANGLE := 1 + NO_LIBELF := 1 + NO_DWARF := 1 + NO_DEMANGLE := 1 + else + msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static); + endif else - msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static); - endif -else - # for linking with debug library, run like: - # make DEBUG=1 LIBDW_DIR=/opt/libdw/ - ifdef LIBDW_DIR - LIBDW_CFLAGS := -I$(LIBDW_DIR)/include - LIBDW_LDFLAGS := -L$(LIBDW_DIR)/lib - endif + # for linking with debug library, run like: + # make DEBUG=1 LIBDW_DIR=/opt/libdw/ + ifdef LIBDW_DIR + LIBDW_CFLAGS := -I$(LIBDW_DIR)/include + LIBDW_LDFLAGS := -L$(LIBDW_DIR)/lib + endif - FLAGS_DWARF=$(CFLAGS) $(LIBDW_CFLAGS) -ldw -lz -lelf $(LIBDW_LDFLAGS) $(LDFLAGS) $(EXTLIBS) - ifneq ($(call try-cc,$(SOURCE_DWARF),$(FLAGS_DWARF),libdw),y) - msg := $(warning No libdw.h found or old libdw.h found or elfutils is older than 0.138, disables dwarf support. Please install new elfutils-devel/libdw-dev); - NO_DWARF := 1 - endif # Dwarf support -endif # SOURCE_LIBELF + FLAGS_DWARF=$(CFLAGS) $(LIBDW_CFLAGS) -ldw -lz -lelf $(LIBDW_LDFLAGS) $(LDFLAGS) $(EXTLIBS) + ifneq ($(call try-cc,$(SOURCE_DWARF),$(FLAGS_DWARF),libdw),y) + msg := $(warning No libdw.h found or old libdw.h found or elfutils is older than 0.138, disables dwarf support. Please install new elfutils-devel/libdw-dev); + NO_DWARF := 1 + endif # Dwarf support + endif # SOURCE_LIBELF endif # NO_LIBELF ifndef NO_LIBELF
Signature · 1 line
1.7.11.7
PATCH 11/50 tools/perf/build: Split out feature check: 'libelf'
In reply to Ingo Molnar--- tools/perf/config/Makefile | 4 ++-- tools/perf/config/feature-checks/Makefile | 4 ++++ tools/perf/config/feature-checks/test-libelf.c | 7 +++++++ 3 files changed, 13 insertions(+), 2 deletions(-)
tools/perf/config/Makefile +2 -2
@@ -108,6 +108,7 @@ FEATURE_TESTS = \ volatile-register-var \ fortify-source \ bionic \ + libelf \ libnuma $(foreach test,$(FEATURE_TESTS),$(call feature_check,$(test),$(test)))
@@ -163,8 +164,7 @@ ifdef NO_LIBELF NO_DEMANGLE := 1 NO_LIBUNWIND := 1 else - FLAGS_LIBELF=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) - ifneq ($(call try-cc,$(SOURCE_LIBELF),$(FLAGS_LIBELF),libelf),y) + ifeq ($(feature-libelf), 0) FLAGS_GLIBC=$(CFLAGS) $(LDFLAGS) ifeq ($(call try-cc,$(SOURCE_GLIBC),$(FLAGS_GLIBC),glibc),y) LIBC_SUPPORT := 1
tools/perf/config/feature-checks/Makefile +4 -0
@@ -6,6 +6,7 @@ FILES= \ test-volatile-register-var \ test-fortify-source \ test-bionic \ + test-libelf \ test-libnuma CC := $(CC) -MD
@@ -34,6 +35,9 @@ test-fortify-source: test-bionic: $(BUILD) +test-libelf: + $(BUILD) -lelf + test-libnuma: $(BUILD) -lnuma
tools/perf/config/feature-checks/test-libelf.c new file +7 -0
@@ -0,0 +1,7 @@ +#include <libelf.h> + +int main (void ) +{ +Elf *elf =elf_begin (0 ,ELF_C_READ ,0 ); +return (long )elf; +}
Signature · 1 line
1.7.11.7
PATCH 12/50 tools/perf/build: Split out feature check: 'glibc'
In reply to Ingo Molnar--- tools/perf/config/Makefile | 4 ++-- tools/perf/config/feature-checks/Makefile | 4 ++++ tools/perf/config/feature-checks/test-glibc.c | 8 ++++++++ 3 files changed, 14 insertions(+), 2 deletions(-)
tools/perf/config/Makefile +2 -2
@@ -109,6 +109,7 @@ FEATURE_TESTS = \ fortify-source \ bionic \ libelf \ + glibc \ libnuma $(foreach test,$(FEATURE_TESTS),$(call feature_check,$(test),$(test)))
@@ -165,8 +166,7 @@ ifdef NO_LIBELF NO_LIBUNWIND := 1 else ifeq ($(feature-libelf), 0) - FLAGS_GLIBC=$(CFLAGS) $(LDFLAGS) - ifeq ($(call try-cc,$(SOURCE_GLIBC),$(FLAGS_GLIBC),glibc),y) + ifeq ($(feature-glibc), 1) LIBC_SUPPORT := 1 endif ifeq ($(BIONIC),1)
tools/perf/config/feature-checks/Makefile +4 -0
@@ -7,6 +7,7 @@ FILES= \ test-fortify-source \ test-bionic \ test-libelf \ + test-glibc \ test-libnuma CC := $(CC) -MD
@@ -38,6 +39,9 @@ test-bionic: test-libelf: $(BUILD) -lelf +test-glibc: + $(BUILD) + test-libnuma: $(BUILD) -lnuma
tools/perf/config/feature-checks/test-glibc.c new file +8 -0
@@ -0,0 +1,8 @@ +#include <gnu/libc-version.h> + +int main (void ) +{ +const char *version =gnu_get_libc_version (); +return (long )version; +} +
Signature · 1 line
1.7.11.7
PATCH 13/50 tools/perf/build: Split out feature check: 'dwarf'
In reply to Ingo Molnar--- tools/perf/config/Makefile | 4 ++-- tools/perf/config/feature-checks/Makefile | 4 ++++ tools/perf/config/feature-checks/test-dwarf.c | 9 +++++++++ 3 files changed, 15 insertions(+), 2 deletions(-)
tools/perf/config/Makefile +2 -2
@@ -110,6 +110,7 @@ FEATURE_TESTS = \ bionic \ libelf \ glibc \ + dwarf \ libnuma $(foreach test,$(FEATURE_TESTS),$(call feature_check,$(test),$(test)))
@@ -189,8 +190,7 @@ else LIBDW_LDFLAGS := -L$(LIBDW_DIR)/lib endif - FLAGS_DWARF=$(CFLAGS) $(LIBDW_CFLAGS) -ldw -lz -lelf $(LIBDW_LDFLAGS) $(LDFLAGS) $(EXTLIBS) - ifneq ($(call try-cc,$(SOURCE_DWARF),$(FLAGS_DWARF),libdw),y) + ifneq ($(feature-dwarf), 1) msg := $(warning No libdw.h found or old libdw.h found or elfutils is older than 0.138, disables dwarf support. Please install new elfutils-devel/libdw-dev); NO_DWARF := 1 endif # Dwarf support
tools/perf/config/feature-checks/Makefile +4 -0
@@ -8,6 +8,7 @@ FILES= \ test-bionic \ test-libelf \ test-glibc \ + test-dwarf \ test-libnuma CC := $(CC) -MD
@@ -42,6 +43,9 @@ test-libelf: test-glibc: $(BUILD) +test-dwarf: + $(BUILD) -ldw + test-libnuma: $(BUILD) -lnuma
tools/perf/config/feature-checks/test-dwarf.c new file +9 -0
@@ -0,0 +1,9 @@ +#include <dwarf.h> +#include <elfutils/libdw.h> +#include <elfutils/version.h> + +int main (void ) +{ +Dwarf *dbg =dwarf_begin (0 ,DWARF_C_READ ); +return (long )dbg; +}
Signature · 1 line
1.7.11.7
PATCH 14/50 tools/perf/build: Clean up the mmap logic in config/Makefile
In reply to Ingo MolnarNest the rules properly. No change in functionality.
--- tools/perf/config/Makefile | 51 ++++++++++++++++++++++++++------------------------- 1 file changed, 26 insertions(+), 25 deletions(-)
tools/perf/config/Makefile +26 -25
@@ -198,37 +198,38 @@ else endif # NO_LIBELF ifndef NO_LIBELF -CFLAGS += -DHAVE_LIBELF_SUPPORT -FLAGS_LIBELF=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) -ifeq ($(call try-cc,$(SOURCE_ELF_MMAP),$(FLAGS_LIBELF),-DHAVE_LIBELF_MMAP_SUPPORT),y) - CFLAGS += -DHAVE_LIBELF_MMAP_SUPPORT -endif -ifeq ($(call try-cc,$(SOURCE_ELF_GETPHDRNUM),$(FLAGS_LIBELF),-DHAVE_ELF_GETPHDRNUM_SUPPORT),y) - CFLAGS += -DHAVE_ELF_GETPHDRNUM_SUPPORT -endif + CFLAGS += -DHAVE_LIBELF_SUPPORT + FLAGS_LIBELF=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) -# include ARCH specific config --include $(src-perf)/arch/$(ARCH)/Makefile + ifeq ($(call try-cc,$(SOURCE_ELF_MMAP),$(FLAGS_LIBELF),-DHAVE_LIBELF_MMAP_SUPPORT),y) + CFLAGS += -DHAVE_LIBELF_MMAP_SUPPORT + endif -ifndef NO_DWARF -ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined) - msg := $(warning DWARF register mappings have not been defined for architecture $(ARCH), DWARF support disabled); - NO_DWARF := 1 -else - CFLAGS += -DHAVE_DWARF_SUPPORT $(LIBDW_CFLAGS) - LDFLAGS += $(LIBDW_LDFLAGS) - EXTLIBS += -lelf -ldw -endif # PERF_HAVE_DWARF_REGS -endif # NO_DWARF + ifeq ($(call try-cc,$(SOURCE_ELF_GETPHDRNUM),$(FLAGS_LIBELF),-DHAVE_ELF_GETPHDRNUM_SUPPORT),y) + CFLAGS += -DHAVE_ELF_GETPHDRNUM_SUPPORT + endif + + # include ARCH specific config + -include $(src-perf)/arch/$(ARCH)/Makefile + ifndef NO_DWARF + ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined) + msg := $(warning DWARF register mappings have not been defined for architecture $(ARCH), DWARF support disabled); + NO_DWARF := 1 + else + CFLAGS += -DHAVE_DWARF_SUPPORT $(LIBDW_CFLAGS) + LDFLAGS += $(LIBDW_LDFLAGS) + EXTLIBS += -lelf -ldw + endif # PERF_HAVE_DWARF_REGS + endif # NO_DWARF endif # NO_LIBELF ifndef NO_LIBELF -CFLAGS += -DHAVE_LIBELF_SUPPORT -FLAGS_LIBELF=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) -ifeq ($(call try-cc,$(SOURCE_ELF_MMAP),$(FLAGS_LIBELF),-DHAVE_LIBELF_MMAP_SUPPORT),y) - CFLAGS += -DHAVE_LIBELF_MMAP_SUPPORT -endif # try-cc + CFLAGS += -DHAVE_LIBELF_SUPPORT + FLAGS_LIBELF=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) + ifeq ($(call try-cc,$(SOURCE_ELF_MMAP),$(FLAGS_LIBELF),-DHAVE_LIBELF_MMAP_SUPPORT),y) + CFLAGS += -DHAVE_LIBELF_MMAP_SUPPORT + endif # try-cc endif # NO_LIBELF # There's only x86 (both 32 and 64) support for CFI unwind so far
Signature · 1 line
1.7.11.7
PATCH 15/50 tools/perf/build: Split out feature check: 'libelf-mmap'
In reply to Ingo Molnar--- tools/perf/config/Makefile | 6 +++--- tools/perf/config/feature-checks/Makefile | 4 ++++ tools/perf/config/feature-checks/test-libelf-mmap.c | 7 +++++++ 3 files changed, 14 insertions(+), 3 deletions(-)
tools/perf/config/Makefile +3 -3
@@ -111,6 +111,7 @@ FEATURE_TESTS = \ libelf \ glibc \ dwarf \ + libelf-mmap \ libnuma $(foreach test,$(FEATURE_TESTS),$(call feature_check,$(test),$(test)))
@@ -201,7 +202,7 @@ ifndef NO_LIBELF CFLAGS += -DHAVE_LIBELF_SUPPORT FLAGS_LIBELF=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) - ifeq ($(call try-cc,$(SOURCE_ELF_MMAP),$(FLAGS_LIBELF),-DHAVE_LIBELF_MMAP_SUPPORT),y) + ifeq ($(feature-libelf-mmap), 1) CFLAGS += -DHAVE_LIBELF_MMAP_SUPPORT endif
@@ -226,8 +227,7 @@ endif # NO_LIBELF ifndef NO_LIBELF CFLAGS += -DHAVE_LIBELF_SUPPORT - FLAGS_LIBELF=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) - ifeq ($(call try-cc,$(SOURCE_ELF_MMAP),$(FLAGS_LIBELF),-DHAVE_LIBELF_MMAP_SUPPORT),y) + ifeq ($(feature-libelf-mmap), 1) CFLAGS += -DHAVE_LIBELF_MMAP_SUPPORT endif # try-cc endif # NO_LIBELF
tools/perf/config/feature-checks/Makefile +4 -0
@@ -9,6 +9,7 @@ FILES= \ test-libelf \ test-glibc \ test-dwarf \ + test-libelf-mmap \ test-libnuma CC := $(CC) -MD
@@ -46,6 +47,9 @@ test-glibc: test-dwarf: $(BUILD) -ldw +test-libelf-mmap: + $(BUILD) -lelf + test-libnuma: $(BUILD) -lnuma
tools/perf/config/feature-checks/test-libelf-mmap.c new file +7 -0
@@ -0,0 +1,7 @@ +#include <libelf.h> +# +int main (void ) +{ +Elf *elf =elf_begin (0 ,ELF_C_READ_MMAP ,0 ); +return (long )elf; +}
Signature · 1 line
1.7.11.7
PATCH 16/50 tools/perf/build: Split out feature check: 'libelf-getphdrnum'
In reply to Ingo Molnar--- tools/perf/config/Makefile | 5 +++-- tools/perf/config/feature-checks/Makefile | 4 ++++ tools/perf/config/feature-checks/test-libelf-getphdrnum.c | 7 +++++++ 3 files changed, 14 insertions(+), 2 deletions(-)
tools/perf/config/Makefile +3 -2
@@ -112,6 +112,7 @@ FEATURE_TESTS = \ glibc \ dwarf \ libelf-mmap \ + libelf-getphdrnum \ libnuma $(foreach test,$(FEATURE_TESTS),$(call feature_check,$(test),$(test)))
@@ -206,7 +207,7 @@ ifndef NO_LIBELF CFLAGS += -DHAVE_LIBELF_MMAP_SUPPORT endif - ifeq ($(call try-cc,$(SOURCE_ELF_GETPHDRNUM),$(FLAGS_LIBELF),-DHAVE_ELF_GETPHDRNUM_SUPPORT),y) + ifeq ($(feature-libelf-getphdrnum), 1) CFLAGS += -DHAVE_ELF_GETPHDRNUM_SUPPORT endif
@@ -229,7 +230,7 @@ ifndef NO_LIBELF CFLAGS += -DHAVE_LIBELF_SUPPORT ifeq ($(feature-libelf-mmap), 1) CFLAGS += -DHAVE_LIBELF_MMAP_SUPPORT - endif # try-cc + endif endif # NO_LIBELF # There's only x86 (both 32 and 64) support for CFI unwind so far
tools/perf/config/feature-checks/Makefile +4 -0
@@ -10,6 +10,7 @@ FILES= \ test-glibc \ test-dwarf \ test-libelf-mmap \ + test-libelf-getphdrnum \ test-libnuma CC := $(CC) -MD
@@ -50,6 +51,9 @@ test-dwarf: test-libelf-mmap: $(BUILD) -lelf +test-libelf-getphdrnum: + $(BUILD) -lelf + test-libnuma: $(BUILD) -lnuma
tools/perf/config/feature-checks/test-libelf-getphdrnum.c new file +7 -0
@@ -0,0 +1,7 @@ +#include <libelf.h> +# +int main (void ) +{ +size_t dst; +return elf_getphdrnum (0 , &dst); +}
Signature · 1 line
1.7.11.7
PATCH 17/50 tools/perf/build: Clean up the libunwind logic in config/Makefile
In reply to Ingo MolnarNest the rules properly. No change in functionality.
--- tools/perf/config/Makefile | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
tools/perf/config/Makefile +12 -12
@@ -239,19 +239,19 @@ ifneq ($(ARCH),x86) endif ifndef NO_LIBUNWIND -# for linking with debug library, run like: -# make DEBUG=1 LIBUNWIND_DIR=/opt/libunwind/ -ifdef LIBUNWIND_DIR - LIBUNWIND_CFLAGS := -I$(LIBUNWIND_DIR)/include - LIBUNWIND_LDFLAGS := -L$(LIBUNWIND_DIR)/lib -endif + # for linking with debug library, run like: + # make DEBUG=1 LIBUNWIND_DIR=/opt/libunwind/ + ifdef LIBUNWIND_DIR + LIBUNWIND_CFLAGS := -I$(LIBUNWIND_DIR)/include + LIBUNWIND_LDFLAGS := -L$(LIBUNWIND_DIR)/lib + endif -FLAGS_UNWIND=$(LIBUNWIND_CFLAGS) $(CFLAGS) $(LIBUNWIND_LDFLAGS) $(LDFLAGS) $(EXTLIBS) $(LIBUNWIND_LIBS) -ifneq ($(call try-cc,$(SOURCE_LIBUNWIND),$(FLAGS_UNWIND),libunwind),y) - msg := $(warning No libunwind found, disabling post unwind support. Please install libunwind-dev[el] >= 0.99); - NO_LIBUNWIND := 1 -endif # Libunwind support -endif # NO_LIBUNWIND + FLAGS_UNWIND=$(LIBUNWIND_CFLAGS) $(CFLAGS) $(LIBUNWIND_LDFLAGS) $(LDFLAGS) $(EXTLIBS) $(LIBUNWIND_LIBS) + ifneq ($(call try-cc,$(SOURCE_LIBUNWIND),$(FLAGS_UNWIND),libunwind),y) + msg := $(warning No libunwind found, disabling post unwind support. Please install libunwind-dev[el] >= 0.99); + NO_LIBUNWIND := 1 + endif +endif ifndef NO_LIBUNWIND CFLAGS += -DHAVE_LIBUNWIND_SUPPORT
Signature · 1 line
1.7.11.7
PATCH 18/50 tools/perf/build: Split out feature check: 'libunwind'
In reply to Ingo Molnar--- tools/perf/config/Makefile | 13 +++---------- tools/perf/config/feature-checks/Makefile | 4 ++++ tools/perf/config/feature-checks/test-libunwind.c | 20 ++++++++++++++++++++ 3 files changed, 27 insertions(+), 10 deletions(-)
tools/perf/config/Makefile +3 -10
@@ -113,6 +113,7 @@ FEATURE_TESTS = \ dwarf \ libelf-mmap \ libelf-getphdrnum \ + libunwind \ libnuma $(foreach test,$(FEATURE_TESTS),$(call feature_check,$(test),$(test)))
@@ -239,15 +240,7 @@ ifneq ($(ARCH),x86) endif ifndef NO_LIBUNWIND - # for linking with debug library, run like: - # make DEBUG=1 LIBUNWIND_DIR=/opt/libunwind/ - ifdef LIBUNWIND_DIR - LIBUNWIND_CFLAGS := -I$(LIBUNWIND_DIR)/include - LIBUNWIND_LDFLAGS := -L$(LIBUNWIND_DIR)/lib - endif - - FLAGS_UNWIND=$(LIBUNWIND_CFLAGS) $(CFLAGS) $(LIBUNWIND_LDFLAGS) $(LDFLAGS) $(EXTLIBS) $(LIBUNWIND_LIBS) - ifneq ($(call try-cc,$(SOURCE_LIBUNWIND),$(FLAGS_UNWIND),libunwind),y) + ifeq ($(feature-libunwind), 1) msg := $(warning No libunwind found, disabling post unwind support. Please install libunwind-dev[el] >= 0.99); NO_LIBUNWIND := 1 endif
@@ -258,7 +251,7 @@ ifndef NO_LIBUNWIND EXTLIBS += $(LIBUNWIND_LIBS) CFLAGS += $(LIBUNWIND_CFLAGS) LDFLAGS += $(LIBUNWIND_LDFLAGS) -endif # NO_LIBUNWIND +endif ifndef NO_LIBAUDIT FLAGS_LIBAUDIT = $(CFLAGS) $(LDFLAGS) -laudit
tools/perf/config/feature-checks/Makefile +4 -0
@@ -11,6 +11,7 @@ FILES= \ test-dwarf \ test-libelf-mmap \ test-libelf-getphdrnum \ + test-libunwind \ test-libnuma CC := $(CC) -MD
@@ -57,6 +58,9 @@ test-libelf-getphdrnum: test-libnuma: $(BUILD) -lnuma +test-libunwind: + $(BUILD) -lunwind -lunwind-x86_64 -lelf + -include *.d */*.d ###############################
tools/perf/config/feature-checks/test-libunwind.c new file +20 -0
@@ -0,0 +1,20 @@ +#include <libunwind.h> +#include <stdlib.h> + +extern int UNW_OBJ (dwarf_search_unwind_table ) (unw_addr_space_t as, +unw_word_t ip, +unw_dyn_info_t *di, +unw_proc_info_t *pi, +int need_unwind_info,void *arg); + + +#define dwarf_search_unwind_table UNW_OBJ(dwarf_search_unwind_table) + +int main (void ) +{ +unw_addr_space_t addr_space; + addr_space =unw_create_addr_space (NULL ,0 ); +unw_init_remote (NULL , addr_space,NULL ); +dwarf_search_unwind_table (addr_space,0 ,NULL ,NULL ,0 ,NULL ); +return 0 ; +}
Signature · 1 line
1.7.11.7
PATCH 19/50 tools/perf/build: Split out feature check: 'libaudit'
In reply to Ingo Molnar--- tools/perf/config/Makefile | 6 +++--- tools/perf/config/feature-checks/Makefile | 4 ++++ tools/perf/config/feature-checks/test-libaudit.c | 7 +++++++ 3 files changed, 14 insertions(+), 3 deletions(-)
tools/perf/config/Makefile +3 -3
@@ -114,6 +114,7 @@ FEATURE_TESTS = \ libelf-mmap \ libelf-getphdrnum \ libunwind \ + libaudit \ libnuma $(foreach test,$(FEATURE_TESTS),$(call feature_check,$(test),$(test)))
@@ -240,7 +241,7 @@ ifneq ($(ARCH),x86) endif ifndef NO_LIBUNWIND - ifeq ($(feature-libunwind), 1) + ifneq ($(feature-libunwind), 1) msg := $(warning No libunwind found, disabling post unwind support. Please install libunwind-dev[el] >= 0.99); NO_LIBUNWIND := 1 endif
@@ -254,8 +255,7 @@ ifndef NO_LIBUNWIND endif ifndef NO_LIBAUDIT - FLAGS_LIBAUDIT = $(CFLAGS) $(LDFLAGS) -laudit - ifneq ($(call try-cc,$(SOURCE_LIBAUDIT),$(FLAGS_LIBAUDIT),libaudit),y) + ifneq ($(feature-libaudit), 1) msg := $(warning No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev); NO_LIBAUDIT := 1 else
tools/perf/config/feature-checks/Makefile +4 -0
@@ -12,6 +12,7 @@ FILES= \ test-libelf-mmap \ test-libelf-getphdrnum \ test-libunwind \ + test-libaudit \ test-libnuma CC := $(CC) -MD
@@ -61,6 +62,9 @@ test-libnuma: test-libunwind: $(BUILD) -lunwind -lunwind-x86_64 -lelf +test-libaudit: + $(BUILD) -laudit + -include *.d */*.d ###############################
tools/perf/config/feature-checks/test-libaudit.c new file +7 -0
@@ -0,0 +1,7 @@ +#include <libaudit.h> + +int main (void ) +{ +printf ("error message: %s\n" ,audit_errno_to_name (0 )); +return audit_open (); +}
Signature · 1 line
1.7.11.7
Re: [PATCH 19/50] tools/perf/build: Split out feature check: 'libaudit'
Quoted 26 lines · Ingo Molnar
Cc Arnaldo Carvalho de Melo <[email protected]>Cc Peter Zijlstra <[email protected]>Cc Namhyung Kim <[email protected]>Cc David Ahern <[email protected]>Cc Jiri Olsa <[email protected]>Signed-off-by Ingo Molnar <[email protected]>--- tools/perf/config/Makefile | 6 +++--- tools/perf/config/feature-checks/Makefile | 4 ++++ tools/perf/config/feature-checks/test-libaudit.c | 7 +++++++ 3 files changed, 14 insertions(+), 3 deletions(-)tools/perf/config/Makefile +1
-0@@ -114,6 +114,7 @@ FEATURE_TESTS = \ libelf-mmap \ libelf-getphdrnum \ libunwind \ + libaudit \ libnuma $(foreach test,$(FEATURE_TESTS),$(call feature_check,$(test),$(test)))
tools/perf/config/Makefile ifneq ($(ARCH),x86) · line 247
Quoted 8 lines
tools/perf/config/Makefile +1
-1@@ -240,7 +241,7 @@ ifneq ($(ARCH),x86) endif ifndef NO_LIBUNWIND - ifeq ($(feature-libunwind), 1) + ifneq ($(feature-libunwind), 1) msg := $(warning No libunwind found, disabling post unwind support. Please install libunwind-dev[el] >= 0.99); NO_LIBUNWIND := 1 endif
nit, this change belongs to previous patch
jirka
Re: [PATCH 19/50] tools/perf/build: Split out feature check: 'libaudit'
Quoted 29 lines · Jiri Olsa
Quoted 28 lines · Ingo Molnar
Cc Arnaldo Carvalho de Melo <[email protected]>Cc Peter Zijlstra <[email protected]>Cc Namhyung Kim <[email protected]>Cc David Ahern <[email protected]>Cc Jiri Olsa <[email protected]>Signed-off-by Ingo Molnar <[email protected]>--- tools/perf/config/Makefile | 6 +++--- tools/perf/config/feature-checks/Makefile | 4 ++++ tools/perf/config/feature-checks/test-libaudit.c | 7 +++++++ 3 files changed, 14 insertions(+), 3 deletions(-)tools/perf/config/Makefile +1
-0@@ -114,6 +114,7 @@ FEATURE_TESTS = \ libelf-mmap \ libelf-getphdrnum \ libunwind \ + libaudit \ libnuma $(foreach test,$(FEATURE_TESTS),$(call feature_check,$(test),$(test)))@@ -240,7 +241,7 @@ ifneq ($(ARCH),x86) endif
Quoted 8 lines
tools/perf/config/Makefile ifneq ($(ARCH),x86) · line 247
Quoted 6 lines
tools/perf/config/Makefile +1
-1ifndef NO_LIBUNWIND - ifeq ($(feature-libunwind), 1) + ifneq ($(feature-libunwind), 1) msg := $(warning No libunwind found, disabling post unwind support. Please install libunwind-dev[el] >= 0.99); NO_LIBUNWIND := 1 endifnit, this change belongs to previous patch
Thanks, fixed.
Ingo
PATCH 20/50 tools/perf/build: Split out feature check: 'libslang'
In reply to Ingo Molnar--- tools/perf/config/Makefile | 6 +++--- tools/perf/config/feature-checks/Makefile | 4 ++++ tools/perf/config/feature-checks/test-libslang.c | 6 ++++++ 3 files changed, 13 insertions(+), 3 deletions(-)
tools/perf/config/Makefile +3 -3
@@ -115,6 +115,7 @@ FEATURE_TESTS = \ libelf-getphdrnum \ libunwind \ libaudit \ + libslang \ libnuma $(foreach test,$(FEATURE_TESTS),$(call feature_check,$(test),$(test)))
@@ -269,8 +270,7 @@ ifdef NO_NEWT endif ifndef NO_SLANG - FLAGS_SLANG=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) -I/usr/include/slang -lslang - ifneq ($(call try-cc,$(SOURCE_SLANG),$(FLAGS_SLANG),libslang),y) + ifneq ($(feature-libslang), 1) msg := $(warning slang not found, disables TUI support. Please install slang-devel or libslang-dev); NO_SLANG := 1 else
@@ -283,7 +283,7 @@ endif ifndef NO_GTK2 FLAGS_GTK2=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) $(shell pkg-config --libs --cflags gtk+-2.0 2>/dev/null) - ifneq ($(call try-cc,$(SOURCE_GTK2),$(FLAGS_GTK2),gtk2),y) + ifneq ($(feature-gtk2), 1) msg := $(warning GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev); NO_GTK2 := 1 else
tools/perf/config/feature-checks/Makefile +4 -0
@@ -13,6 +13,7 @@ FILES= \ test-libelf-getphdrnum \ test-libunwind \ test-libaudit \ + test-libslang \ test-libnuma CC := $(CC) -MD
@@ -65,6 +66,9 @@ test-libunwind: test-libaudit: $(BUILD) -laudit +test-libslang: + $(BUILD) -I/usr/include/slang -lslang + -include *.d */*.d ###############################
tools/perf/config/feature-checks/test-libslang.c new file +6 -0
@@ -0,0 +1,6 @@ +#include <slang.h> + +int main (void ) +{ +return SLsmg_init_smg (); +}
Signature · 1 line
1.7.11.7
Re: [PATCH 20/50] tools/perf/build: Split out feature check: 'libslang'
tools/perf/config/Makefile endif · line 289
Quoted 9 lines · Ingo Molnar
tools/perf/config/Makefile +1
-1@@ -283,7 +283,7 @@ endif ifndef NO_GTK2 FLAGS_GTK2=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) $(shell pkg-config --libs --cflags gtk+-2.0 2>/dev/null) - ifneq ($(call try-cc,$(SOURCE_GTK2),$(FLAGS_GTK2),gtk2),y) + ifneq ($(feature-gtk2), 1) msg := $(warning GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev); NO_GTK2 := 1 else
Looks like the gtk2 change bled in early. this should be with the next patch.
David
Re: [PATCH 20/50] tools/perf/build: Split out feature check: 'libslang'
Quoted 4 lines · David Ahern
Quoted 2 lines · Ingo Molnar
(quoted diff) +0
-0@@ -283,7 +283,7 @@ endif
Quoted 10 lines
tools/perf/config/Makefile endif · line 289
Quoted 7 lines
tools/perf/config/Makefile +1
-1ifndef NO_GTK2 FLAGS_GTK2=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) $(shell pkg-config --libs --cflags gtk+-2.0 2>/dev/null) - ifneq ($(call try-cc,$(SOURCE_GTK2),$(FLAGS_GTK2),gtk2),y) + ifneq ($(feature-gtk2), 1) msg := $(warning GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev); NO_GTK2 := 1 elseLooks like the gtk2 change bled in early. this should be with the next patch.
Indeed - fixed.
Thanks,
Ingo
PATCH 21/50 tools/perf/build: Split out feature check: 'gtk2'
In reply to Ingo Molnar--- tools/perf/config/Makefile | 1 + tools/perf/config/feature-checks/Makefile | 4 ++++ tools/perf/config/feature-checks/test-gtk2.c | 10 ++++++++++ 3 files changed, 15 insertions(+)
tools/perf/config/Makefile +1 -0
@@ -116,6 +116,7 @@ FEATURE_TESTS = \ libunwind \ libaudit \ libslang \ + gtk2 \ libnuma $(foreach test,$(FEATURE_TESTS),$(call feature_check,$(test),$(test)))
tools/perf/config/feature-checks/Makefile +4 -0
@@ -14,6 +14,7 @@ FILES= \ test-libunwind \ test-libaudit \ test-libslang \ + test-gtk2 \ test-libnuma CC := $(CC) -MD
@@ -69,6 +70,9 @@ test-libaudit: test-libslang: $(BUILD) -I/usr/include/slang -lslang +test-gtk2: + $(BUILD) $(shell pkg-config --libs --cflags gtk+-2.0 2>/dev/null) + -include *.d */*.d ###############################
tools/perf/config/feature-checks/test-gtk2.c new file +10 -0
@@ -0,0 +1,10 @@ +#pragma GCC diagnostic ignored "-Wstrict-prototypes" +#include <gtk/gtk.h> +#pragma GCC diagnostic error "-Wstrict-prototypes" + +int main (int argc,char *argv[]) +{ +gtk_init (&argc, &argv); + +return 0 ; +}
Signature · 1 line
1.7.11.7
PATCH 22/50 tools/perf/build: Split out feature check: 'gtk2-infobar'
In reply to Ingo Molnar--- tools/perf/config/Makefile | 3 ++- tools/perf/config/feature-checks/Makefile | 4 ++++ tools/perf/config/feature-checks/test-gtk2-infobar.c | 10 ++++++++++ 3 files changed, 16 insertions(+), 1 deletion(-)
tools/perf/config/Makefile +2 -1
@@ -117,6 +117,7 @@ FEATURE_TESTS = \ libaudit \ libslang \ gtk2 \ + gtk2-infobar \ libnuma $(foreach test,$(FEATURE_TESTS),$(call feature_check,$(test),$(test)))
@@ -288,7 +289,7 @@ ifndef NO_GTK2 msg := $(warning GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev); NO_GTK2 := 1 else - ifeq ($(call try-cc,$(SOURCE_GTK2_INFOBAR),$(FLAGS_GTK2),-DHAVE_GTK_INFO_BAR_SUPPORT),y) + ifeq ($(feature-gtk2-infobar), 1) CFLAGS += -DHAVE_GTK_INFO_BAR_SUPPORT endif CFLAGS += -DHAVE_GTK2_SUPPORT
tools/perf/config/feature-checks/Makefile +4 -0
@@ -15,6 +15,7 @@ FILES= \ test-libaudit \ test-libslang \ test-gtk2 \ + test-gtk2-infobar \ test-libnuma CC := $(CC) -MD
@@ -73,6 +74,9 @@ test-libslang: test-gtk2: $(BUILD) $(shell pkg-config --libs --cflags gtk+-2.0 2>/dev/null) +test-gtk2-infobar: + $(BUILD) $(shell pkg-config --libs --cflags gtk+-2.0 2>/dev/null) + -include *.d */*.d ###############################
tools/perf/config/feature-checks/test-gtk2-infobar.c new file +10 -0
@@ -0,0 +1,10 @@ +#pragma GCC diagnostic ignored "-Wstrict-prototypes" +#include <gtk/gtk.h> +#pragma GCC diagnostic error "-Wstrict-prototypes" + +int main (void ) +{ +gtk_info_bar_new (); + +return 0 ; +}
Signature · 1 line
1.7.11.7
PATCH 23/50 tools/perf/build: Split out feature check: 'libperl'
In reply to Ingo Molnar--- tools/perf/config/Makefile | 3 ++- tools/perf/config/feature-checks/Makefile | 13 +++++++++++++ tools/perf/config/feature-checks/test-libperl.c | 9 +++++++++ 3 files changed, 24 insertions(+), 1 deletion(-)
tools/perf/config/Makefile +2 -1
@@ -118,6 +118,7 @@ FEATURE_TESTS = \ libslang \ gtk2 \ gtk2-infobar \ + libperl \ libnuma $(foreach test,$(FEATURE_TESTS),$(call feature_check,$(test),$(test)))
@@ -310,7 +311,7 @@ else PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null` FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS) - ifneq ($(call try-cc,$(SOURCE_PERL_EMBED),$(FLAGS_PERL_EMBED),perl),y) + ifneq ($(feature-libperl), 1) CFLAGS += -DNO_LIBPERL NO_LIBPERL := 1 else
tools/perf/config/feature-checks/Makefile +13 -0
@@ -16,6 +16,7 @@ FILES= \ test-libslang \ test-gtk2 \ test-gtk2-infobar \ + test-libperl \ test-libnuma CC := $(CC) -MD
@@ -77,6 +78,18 @@ test-gtk2: test-gtk2-infobar: $(BUILD) $(shell pkg-config --libs --cflags gtk+-2.0 2>/dev/null) +grep-libs = $(filter -l%,$(1)) +strip-libs = $(filter-out -l%,$(1)) + +PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null) +PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS)) +PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS)) +PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null` +FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS) + +test-libperl: + $(BUILD) $(FLAGS_PERL_EMBED) + -include *.d */*.d ###############################
tools/perf/config/feature-checks/test-libperl.c new file +9 -0
@@ -0,0 +1,9 @@ +#include <EXTERN.h> +#include <perl.h> + +int main (void ) +{ +perl_alloc (); + +return 0 ; +}
Signature · 1 line
1.7.11.7
PATCH 24/50 tools/perf/build: Split out feature check: 'libpython'
In reply to Ingo Molnar--- tools/perf/config/Makefile | 3 ++- tools/perf/config/feature-checks/Makefile | 18 ++++++++++++++++++ tools/perf/config/feature-checks/test-libpython.c | 7 +++++++ 3 files changed, 27 insertions(+), 1 deletion(-)
tools/perf/config/Makefile +2 -1
@@ -119,6 +119,7 @@ FEATURE_TESTS = \ gtk2 \ gtk2-infobar \ libperl \ + libpython \ libnuma $(foreach test,$(FEATURE_TESTS),$(call feature_check,$(test),$(test)))
@@ -356,7 +357,7 @@ else PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null) FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS) - ifneq ($(call try-cc,$(SOURCE_PYTHON_EMBED),$(FLAGS_PYTHON_EMBED),python),y) + ifneq ($(feature-libpython), 1) $(call disable-python,Python.h (for Python 2.x)) else
tools/perf/config/feature-checks/Makefile +18 -0
@@ -17,6 +17,7 @@ FILES= \ test-gtk2 \ test-gtk2-infobar \ test-libperl \ + test-libpython \ test-libnuma CC := $(CC) -MD
@@ -90,6 +91,23 @@ FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS) test-libperl: $(BUILD) $(FLAGS_PERL_EMBED) +override PYTHON := python +override PYTHON_CONFIG := python-config + +escape-for-shell-sq = $(subst ','\'',$(1)) +shell-sq = '$(escape-for-shell-sq)' + +PYTHON_CONFIG_SQ = $(call shell-sq,$(PYTHON_CONFIG)) + +PYTHON_EMBED_LDOPTS = $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null) +PYTHON_EMBED_LDFLAGS = $(call strip-libs,$(PYTHON_EMBED_LDOPTS)) +PYTHON_EMBED_LIBADD = $(call grep-libs,$(PYTHON_EMBED_LDOPTS)) +PYTHON_EMBED_CCOPTS = $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null) +FLAGS_PYTHON_EMBED = $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS) + +test-libpython: + $(BUILD) $(FLAGS_PYTHON_EMBED) + -include *.d */*.d ###############################
tools/perf/config/feature-checks/test-libpython.c new file +7 -0
@@ -0,0 +1,7 @@ +#include <Python.h> +# +int main (void ) +{ +Py_Initialize (); +return 0 ; +}
Signature · 1 line
1.7.11.7
PATCH 25/50 tools/perf/build: Split out feature check: 'libpython-version'
In reply to Ingo Molnar--- tools/perf/config/Makefile | 3 ++- tools/perf/config/feature-checks/Makefile | 4 ++++ tools/perf/config/feature-checks/test-libpython-version.c | 10 ++++++++++ 3 files changed, 16 insertions(+), 1 deletion(-)
tools/perf/config/Makefile +2 -1
@@ -120,6 +120,7 @@ FEATURE_TESTS = \ gtk2-infobar \ libperl \ libpython \ + libpython-version \ libnuma $(foreach test,$(FEATURE_TESTS),$(call feature_check,$(test),$(test)))
@@ -361,7 +362,7 @@ else $(call disable-python,Python.h (for Python 2.x)) else - ifneq ($(call try-cc,$(SOURCE_PYTHON_VERSION),$(FLAGS_PYTHON_EMBED),python version),y) + ifneq ($(feature-libpython-version), 1) $(warning Python 3 is not yet supported; please set) $(warning PYTHON and/or PYTHON_CONFIG appropriately.) $(warning If you also have Python 2 installed, then)
tools/perf/config/feature-checks/Makefile +4 -0
@@ -18,6 +18,7 @@ FILES= \ test-gtk2-infobar \ test-libperl \ test-libpython \ + test-libpython-version \ test-libnuma CC := $(CC) -MD
@@ -108,6 +109,9 @@ FLAGS_PYTHON_EMBED = $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS) test-libpython: $(BUILD) $(FLAGS_PYTHON_EMBED) +test-libpython-version: + $(BUILD) $(FLAGS_PYTHON_EMBED) + -include *.d */*.d ###############################
tools/perf/config/feature-checks/test-libpython-version.c new file +10 -0
@@ -0,0 +1,10 @@ +#include <Python.h> + +#if PY_VERSION_HEX >=0x03000000 +#error +#endif + +int main (void ) +{ +return 0 ; +}
Signature · 1 line
1.7.11.7
PATCH 26/50 tools/perf/build: Split out feature check: 'libbfd'
In reply to Ingo Molnar--- tools/perf/config/Makefile | 6 +++--- tools/perf/config/feature-checks/Makefile | 7 +++++++ tools/perf/config/feature-checks/test-libbfd.c | 7 +++++++ tools/perf/config/feature-checks/test-strlcpy.c | 8 ++++++++ 4 files changed, 25 insertions(+), 3 deletions(-)
tools/perf/config/Makefile +3 -3
@@ -121,6 +121,7 @@ FEATURE_TESTS = \ libperl \ libpython \ libpython-version \ + libbfd \ libnuma $(foreach test,$(FEATURE_TESTS),$(call feature_check,$(test),$(test)))
@@ -393,8 +394,7 @@ else CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT else FLAGS_BFD=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) -DPACKAGE='perf' -lbfd - has_bfd := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD),libbfd) - ifeq ($(has_bfd),y) + ifeq ($(feature-libbfd), 1) EXTLIBS += -lbfd else FLAGS_BFD_IBERTY=$(FLAGS_BFD) -liberty
@@ -423,7 +423,7 @@ else endif ifndef NO_STRLCPY - ifeq ($(call try-cc,$(SOURCE_STRLCPY),,-DHAVE_STRLCPY_SUPPORT),y) + ifeq ($(feature-strlcpy), 1) CFLAGS += -DHAVE_STRLCPY_SUPPORT endif endif
tools/perf/config/feature-checks/Makefile +7 -0
@@ -19,6 +19,7 @@ FILES= \ test-libperl \ test-libpython \ test-libpython-version \ + test-libbfd \ test-libnuma CC := $(CC) -MD
@@ -112,6 +113,12 @@ test-libpython: test-libpython-version: $(BUILD) $(FLAGS_PYTHON_EMBED) +test-libbfd: + $(BUILD) -DPACKAGE='perf' -DPACKAGE=perf -lbfd -ldl + +test-strlcpy: + $(BUILD) + -include *.d */*.d ###############################
tools/perf/config/feature-checks/test-libbfd.c new file +7 -0
@@ -0,0 +1,7 @@ +#include <bfd.h> + +int main (void ) +{ +bfd_demangle (0 ,0 ,0 ); +return 0 ; +}
tools/perf/config/feature-checks/test-strlcpy.c new file +8 -0
@@ -0,0 +1,8 @@ +#include <stdlib.h> +extern size_t strlcpy (char *dest,const char *src,size_t size); + +int main (void ) +{ +strlcpy (NULL ,NULL ,0 ); +return 0 ; +}
Signature · 1 line
1.7.11.7
Re: [PATCH 26/50] tools/perf/build: Split out feature check: 'libbfd'
tools/perf/config/Makefile FEATURE_TESTS = \ · line 127
Quoted 12 lines · Ingo Molnar
tools/perf/config/Makefile +1
-0@@ -121,6 +121,7 @@ FEATURE_TESTS = \ libperl \ libpython \ libpython-version \ + libbfd \ libnuma $(foreach test,$(FEATURE_TESTS),$(call feature_check,$(test),$(test)))
strlcpy missing from FEATURE_TESTS, but really the strlcpy changes should be a separate patch.
David
Quoted 62 lines
tools/perf/config/Makefile +1
-1@@ -423,7 +423,7 @@ else endif ifndef NO_STRLCPY - ifeq ($(call try-cc,$(SOURCE_STRLCPY),,-DHAVE_STRLCPY_SUPPORT),y) + ifeq ($(feature-strlcpy), 1) CFLAGS += -DHAVE_STRLCPY_SUPPORT endif endiftools/perf/config/feature-checks/Makefile +7
-0@@ -19,6 +19,7 @@ FILES= \ test-libperl \ test-libpython \ test-libpython-version \ + test-libbfd \ test-libnuma CC := $(CC) -MD@@ -112,6 +113,12 @@ test-libpython: test-libpython-version: $(BUILD) $(FLAGS_PYTHON_EMBED) +test-libbfd: + $(BUILD) -DPACKAGE='perf' -DPACKAGE=perf -lbfd -ldl + +test-strlcpy: + $(BUILD) + -include *.d */*.d ###############################tools/perf/config/feature-checks/test-libbfd.c new file +7
-0@@ -0,0 +1,7 @@ +#include <bfd.h> + +int main (void ) +{ +bfd_demangle (0 ,0 ,0 ); +return 0 ; +}tools/perf/config/feature-checks/test-strlcpy.c new file +8
-0@@ -0,0 +1,8 @@ +#include <stdlib.h> +extern size_t strlcpy (char *dest,const char *src,size_t size); + +int main (void ) +{ +strlcpy (NULL ,NULL ,0 ); +return 0 ; +}
Re: [PATCH 26/50] tools/perf/build: Split out feature check: 'libbfd'
Quoted 12 lines · David Ahern
Quoted 11 lines · Ingo Molnar
tools/perf/config/Makefile +1
-0@@ -121,6 +121,7 @@ FEATURE_TESTS = \ libperl \ libpython \ libpython-version \ + libbfd \ libnuma
Quoted 4 lines
tools/perf/config/Makefile FEATURE_TESTS = \ · line 127
Quoted 1 line
tools/perf/config/Makefile +0
-0$(foreach test,$(FEATURE_TESTS),$(call feature_check,$(test),$(test)))strlcpy missing from
FEATURE_TESTS, but really the strlcpy changes should be a separate patch.
it gets removed completely in here:
tools/perf: Turn strlcpy() into a __weak function
still I think David's right and there should be
separate patch for strlcpy check
jirka
Re: [PATCH 26/50] tools/perf/build: Split out feature check: 'libbfd'
Quoted 13 lines · Jiri Olsa
Quoted 12 lines · David Ahern
Quoted 11 lines · Ingo Molnar
tools/perf/config/Makefile +1
-0@@ -121,6 +121,7 @@ FEATURE_TESTS = \ libperl \ libpython \ libpython-version \ + libbfd \ libnuma
Quoted 4 lines
Quoted 4 lines
tools/perf/config/Makefile FEATURE_TESTS = \ · line 127
Quoted 1 line
tools/perf/config/Makefile +0
-0$(foreach test,$(FEATURE_TESTS),$(call feature_check,$(test),$(test)))strlcpy missing from
FEATURE_TESTS, but really the strlcpy changes should be a separate patch.
Indeed, that's an oversight.
Quoted 5 lines
it gets removed completely in here:
tools/perf: Turnstrlcpy()into a__weakfunctionstill I think David's right and there should be
separate patch for strlcpy check
Ok, I have created a separate patch for that, so that's logically consistent.
Thanks,
Ingo
PATCH 27/50 tools/perf/build: Split out feature check: 'on-exit'
In reply to Ingo Molnar--- tools/perf/config/Makefile | 3 ++- tools/perf/config/feature-checks/Makefile | 4 ++++ tools/perf/config/feature-checks/test-on-exit.c | 6 ++++++ 3 files changed, 12 insertions(+), 1 deletion(-)
tools/perf/config/Makefile +2 -1
@@ -122,6 +122,7 @@ FEATURE_TESTS = \ libpython \ libpython-version \ libbfd \ + on-exit \ libnuma $(foreach test,$(FEATURE_TESTS),$(call feature_check,$(test),$(test)))
@@ -429,7 +430,7 @@ ifndef NO_STRLCPY endif ifndef NO_ON_EXIT - ifeq ($(call try-cc,$(SOURCE_ON_EXIT),,-DHAVE_ON_EXIT_SUPPORT),y) + ifeq ($(feature-on-exit), 1) CFLAGS += -DHAVE_ON_EXIT_SUPPORT endif endif
tools/perf/config/feature-checks/Makefile +4 -0
@@ -20,6 +20,7 @@ FILES= \ test-libpython \ test-libpython-version \ test-libbfd \ + test-on-exit \ test-libnuma CC := $(CC) -MD
@@ -119,6 +120,9 @@ test-libbfd: test-strlcpy: $(BUILD) +test-on-exit: + $(BUILD) + -include *.d */*.d ###############################
tools/perf/config/feature-checks/test-on-exit.c new file +6 -0
@@ -0,0 +1,6 @@ +#include <stdio.h> + +int main (void ) +{ +return on_exit (NULL ,NULL ); +}
Signature · 1 line
1.7.11.7
PATCH 28/50 tools/perf/build: Split out feature check: 'backtrace'
In reply to Ingo Molnar--- tools/perf/config/Makefile | 3 ++- tools/perf/config/feature-checks/Makefile | 4 ++++ tools/perf/config/feature-checks/test-backtrace.c | 10 ++++++++++ 3 files changed, 16 insertions(+), 1 deletion(-)
tools/perf/config/Makefile +2 -1
@@ -123,6 +123,7 @@ FEATURE_TESTS = \ libpython-version \ libbfd \ on-exit \ + backtrace \ libnuma $(foreach test,$(FEATURE_TESTS),$(call feature_check,$(test),$(test)))
@@ -436,7 +437,7 @@ ifndef NO_ON_EXIT endif ifndef NO_BACKTRACE - ifeq ($(call try-cc,$(SOURCE_BACKTRACE),,-DHAVE_BACKTRACE_SUPPORT),y) + ifeq ($(feature-backtrace), 1) CFLAGS += -DHAVE_BACKTRACE_SUPPORT endif endif
tools/perf/config/feature-checks/Makefile +4 -0
@@ -21,6 +21,7 @@ FILES= \ test-libpython-version \ test-libbfd \ test-on-exit \ + test-backtrace \ test-libnuma CC := $(CC) -MD
@@ -123,6 +124,9 @@ test-strlcpy: test-on-exit: $(BUILD) +test-backtrace: + $(BUILD) + -include *.d */*.d ###############################
tools/perf/config/feature-checks/test-backtrace.c new file +10 -0
@@ -0,0 +1,10 @@ +#include <execinfo.h> +#include <stdio.h> + +int main (void ) +{ +backtrace (NULL ,0 ); +backtrace_symbols (NULL ,0 ); + +return 0 ; +}
Signature · 1 line
1.7.11.7
PATCH 29/50 tools/perf: Clean up util/include/linux/compiler.h
In reply to Ingo MolnarUse the standard CPP style we use in the kernel:
#ifndef foo
# define foo bar #endif
--- tools/perf/util/include/linux/compiler.h | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
tools/perf/util/include/linux/compiler.h +10 -5
@@ -2,20 +2,25 @@#define _PERF_LINUX_COMPILER_H_#ifndef __always_inline -#define __always_inline inline +# define __always_inline inline __attribute__((always_inline))#endif +#define __user +#ifndef __attribute_const__ -#define __attribute_const__ +# define __attribute_const__#endif #ifndef __maybe_unused -#define __maybe_unused __attribute__((unused)) +# define __maybe_unused __attribute__((unused)) +#endif + +#ifndef __packed +# define __packed __attribute__((__packed__))#endif -#define __packed __attribute__((__packed__))#ifndef __force -#define __force +# define __force#endif #endif
Signature · 1 line
1.7.11.7
PATCH 30/50 tools/perf: Turn strlcpy() into a __weak function
In reply to Ingo MolnarThe strlcpy() feature check slows every build unnecessarily - so make it a __weak function so it does not have to be auto-detected.
If the libc (or any other library) has an strlcpy() implementation it will be used - otherwise our fallback is active.
--- tools/perf/config/Makefile | 6 ------ tools/perf/config/feature-checks/Makefile | 3 --- tools/perf/config/feature-checks/test-strlcpy.c | 8 -------- tools/perf/util/cache.h | 3 +-- tools/perf/util/include/linux/compiler.h | 4 ++++ tools/perf/util/path.c | 10 +++++++--- 6 files changed, 12 insertions(+), 22 deletions(-)
tools/perf/config/Makefile +0 -6
@@ -424,12 +424,6 @@ else endif endif -ifndef NO_STRLCPY - ifeq ($(feature-strlcpy), 1) - CFLAGS += -DHAVE_STRLCPY_SUPPORT - endif -endif - ifndef NO_ON_EXIT ifeq ($(feature-on-exit), 1) CFLAGS += -DHAVE_ON_EXIT_SUPPORT
tools/perf/config/feature-checks/Makefile +0 -3
@@ -118,9 +118,6 @@ test-libpython-version: test-libbfd: $(BUILD) -DPACKAGE='perf' -DPACKAGE=perf -lbfd -ldl -test-strlcpy: - $(BUILD) - test-on-exit: $(BUILD)
tools/perf/config/feature-checks/test-strlcpy.c deleted +0 -8
@@ -1,8 +0,0 @@ -#include <stdlib.h> -extern size_t strlcpy (char *dest,const char *src,size_t size); - -int main (void ) -{ -strlcpy (NULL ,NULL ,0 ); -return 0 ; -}
tools/perf/util/cache.h +1 -2
@@ -70,8 +70,7 @@ extern char *perf_path(const char *fmt, ...) __attribute__((format (printf, 1, 2extern char *perf_pathdup (const char *fmt, ...) __attribute__((format (printf,1 ,2 ))); -#ifndef HAVE_STRLCPY_SUPPORT +/* Matches the libc/libbsd function attribute so we declare this unconditionally: */ extern size_t strlcpy (char *dest,const char *src,size_t size); -#endif #endif /* __PERF_CACHE_H */
tools/perf/util/include/linux/compiler.h +4 -0
@@ -23,4 +23,8 @@# define __force#endif +#ifndef __weak +# define __weak __attribute__((weak)) +#endif +#endif
tools/perf/util/path.c +7 -3
@@ -22,19 +22,23 @@ static const char *get_perf_dir(void)return "." ; } -#ifndef HAVE_STRLCPY_SUPPORT -size_t strlcpy (char *dest,const char *src,size_t size) +/* +* 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; } -#endif static char *get_pathname (void ) {
Signature · 1 line
1.7.11.7
PATCH 31/50 tools/perf/build: Speed up auto-detection of features by adding a 'test-all' target
In reply to Ingo MolnarConcatenate all feature checks into test-all.c.
This can be built and checked faster than all the individual tests.
If test-all fails then we still check all the individual features, so this is a pure speedup, it should have no effects on functionality.
--- tools/perf/config/Makefile | 48 ++++++++++-- tools/perf/config/feature-checks/Makefile | 3 + tools/perf/config/feature-checks/test-all.c | 196 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 240 insertions(+), 7 deletions(-)
tools/perf/config/Makefile +41 -7
@@ -89,17 +89,21 @@ CFLAGS += -std=gnu99 EXTLIBS = -lelf -lpthread -lrt -lm -ldl -feature_check = $(eval $(feature_check_code)); $(info CHK: config/feature-checks/test-$(1)) +feature_check = $(eval $(feature_check_code)) define feature_check_code - feature-$(2) := $(shell make -C config/feature-checks test-$1 >/dev/null 2>/dev/null && echo 1 || echo 0) + feature-$(1) := $(shell $(MAKE) -C config/feature-checks test-$1 >/dev/null 2>/dev/null && echo 1 || echo 0) +endef + +feature_set = $(eval $(feature_set_code)) +define feature_set_code + feature-$(1) := 1 endef # # Build the feature check binaries in parallel, ignore errors, ignore return value and suppress output: # -$(info Testing features:) -$(shell make -i -j -C config/feature-checks >/dev/null 2>&1) -$(info done) +$(info ) +$(info Auto-detecting system features:) FEATURE_TESTS = \ hello \
@@ -126,9 +130,38 @@ FEATURE_TESTS = \ backtrace \ libnuma -$(foreach test,$(FEATURE_TESTS),$(call feature_check,$(test),$(test))) +# +# Special fast-path for the 'all features are available' case: +# +$(call feature_check,all) + +ifeq ($(feature-all), 1) + $(foreach feat,$(FEATURE_TESTS),$(call feature_set,$(feat))) +else + $(shell $(MAKE) -i -j -C config/feature-checks >/dev/null 2>&1) + $(foreach feat,$(FEATURE_TESTS),$(call feature_check,$(feat))) +endif + +feature_print = $(eval $(feature_print_code)) + +# +# Print the result of the feature test: +# +define feature_print_code + ifeq ($(feature-$(1)), 1) + MSG := $(shell printf '...%30s: [ \033[32mon\033[m ]' $(1)) + else + MSG := $(shell printf '...%30s: [ \033[31mOFF\033[m ]' $(1)) + endif + $(info $(MSG)) +endef + +$(foreach feat,$(FEATURE_TESTS) DUMMY,$(call feature_print,$(feat))) + +# newline at the end of the feature printouts: +$(info ) -ifeq ($(stackprotector-all), 1) +ifeq ($(feature-stackprotector-all), 1) CFLAGS += -fstack-protector-all endif
@@ -167,6 +200,7 @@ CFLAGS += -I$(LIB_INCLUDE) CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE ifndef NO_BIONIC + $(feature_check,bionic) ifeq ($(feature-bionic), 1) BIONIC := 1 EXTLIBS := $(filter-out -lrt,$(EXTLIBS))
tools/perf/config/feature-checks/Makefile +3 -0
@@ -32,6 +32,9 @@ BUILD = $(CC) -o $(OUTPUT)$@ [email protected] ############################### +test-all: + $(BUILD) -Werror -fstack-protector -Wvolatile-register-var -O2 -Werror -D_FORTIFY_SOURCE=2 -ldw -lelf -lnuma -lunwind -lunwind-x86_64 -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' -DPACKAGE=perf -lbfd -ldl + test-hello: $(BUILD)
tools/perf/config/feature-checks/test-all.c new file +196 -0
196 lines not on this page · raw message
Signature · 1 line
1.7.11.7
Re: [PATCH 31/50] tools/perf/build: Speed up auto-detection of features by adding a 'test-all' target
On Mon, Oct 07, 2013 at 01:56:24PM +0200, Ingo Molnar wrote:
SNIP
Quoted 12 lines
tools/perf/config/Makefile +12
-0+ +# +# Print the result of the feature test: +# +define feature_print_code + ifeq ($(feature-$(1)), 1) + MSG := $(shell printf '...%30s: [ \033[32mon\033[m ]' $(1)) + else + MSG := $(shell printf '...%30s: [ \033[31mOFF\033[m ]' $(1)) + endif + $(info $(MSG)) +endef
tools/perf/config/Makefile FEATURE_TESTS = \ · line 166
Quoted 10 lines
tools/perf/config/Makefile +6
-1+ +$(foreach feat,$(FEATURE_TESTS) DUMMY,$(call feature_print,$(feat))) + +# newline at the end of the feature printouts: +$(info ) -ifeq ($(stackprotector-all), 1) +ifeq ($(feature-stackprotector-all), 1) CFLAGS += -fstack-protector-all endif
nit, belongs to:
tools/perf/build: Split out feature check: 'stackprotector-all'
jirka
Re: [PATCH 31/50] tools/perf/build: Speed up auto-detection of features by adding a 'test-all' target
Quoted 22 lines · Jiri Olsa
On Mon, Oct 07, 2013 at 01:56:24PM +0200, Ingo Molnar wrote:
SNIP
Quoted 18 lines
tools/perf/config/Makefile +17
-0+ +# +# Print the result of the feature test: +# +define feature_print_code + ifeq ($(feature-$(1)), 1) + MSG := $(shell printf '...%30s: [ \033[32mon\033[m ]' $(1)) + else + MSG := $(shell printf '...%30s: [ \033[31mOFF\033[m ]' $(1)) + endif + $(info $(MSG)) +endef + +$(foreach feat,$(FEATURE_TESTS) DUMMY,$(call feature_print,$(feat))) + +# newline at the end of the feature printouts: +$(info )
Quoted 7 lines
tools/perf/config/Makefile FEATURE_TESTS = \ · line 166
Quoted 4 lines
tools/perf/config/Makefile +1
-1-ifeq ($(stackprotector-all), 1) +ifeq ($(feature-stackprotector-all), 1) CFLAGS += -fstack-protector-all endifnit, belongs to:
tools/perf/build: Split out feature check: 'stackprotector-all'
Indeed, fixed.
I also fixed the next hunk:
Quoted 4 lines
ifndef
NO_BIONIC
+ $(feature_check,bionic)
ifeq ($(feature-bionic), 1)BIONIC := 1
Which was misplaced as well.
Thanks,
Ingo
Re: [PATCH 31/50] tools/perf/build: Speed up auto-detection of features by adding a 'test-all' target
In reply to Ingo MolnarOn Mon, Oct 07, 2013 at 01:56:24PM +0200, Ingo Molnar wrote:
SNIP
tools/perf/config/feature-checks/Makefile BUILD = $(CC) -o $(OUTPUT)$@ [email protected] · line 37
Quoted 11 lines
tools/perf/config/feature-checks/Makefile +3
-0@@ -32,6 +32,9 @@ BUILD = $(CC) -o $(OUTPUT)$@ [email protected] ############################### +test-all: + $(BUILD) -Werror -fstack-protector -Wvolatile-register-var -O2 -Werror -D_FORTIFY_SOURCE=2 -ldw -lelf -lnuma -lunwind -lunwind-x86_64 -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' -DPACKAGE=perf -lbfd -ldl +
missing -fstack-protector-all ?
jirka
PATCH 32/50 tools/perf/build: Speed up git-version test on re-make
In reply to Ingo Molnarutil/PERF-VERSION-GEN is currently executed on every build attempt, and this script can take a lot of time on trees that are at a significant git-distance from Linus's tree:
$ time util/PERF-VERSION-GEN
real 0m4.343s user 0m4.176s sys 0m0.140s
It also takes a lot of time if the Git repository is network attached, etc., because the commands it uses:
TAG=$(git describe --abbrev=0 --match "v[0-9].[0-9]*" 2>/dev/null )
has to count commits from the nearest tag and thus has to access (and decompress) every git commit blob on the relevant version path.
Even on Linus's tree it takes 0.28 seconds on a fast box to count all the commits and get the git version string:
$ time util/PERF-VERSION-GEN
real 0m0.279s user 0m0.247s sys 0m0.025s
But the version string only has to be regenerated if the git repository's head commit changes. So add a dependency of ../../.git/HEAD and touch the file every time it's regenerated, so that Make's build rules can pick it up and cache the result:
make: `PERF-VERSION-FILE' is up to date.
real 0m0.184s user 0m0.117s sys 0m0.026s
--- tools/perf/Makefile | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
tools/perf/Makefile +13 -2
@@ -70,8 +70,9 @@ ifneq ($(OUTPUT),) #$(info Determined 'OUTPUT' to be $(OUTPUT)) endif -$(OUTPUT)PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE +$(OUTPUT)PERF-VERSION-FILE: ../../.git/HEAD @$(SHELL_PATH) util/PERF-VERSION-GEN $(OUTPUT) + @touch $(OUTPUT)PERF-VERSION-FILE CC = $(CROSS_COMPILE)gcc AR = $(CROSS_COMPILE)ar
@@ -813,6 +814,16 @@ clean: $(LIBTRACEEVENT)-clean $(LIBLK)-clean $(RM) $(OUTPUT)util/*-flex* $(python-clean) +# +# Trick: if ../../.git does not exist - we are building out of tree for example, +# then force version regeneration: +# +ifeq ($(wildcard ../../.git/HEAD),) + GIT-HEAD-PHONY = ../../.git/HEAD +else + GIT-HEAD-PHONY = +endif + .PHONY: all install clean strip $(LIBTRACEEVENT) $(LIBLK) .PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell -.PHONY: .FORCE-PERF-VERSION-FILE TAGS tags cscope .FORCE-PERF-CFLAGS +.PHONY: $(GIT-HEAD-PHONY) TAGS tags cscope .FORCE-PERF-CFLAGS
Signature · 1 line
1.7.11.7
PATCH 33/50 tools/perf/build: Speed up the final link
In reply to Ingo Molnarlibtraceevent.a and liblk.a rules have always-missed dependencies, which causes python.so to be relinked at every build attempt - even if none of the affected code changes.
This slows down re-builds unnecessarily, by adding more than a second to the build time:
comet:~/tip/tools/perf> time make
...
SUBDIR /fast/mingo/tip/tools/lib/lk/
make[1]: `liblk.a' is up to date.
SUBDIR /fast/mingo/tip/tools/lib/traceevent/
LINK perf
GEN python/perf.so
real 0m1.701s user 0m1.338s sys 0m0.301s
Add the (trivial) dependencies to not force a re-link.
This speeds up an empty re-build enormously:
comet:~/tip/tools/perf> time make
...
real 0m0.207s user 0m0.134s sys 0m0.028s
[ This adds some coupling between the build dependencies of
libtraceevent and liblk - but until those stay relatively simple this should not be an issue. ]
--- tools/perf/Makefile | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
tools/perf/Makefile +7 -3
@@ -669,15 +669,19 @@ $(LIB_FILE): $(LIB_OBJS) $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(LIB_OBJS) # libtraceevent.a -$(LIBTRACEEVENT): +TE_SOURCES = $(wildcard $(TRACE_EVENT_DIR)*.[ch]) + +$(LIBTRACEEVENT): $(TE_SOURCES) $(QUIET_SUBDIR0)$(TRACE_EVENT_DIR) $(QUIET_SUBDIR1) O=$(OUTPUT) libtraceevent.a $(LIBTRACEEVENT)-clean: $(QUIET_SUBDIR0)$(TRACE_EVENT_DIR) $(QUIET_SUBDIR1) O=$(OUTPUT) clean +LIBLK_SOURCES = $(wildcard $(LK_PATH)*.[ch]) + # if subdir is set, we've been called from above so target has been built # already -$(LIBLK): +$(LIBLK): $(LIBLK_SOURCES) ifeq ($(subdir),) $(QUIET_SUBDIR0)$(LK_DIR) $(QUIET_SUBDIR1) O=$(OUTPUT) liblk.a endif
@@ -824,6 +828,6 @@ else GIT-HEAD-PHONY = endif -.PHONY: all install clean strip $(LIBTRACEEVENT) $(LIBLK) +.PHONY: all install clean strip .PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell .PHONY: $(GIT-HEAD-PHONY) TAGS tags cscope .FORCE-PERF-CFLAGS
Signature · 1 line
1.7.11.7
PATCH 34/50 tools/perf: Fix double/triple-build of the feature detection logic during 'make install' et al
In reply to Ingo MolnarLinus reported the following perf build system bug:
'Another annoyance during that make was that "make install" seems to
want to re-make the thing I just built. That's absolutely horrible, [...]'
The thing that got re-built were 'only' the (numerous) feature checks, not the whole project - but still it was mighty annoying as the feature checks took 9+ seconds even on reasonably fast boxes.
Even with the autodep patches where feature detection is much faster it wastes resources, wastes screen real estate and confuses users if we execute feature detection twice.
There were two sources for these unnecessary re-builds of the feature checks:
- Unnecessary nested invocations of $(MAKE), apparently to be able to do conditional compilation dependent on documentation tools presence. Use straight dependencies instead, with no nesting.
- A direct invocation of $(MAKE) to rebuild the PERF-VERSION-FILE. This is apparently done to be able to include it into the Makefile:
-include $(OUTPUT)PERF-VERSION-FILE
but that's entirely pointless for two reasons: 1) the version file gets regenerated by the initial build pass anyway, 2) including it is futile, given its contents:
#define PERF_VERSION "3.12.rc3.g8510c7"
'make' will interpret that as a comment line...
So just remove this part of the doc-generation logic.
With these things fixed a 'make install' now rebuilds only what is needed.
A repeated 'make install' on an already built tree is super fast now, it finishes in under 0.3 seconds:
#
# After the patch:
#
$ time make install
...
real 0m0.280s user 0m0.162s sys 0m0.054s
Prior all the autodep changes and prior this fix, a repeat 'make install' took 24.1 seconds (!) on the same system:
#
# Before the patches:
#
$ time make install
...
real 0m24.109s user 0m21.171s sys 0m2.449s
Which almost entirely was caused by fixable build system fat. We are now literally ~86 times faster.
A fresh rebuild and install now takes just 11.4 seconds:
#
# After the patch:
#
$ make clean $ time make -j16 install
...
real 0m11.457s user 1m43.411s sys 0m7.610s
Without the patches it took 27.8 seconds:
#
# Before the patches:
#
$ make clean $ time make -j16 install
...
real 0m27.801s user 1m59.242s sys 0m9.749s
So even in the complete rebuild case we are now ~2.5 times faster.
--- tools/perf/Documentation/Makefile | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-)
tools/perf/Documentation/Makefile +4 -13
@@ -192,13 +192,14 @@ do-install-man: man install-man: check-man-tools man -try-install-man: ifdef missing_tools - $(warning Please install $(missing_tools) to have the man pages installed) + DO_INSTALL_MAN = $(warning Please install $(missing_tools) to have the man pages installed) else - $(MAKE) do-install-man + DO_INSTALL_MAN = do-install-man endif +try-install-man: $(DO_INSTALL_MAN) + install-info: info $(INSTALL) -d -m 755 $(DESTDIR)$(infodir) $(INSTALL) -m 644 $(OUTPUT)perf.info $(OUTPUT)perfman.info $(DESTDIR)$(infodir)
@@ -216,14 +217,6 @@ install-pdf: pdf #install-html: html # '$(SHELL_PATH_SQ)' ./install-webdoc.sh $(DESTDIR)$(htmldir) -ifneq ($(MAKECMDGOALS),clean) -ifneq ($(MAKECMDGOALS),tags) -$(OUTPUT)PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE - $(QUIET_SUBDIR0)../ $(QUIET_SUBDIR1) $(OUTPUT)PERF-VERSION-FILE - --include $(OUTPUT)PERF-VERSION-FILE -endif -endif # # Determine "include::" file references in asciidoc files.
@@ -342,5 +335,3 @@ $(patsubst %.txt,%.html,$(wildcard howto/*.txt)): %.html : %.txt #quick-install-html: # '$(SHELL_PATH_SQ)' ./install-doc-quick.sh $(HTML_REF) $(DESTDIR)$(htmldir) - -.PHONY: .FORCE-PERF-VERSION-FILE
Signature · 1 line
1.7.11.7
PATCH 35/50 tools/perf/build: Invoke feature-checks 'clean' target from the main Makefile
In reply to Ingo Molnarconfig/Makefile is not included for the 'clean' target, so invoke the config/feature-checks/Makefile 'clean' target from Makefile.perf.
--- tools/perf/Makefile | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
tools/perf/Makefile +9 -2
@@ -808,7 +808,14 @@ $(INSTALL_DOC_TARGETS): ### Cleaning rules -clean: $(LIBTRACEEVENT)-clean $(LIBLK)-clean +# +# This is here, not in config/Makefile, because config/Makefile does +# not get included for the clean target: +# +config-clean: + @$(MAKE) -C config/feature-checks clean + +clean: $(LIBTRACEEVENT)-clean $(LIBLK)-clean config-clean $(RM) $(LIB_OBJS) $(BUILTIN_OBJS) $(LIB_FILE) $(OUTPUT)perf-archive $(OUTPUT)perf.o $(LANG_BINDINGS) $(RM) $(ALL_PROGRAMS) perf $(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope*
@@ -828,6 +835,6 @@ else GIT-HEAD-PHONY = endif -.PHONY: all install clean strip +.PHONY: all install clean config-clean strip .PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell .PHONY: $(GIT-HEAD-PHONY) TAGS tags cscope .FORCE-PERF-CFLAGS
Signature · 1 line
1.7.11.7
PATCH 36/50 tools/perf/build: Speed up auto-detection
In reply to Ingo MolnarThe detection of certain rarely detected features can be delayed to when they are actually needed.
So speed up the common case of auto-detection by pre-building only a core set of features and populating only their feature-flags.
[ Features not listed in CORE_FEATURES need to built explicitly
via the feature_check() function. ]
(Also order the feature names alphabetically, while at it.)
--- tools/perf/config/Makefile | 48 ++++++++++++++++++++++++++++-------------------- tools/perf/config/feature-checks/Makefile | 31 ++++++++++++++++--------------- 2 files changed, 44 insertions(+), 35 deletions(-)
tools/perf/config/Makefile +28 -20
@@ -105,30 +105,35 @@ endef $(info ) $(info Auto-detecting system features:) -FEATURE_TESTS = \ - hello \ - stackprotector-all \ - stackprotector \ - volatile-register-var \ +# +# Note that this is not a complete list of all feature tests, just +# those that are typically built on a fully configured system. +# +# [ Feature tests not mentioned here have to be built explicitly in +# the rule that uses them - an example for that is the 'bionic' +# feature check. ] +# +CORE_FEATURE_TESTS = \ + backtrace \ + dwarf \ fortify-source \ - bionic \ - libelf \ glibc \ - dwarf \ - libelf-mmap \ - libelf-getphdrnum \ - libunwind \ - libaudit \ - libslang \ gtk2 \ gtk2-infobar \ + libaudit \ + libbfd \ + libelf \ + libelf-getphdrnum \ + libelf-mmap \ + libnuma \ libperl \ libpython \ libpython-version \ - libbfd \ + libslang \ + libunwind \ on-exit \ - backtrace \ - libnuma + stackprotector-all \ + volatile-register-var # # Special fast-path for the 'all features are available' case:
@@ -136,10 +141,13 @@ FEATURE_TESTS = \ $(call feature_check,all) ifeq ($(feature-all), 1) - $(foreach feat,$(FEATURE_TESTS),$(call feature_set,$(feat))) + # + # test-all.c passed - just set all the core feature flags to 1: + # + $(foreach feat,$(CORE_FEATURE_TESTS),$(call feature_set,$(feat))) else - $(shell $(MAKE) -i -j -C config/feature-checks >/dev/null 2>&1) - $(foreach feat,$(FEATURE_TESTS),$(call feature_check,$(feat))) + $(shell $(MAKE) -i -j -C config/feature-checks $(CORE_FEATURE_TESTS) >/dev/null 2>&1) + $(foreach feat,$(CORE_FEATURE_TESTS),$(call feature_check,$(feat))) endif feature_print = $(eval $(feature_print_code))
@@ -156,7 +164,7 @@ define feature_print_code $(info $(MSG)) endef -$(foreach feat,$(FEATURE_TESTS) DUMMY,$(call feature_print,$(feat))) +$(foreach feat,$(CORE_FEATURE_TESTS) DUMMY,$(call feature_print,$(feat))) # newline at the end of the feature printouts: $(info )
tools/perf/config/feature-checks/Makefile +16 -15
@@ -1,28 +1,29 @@ FILES= \ - test-hello \ - test-stackprotector-all \ - test-stackprotector \ - test-volatile-register-var \ - test-fortify-source \ + test-all \ + test-backtrace \ test-bionic \ - test-libelf \ - test-glibc \ test-dwarf \ - test-libelf-mmap \ - test-libelf-getphdrnum \ - test-libunwind \ - test-libaudit \ - test-libslang \ + test-fortify-source \ + test-glibc \ test-gtk2 \ test-gtk2-infobar \ + test-hello \ + test-libaudit \ + test-libbfd \ + test-libelf \ + test-libelf-getphdrnum \ + test-libelf-mmap \ + test-libnuma \ test-libperl \ test-libpython \ test-libpython-version \ - test-libbfd \ + test-libslang \ + test-libunwind \ test-on-exit \ - test-backtrace \ - test-libnuma + test-stackprotector-all \ + test-stackprotector \ + test-volatile-register-var CC := $(CC) -MD
Signature · 1 line
1.7.11.7
Re: [PATCH 36/50] tools/perf/build: Speed up auto-detection
On Mon, Oct 07, 2013 at 01:56:29PM +0200, Ingo Molnar wrote:
SNIP
Quoted 34 lines
tools/perf/config/Makefile +17
-13-FEATURE_TESTS = \ - hello \ - stackprotector-all \ - stackprotector \ - volatile-register-var \ +# +# Note that this is not a complete list of all feature tests, just +# those that are typically built on a fully configured system. +# +# [ Feature tests not mentioned here have to be built explicitly in +# the rule that uses them - an example for that is the 'bionic' +# feature check. ] +# +CORE_FEATURE_TESTS = \ + backtrace \ + dwarf \ fortify-source \ - bionic \ - libelf \ glibc \ - dwarf \ - libelf-mmap \ - libelf-getphdrnum \ - libunwind \ - libaudit \ - libslang \ gtk2 \ gtk2-infobar \ + libaudit \ + libbfd \ + libelf \ + libelf-getphdrnum \ + libelf-mmap \ + libnuma \
tools/perf/config/Makefile endef · line 135
Quoted 10 lines
tools/perf/config/Makefile +3
-3libperl \ libpython \ libpython-version \ - libbfd \ + libslang \ + libunwind \ on-exit \ - backtrace \ - libnuma + stackprotector-all \
missing stackprotector?
I guess that various gcc version could support either of them or both.. so we need to check for both
looks like -fstack-protector-all overloads -fstack-protector but no harm to have them both added probably ;-)
jirka
Re: [PATCH 36/50] tools/perf/build: Speed up auto-detection
Quoted 42 lines · Jiri Olsa
On Mon, Oct 07, 2013 at 01:56:29PM +0200, Ingo Molnar wrote:
SNIP
Quoted 38 lines
tools/perf/config/Makefile +17
-14-FEATURE_TESTS = \ - hello \ - stackprotector-all \ - stackprotector \ - volatile-register-var \ +# +# Note that this is not a complete list of all feature tests, just +# those that are typically built on a fully configured system. +# +# [ Feature tests not mentioned here have to be built explicitly in +# the rule that uses them - an example for that is the 'bionic' +# feature check. ] +# +CORE_FEATURE_TESTS = \ + backtrace \ + dwarf \ fortify-source \ - bionic \ - libelf \ glibc \ - dwarf \ - libelf-mmap \ - libelf-getphdrnum \ - libunwind \ - libaudit \ - libslang \ gtk2 \ gtk2-infobar \ + libaudit \ + libbfd \ + libelf \ + libelf-getphdrnum \ + libelf-mmap \ + libnuma \ libperl \ libpython \ libpython-version \ - libbfd \
Quoted 8 lines
tools/perf/config/Makefile endef · line 135
Quoted 6 lines
tools/perf/config/Makefile +3
-2+ libslang \ + libunwind \ on-exit \ - backtrace \ - libnuma + stackprotector-all \missing stackprotector?
Thanks, fixed.
Btw., this was amazing of you to find during review, from such a supposedly identity transformation patch! :)
Quoted 5 lines
I guess that various gcc version could support either of them or both.. so we need to check for both
looks like -fstack-protector-all overloads -fstack-protector but no harm to have them both added probably ;-)
Yeah, both checks were there originally and it was an oversight from me to have only stackprotector-all in the final result.
(Had I left it out intentionally it would have been either a separate patch, or at least would have earned a mention in the changelog.)
Thanks,
Ingo
PATCH 37/50 tools/perf/build: Improve printout-of auto-detected features
In reply to Ingo MolnarChange the print-out of auto-detected features by making sure that repeat invocations of 'make' when all features are successfully detected do not produce the (rather lengthy) autodetection printout.
( When one or more features are missing then we still print out the
feature detection table, to make sure people are aware of the resulting limitations. )
--- tools/perf/config/Makefile | 42 +++++++++++++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 9 deletions(-)
tools/perf/config/Makefile +33 -9
@@ -102,8 +102,6 @@ endef # # Build the feature check binaries in parallel, ignore errors, ignore return value and suppress output: # -$(info ) -$(info Auto-detecting system features:) # # Note that this is not a complete list of all feature tests, just
@@ -136,9 +134,33 @@ CORE_FEATURE_TESTS = \ volatile-register-var # +# So here we detect whether test-all was rebuilt, to be able +# to skip the print-out of the long features list if the file +# existed before and after it was built: +# +ifeq ($(wildcard config/feature-checks/test-all),) + test-all-failed := 1 +else + test-all-failed := 0 +endif + +# # Special fast-path for the 'all features are available' case: # -$(call feature_check,all) +$(call feature_check,all,$(MSG)) + +# +# Just in case the build freshly failed, make sure we print the +# feature matrix: +# +ifeq ($(feature-all), 0) + test-all-failed := 1 +endif + +ifeq ($(test-all-failed),1) + $(info ) + $(info Auto-detecting system features:) +endif ifeq ($(feature-all), 1) #
@@ -150,11 +172,10 @@ else $(foreach feat,$(CORE_FEATURE_TESTS),$(call feature_check,$(feat))) endif -feature_print = $(eval $(feature_print_code)) - # # Print the result of the feature test: # +feature_print = $(eval $(feature_print_code)) define feature_print_code ifeq ($(feature-$(1)), 1) MSG := $(shell printf '...%30s: [ \033[32mon\033[m ]' $(1))
@@ -164,10 +185,13 @@ define feature_print_code $(info $(MSG)) endef -$(foreach feat,$(CORE_FEATURE_TESTS) DUMMY,$(call feature_print,$(feat))) - -# newline at the end of the feature printouts: -$(info ) +# +# Only print out our features if we rebuilt the testcases or if a test failed: +# +ifeq ($(test-all-failed), 1) + $(foreach feat,$(CORE_FEATURE_TESTS) DUMMY,$(call feature_print,$(feat))) + $(info ) +endif ifeq ($(feature-stackprotector-all), 1) CFLAGS += -fstack-protector-all
Signature · 1 line
1.7.11.7
Re: [PATCH 37/50] tools/perf/build: Improve printout-of auto-detected features
On Mon, Oct 07, 2013 at 01:56:30PM +0200, Ingo Molnar wrote:
SNIP
tools/perf/config/Makefile define feature_print_code · line 194
Quoted 7 lines
tools/perf/config/Makefile +7
-0+# +# Only print out our features if we rebuilt the testcases or if a test failed: +# +ifeq ($(test-all-failed), 1) + $(foreach feat,$(CORE_FEATURE_TESTS) DUMMY,$(call feature_print,$(feat))) + $(info ) +endif
found the DUMMY! what do I win? ;-)
jirka
Re: [PATCH 37/50] tools/perf/build: Improve printout-of auto-detected features
Quoted 4 lines · Jiri Olsa
On Mon, Oct 07, 2013 at 01:56:30PM +0200, Ingo Molnar wrote:
SNIP
Quoted 9 lines
tools/perf/config/Makefile define feature_print_code · line 194
Quoted 7 lines
tools/perf/config/Makefile +7
-0+# +# Only print out our features if we rebuilt the testcases or if a test failed: +# +ifeq ($(test-all-failed), 1) + $(foreach feat,$(CORE_FEATURE_TESTS) DUMMY,$(call feature_print,$(feat))) + $(info ) +endiffound the DUMMY! what do I win? ;-)
:-)
So, this is a bit of a GNU Make mystery to me. If I have a failure for at least one of the features, and if I leave out that DUMMY then I get this printout:
... libperl: [ OFF ]
... libpython: [ on ] ... libpython-version: [ on ] ... libslang: [ on ] ... libunwind: [ on ] ... on-exit: [ on ] ... stackprotector: [ on ] ... stackprotector-all: [ on ]
GEN python/perf.so
Note how the last entry is missing: volatile-register-var.
If I add the DUMMY I get the full printout:
... libperl: [ OFF ]
... libpython: [ on ] ... libpython-version: [ on ] ... libslang: [ on ] ... libunwind: [ on ] ... on-exit: [ on ] ... stackprotector: [ on ] ... stackprotector-all: [ on ] ... volatile-register-var: [ on ]
GEN python/perf.so
Somehow GNU Make appears to be eating terminal ouput - or I might have misunderstood something.
I hope it's the latter - but if it's the former then the DUMMY entry is needed :-/
Thanks,
Ingo
Re: [PATCH 37/50] tools/perf/build: Improve printout-of auto-detected features
On Tue, Oct 08, 2013 at 10:46:10AM +0200, Ingo Molnar wrote:
SNIP
Quoted 34 lines
So, this is a bit of a GNU Make mystery to me. If I have a failure for at least one of the features, and if I leave out that DUMMY then I get this printout:
... libperl: [ OFF ]
... libpython: [ on ] ... libpython-version: [ on ] ... libslang: [ on ] ... libunwind: [ on ] ... on-exit: [ on ] ... stackprotector: [ on ] ... stackprotector-all: [ on ]GEN python/perf.so
Note how the last entry is missing: volatile-register-var.
If I add the DUMMY I get the full printout:
... libperl: [ OFF ]
... libpython: [ on ] ... libpython-version: [ on ] ... libslang: [ on ] ... libunwind: [ on ] ... on-exit: [ on ] ... stackprotector: [ on ] ... stackprotector-all: [ on ] ... volatile-register-var: [ on ]GEN python/perf.so
Somehow GNU Make appears to be eating terminal ouput - or I might have misunderstood something.
Quoted 6 lines
I hope it's the latter - but if it's the former then the DUMMY entry is needed :-/
Thanks,
Ingo
I think the issue might be in the eval handling the $(info $(MSG)). With following change on top of your v2 patchset it works for me.
jirka
--- tools/perf/config/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
tools/perf/config/Makefile +3 -3
@@ -180,21 +180,21 @@ endif # # Print the result of the feature test: # -feature_print = $(eval $(feature_print_code)) +feature_print = $(eval $(feature_print_code)) $(info $(MSG)) + define feature_print_code ifeq ($(feature-$(1)), 1) MSG = $(shell printf '...%30s: [ \033[32mon\033[m ]' $(1)) else MSG = $(shell printf '...%30s: [ \033[31mOFF\033[m ]' $(1)) endif - $(info $(MSG)) endef # # Only print out our features if we rebuilt the testcases or if a test failed: # ifeq ($(test-all-failed), 1) - $(foreach feat,$(CORE_FEATURE_TESTS) DUMMY,$(call feature_print,$(feat))) + $(foreach feat,$(CORE_FEATURE_TESTS),$(call feature_print,$(feat))) $(info ) endif
Signature · 1 line
1.7.11.7
[PATCH 53/52] tools/perf/build: Clean up feature_print_code()
Quoted 41 lines · Jiri Olsa
On Tue, Oct 08, 2013 at 10:46:10AM +0200, Ingo Molnar wrote:
SNIP
Quoted 37 lines
So, this is a bit of a GNU Make mystery to me. If I have a failure for at least one of the features, and if I leave out that DUMMY then I get this printout:
... libperl: [ OFF ]
... libpython: [ on ] ... libpython-version: [ on ] ... libslang: [ on ] ... libunwind: [ on ] ... on-exit: [ on ] ... stackprotector: [ on ] ... stackprotector-all: [ on ]GEN python/perf.so
Note how the last entry is missing: volatile-register-var.
If I add the DUMMY I get the full printout:
... libperl: [ OFF ]
... libpython: [ on ] ... libpython-version: [ on ] ... libslang: [ on ] ... libunwind: [ on ] ... on-exit: [ on ] ... stackprotector: [ on ] ... stackprotector-all: [ on ] ... volatile-register-var: [ on ]GEN python/perf.so
Somehow GNU Make appears to be eating terminal ouput - or I might have misunderstood something.
I hope it's the latter - but if it's the former then the DUMMY entry is needed :-/
Quoted 6 lines
Quoted 3 lines
Thanks,
Ingo
I think the issue might be in the eval handling the $(info $(MSG)). With following change on top of your v2 patchset it works for me.
Indeed - and that works here too. Initially I was trying to solve it by forcing expansion:
MSG := ...
but I forgot that expansion does not necessarily force evaluation of the expression and that Make can still optimize such assignments away if their result is not used by a target, correct?
I've applied your cleanup patch below and added your signoff - is that fine with you?
Thanks,
Ingo
=====================>
Subject: tools/perf/build: Clean up feature_print_code()
From: Jiri Olsa <[email protected]>
Date: Tue, 8 Oct 2013 17:51:10 +0200
Remove DUMMY by making sure 'feature_print' is evaluated and thus all messages are printed.
--- tools/perf/config/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
tools/perf/config/Makefile +3 -3
@@ -180,21 +180,21 @@ endif # # Print the result of the feature test: # -feature_print = $(eval $(feature_print_code)) +feature_print = $(eval $(feature_print_code)) $(info $(MSG)) + define feature_print_code ifeq ($(feature-$(1)), 1) MSG = $(shell printf '...%30s: [ \033[32mon\033[m ]' $(1)) else MSG = $(shell printf '...%30s: [ \033[31mOFF\033[m ]' $(1)) endif - $(info $(MSG)) endef # # Only print out our features if we rebuilt the testcases or if a test failed: # ifeq ($(test-all-failed), 1) - $(foreach feat,$(CORE_FEATURE_TESTS) DUMMY,$(call feature_print,$(feat))) + $(foreach feat,$(CORE_FEATURE_TESTS),$(call feature_print,$(feat))) $(info ) endif
Re: [PATCH 53/52] tools/perf/build: Clean up feature_print_code()
On Wed, Oct 09, 2013 at 08:42:05AM +0200, Ingo Molnar wrote:
SNIP
Quoted 4 lines
Quoted 3 lines
I think the issue might be in the eval handling the $(info $(MSG)). With following change on top of your v2 patchset it works for me.
Quoted 8 lines
Indeed - and that works here too. Initially I was trying to solve it by forcing expansion:
MSG := ...but I forgot that expansion does not necessarily force evaluation of the expression and that Make can still optimize such assignments away if their result is not used by a target, correct?
I saw that the $(info $(MSG)) output was delayed to next iteration, that's why an extra item (DUMMY) was needed to display all of them
so I guessed the eval had issues with $(info ...) and put it away.. not sure what the actual reason was.. we could go with your explanation ;-)
Quoted 3 lines
I've applied your cleanup patch below and added your signoff - is that fine with you?
sure, np
thanks,
jirka
tip-bot for Jiri Olsa
merge bot[tip:perf/core] tools/perf/build: Clean up feature_print_code()
In reply to Jiri Olsatools/perf/build: Clean up feature_print_code()
Commit-ID: 165108a92fc554d51e73b143b69b77e7c278da78 Gitweb: http://git.kernel.org/tip/165108a92fc554d51e73b143b69b77e7c278da78 Author: Jiri Olsa <[email protected]> AuthorDate: Tue, 8 Oct 2013 17:51:10 +0200 Committer: Ingo Molnar <[email protected]> CommitDate: Wed, 9 Oct 2013 08:49:04 +0200
tools/perf/build: Clean up feature_print_code()
Remove DUMMY by making sure 'feature_print' is evaluated and thus all messages are printed.
--- tools/perf/config/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
tools/perf/config/Makefile +3 -3
@@ -180,21 +180,21 @@ endif # # Print the result of the feature test: # -feature_print = $(eval $(feature_print_code)) +feature_print = $(eval $(feature_print_code)) $(info $(MSG)) + define feature_print_code ifeq ($(feature-$(1)), 1) MSG = $(shell printf '...%30s: [ \033[32mon\033[m ]' $(1)) else MSG = $(shell printf '...%30s: [ \033[31mOFF\033[m ]' $(1)) endif - $(info $(MSG)) endef # # Only print out our features if we rebuilt the testcases or if a test failed: # ifeq ($(test-all-failed), 1) - $(foreach feat,$(CORE_FEATURE_TESTS) DUMMY,$(call feature_print,$(feat))) + $(foreach feat,$(CORE_FEATURE_TESTS),$(call feature_print,$(feat))) $(info ) endif
PATCH 38/50 tools/perf/build: Automatically build in parallel, based on number of CPUs in the system
In reply to Ingo MolnarImplement automatic parallel builds when building in tools/perf:
$ time make
# [ perf build: Doing 'make -j12' parallel build. ]
Auto-detecting system features:
...
real 0m9.265s user 0m59.888s sys 0m6.082s
On GNU make achieving this is not particularly easy, it requires a separate makefile, which then invokes the main Makefile.
( Note: this patch adds Makefile.parallel to show the concept - the two
makefiles will be flipped in the next patch to avoid having to specify -f to get parallelism in the default build. )
--- tools/perf/Makefile.parallel | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+)
tools/perf/Makefile.parallel new file +26 -0
@@ -0,0 +1,26 @@ +# +# Do a parallel build with multiple jobs, based on the number of CPUs online +# in this system: 'make -j8' on a 8-CPU system, etc. +# +# (To override it, run 'make JOBS=1' and similar.) +# +ifeq ($(JOBS),) + JOBS := $(shell grep -c ^processor /proc/cpuinfo 2>/dev/null) + ifeq ($(JOBS),) + JOBS := 1 + endif +endif + +export JOBS + +$(info $(shell printf '# [ perf build: Doing '\''make \033[33m-j'$(JOBS)'\033[m'\'' parallel build. ]\n')) + +# +# Needed if no target specified: +# +all: + @$(MAKE) --no-print-directory -j$(JOBS) $@ + +%: + @$(MAKE) --no-print-directory -j$(JOBS) $@ +
Signature · 1 line
1.7.11.7
PATCH 39/50 tools/perf/build: Flip Makefile.parallel and Makefile.perf
In reply to Ingo MolnarTo make it more apparent that there is not change in functionality we introduced Makefile.parallel separately and now flip it with the main Makefile, which moves into Makefile.perf.
The renames are:
Makefile.parallel => Makefile
Makefile => Makefile.perf
--- tools/perf/Makefile | 843 ++------------------------------------------------------------- tools/perf/Makefile.parallel | 26 -- tools/perf/Makefile.perf | 841 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 855 insertions(+), 855 deletions(-)
tools/perf/Makefile +14 -829
@@ -1,840 +1,25 @@ -include ../scripts/Makefile.include - -# The default target of this Makefile is... -all: - -include config/utilities.mak - -# Define V to have a more verbose compile. -# -# Define O to save output files in a separate directory. -# -# Define ARCH as name of target architecture if you want cross-builds. -# -# Define CROSS_COMPILE as prefix name of compiler if you want cross-builds. -# -# Define NO_LIBPERL to disable perl script extension. -# -# Define NO_LIBPYTHON to disable python script extension. -# -# Define PYTHON to point to the python binary if the default -# `python' is not correct; for example: PYTHON=python2 -# -# Define PYTHON_CONFIG to point to the python-config binary if -# the default `$(PYTHON)-config' is not correct. -# -# Define ASCIIDOC8 if you want to format documentation with AsciiDoc 8 -# -# Define DOCBOOK_XSL_172 if you want to format man pages with DocBook XSL v1.72. -# -# Define LDFLAGS=-static to build a static binary. -# -# Define EXTRA_CFLAGS=-m64 or EXTRA_CFLAGS=-m32 as appropriate for cross-builds. -# -# Define NO_DWARF if you do not want debug-info analysis feature at all. -# -# Define WERROR=0 to disable treating any warnings as errors. -# -# Define NO_NEWT if you do not want TUI support. (deprecated) -# -# Define NO_SLANG if you do not want TUI support. -# -# Define NO_GTK2 if you do not want GTK+ GUI support. -# -# Define NO_DEMANGLE if you do not want C++ symbol demangling. -# -# Define NO_LIBELF if you do not want libelf dependency (e.g. cross-builds) -# -# Define NO_LIBUNWIND if you do not want libunwind dependency for dwarf -# backtrace post unwind. # -# Define NO_BACKTRACE if you do not want stack backtrace debug feature +# Do a parallel build with multiple jobs, based on the number of CPUs online +# in this system: 'make -j8' on a 8-CPU system, etc. # -# Define NO_LIBNUMA if you do not want numa perf benchmark +# (To override it, run 'make JOBS=1' and similar.) # -# Define NO_LIBAUDIT if you do not want libaudit support -# -# Define NO_LIBBIONIC if you do not want bionic support - -ifeq ($(srctree),) -srctree := $(patsubst %/,%,$(dir $(shell pwd))) -srctree := $(patsubst %/,%,$(dir $(srctree))) -#$(info Determined 'srctree' to be $(srctree)) -endif - -ifneq ($(objtree),) -#$(info Determined 'objtree' to be $(objtree)) -endif - -ifneq ($(OUTPUT),) -#$(info Determined 'OUTPUT' to be $(OUTPUT)) -endif - -$(OUTPUT)PERF-VERSION-FILE: ../../.git/HEAD - @$(SHELL_PATH) util/PERF-VERSION-GEN $(OUTPUT) - @touch $(OUTPUT)PERF-VERSION-FILE - -CC = $(CROSS_COMPILE)gcc -AR = $(CROSS_COMPILE)ar - -RM = rm -f -MKDIR = mkdir -FIND = find -INSTALL = install -FLEX = flex -BISON = bison -STRIP = strip - -LK_DIR = $(srctree)/tools/lib/lk/ -TRACE_EVENT_DIR = $(srctree)/tools/lib/traceevent/ - -# include config/Makefile by default and rule out -# non-config cases -config := 1 - -NON_CONFIG_TARGETS := clean TAGS tags cscope help - -ifdef MAKECMDGOALS -ifeq ($(filter-out $(NON_CONFIG_TARGETS),$(MAKECMDGOALS)),) - config := 0 -endif -endif - -ifeq ($(config),1) -include config/Makefile -endif - -export prefix bindir sharedir sysconfdir - -# sparse is architecture-neutral, which means that we need to tell it -# explicitly what architecture to check for. Fix this up for yours.. -SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__ - -# Guard against environment variables -BUILTIN_OBJS = -LIB_H = -LIB_OBJS = -PYRF_OBJS = -SCRIPT_SH = - -SCRIPT_SH += perf-archive.sh - -grep-libs = $(filter -l%,$(1)) -strip-libs = $(filter-out -l%,$(1)) - -ifneq ($(OUTPUT),) - TE_PATH=$(OUTPUT) -ifneq ($(subdir),) - LK_PATH=$(OUTPUT)/../lib/lk/ -else - LK_PATH=$(OUTPUT) -endif -else - TE_PATH=$(TRACE_EVENT_DIR) - LK_PATH=$(LK_DIR) -endif - -LIBTRACEEVENT = $(TE_PATH)libtraceevent.a -export LIBTRACEEVENT - -LIBLK = $(LK_PATH)liblk.a -export LIBLK - -# python extension build directories -PYTHON_EXTBUILD := $(OUTPUT)python_ext_build/ -PYTHON_EXTBUILD_LIB := $(PYTHON_EXTBUILD)lib/ -PYTHON_EXTBUILD_TMP := $(PYTHON_EXTBUILD)tmp/ -export PYTHON_EXTBUILD_LIB PYTHON_EXTBUILD_TMP - -python-clean := rm -rf $(PYTHON_EXTBUILD) $(OUTPUT)python/perf.so - -PYTHON_EXT_SRCS := $(shell grep -v ^\# util/python-ext-sources) -PYTHON_EXT_DEPS := util/python-ext-sources util/setup.py $(LIBTRACEEVENT) $(LIBLK) - -$(OUTPUT)python/perf.so: $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS) - $(QUIET_GEN)CFLAGS='$(CFLAGS)' $(PYTHON_WORD) util/setup.py \ - --quiet build_ext; \ - mkdir -p $(OUTPUT)python && \ - cp $(PYTHON_EXTBUILD_LIB)perf.so $(OUTPUT)python/ -# -# No Perl scripts right now: -# - -SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH)) - -# -# Single 'perf' binary right now: -# -PROGRAMS += $(OUTPUT)perf - -# what 'all' will build and 'install' will install, in perfexecdir -ALL_PROGRAMS = $(PROGRAMS) $(SCRIPTS) - -# what 'all' will build but not install in perfexecdir -OTHER_PROGRAMS = $(OUTPUT)perf - -# Set paths to tools early so that they can be used for version tests. -ifndef SHELL_PATH - SHELL_PATH = /bin/sh -endif -ifndef PERL_PATH - PERL_PATH = /usr/bin/perl -endif - -export PERL_PATH - -$(OUTPUT)util/parse-events-flex.c: util/parse-events.l $(OUTPUT)util/parse-events-bison.c - $(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/parse-events-flex.h $(PARSER_DEBUG_FLEX) -t util/parse-events.l > $(OUTPUT)util/parse-events-flex.c - -$(OUTPUT)util/parse-events-bison.c: util/parse-events.y - $(QUIET_BISON)$(BISON) -v util/parse-events.y -d $(PARSER_DEBUG_BISON) -o $(OUTPUT)util/parse-events-bison.c -p parse_events_ - -$(OUTPUT)util/pmu-flex.c: util/pmu.l $(OUTPUT)util/pmu-bison.c - $(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/pmu-flex.h -t util/pmu.l > $(OUTPUT)util/pmu-flex.c - -$(OUTPUT)util/pmu-bison.c: util/pmu.y - $(QUIET_BISON)$(BISON) -v util/pmu.y -d -o $(OUTPUT)util/pmu-bison.c -p perf_pmu_ - -$(OUTPUT)util/parse-events.o: $(OUTPUT)util/parse-events-flex.c $(OUTPUT)util/parse-events-bison.c -$(OUTPUT)util/pmu.o: $(OUTPUT)util/pmu-flex.c $(OUTPUT)util/pmu-bison.c - -LIB_FILE=$(OUTPUT)libperf.a - -LIB_H += ../../include/uapi/linux/perf_event.h -LIB_H += ../../include/linux/rbtree.h -LIB_H += ../../include/linux/list.h -LIB_H += ../../include/uapi/linux/const.h -LIB_H += ../../include/linux/hash.h -LIB_H += ../../include/linux/stringify.h -LIB_H += util/include/linux/bitmap.h -LIB_H += util/include/linux/bitops.h -LIB_H += util/include/linux/compiler.h -LIB_H += util/include/linux/const.h -LIB_H += util/include/linux/ctype.h -LIB_H += util/include/linux/kernel.h -LIB_H += util/include/linux/list.h -LIB_H += util/include/linux/export.h -LIB_H += util/include/linux/magic.h -LIB_H += util/include/linux/poison.h -LIB_H += util/include/linux/prefetch.h -LIB_H += util/include/linux/rbtree.h -LIB_H += util/include/linux/rbtree_augmented.h -LIB_H += util/include/linux/string.h -LIB_H += util/include/linux/types.h -LIB_H += util/include/linux/linkage.h -LIB_H += util/include/asm/asm-offsets.h -LIB_H += util/include/asm/bug.h -LIB_H += util/include/asm/byteorder.h -LIB_H += util/include/asm/hweight.h -LIB_H += util/include/asm/swab.h -LIB_H += util/include/asm/system.h -LIB_H += util/include/asm/uaccess.h -LIB_H += util/include/dwarf-regs.h -LIB_H += util/include/asm/dwarf2.h -LIB_H += util/include/asm/cpufeature.h -LIB_H += util/include/asm/unistd_32.h -LIB_H += util/include/asm/unistd_64.h -LIB_H += perf.h -LIB_H += util/annotate.h -LIB_H += util/cache.h -LIB_H += util/callchain.h -LIB_H += util/build-id.h -LIB_H += util/debug.h -LIB_H += util/sysfs.h -LIB_H += util/pmu.h -LIB_H += util/event.h -LIB_H += util/evsel.h -LIB_H += util/evlist.h -LIB_H += util/exec_cmd.h -LIB_H += util/types.h -LIB_H += util/levenshtein.h -LIB_H += util/machine.h -LIB_H += util/map.h -LIB_H += util/parse-options.h -LIB_H += util/parse-events.h -LIB_H += util/quote.h -LIB_H += util/util.h -LIB_H += util/xyarray.h -LIB_H += util/header.h -LIB_H += util/help.h -LIB_H += util/session.h -LIB_H += util/strbuf.h -LIB_H += util/strlist.h -LIB_H += util/strfilter.h -LIB_H += util/svghelper.h -LIB_H += util/tool.h -LIB_H += util/run-command.h -LIB_H += util/sigchain.h -LIB_H += util/dso.h -LIB_H += util/symbol.h -LIB_H += util/color.h -LIB_H += util/values.h -LIB_H += util/sort.h -LIB_H += util/hist.h -LIB_H += util/thread.h -LIB_H += util/thread_map.h -LIB_H += util/trace-event.h -LIB_H += util/probe-finder.h -LIB_H += util/dwarf-aux.h -LIB_H += util/probe-event.h -LIB_H += util/pstack.h -LIB_H += util/cpumap.h -LIB_H += util/top.h -LIB_H += $(ARCH_INCLUDE) -LIB_H += util/cgroup.h -LIB_H += $(LIB_INCLUDE)traceevent/event-parse.h -LIB_H += util/target.h -LIB_H += util/rblist.h -LIB_H += util/intlist.h -LIB_H += util/perf_regs.h -LIB_H += util/unwind.h -LIB_H += util/vdso.h -LIB_H += ui/helpline.h -LIB_H += ui/progress.h -LIB_H += ui/util.h -LIB_H += ui/ui.h - -LIB_OBJS += $(OUTPUT)util/abspath.o -LIB_OBJS += $(OUTPUT)util/alias.o -LIB_OBJS += $(OUTPUT)util/annotate.o -LIB_OBJS += $(OUTPUT)util/build-id.o -LIB_OBJS += $(OUTPUT)util/config.o -LIB_OBJS += $(OUTPUT)util/ctype.o -LIB_OBJS += $(OUTPUT)util/sysfs.o -LIB_OBJS += $(OUTPUT)util/pmu.o -LIB_OBJS += $(OUTPUT)util/environment.o -LIB_OBJS += $(OUTPUT)util/event.o -LIB_OBJS += $(OUTPUT)util/evlist.o -LIB_OBJS += $(OUTPUT)util/evsel.o -LIB_OBJS += $(OUTPUT)util/exec_cmd.o -LIB_OBJS += $(OUTPUT)util/help.o -LIB_OBJS += $(OUTPUT)util/levenshtein.o -LIB_OBJS += $(OUTPUT)util/parse-options.o -LIB_OBJS += $(OUTPUT)util/parse-events.o -LIB_OBJS += $(OUTPUT)util/path.o -LIB_OBJS += $(OUTPUT)util/rbtree.o -LIB_OBJS += $(OUTPUT)util/bitmap.o -LIB_OBJS += $(OUTPUT)util/hweight.o -LIB_OBJS += $(OUTPUT)util/run-command.o -LIB_OBJS += $(OUTPUT)util/quote.o -LIB_OBJS += $(OUTPUT)util/strbuf.o -LIB_OBJS += $(OUTPUT)util/string.o -LIB_OBJS += $(OUTPUT)util/strlist.o -LIB_OBJS += $(OUTPUT)util/strfilter.o -LIB_OBJS += $(OUTPUT)util/top.o -LIB_OBJS += $(OUTPUT)util/usage.o -LIB_OBJS += $(OUTPUT)util/wrapper.o -LIB_OBJS += $(OUTPUT)util/sigchain.o -LIB_OBJS += $(OUTPUT)util/dso.o -LIB_OBJS += $(OUTPUT)util/symbol.o -LIB_OBJS += $(OUTPUT)util/symbol-elf.o -LIB_OBJS += $(OUTPUT)util/color.o -LIB_OBJS += $(OUTPUT)util/pager.o -LIB_OBJS += $(OUTPUT)util/header.o -LIB_OBJS += $(OUTPUT)util/callchain.o -LIB_OBJS += $(OUTPUT)util/values.o -LIB_OBJS += $(OUTPUT)util/debug.o -LIB_OBJS += $(OUTPUT)util/machine.o -LIB_OBJS += $(OUTPUT)util/map.o -LIB_OBJS += $(OUTPUT)util/pstack.o -LIB_OBJS += $(OUTPUT)util/session.o -LIB_OBJS += $(OUTPUT)util/thread.o -LIB_OBJS += $(OUTPUT)util/thread_map.o -LIB_OBJS += $(OUTPUT)util/trace-event-parse.o -LIB_OBJS += $(OUTPUT)util/parse-events-flex.o -LIB_OBJS += $(OUTPUT)util/parse-events-bison.o -LIB_OBJS += $(OUTPUT)util/pmu-flex.o -LIB_OBJS += $(OUTPUT)util/pmu-bison.o -LIB_OBJS += $(OUTPUT)util/trace-event-read.o -LIB_OBJS += $(OUTPUT)util/trace-event-info.o -LIB_OBJS += $(OUTPUT)util/trace-event-scripting.o -LIB_OBJS += $(OUTPUT)util/svghelper.o -LIB_OBJS += $(OUTPUT)util/sort.o -LIB_OBJS += $(OUTPUT)util/hist.o -LIB_OBJS += $(OUTPUT)util/probe-event.o -LIB_OBJS += $(OUTPUT)util/util.o -LIB_OBJS += $(OUTPUT)util/xyarray.o -LIB_OBJS += $(OUTPUT)util/cpumap.o -LIB_OBJS += $(OUTPUT)util/cgroup.o -LIB_OBJS += $(OUTPUT)util/target.o -LIB_OBJS += $(OUTPUT)util/rblist.o -LIB_OBJS += $(OUTPUT)util/intlist.o -LIB_OBJS += $(OUTPUT)util/vdso.o -LIB_OBJS += $(OUTPUT)util/stat.o -LIB_OBJS += $(OUTPUT)util/record.o - -LIB_OBJS += $(OUTPUT)ui/setup.o -LIB_OBJS += $(OUTPUT)ui/helpline.o -LIB_OBJS += $(OUTPUT)ui/progress.o -LIB_OBJS += $(OUTPUT)ui/util.o -LIB_OBJS += $(OUTPUT)ui/hist.o -LIB_OBJS += $(OUTPUT)ui/stdio/hist.o - -LIB_OBJS += $(OUTPUT)arch/common.o - -LIB_OBJS += $(OUTPUT)tests/parse-events.o -LIB_OBJS += $(OUTPUT)tests/dso-data.o -LIB_OBJS += $(OUTPUT)tests/attr.o -LIB_OBJS += $(OUTPUT)tests/vmlinux-kallsyms.o -LIB_OBJS += $(OUTPUT)tests/open-syscall.o -LIB_OBJS += $(OUTPUT)tests/open-syscall-all-cpus.o -LIB_OBJS += $(OUTPUT)tests/open-syscall-tp-fields.o -LIB_OBJS += $(OUTPUT)tests/mmap-basic.o -LIB_OBJS += $(OUTPUT)tests/perf-record.o -LIB_OBJS += $(OUTPUT)tests/rdpmc.o -LIB_OBJS += $(OUTPUT)tests/evsel-roundtrip-name.o -LIB_OBJS += $(OUTPUT)tests/evsel-tp-sched.o -LIB_OBJS += $(OUTPUT)tests/pmu.o -LIB_OBJS += $(OUTPUT)tests/hists_link.o -LIB_OBJS += $(OUTPUT)tests/python-use.o -LIB_OBJS += $(OUTPUT)tests/bp_signal.o -LIB_OBJS += $(OUTPUT)tests/bp_signal_overflow.o -LIB_OBJS += $(OUTPUT)tests/task-exit.o -LIB_OBJS += $(OUTPUT)tests/sw-clock.o -ifeq ($(ARCH),x86) -LIB_OBJS += $(OUTPUT)tests/perf-time-to-tsc.o -endif -LIB_OBJS += $(OUTPUT)tests/code-reading.o -LIB_OBJS += $(OUTPUT)tests/sample-parsing.o -LIB_OBJS += $(OUTPUT)tests/parse-no-sample-id-all.o - -BUILTIN_OBJS += $(OUTPUT)builtin-annotate.o -BUILTIN_OBJS += $(OUTPUT)builtin-bench.o -# Benchmark modules -BUILTIN_OBJS += $(OUTPUT)bench/sched-messaging.o -BUILTIN_OBJS += $(OUTPUT)bench/sched-pipe.o -ifeq ($(RAW_ARCH),x86_64) -BUILTIN_OBJS += $(OUTPUT)bench/mem-memcpy-x86-64-asm.o -BUILTIN_OBJS += $(OUTPUT)bench/mem-memset-x86-64-asm.o -endif -BUILTIN_OBJS += $(OUTPUT)bench/mem-memcpy.o -BUILTIN_OBJS += $(OUTPUT)bench/mem-memset.o - -BUILTIN_OBJS += $(OUTPUT)builtin-diff.o -BUILTIN_OBJS += $(OUTPUT)builtin-evlist.o -BUILTIN_OBJS += $(OUTPUT)builtin-help.o -BUILTIN_OBJS += $(OUTPUT)builtin-sched.o -BUILTIN_OBJS += $(OUTPUT)builtin-buildid-list.o -BUILTIN_OBJS += $(OUTPUT)builtin-buildid-cache.o -BUILTIN_OBJS += $(OUTPUT)builtin-list.o -BUILTIN_OBJS += $(OUTPUT)builtin-record.o -BUILTIN_OBJS += $(OUTPUT)builtin-report.o -BUILTIN_OBJS += $(OUTPUT)builtin-stat.o -BUILTIN_OBJS += $(OUTPUT)builtin-timechart.o -BUILTIN_OBJS += $(OUTPUT)builtin-top.o -BUILTIN_OBJS += $(OUTPUT)builtin-script.o -BUILTIN_OBJS += $(OUTPUT)builtin-probe.o -BUILTIN_OBJS += $(OUTPUT)builtin-kmem.o -BUILTIN_OBJS += $(OUTPUT)builtin-lock.o -BUILTIN_OBJS += $(OUTPUT)builtin-kvm.o -BUILTIN_OBJS += $(OUTPUT)builtin-inject.o -BUILTIN_OBJS += $(OUTPUT)tests/builtin-test.o -BUILTIN_OBJS += $(OUTPUT)builtin-mem.o - -PERFLIBS = $(LIB_FILE) $(LIBLK) $(LIBTRACEEVENT) - -# We choose to avoid "if .. else if .. else .. endif endif" -# because maintaining the nesting to match is a pain. If -# we had "elif" things would have been much nicer... - --include arch/$(ARCH)/Makefile - -ifneq ($(OUTPUT),) - CFLAGS += -I$(OUTPUT) -endif - -ifdef NO_LIBELF -EXTLIBS := $(filter-out -lelf,$(EXTLIBS)) - -# Remove ELF/DWARF dependent codes -LIB_OBJS := $(filter-out $(OUTPUT)util/symbol-elf.o,$(LIB_OBJS)) -LIB_OBJS := $(filter-out $(OUTPUT)util/dwarf-aux.o,$(LIB_OBJS)) -LIB_OBJS := $(filter-out $(OUTPUT)util/probe-event.o,$(LIB_OBJS)) -LIB_OBJS := $(filter-out $(OUTPUT)util/probe-finder.o,$(LIB_OBJS)) - -BUILTIN_OBJS := $(filter-out $(OUTPUT)builtin-probe.o,$(BUILTIN_OBJS)) - -# Use minimal symbol handling -LIB_OBJS += $(OUTPUT)util/symbol-minimal.o - -else # NO_LIBELF -ifndef NO_DWARF - LIB_OBJS += $(OUTPUT)util/probe-finder.o - LIB_OBJS += $(OUTPUT)util/dwarf-aux.o -endif # NO_DWARF -endif # NO_LIBELF - -ifndef NO_LIBUNWIND - LIB_OBJS += $(OUTPUT)util/unwind.o -endif -LIB_OBJS += $(OUTPUT)tests/keep-tracking.o - -ifndef NO_LIBAUDIT - BUILTIN_OBJS += $(OUTPUT)builtin-trace.o -endif - -ifndef NO_SLANG - LIB_OBJS += $(OUTPUT)ui/browser.o - LIB_OBJS += $(OUTPUT)ui/browsers/annotate.o - LIB_OBJS += $(OUTPUT)ui/browsers/hists.o - LIB_OBJS += $(OUTPUT)ui/browsers/map.o - LIB_OBJS += $(OUTPUT)ui/browsers/scripts.o - LIB_OBJS += $(OUTPUT)ui/tui/setup.o - LIB_OBJS += $(OUTPUT)ui/tui/util.o - LIB_OBJS += $(OUTPUT)ui/tui/helpline.o - LIB_OBJS += $(OUTPUT)ui/tui/progress.o - LIB_H += ui/browser.h - LIB_H += ui/browsers/map.h - LIB_H += ui/keysyms.h - LIB_H += ui/libslang.h -endif - -ifndef NO_GTK2 - LIB_OBJS += $(OUTPUT)ui/gtk/browser.o - LIB_OBJS += $(OUTPUT)ui/gtk/hists.o - LIB_OBJS += $(OUTPUT)ui/gtk/setup.o - LIB_OBJS += $(OUTPUT)ui/gtk/util.o - LIB_OBJS += $(OUTPUT)ui/gtk/helpline.o - LIB_OBJS += $(OUTPUT)ui/gtk/progress.o - LIB_OBJS += $(OUTPUT)ui/gtk/annotate.o -endif - -ifndef NO_LIBPERL - LIB_OBJS += $(OUTPUT)util/scripting-engines/trace-event-perl.o - LIB_OBJS += $(OUTPUT)scripts/perl/Perf-Trace-Util/Context.o -endif - -ifndef NO_LIBPYTHON - LIB_OBJS += $(OUTPUT)util/scripting-engines/trace-event-python.o - LIB_OBJS += $(OUTPUT)scripts/python/Perf-Trace-Util/Context.o -endif - -ifeq ($(NO_PERF_REGS),0) - ifeq ($(ARCH),x86) - LIB_H += arch/x86/include/perf_regs.h +ifeq ($(JOBS),) + JOBS := $(shell grep -c ^processor /proc/cpuinfo 2>/dev/null) + ifeq ($(JOBS),) + JOBS := 1 endif endif -ifndef NO_LIBNUMA - BUILTIN_OBJS += $(OUTPUT)bench/numa.o -endif - -ifdef ASCIIDOC8 - export ASCIIDOC8 -endif - -LIBS = -Wl,--whole-archive $(PERFLIBS) -Wl,--no-whole-archive -Wl,--start-group $(EXTLIBS) -Wl,--end-group - -export INSTALL SHELL_PATH - -### Build rules - -SHELL = $(SHELL_PATH) - -all: shell_compatibility_test $(ALL_PROGRAMS) $(LANG_BINDINGS) $(OTHER_PROGRAMS) - -please_set_SHELL_PATH_to_a_more_modern_shell: - @$$(:) - -shell_compatibility_test: please_set_SHELL_PATH_to_a_more_modern_shell - -strip: $(PROGRAMS) $(OUTPUT)perf - $(STRIP) $(STRIP_OPTS) $(PROGRAMS) $(OUTPUT)perf - -$(OUTPUT)perf.o: perf.c $(OUTPUT)common-cmds.h $(OUTPUT)PERF-CFLAGS - $(QUIET_CC)$(CC) -include $(OUTPUT)PERF-VERSION-FILE \ - '-DPERF_HTML_PATH="$(htmldir_SQ)"' \ - $(CFLAGS) -c $(filter %.c,$^) -o $@ - -$(OUTPUT)perf: $(OUTPUT)perf.o $(BUILTIN_OBJS) $(PERFLIBS) - $(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $(OUTPUT)perf.o \ - $(BUILTIN_OBJS) $(LIBS) -o $@ - -$(OUTPUT)builtin-help.o: builtin-help.c $(OUTPUT)common-cmds.h $(OUTPUT)PERF-CFLAGS - $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) \ - '-DPERF_HTML_PATH="$(htmldir_SQ)"' \ - '-DPERF_MAN_PATH="$(mandir_SQ)"' \ - '-DPERF_INFO_PATH="$(infodir_SQ)"' $< - -$(OUTPUT)builtin-timechart.o: builtin-timechart.c $(OUTPUT)common-cmds.h $(OUTPUT)PERF-CFLAGS - $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) \ - '-DPERF_HTML_PATH="$(htmldir_SQ)"' \ - '-DPERF_MAN_PATH="$(mandir_SQ)"' \ - '-DPERF_INFO_PATH="$(infodir_SQ)"' $< - -$(OUTPUT)common-cmds.h: util/generate-cmdlist.sh command-list.txt - -$(OUTPUT)common-cmds.h: $(wildcard Documentation/perf-*.txt) - $(QUIET_GEN). util/generate-cmdlist.sh > $@+ && mv $@+ $@ - -$(SCRIPTS) : % : %.sh - $(QUIET_GEN)$(INSTALL) '[email protected]' '$(OUTPUT)$@' - -# These can record PERF_VERSION -$(OUTPUT)perf.o perf.spec \ - $(SCRIPTS) \ - : $(OUTPUT)PERF-VERSION-FILE - -.SUFFIXES: -.SUFFIXES: .o .c .S .s - -# These two need to be here so that when O= is not used they take precedence -# over the general rule for .o - -$(OUTPUT)util/%-flex.o: $(OUTPUT)util/%-flex.c $(OUTPUT)PERF-CFLAGS - $(QUIET_CC)$(CC) -o $@ -c -Iutil/ $(CFLAGS) -w $< - -$(OUTPUT)util/%-bison.o: $(OUTPUT)util/%-bison.c $(OUTPUT)PERF-CFLAGS - $(QUIET_CC)$(CC) -o $@ -c -Iutil/ $(CFLAGS) -DYYENABLE_NLS=0 -DYYLTYPE_IS_TRIVIAL=0 -w $< - -$(OUTPUT)%.o: %.c $(OUTPUT)PERF-CFLAGS - $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $< -$(OUTPUT)%.i: %.c $(OUTPUT)PERF-CFLAGS - $(QUIET_CC)$(CC) -o $@ -E $(CFLAGS) $< -$(OUTPUT)%.s: %.c $(OUTPUT)PERF-CFLAGS - $(QUIET_CC)$(CC) -o $@ -S $(CFLAGS) $< -$(OUTPUT)%.o: %.S - $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $< -$(OUTPUT)%.s: %.S - $(QUIET_CC)$(CC) -o $@ -E $(CFLAGS) $< - -$(OUTPUT)util/exec_cmd.o: util/exec_cmd.c $(OUTPUT)PERF-CFLAGS - $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) \ - '-DPERF_EXEC_PATH="$(perfexecdir_SQ)"' \ - '-DPREFIX="$(prefix_SQ)"' \ - $< - -$(OUTPUT)tests/attr.o: tests/attr.c $(OUTPUT)PERF-CFLAGS - $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) \ - '-DBINDIR="$(bindir_SQ)"' -DPYTHON='"$(PYTHON_WORD)"' \ - $< - -$(OUTPUT)tests/python-use.o: tests/python-use.c $(OUTPUT)PERF-CFLAGS - $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) \ - -DPYTHONPATH='"$(OUTPUT)python"' \ - -DPYTHON='"$(PYTHON_WORD)"' \ - $< - -$(OUTPUT)util/config.o: util/config.c $(OUTPUT)PERF-CFLAGS - $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $< - -$(OUTPUT)ui/browser.o: ui/browser.c $(OUTPUT)PERF-CFLAGS - $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -DENABLE_SLFUTURE_CONST $< - -$(OUTPUT)ui/browsers/annotate.o: ui/browsers/annotate.c $(OUTPUT)PERF-CFLAGS - $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -DENABLE_SLFUTURE_CONST $< - -$(OUTPUT)ui/browsers/hists.o: ui/browsers/hists.c $(OUTPUT)PERF-CFLAGS - $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -DENABLE_SLFUTURE_CONST $< - -$(OUTPUT)ui/browsers/map.o: ui/browsers/map.c $(OUTPUT)PERF-CFLAGS - $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -DENABLE_SLFUTURE_CONST $< +export JOBS -$(OUTPUT)ui/browsers/scripts.o: ui/browsers/scripts.c $(OUTPUT)PERF-CFLAGS - $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -DENABLE_SLFUTURE_CONST $< - -$(OUTPUT)util/rbtree.o: ../../lib/rbtree.c $(OUTPUT)PERF-CFLAGS - $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -Wno-unused-parameter -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $< - -$(OUTPUT)util/parse-events.o: util/parse-events.c $(OUTPUT)PERF-CFLAGS - $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -Wno-redundant-decls $< - -$(OUTPUT)util/scripting-engines/trace-event-perl.o: util/scripting-engines/trace-event-perl.c $(OUTPUT)PERF-CFLAGS - $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $(PERL_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow -Wno-undef -Wno-switch-default $< - -$(OUTPUT)scripts/perl/Perf-Trace-Util/Context.o: scripts/perl/Perf-Trace-Util/Context.c $(OUTPUT)PERF-CFLAGS - $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $(PERL_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-nested-externs -Wno-undef -Wno-switch-default $< - -$(OUTPUT)util/scripting-engines/trace-event-python.o: util/scripting-engines/trace-event-python.c $(OUTPUT)PERF-CFLAGS - $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $(PYTHON_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow $< - -$(OUTPUT)scripts/python/Perf-Trace-Util/Context.o: scripts/python/Perf-Trace-Util/Context.c $(OUTPUT)PERF-CFLAGS - $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $(PYTHON_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-nested-externs $< - -$(OUTPUT)perf-%: %.o $(PERFLIBS) - $(QUIET_LINK)$(CC) $(CFLAGS) -o $@ $(LDFLAGS) $(filter %.o,$^) $(LIBS) - -$(LIB_OBJS) $(BUILTIN_OBJS): $(LIB_H) -$(patsubst perf-%,%.o,$(PROGRAMS)): $(LIB_H) $(wildcard */*.h) - -# we compile into subdirectories. if the target directory is not the source directory, they might not exists. So -# we depend the various files onto their directories. -DIRECTORY_DEPS = $(LIB_OBJS) $(BUILTIN_OBJS) $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h -$(DIRECTORY_DEPS): | $(sort $(dir $(DIRECTORY_DEPS))) -# In the second step, we make a rule to actually create these directories -$(sort $(dir $(DIRECTORY_DEPS))): - $(QUIET_MKDIR)$(MKDIR) -p $@ 2>/dev/null - -$(LIB_FILE): $(LIB_OBJS) - $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(LIB_OBJS) - -# libtraceevent.a -TE_SOURCES = $(wildcard $(TRACE_EVENT_DIR)*.[ch]) - -$(LIBTRACEEVENT): $(TE_SOURCES) - $(QUIET_SUBDIR0)$(TRACE_EVENT_DIR) $(QUIET_SUBDIR1) O=$(OUTPUT) libtraceevent.a - -$(LIBTRACEEVENT)-clean: - $(QUIET_SUBDIR0)$(TRACE_EVENT_DIR) $(QUIET_SUBDIR1) O=$(OUTPUT) clean - -LIBLK_SOURCES = $(wildcard $(LK_PATH)*.[ch]) - -# if subdir is set, we've been called from above so target has been built -# already -$(LIBLK): $(LIBLK_SOURCES) -ifeq ($(subdir),) - $(QUIET_SUBDIR0)$(LK_DIR) $(QUIET_SUBDIR1) O=$(OUTPUT) liblk.a -endif - -$(LIBLK)-clean: -ifeq ($(subdir),) - $(QUIET_SUBDIR0)$(LK_DIR) $(QUIET_SUBDIR1) O=$(OUTPUT) clean -endif - -help: - @echo 'Perf make targets:' - @echo ' doc - make *all* documentation (see below)' - @echo ' man - make manpage documentation (access with man <foo>)' - @echo ' html - make html documentation' - @echo ' info - make GNU info documentation (access with info <foo>)' - @echo ' pdf - make pdf documentation' - @echo ' TAGS - use etags to make tag information for source browsing' - @echo ' tags - use ctags to make tag information for source browsing' - @echo ' cscope - use cscope to make interactive browsing database' - @echo '' - @echo 'Perf install targets:' - @echo ' NOTE: documentation build requires asciidoc, xmlto packages to be installed' - @echo ' HINT: use "make prefix=<path> <install target>" to install to a particular' - @echo ' path like make prefix=/usr/local install install-doc' - @echo ' install - install compiled binaries' - @echo ' install-doc - install *all* documentation' - @echo ' install-man - install manpage documentation' - @echo ' install-html - install html documentation' - @echo ' install-info - install GNU info documentation' - @echo ' install-pdf - install pdf documentation' - @echo '' - @echo ' quick-install-doc - alias for quick-install-man' - @echo ' quick-install-man - install the documentation quickly' - @echo ' quick-install-html - install the html documentation quickly' - @echo '' - @echo 'Perf maintainer targets:' - @echo ' clean - clean all binary objects and build output' - - -DOC_TARGETS := doc man html info pdf - -INSTALL_DOC_TARGETS := $(patsubst %,install-%,$(DOC_TARGETS)) try-install-man -INSTALL_DOC_TARGETS += quick-install-doc quick-install-man quick-install-html - -# 'make doc' should call 'make -C Documentation all' -$(DOC_TARGETS): - $(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) $(@:doc=all) - -TAGS: - $(RM) TAGS - $(FIND) . -name '*.[hcS]' -print | xargs etags -a - -tags: - $(RM) tags - $(FIND) . -name '*.[hcS]' -print | xargs ctags -a - -cscope: - $(RM) cscope* - $(FIND) . -name '*.[hcS]' -print | xargs cscope -b - -### Detect prefix changes -TRACK_CFLAGS = $(subst ','\'',$(CFLAGS)):\ - $(bindir_SQ):$(perfexecdir_SQ):$(template_dir_SQ):$(prefix_SQ) - -$(OUTPUT)PERF-CFLAGS: .FORCE-PERF-CFLAGS - @FLAGS='$(TRACK_CFLAGS)'; \ - if test x"$$FLAGS" != x"`cat $(OUTPUT)PERF-CFLAGS 2>/dev/null`" ; then \ - echo 1>&2 " * new build flags or prefix"; \ - echo "$$FLAGS" >$(OUTPUT)PERF-CFLAGS; \ - fi - -### Testing rules - -# GNU make supports exporting all variables by "export" without parameters. -# However, the environment gets quite big, and some programs have problems -# with that. - -check: $(OUTPUT)common-cmds.h - if sparse; \ - then \ - for i in *.c */*.c; \ - do \ - sparse $(CFLAGS) $(SPARSE_FLAGS) $$i || exit; \ - done; \ - else \ - exit 1; \ - fi - -### Installation rules - -install-bin: all - $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)' - $(INSTALL) $(OUTPUT)perf '$(DESTDIR_SQ)$(bindir_SQ)' - $(INSTALL) $(OUTPUT)perf-archive -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)' -ifndef NO_LIBPERL - $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace' - $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/bin' - $(INSTALL) scripts/perl/Perf-Trace-Util/lib/Perf/Trace/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace' - $(INSTALL) scripts/perl/*.pl -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl' - $(INSTALL) scripts/perl/bin/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/bin' -endif -ifndef NO_LIBPYTHON - $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/Perf-Trace-Util/lib/Perf/Trace' - $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/bin' - $(INSTALL) scripts/python/Perf-Trace-Util/lib/Perf/Trace/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/Perf-Trace-Util/lib/Perf/Trace' - $(INSTALL) scripts/python/*.py -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python' - $(INSTALL) scripts/python/bin/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/bin' -endif - $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(sysconfdir_SQ)/bash_completion.d' - $(INSTALL) bash_completion '$(DESTDIR_SQ)$(sysconfdir_SQ)/bash_completion.d/perf' - $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests' - $(INSTALL) tests/attr.py '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests' - $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/attr' - $(INSTALL) tests/attr/* '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/attr' - -install: install-bin try-install-man - -install-python_ext: - $(PYTHON_WORD) util/setup.py --quiet install --root='/$(DESTDIR_SQ)' - -# 'make install-doc' should call 'make -C Documentation install' -$(INSTALL_DOC_TARGETS): - $(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) $(@:-doc=) - -### Cleaning rules +$(info $(shell printf '# [ perf build: Doing '\''make \033[33m-j'$(JOBS)'\033[m'\'' parallel build. ]\n')) # -# This is here, not in config/Makefile, because config/Makefile does -# not get included for the clean target: +# Needed if no target specified: # -config-clean: - @$(MAKE) -C config/feature-checks clean - -clean: $(LIBTRACEEVENT)-clean $(LIBLK)-clean config-clean - $(RM) $(LIB_OBJS) $(BUILTIN_OBJS) $(LIB_FILE) $(OUTPUT)perf-archive $(OUTPUT)perf.o $(LANG_BINDINGS) - $(RM) $(ALL_PROGRAMS) perf - $(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope* - $(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) clean - $(RM) $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)PERF-CFLAGS - $(RM) $(OUTPUT)util/*-bison* - $(RM) $(OUTPUT)util/*-flex* - $(python-clean) - -# -# Trick: if ../../.git does not exist - we are building out of tree for example, -# then force version regeneration: -# -ifeq ($(wildcard ../../.git/HEAD),) - GIT-HEAD-PHONY = ../../.git/HEAD -else - GIT-HEAD-PHONY = -endif +all: + @$(MAKE) -f Makefile.perf --no-print-directory -j$(JOBS) $@ -.PHONY: all install clean config-clean strip -.PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell -.PHONY: $(GIT-HEAD-PHONY) TAGS tags cscope .FORCE-PERF-CFLAGS +%: + @$(MAKE) -f Makefile.perf --no-print-directory -j$(JOBS) $@
tools/perf/Makefile.parallel deleted +0 -26
@@ -1,26 +0,0 @@ -# -# Do a parallel build with multiple jobs, based on the number of CPUs online -# in this system: 'make -j8' on a 8-CPU system, etc. -# -# (To override it, run 'make JOBS=1' and similar.) -# -ifeq ($(JOBS),) - JOBS := $(shell grep -c ^processor /proc/cpuinfo 2>/dev/null) - ifeq ($(JOBS),) - JOBS := 1 - endif -endif - -export JOBS - -$(info $(shell printf '# [ perf build: Doing '\''make \033[33m-j'$(JOBS)'\033[m'\'' parallel build. ]\n')) - -# -# Needed if no target specified: -# -all: - @$(MAKE) --no-print-directory -j$(JOBS) $@ - -%: - @$(MAKE) --no-print-directory -j$(JOBS) $@ -
tools/perf/Makefile.perf new file +841 -0
841 lines not on this page · raw message
Signature · 1 line
1.7.11.7
PATCH 40/50 tools/perf/build: Standardize the various messages output by parallel make
In reply to Ingo Molnar--- tools/perf/Makefile | 23 ++++++++++++++++++++--- tools/perf/config/Makefile | 4 ++-- 2 files changed, 22 insertions(+), 5 deletions(-)
tools/perf/Makefile +20 -3
@@ -13,13 +13,30 @@ endif export JOBS -$(info $(shell printf '# [ perf build: Doing '\''make \033[33m-j'$(JOBS)'\033[m'\'' parallel build. ]\n')) +define print_msg + @printf ' BUILD: Doing '\''make \033[33m-j'$(JOBS)'\033[m'\'' parallel build\n' +endef + +define make + @$(MAKE) -f Makefile.perf --no-print-directory -j$(JOBS) $@ +endef # # Needed if no target specified: # all: - @$(MAKE) -f Makefile.perf --no-print-directory -j$(JOBS) $@ + $(print_msg) + $(make) + +# +# The clean target is not really parallel, don't print the jobs info: +# +clean: + $(make) +# +# All other targets get passed through: +# %: - @$(MAKE) -f Makefile.perf --no-print-directory -j$(JOBS) $@ + $(print_msg) + $(make)
tools/perf/config/Makefile +2 -2
@@ -178,9 +178,9 @@ endif feature_print = $(eval $(feature_print_code)) define feature_print_code ifeq ($(feature-$(1)), 1) - MSG := $(shell printf '...%30s: [ \033[32mon\033[m ]' $(1)) + MSG = $(shell printf '...%30s: [ \033[32mon\033[m ]' $(1)) else - MSG := $(shell printf '...%30s: [ \033[31mOFF\033[m ]' $(1)) + MSG = $(shell printf '...%30s: [ \033[31mOFF\033[m ]' $(1)) endif $(info $(MSG)) endef
Signature · 1 line
1.7.11.7
PATCH 41/50 tools/perf/build: Split out feature checks: 'liberty', 'liberty-z', 'cplus-demangle'
In reply to Ingo MolnarNote that these are rarely executed tests, so we call feature_check() explicitly and don't have them in CORE_FEATURE_CHECKS.
--- tools/perf/config/Makefile | 16 ++++++---------- tools/perf/config/feature-checks/Makefile | 12 ++++++++++++ tools/perf/config/feature-checks/test-cplus-demangle.c | 10 ++++++++++ 3 files changed, 28 insertions(+), 10 deletions(-)
tools/perf/config/Makefile +6 -10
@@ -461,23 +461,19 @@ else EXTLIBS += -liberty CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT else - FLAGS_BFD=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) -DPACKAGE='perf' -lbfd ifeq ($(feature-libbfd), 1) EXTLIBS += -lbfd else - FLAGS_BFD_IBERTY=$(FLAGS_BFD) -liberty - has_bfd_iberty := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD_IBERTY),liberty) - ifeq ($(has_bfd_iberty),y) + $(feature_check,liberty) + ifeq ($(feature-liberty), 1) EXTLIBS += -lbfd -liberty else - FLAGS_BFD_IBERTY_Z=$(FLAGS_BFD_IBERTY) -lz - has_bfd_iberty_z := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD_IBERTY_Z),libz) - ifeq ($(has_bfd_iberty_z),y) + $(feature_check,liberty-z) + ifeq ($(feature-liberty-z), 1) EXTLIBS += -lbfd -liberty -lz else - FLAGS_CPLUS_DEMANGLE=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) -liberty - has_cplus_demangle := $(call try-cc,$(SOURCE_CPLUS_DEMANGLE),$(FLAGS_CPLUS_DEMANGLE),demangle) - ifeq ($(has_cplus_demangle),y) + $(feature_check,cplus-demangle) + ifeq ($(feature-cplus-demangle), 1) EXTLIBS += -liberty CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT else
tools/perf/config/feature-checks/Makefile +12 -0
@@ -11,6 +11,9 @@ FILES= \ test-hello \ test-libaudit \ test-libbfd \ + test-liberty \ + test-liberty-z \ + test-cplus-demangle \ test-libelf \ test-libelf-getphdrnum \ test-libelf-mmap \
@@ -122,6 +125,15 @@ test-libpython-version: test-libbfd: $(BUILD) -DPACKAGE='perf' -DPACKAGE=perf -lbfd -ldl +test-liberty: + $(CC) -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='perf' -DPACKAGE=perf -lbfd -ldl -liberty + +test-liberty-z: + $(CC) -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='perf' -DPACKAGE=perf -lbfd -ldl -liberty -lz + +test-cplus-demangle: + $(BUILD) -liberty + test-on-exit: $(BUILD)
tools/perf/config/feature-checks/test-cplus-demangle.c new file +10 -0
@@ -0,0 +1,10 @@ + +extern char *cplus_demangle (const char *,int ); + +int main (void ) +{ +cplus_demangle (0 ,0 ); + +return 0 ; +} +
Signature · 1 line
1.7.11.7
PATCH 42/50 tools/perf/build: Remove unused config/feature-tests.mak
In reply to Ingo MolnarAlso remove try-cc et al. These got obsoleted by the split-out feature checks in config/feature-checks/.
--- tools/perf/config/Makefile | 3 +- tools/perf/config/feature-tests.mak | 244 -------------------------------------------------------- tools/perf/config/utilities.mak | 14 ---- 3 files changed, 1 insertion(+), 260 deletions(-)
tools/perf/config/Makefile +1 -2
@@ -51,7 +51,6 @@ LIB_INCLUDE := $(srctree)/tools/lib/ # include ARCH specific config -include $(src-perf)/arch/$(ARCH)/Makefile -include $(src-perf)/config/feature-tests.mak include $(src-perf)/config/utilities.mak ifeq ($(call get-executable,$(FLEX)),)
@@ -273,7 +272,7 @@ else msg := $(warning No libdw.h found or old libdw.h found or elfutils is older than 0.138, disables dwarf support. Please install new elfutils-devel/libdw-dev); NO_DWARF := 1 endif # Dwarf support - endif # SOURCE_LIBELF + endif # libelf support endif # NO_LIBELF ifndef NO_LIBELF
tools/perf/config/feature-tests.mak +0 -244
246 lines not on this page · raw message
tools/perf/config/utilities.mak +0 -14
@@ -178,17 +178,3 @@ endef _ge_attempt = $(if $(get-executable),$(get-executable),$(_gea_warn)$(call _gea_err,$(2))) _gea_warn = $(warning The path '$(1)' is not executable.) _gea_err = $(if $(1),$(error Please set '$(1)' appropriately)) - -# try-cc -# Usage: option = $(call try-cc, source-to-build, cc-options, msg) -ifneq ($(V),1) -TRY_CC_OUTPUT= > /dev/null 2>&1 -endif -TRY_CC_MSG=echo " CHK $(3)" 1>&2; - -try-cc = $(shell sh -c \ - 'TMP="$(OUTPUT)$(TMPOUT).$$$$"; \ - $(TRY_CC_MSG) \ - echo "$(1)" | \ - $(CC) -x c - $(2) -o "$$TMP" $(TRY_CC_OUTPUT) && echo y; \ - rm -f "$$TMP"')
Signature · 1 line
1.7.11.7
PATCH 43/50 tools/perf/build: Clean up various testcases
In reply to Ingo MolnarPrepare to include them into test-all.c directly, by making sure that they build cleanly and without warnings.
Also make sure they make a certain amount of sense and don't crash when executed.
--- tools/perf/config/feature-checks/test-backtrace.c | 10 ++++++++-- tools/perf/config/feature-checks/test-cplus-demangle.c | 9 +++++++-- tools/perf/config/feature-checks/test-gtk2-infobar.c | 3 ++- tools/perf/config/feature-checks/test-gtk2.c | 2 +- tools/perf/config/feature-checks/test-libaudit.c | 2 ++ tools/perf/config/feature-checks/test-libbfd.c | 11 ++++++++++- tools/perf/config/feature-checks/test-libunwind.c | 8 +++++++- tools/perf/config/feature-checks/test-on-exit.c | 11 ++++++++++- 8 files changed, 47 insertions(+), 9 deletions(-)
tools/perf/config/feature-checks/test-backtrace.c +8 -2
@@ -3,8 +3,14 @@int main (void ) { -backtrace (NULL ,0 ); -backtrace_symbols (NULL ,0 ); +void *backtrace_fns[10 ]; +size_t entries; + entries =backtrace (backtrace_fns,10 ); +backtrace_symbols_fd (backtrace_fns, entries,1 ); + +printf ("backtrace entries: %d\n" , entries); +return 0 ; } +
tools/perf/config/feature-checks/test-cplus-demangle.c +7 -2
@@ -1,9 +1,14 @@ - +extern int printf (const char *format, ...);extern char *cplus_demangle (const char *,int );int main (void ) { -cplus_demangle (0 ,0 ); +char symbol[4096 ] ="FieldName__9ClassNameFd" ; +char *tmp; + + tmp =cplus_demangle (symbol,0 ); + +printf ("demangled symbol: {%s}\n" , tmp);return 0 ; }
tools/perf/config/feature-checks/test-gtk2-infobar.c +2 -1
@@ -2,8 +2,9 @@#include <gtk/gtk.h> #pragma GCC diagnostic error "-Wstrict-prototypes" -int main (void ) +int main (int argc,char *argv[]) { +gtk_init (&argc, &argv);gtk_info_bar_new ();return 0 ;
tools/perf/config/feature-checks/test-gtk2.c +1 -1
@@ -4,7 +4,7 @@int main (int argc,char *argv[]) { -gtk_init (&argc, &argv); +gtk_init (&argc, &argv);return 0 ; }
tools/perf/config/feature-checks/test-libaudit.c +2 -0
@@ -1,5 +1,7 @@#include <libaudit.h> +extern int printf (const char *format, ...); +int main (void ) {printf ("error message: %s\n" ,audit_errno_to_name (0 ));
tools/perf/config/feature-checks/test-libbfd.c +10 -1
@@ -1,7 +1,16 @@#include <bfd.h> +extern int printf (const char *format, ...); +int main (void ) { -bfd_demangle (0 ,0 ,0 ); +char symbol[4096 ] ="FieldName__9ClassNameFd" ; +char *tmp; + + tmp =bfd_demangle (0 , symbol,0 ); + +printf ("demangled symbol: {%s}\n" , tmp); +return 0 ; } +
tools/perf/config/feature-checks/test-libunwind.c +7 -1
@@ -10,10 +10,16 @@ extern int UNW_OBJ(dwarf_search_unwind_table) (unw_addr_space_t as,#define dwarf_search_unwind_table UNW_OBJ(dwarf_search_unwind_table) +static unw_accessors_t accessors; +int main (void ) {unw_addr_space_t addr_space; - addr_space =unw_create_addr_space (NULL ,0 ); + + addr_space =unw_create_addr_space (&accessors,0 ); +if (addr_space) +return ; +unw_init_remote (NULL , addr_space,NULL );dwarf_search_unwind_table (addr_space,0 ,NULL ,NULL ,0 ,NULL );return 0 ;
tools/perf/config/feature-checks/test-on-exit.c +10 -1
@@ -1,6 +1,15 @@#include <stdio.h> +static void exit_fn (int status,void *__data) +{ +printf ("exit status: %d, data: %d\n" , status, *(int *)__data); +} + +static int data =123 ; +int main (void ) { -return on_exit (NULL ,NULL ); +on_exit (exit_fn, &data); + +return 321 ; }
Signature · 1 line
1.7.11.7
PATCH 44/50 tools/perf/build: Collapse the test-all.c testcase
In reply to Ingo MolnarSimplify test-all.c by including it all the testcases via #include.
--- tools/perf/config/feature-checks/test-all.c | 290 +++++++++++++++--------------------------- tools/perf/config/feature-checks/test-backtrace.c | 2 - tools/perf/config/feature-checks/test-libunwind.c | 3 +- 3 files changed, 102 insertions(+), 193 deletions(-)
tools/perf/config/feature-checks/test-all.c +100 -190
@@ -1,196 +1,106 @@ - -#pragma GCC diagnostic ignored "-Wstrict-prototypes" - -#include <Python.h> - -#include <EXTERN.h> -#include <perl.h> - -#include <stdio.h> -#include <libelf.h> -#include <gnu/libc-version.h> -#include <dwarf.h> -#include <elfutils/libdw.h> -#include <elfutils/version.h> -#include <libelf.h> -#include <libunwind.h> -#include <stdlib.h> -#include <libaudit.h> -#include <slang.h> -#include <gtk/gtk.h> -#include <bfd.h> -#include <stdio.h> -#include <execinfo.h> -#include <stdio.h> -#include <numa.h> -#include <numaif.h> - -#pragma GCC diagnostic error "-Wstrict-prototypes" - -int main1 (void ) -{ -return puts ("hi" ); -} - -int main2 (void ) -{ -return puts ("hi" ); -} - -int main3 (void ) -{ -return puts ("hi" ); -} - -int main4 (void ) -{ -Elf *elf =elf_begin (0 ,ELF_C_READ ,0 ); -return (long )elf; -} -# -int main5 (void ) -{ -Elf *elf =elf_begin (0 ,ELF_C_READ_MMAP ,0 ); -return (long )elf; -} - -int main6 (void ) -{ -const char *version =gnu_get_libc_version (); -return (long )version; -} - -int main7 (void ) -{ -Dwarf *dbg =dwarf_begin (0 ,DWARF_C_READ ); -return (long )dbg; -} - -int main8 (void ) -{ -size_t dst; -return elf_getphdrnum (0 , &dst); -} - -extern int UNW_OBJ (dwarf_search_unwind_table ) (unw_addr_space_t as, -unw_word_t ip, -unw_dyn_info_t *di, -unw_proc_info_t *pi, -int need_unwind_info,void *arg); - - -#define dwarf_search_unwind_table UNW_OBJ(dwarf_search_unwind_table) - -int main9 (void ) -{ -unw_addr_space_t addr_space; - addr_space =unw_create_addr_space (NULL ,0 ); -unw_init_remote (NULL , addr_space,NULL ); -dwarf_search_unwind_table (addr_space,0 ,NULL ,NULL ,0 ,NULL ); -return 0 ; -} - -int main10 (void ) -{ -printf ("error message: %s\n" ,audit_errno_to_name (0 )); -return audit_open (); -} - -int main11 (void ) -{ -return SLsmg_init_smg (); -} - -int main12 (int argc,char *argv[]) -{ -gtk_init (&argc, &argv); - -return 0 ; -} - -int main13 (void ) -{ -gtk_info_bar_new (); - -return 0 ; -} - -int main14 (void ) -{ -perl_alloc (); - -return 0 ; -} - -int main15 (void ) -{ -Py_Initialize (); -return 0 ; -} - -#if PY_VERSION_HEX >=0x03000000 -#error -#endif - -int main16 (void ) -{ -return 0 ; -} - -int main17 (void ) -{ -bfd_demangle (0 ,0 ,0 ); -return 0 ; -} - -void exit_function (int x,void *y) -{ -} - -int main18 (void ) -{ -return on_exit (exit_function,NULL ); -} - -int main19 (void ) -{ -void *backtrace_fns[1 ]; -size_t entries; - - entries =backtrace (backtrace_fns,1 ); -backtrace_symbols (backtrace_fns, entries); - -return 0 ; -} - -int main20 (void ) -{ -numa_available (); -return 0 ; -} +/* +* test-all.c: Try to build all the main testcases at once. +* +* A well-configured system will have all the prereqs installed, so we can speed +* up auto-detection on such systems. +*/ + +/* +* Quirk: Python and Perl headers cannot be in arbitrary places, so keep +* these 3 testcases at the top: +*/ +#define main main_test_libpython +# include "test-libpython.c" +#undef main + +#define main main_test_libpython_version +# include "test-libpython-version.c" +#undef main + +#define main main_test_libperl +# include "test-libperl.c" +#undef main + +#define main main_test_hello +# include "test-hello.c" +#undef main + +#define main main_test_libelf +# include "test-libelf.c" +#undef main + +#define main main_test_libelf_mmap +# include "test-libelf-mmap.c" +#undef main + +#define main main_test_glibc +# include "test-glibc.c" +#undef main + +#define main main_test_dwarf +# include "test-dwarf.c" +#undef main + +#define main main_test_libelf_getphdrnum +# include "test-libelf-getphdrnum.c" +#undef main + +#define main main_test_libunwind +# include "test-libunwind.c" +#undef main + +#define main main_test_libaudit +# include "test-libaudit.c" +#undef main + +#define main main_test_libslang +# include "test-libslang.c" +#undef main + +#define main main_test_gtk2 +# include "test-gtk2.c" +#undef main + +#define main main_test_gtk2_infobar +# include "test-gtk2-infobar.c" +#undef main + +#define main main_test_libbfd +# include "test-libbfd.c" +#undef main + +#define main main_test_on_exit +# include "test-on-exit.c" +#undef main + +#define main main_test_backtrace +# include "test-backtrace.c" +#undef main + +#define main main_test_libnuma +# include "test-libnuma.c" +#undef mainint main (int argc,char *argv[]) { -main1 (); -main2 (); -main3 (); -main4 (); -main5 (); -main6 (); -main7 (); -main8 (); -main9 (); -main10 (); -main11 (); -main12 (argc, argv); -main13 (); -main14 (); -main15 (); -main16 (); -main17 (); -main18 (); -main19 (); -main20 (); +main_test_libpython (); +main_test_libpython_version (); +main_test_libperl (); +main_test_hello (); +main_test_libelf (); +main_test_libelf_mmap (); +main_test_glibc (); +main_test_dwarf (); +main_test_libelf_getphdrnum (); +main_test_libunwind (); +main_test_libaudit (); +main_test_libslang (); +main_test_gtk2 (argc, argv); +main_test_gtk2_infobar (argc, argv); +main_test_libbfd (); +main_test_on_exit (); +main_test_backtrace (); +main_test_libnuma ();return 0 ; }
tools/perf/config/feature-checks/test-backtrace.c +0 -2
@@ -9,8 +9,6 @@ int main(void) entries =backtrace (backtrace_fns,10 );backtrace_symbols_fd (backtrace_fns, entries,1 ); -printf ("backtrace entries: %d\n" , entries); -return 0 ; }
tools/perf/config/feature-checks/test-libunwind.c +2 -1
@@ -18,9 +18,10 @@ int main(void) addr_space =unw_create_addr_space (&accessors,0 );if (addr_space) -return ; +return 0 ;unw_init_remote (NULL , addr_space,NULL );dwarf_search_unwind_table (addr_space,0 ,NULL ,NULL ,0 ,NULL ); +return 0 ; }
Signature · 1 line
1.7.11.7
Re: [PATCH 44/50] tools/perf/build: Collapse the test-all.c testcase
On Mon, Oct 07, 2013 at 01:56:37PM +0200, Ingo Molnar wrote:
SNIP
tools/perf/config/feature-checks/test-backtrace.c int main(void) · line 12
Quoted 11 lines
tools/perf/config/feature-checks/test-backtrace.c +0
-2@@ -9,8 +9,6 @@ int main(void) entries =backtrace (backtrace_fns,10 );backtrace_symbols_fd (backtrace_fns, entries,1 ); -printf ("backtrace entries: %d\n" , entries); -return 0 ;
belongs to previous patch?
Quoted 7 lines
tools/perf/config/feature-checks/test-backtrace.c +0
-0}tools/perf/config/feature-checks/test-libunwind.c +0
-0
tools/perf/config/feature-checks/test-libunwind.c int main(void) · line 25
Quoted 9 lines
tools/perf/config/feature-checks/test-libunwind.c +2
-1@@ -18,9 +18,10 @@ int main(void) addr_space =unw_create_addr_space (&accessors,0 );if (addr_space) -return ; +return 0 ;unw_init_remote (NULL , addr_space,NULL );dwarf_search_unwind_table (addr_space,0 ,NULL ,NULL ,0 ,NULL ); +
ditto
jirka
Re: [PATCH 44/50] tools/perf/build: Collapse the test-all.c testcase
Quoted 12 lines · Jiri Olsa
On Mon, Oct 07, 2013 at 01:56:37PM +0200, Ingo Molnar wrote:
SNIP
Quoted 8 lines
tools/perf/config/feature-checks/test-backtrace.c +0
-0@@ -9,8 +9,6 @@ int main(void) entries =backtrace (backtrace_fns,10 );backtrace_symbols_fd (backtrace_fns, entries,1 );
Quoted 5 lines
tools/perf/config/feature-checks/test-backtrace.c int main(void) · line 12
Quoted 3 lines
tools/perf/config/feature-checks/test-backtrace.c +0
-2-printf ("backtrace entries: %d\n" , entries); -return 0 ;belongs to previous patch?
Yes.
Quoted 14 lines
Quoted 14 lines
tools/perf/config/feature-checks/test-backtrace.c +0
-0}tools/perf/config/feature-checks/test-libunwind.c +1
-1@@ -18,9 +18,10 @@ int main(void) addr_space =unw_create_addr_space (&accessors,0 );if (addr_space) -return ; +return 0 ;
Quoted 5 lines
tools/perf/config/feature-checks/test-libunwind.c int main(void) · line 25
Quoted 3 lines
tools/perf/config/feature-checks/test-libunwind.c +1
-0unw_init_remote (NULL , addr_space,NULL );dwarf_search_unwind_table (addr_space,0 ,NULL ,NULL ,0 ,NULL ); +ditto
Thanks, fixed.
Ingo
PATCH 45/50 tools/perf/build: Pass through all targets to Makefile.perf
In reply to Ingo MolnarJiri reported that 'make .o' stopped working:
Quoted 7 lines
[jolsa@krava perf]$ make -f
Makefileperf.o
cc -c -o perf.operf.c
In file included from builtin.h:4:0,from perf.c:9:
util/util.h:74:24: fatal error:lk/debugfs.h: No such file or directory compilation terminated.
make: *** [perf.o] Error 1
This is due to GNU make having built-in rules for popular targets such as *.o. Clear them out so that all targets as passed through to Makefile.perf.
--- tools/perf/Makefile | 7 +++++++ 1 file changed, 7 insertions(+)
tools/perf/Makefile +7 -0
@@ -1,3 +1,10 @@ + +# +# Clear out the built-in rules GNU make defines by default (such as .o targets), +# so that we pass through all targets to Makefile.perf: +# +.SUFFIXES: + # # Do a parallel build with multiple jobs, based on the number of CPUs online # in this system: 'make -j8' on a 8-CPU system, etc.
Signature · 1 line
1.7.11.7
PATCH 46/50 tools/perf/build: Make sure autodep feature binaries honor the O= setting
In reply to Ingo MolnarArnaldo noticed that the feature-check binaries are generated in the config/check-features/ directory even if O= is specified.
Implement $(OUTPUT) logic for config/check-features/Makefile.
--- tools/perf/config/Makefile | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
tools/perf/config/Makefile +8 -3
@@ -88,9 +88,14 @@ CFLAGS += -std=gnu99 EXTLIBS = -lelf -lpthread -lrt -lm -ldl +ifneq ($(OUTPUT),) + OUTPUT_FEATURES = $(OUTPUT)config/feature-checks/ + $(shell mkdir -p $(OUTPUT_FEATURES)) +endif + feature_check = $(eval $(feature_check_code)) define feature_check_code - feature-$(1) := $(shell $(MAKE) -C config/feature-checks test-$1 >/dev/null 2>/dev/null && echo 1 || echo 0) + feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) -C config/feature-checks test-$1 >/dev/null 2>/dev/null && echo 1 || echo 0) endef feature_set = $(eval $(feature_set_code))
@@ -137,7 +142,7 @@ CORE_FEATURE_TESTS = \ # to skip the print-out of the long features list if the file # existed before and after it was built: # -ifeq ($(wildcard config/feature-checks/test-all),) +ifeq ($(wildcard $(OUTPUT)config/feature-checks/test-all),) test-all-failed := 1 else test-all-failed := 0
@@ -167,7 +172,7 @@ ifeq ($(feature-all), 1) # $(foreach feat,$(CORE_FEATURE_TESTS),$(call feature_set,$(feat))) else - $(shell $(MAKE) -i -j -C config/feature-checks $(CORE_FEATURE_TESTS) >/dev/null 2>&1) + $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) -i -j -C config/feature-checks $(CORE_FEATURE_TESTS) >/dev/null 2>&1) $(foreach feat,$(CORE_FEATURE_TESTS),$(call feature_check,$(feat))) endif
Signature · 1 line
1.7.11.7
PATCH 47/50 tools/perf/build: Exclude MAKEFLAGS from nested invocation
In reply to Ingo MolnarIn case the user specifies MAKEFLAGS as an environment variable, or uses 'make -jN' explicitly, the options can conflict and result in:
BUILD: Doing 'make -j8' parallel build
make[1]: warning: -jN forced in submake: disabling jobserver mode. GEN common-cmds.h
make[1]: *** write jobserver: Bad file descriptor. Stop.
Make sure we invoke the main makefile in a pristine state.
Users who want to do something non-standard can use the:
make -f Makefile.perf
method to invoke the makefile.
--- tools/perf/Makefile | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
tools/perf/Makefile +13 -3
@@ -1,3 +1,10 @@ +# +# This is a simple wrapper Makefile that calls the main Makefile.perf +# with a -j option to do parallel builds +# +# If you want to invoke the perf build in some non-standard way then +# you can use the 'make -f Makefile.perf' method to invoke it. +# # # Clear out the built-in rules GNU make defines by default (such as .o targets),
@@ -6,6 +13,11 @@ .SUFFIXES: # +# We don't want to pass along options like -j: +# +unexport MAKEFLAGS + +# # Do a parallel build with multiple jobs, based on the number of CPUs online # in this system: 'make -j8' on a 8-CPU system, etc. #
@@ -18,14 +30,12 @@ ifeq ($(JOBS),) endif endif -export JOBS - define print_msg @printf ' BUILD: Doing '\''make \033[33m-j'$(JOBS)'\033[m'\'' parallel build\n' endef define make - @$(MAKE) -f Makefile.perf --no-print-directory -j$(JOBS) $@ + @$(MAKE) -f Makefile.perf --no-print-directory -j$(JOBS) O=$(O) $@ endef #
Signature · 1 line
1.7.11.7
PATCH 48/50 tools/perf/build: Fix non-canonical directory names in O=
In reply to Ingo MolnarThis was a long-standing bug, relative pathnames like O=dir did not fully work in the build system:
$ make O=localdir clean
SUBDIR Documentation
../../scripts/Makefile.include:3: *** O=localdir does not exist. Stop.
make[1]: *** [clean] Error 2
make: *** [clean] Error 2Fix this by canonizing the directory before passing it to Makefile.perf.
--- tools/perf/Makefile | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
tools/perf/Makefile +8 -1
@@ -30,12 +30,19 @@ ifeq ($(JOBS),) endif endif +# +# Only pass canonical directory names as the output directory: +# +ifneq ($(O),) + FULL_O := $(shell readlink -f $(O)) +endif + define print_msg @printf ' BUILD: Doing '\''make \033[33m-j'$(JOBS)'\033[m'\'' parallel build\n' endef define make - @$(MAKE) -f Makefile.perf --no-print-directory -j$(JOBS) O=$(O) $@ + @$(MAKE) -f Makefile.perf --no-print-directory -j$(JOBS) O=$(FULL_O) $@ endef #
Signature · 1 line
1.7.11.7
PATCH 49/50 tools/perf/build: Fix O=/some/dir perf.o type of targets
In reply to Ingo MolnarIf someone specifies a single target, mixed with O=, the following way:
hubble:~/tip/tools/perf> make O=/tmp/perf util/stat.o
BUILD: Doing 'make -j8' parallel build
gcc -Wbad-function-cast -Wdeclaration-after-statement -Wformat-security [...]
The build might even fail, if a target depends on other targets:
hubble:~/tip/tools/perf> make O=/tmp/perf perf.o
...
perf.c: In function ‘handle_options’:
perf.c:155:21: error: ‘PERF_HTML_PATH’ undeclared (first use in this function)
The correct way to invoke such targets is:
hubble:~/tip/tools/perf> make O=/tmp/perf /tmp/perf/perf.o
BUILD: Doing 'make -j8' parallel build
GEN /tmp/perf/common-cmds.h
CC /tmp/perf/perf.o
But that's unnecessary typing and it's also easy to mistakenly build into the source directory.
To fix this remove the generic suffix rules and add redirection to $(OUTPUT) for the most popular .o targets.
--- tools/perf/Documentation/Makefile | 2 ++ tools/perf/Makefile.perf | 16 +++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-)
tools/perf/Documentation/Makefile +2 -0
@@ -1,3 +1,5 @@ +$(info Documentation/Makefile) + include ../../scripts/Makefile.include include ../config/utilities.mak
tools/perf/Makefile.perf +15 -1
@@ -576,7 +576,21 @@ $(OUTPUT)perf.o perf.spec \ : $(OUTPUT)PERF-VERSION-FILE .SUFFIXES: -.SUFFIXES: .o .c .S .s + +# +# If a target does not match any of the later rules then prefix it by $(OUTPUT) +# This makes targets like 'make O=/tmp/perf perf.o' work in a natural way. +# +ifneq ($(OUTPUT),) +%.o: $(OUTPUT)%.o + @echo " # Redirected target $@ => $(OUTPUT)$@" +util/%.o: $(OUTPUT)util/%.o + @echo " # Redirected target $@ => $(OUTPUT)util/$@" +bench/%.o: $(OUTPUT)bench/%.o + @echo " # Redirected target $@ => $(OUTPUT)bench/$@" +tests/%.o: $(OUTPUT)tests/%.o + @echo " # Redirected target $@ => $(OUTPUT)tests/$@" +endif # These two need to be here so that when O= is not used they take precedence # over the general rule for .o
Signature · 1 line
1.7.11.7
Re: [PATCH 49/50] tools/perf/build: Fix O=/some/dir perf.o type of targets
On Mon, Oct 07, 2013 at 01:56:42PM +0200, Ingo Molnar wrote:
SNIP
tools/perf/Documentation/Makefile line 4
Quoted 9 lines
tools/perf/Documentation/Makefile +2
-0@@ -1,3 +1,5 @@ +$(info Documentation/Makefile) + include ../../scripts/Makefile.include include ../config/utilities.mak
debug leftover?
jirka
Re: [PATCH 49/50] tools/perf/build: Fix O=/some/dir perf.o type of targets
Quoted 4 lines · Jiri Olsa
On Mon, Oct 07, 2013 at 01:56:42PM +0200, Ingo Molnar wrote:
SNIP
Quoted 11 lines
tools/perf/Documentation/Makefile line 4
Quoted 9 lines
tools/perf/Documentation/Makefile +2
-0@@ -1,3 +1,5 @@ +$(info Documentation/Makefile) + include ../../scripts/Makefile.include include ../config/utilities.makdebug leftover?
Yes, fixed.
I'll do a resend of the final result, there's been enough changes to the whole series.
Thanks a lot for the review!
Ingo
PATCH 50/50 tools/perf/build: Harmonize the style of the feature testcases
In reply to Ingo MolnarThe various testcases used different styles, which was not really visible as long as they hid in feature-tests.mak. Now that they are out in the open make them prettier.
( Also delete the leftover, empty feature-tests.mak file. )
--- tools/perf/config/feature-checks/test-backtrace.c | 1 - tools/perf/config/feature-checks/test-cplus-demangle.c | 1 - tools/perf/config/feature-checks/test-dwarf.c | 1 + tools/perf/config/feature-checks/test-glibc.c | 2 +- tools/perf/config/feature-checks/test-libaudit.c | 1 + tools/perf/config/feature-checks/test-libbfd.c | 1 - tools/perf/config/feature-checks/test-libelf-getphdrnum.c | 3 ++- tools/perf/config/feature-checks/test-libelf-mmap.c | 3 ++- tools/perf/config/feature-checks/test-libelf.c | 1 + tools/perf/config/feature-checks/test-libnuma.c | 1 + tools/perf/config/feature-checks/test-libpython.c | 3 ++- tools/perf/config/feature-tests.mak | 2 -- 12 files changed, 11 insertions(+), 9 deletions(-)
tools/perf/config/feature-checks/test-backtrace.c +0 -1
@@ -11,4 +11,3 @@ int main(void)return 0 ; } -
tools/perf/config/feature-checks/test-cplus-demangle.c +0 -1
@@ -12,4 +12,3 @@ int main(void)return 0 ; } -
tools/perf/config/feature-checks/test-dwarf.c +1 -0
@@ -5,5 +5,6 @@int main (void ) {Dwarf *dbg =dwarf_begin (0 ,DWARF_C_READ ); +return (long )dbg; }
tools/perf/config/feature-checks/test-glibc.c +1 -1
@@ -3,6 +3,6 @@int main (void ) {const char *version =gnu_get_libc_version (); +return (long )version; } -
tools/perf/config/feature-checks/test-libaudit.c +1 -0
@@ -5,5 +5,6 @@ extern int printf(const char *format, ...);int main (void ) {printf ("error message: %s\n" ,audit_errno_to_name (0 )); +return audit_open (); }
tools/perf/config/feature-checks/test-libbfd.c +0 -1
@@ -13,4 +13,3 @@ int main(void)return 0 ; } -
tools/perf/config/feature-checks/test-libelf-getphdrnum.c +2 -1
@@ -1,7 +1,8 @@#include <libelf.h> -# +int main (void ) {size_t dst; +return elf_getphdrnum (0 , &dst); }
tools/perf/config/feature-checks/test-libelf-mmap.c +2 -1
@@ -1,7 +1,8 @@#include <libelf.h> -# +int main (void ) {Elf *elf =elf_begin (0 ,ELF_C_READ_MMAP ,0 ); +return (long )elf; }
tools/perf/config/feature-checks/test-libelf.c +1 -0
@@ -3,5 +3,6 @@int main (void ) {Elf *elf =elf_begin (0 ,ELF_C_READ ,0 ); +return (long )elf; }
tools/perf/config/feature-checks/test-libnuma.c +1 -0
@@ -4,5 +4,6 @@int main (void ) {numa_available (); +return 0 ; }
tools/perf/config/feature-checks/test-libpython.c +2 -1
@@ -1,7 +1,8 @@#include <Python.h> -# +int main (void ) {Py_Initialize (); +return 0 ; }
tools/perf/config/feature-tests.mak deleted +0 -2
@@ -1,2 +0,0 @@ - -
Signature · 1 line
1.7.11.7
Quoted 1 line · Ingo Molnar
This series improves various aspects of the
tools/perfbuild system.
Branch in your tip tree? tip/rfc/perf does not seem to be it and you have too many branches to manually search for it.
David
Quoted 6 lines · David Ahern
Quoted 1 line · Ingo Molnar
This series improves various aspects of the
tools/perfbuild system.Branch in your tip tree? tip/rfc/perf does not seem to be it and you have too many branches to manually search for it.
These changes are not yet committed into any stable Git tree - I've pushed them out into:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git tmp.perf
(it might take a few minutes for kernel.org to sync up.)
Thanks,
Ingo
Quoted 6 lines · Ingo Molnar
These changes are not yet committed into any stable Git tree - I've pushed them out into:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.gittmp.perf(it might take a few minutes for kernel.org to sync up.)
Tested on Fedora 12, 14, 16 with varying degrees of feature support installed. The tests that failed are all static builds with the command line:
make O=/tmp/junk -C tools/perf LDFLAGS=-static NO_DWARF=1
Passing LDFLAGS to the feature tests should handle that.
I also noticed that the dwarf test is still run even with the NO_DWARF option passed in:
[daahern@nxos-vdc-dev1 perf]$ make O=/tmp/junk LDFLAGS=-static NO_DWARF=1 -j 4
BUILD: Doing 'make -j16' parallel build
Auto-detecting system features:
... backtrace: [ on ] ... dwarf: [ on ] ... fortify-source: [ on ]
Note the dwarf test shows 'on'.
David
PATCH 1/1 tools/perf/build: Pass through LDFLAGS to feature tests
Quoted 8 lines · David Ahern
Quoted 6 lines · Ingo Molnar
These changes are not yet committed into any stable Git tree - I've pushed them out into:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.gittmp.perf(it might take a few minutes for kernel.org to sync up.)
Quoted 7 lines
Tested on Fedora 12, 14, 16 with varying degrees of feature support installed. The tests that failed are all static builds with the command line:
make O=/tmp/junk -C
tools/perfLDFLAGS=-static NO_DWARF=1Passing LDFLAGS to the feature tests should handle that.
Indeed. Does the patch below fix it for you?
Thanks,
Ingo
-------------------->
Subject: tools/perf/build: Pass through LDFLAGS to feature tests
From: Ingo Molnar <[email protected]>
Date: Mon Oct 7 17:48:56 CEST 2013
David Ahern reported that when passing in LDFLAGS=-static then the feature checks still succeed - causing build failures down the line because the static libraries are missing.
Solve this by passing through LDFLAGS to the feature-check Makefile.
--- tools/perf/config/Makefile | 4 ++-- tools/perf/config/feature-checks/Makefile | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
tools/perf/config/Makefile +2 -2
@@ -95,7 +95,7 @@ endif feature_check = $(eval $(feature_check_code)) define feature_check_code - feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) -C config/feature-checks test-$1 >/dev/null 2>/dev/null && echo 1 || echo 0) + feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) LDFLAGS=$(LDFLAGS) -C config/feature-checks test-$1 >/dev/null 2>/dev/null && echo 1 || echo 0) endef feature_set = $(eval $(feature_set_code))
@@ -172,7 +172,7 @@ ifeq ($(feature-all), 1) # $(foreach feat,$(CORE_FEATURE_TESTS),$(call feature_set,$(feat))) else - $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) -i -j -C config/feature-checks $(CORE_FEATURE_TESTS) >/dev/null 2>&1) + $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) LDFLAGS=$(LDFLAGS) -i -j -C config/feature-checks $(CORE_FEATURE_TESTS) >/dev/null 2>&1) $(foreach feat,$(CORE_FEATURE_TESTS),$(call feature_check,$(feat))) endif
tools/perf/config/feature-checks/Makefile +1 -1
@@ -32,7 +32,7 @@ CC := $(CC) -MD all: $(FILES) -BUILD = $(CC) -o $(OUTPUT)$@ [email protected] +BUILD = $(CC) $(LDFLAGS) -o $(OUTPUT)$@ [email protected] ###############################
Re: [PATCH] tools/perf/build: Pass through LDFLAGS to feature tests
Quoted 15 lines · Ingo Molnar
Quoted 12 lines · David Ahern
Quoted 6 lines · Ingo Molnar
These changes are not yet committed into any stable Git tree - I've pushed them out into:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.gittmp.perf(it might take a few minutes for kernel.org to sync up.)
Tested on Fedora 12, 14, 16 with varying degrees of feature support installed. The tests that failed are all static builds with the command line:
Quoted 5 lines
Quoted 3 lines
make O=/tmp/junk -C
tools/perfLDFLAGS=-static NO_DWARF=1Passing LDFLAGS to the feature tests should handle that.
Indeed. Does the patch below fix it for you?
It does.
tip-bot for Ingo Molnar
merge bot[tip:perf/core] tools/perf/build: Pass through LDFLAGS to feature tests
In reply to Ingo Molnartools/perf/build: Pass through LDFLAGS to feature tests
Commit-ID: aa4acf6cf102f639a2023b389ca8be8b8d9cad52 Gitweb: http://git.kernel.org/tip/aa4acf6cf102f639a2023b389ca8be8b8d9cad52 Author: Ingo Molnar <[email protected]> AuthorDate: Mon, 7 Oct 2013 17:51:29 +0200 Committer: Ingo Molnar <[email protected]> CommitDate: Wed, 9 Oct 2013 08:49:03 +0200
tools/perf/build: Pass through LDFLAGS to feature tests
David Ahern reported that when passing in LDFLAGS=-static then the feature checks still succeed - causing build failures down the line because the static libraries are missing.
Solve this by passing through LDFLAGS to the feature-check Makefile.
--- tools/perf/config/Makefile | 4 ++-- tools/perf/config/feature-checks/Makefile | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
tools/perf/config/Makefile +2 -2
@@ -95,7 +95,7 @@ endif feature_check = $(eval $(feature_check_code)) define feature_check_code - feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) -C config/feature-checks test-$1 >/dev/null 2>/dev/null && echo 1 || echo 0) + feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) LDFLAGS=$(LDFLAGS) -C config/feature-checks test-$1 >/dev/null 2>/dev/null && echo 1 || echo 0) endef feature_set = $(eval $(feature_set_code))
@@ -173,7 +173,7 @@ ifeq ($(feature-all), 1) # $(foreach feat,$(CORE_FEATURE_TESTS),$(call feature_set,$(feat))) else - $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) -i -j -C config/feature-checks $(CORE_FEATURE_TESTS) >/dev/null 2>&1) + $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) LDFLAGS=$(LDFLAGS) -i -j -C config/feature-checks $(CORE_FEATURE_TESTS) >/dev/null 2>&1) $(foreach feat,$(CORE_FEATURE_TESTS),$(call feature_check,$(feat))) endif
tools/perf/config/feature-checks/Makefile +1 -1
@@ -32,7 +32,7 @@ CC := $(CC) -MD all: $(FILES) -BUILD = $(CC) -o $(OUTPUT)$@ [email protected] +BUILD = $(CC) $(LDFLAGS) -o $(OUTPUT)$@ [email protected] ###############################
Quoted 7 lines · David Ahern
I also noticed that the dwarf test is still run even with the
NO_DWARFoption passed in:[daahern@nxos-vdc-dev1 perf]$ make O=/tmp/junk LDFLAGS=-static NO_DWARF=1 -j 4
BUILD: Doing 'make -j16' parallel build
Quoted 7 lines
Auto-detecting system features:
... backtrace: [ on ] ... dwarf: [ on ] ... fortify-source: [ on ]Note the dwarf test shows 'on'.
Hm, yes.
This is just the print-out though - the actual feature logic should still follow the NO_DWARF=1 setting (modulo bugs).
So I'm wondering, should we solve this by adding extra logic linking the feature flags with their legacy names. It would get unwieldy rather quickly I think.
Another solution would be to introduce a new method to disable features, via something like:
make FEATURE_dwarf=0
Where the pattern would follow the auto-detected naming. This would simplify the printout logic and would simplify the feature support / flags decision tree as well.
Furthermore, it would unify the various flags we have today, which is rather mixed: for example there's NO_DWARF which is a name that shows negated logic, but there's also HAVE_CPLUS_DEMANGLE_SUPPORT is is a name with positive logic. We'd have one uniform naming scheme permeating the whole build system.
And that brings in your [K]config patches: which would make sense in that context as well, as they'd allow the permanent configuration of features with 3 states for each feature flag:
off
auto-detect
on
Your scheme I think makes a lot of sense on top of my bits. Packagers would likely want to use a .config to build perf, most users would likely be fine with a default of everything on auto-detect. Specialized users would want to use their own .config's.
Thanks,
Ingo
Quoted 18 lines · Ingo Molnar
Quoted 7 lines · David Ahern
I also noticed that the dwarf test is still run even with the
NO_DWARFoption passed in:[daahern@nxos-vdc-dev1 perf]$ make O=/tmp/junk LDFLAGS=-static NO_DWARF=1 -j 4
BUILD: Doing 'make -j16' parallel buildQuoted 7 lines
Auto-detecting system features:
... backtrace: [ on ] ... dwarf: [ on ] ... fortify-source: [ on ]Note the dwarf test shows 'on'.
Quoted 8 lines
Hm, yes.
This is just the print-out though - the actual feature logic should still follow the NO_DWARF=1 setting (modulo bugs).
So I'm wondering, should we solve this by adding extra logic linking the feature flags with their legacy names. It would get unwieldy rather quickly I think.
yes.
Quoted 9 lines
Another solution would be to introduce a new method to disable features, via something like:
make FEATURE_dwarf=0
Where the pattern would follow the auto-detected naming. This would simplify the printout logic and would simplify the feature support / flags decision tree as well.
Quoted 5 lines
Furthermore, it would unify the various flags we have today, which is rather mixed: for example there's
NO_DWARFwhich is a name that shows negated logic, but there's alsoHAVE_CPLUS_DEMANGLE_SUPPORTis is a name with positive logic. We'd have one uniform naming scheme permeating the whole build system.
The Kconfig series converts all of the NO_XXXXX to CONFIG_XXXXX. I'd like to see that because it mirrors kernel configs and is a stepping stone to kconf integration.
If the NO_XXXX takes precedence over the autoprobe detection then the user gets what is asked, so I guess we can leave it as is for now.
Quoted 5 lines
And that brings in your [K]config patches: which would make sense in that context as well, as they'd allow the permanent configuration of features with 3 states for each feature flag:
Quoted 8 lines
off
auto-detect
onYour scheme I think makes a lot of sense on top of my bits. Packagers would likely want to use a .config to build perf, most users would likely be fine with a default of everything on auto-detect. Specialized users would want to use their own .config's.
Yes. This series helps with the auto-probing config option. Jiri has done quite a bit in this direction as well. Once this set goes in I'll see if I can find some time to revisit the kconf stuff - unless Jiri beats me to it. We have been overlapping on a few features. ;-)
David
Quoted 24 lines · David Ahern
Quoted 6 lines
This is just the print-out though - the actual feature logic should still follow the NO_DWARF=1 setting (modulo bugs).
So I'm wondering, should we solve this by adding extra logic linking the feature flags with their legacy names. It would get unwieldy rather quickly I think.
yes.
Quoted 9 lines
Another solution would be to introduce a new method to disable features, via something like:
make FEATURE_dwarf=0
Where the pattern would follow the auto-detected naming. This would simplify the printout logic and would simplify the feature support / flags decision tree as well.
Quoted 5 lines
Furthermore, it would unify the various flags we have today, which is rather mixed: for example there's
NO_DWARFwhich is a name that shows negated logic, but there's alsoHAVE_CPLUS_DEMANGLE_SUPPORTis is a name with positive logic. We'd have one uniform naming scheme permeating the whole build system.
Quoted 3 lines
The
Kconfigseries converts all of theNO_XXXXXtoCONFIG_XXXXX. I'd like to see that because it mirrors kernel configs and is a stepping stone to kconf integration.
Yeah.
It also negates NO_XXXXX use back to straight logic, right?
I.e. CONFIG_LIBSLANG=y should mean that libslang is enabled, CONFIG_LIBSLANG undefined means that it's disabled.
These could then also be passed straight to the build system:
make CONFIG_LIBSLANG=0
should have the same effect as NO_LIBSLANG. The old NO_XXXXX flags would go away.
Maybe we could also force features on via:
make CONFIG_LIBSLANG=1
this could be used to work around auto-detection failures, and could be used to check whether a feature check is precise.
This:
make CONFIG_ALL=1
could perhaps be a handy shortcut to force-enable all features [that make sense on an architecture] - for package builds.
Quoted 2 lines
If the
NO_XXXXtakes precedence over the autoprobe detection then the user gets what is asked, so I guess we can leave it as is for now.
Okay. I'll try to leave it alone as much as possible, to not upset your kconfig series even more ...
Thanks,
Ingo
Quoted 5 lines · Ingo Molnar
The series also includes a number of fixes and convenience features:
- auto-detect the number of CPUs on the system and add the -j<cpus> option automatically
FWIW I would prefer if you not do that automatically, because:
- Often the optimal factor is not 1, but something like 1.5*CPUs (but I'm not sure it's the same on all systems, probably depends on the IO capacity and memory)
- It may use a lot of memory, so should be something controlled by the user.
- Often it's useful to use a few threads less to avoid interactivity problems on a workstation.
- With LTO there can be rare cases where you need to lower it to avoid running out of memory.
- Kernel build users should be already trained to set that parameter and it's not really a big burden.
The rest looks like a great improvement.
-Andi
Signature · 1 line
[email protected] -- Speaking for myself only
Quoted 4 lines · Andi Kleen
Quoted 3 lines · Ingo Molnar
The series also includes a number of fixes and convenience features:
Quoted 8 lines
Quoted 2 lines
- auto-detect the number of CPUs on the system and add the -j<cpus> option automatically
FWIW I would prefer if you not do that automatically, because:
- Often the optimal factor is not 1, but something like 1.5*CPUs (but I'm not sure it's the same on all systems, probably depends on the IO capacity and memory)
In my experience on numerous systems perf builds are rarely IO bound. But it could be upped to a factor of 1.5x without hurting the normal case if someone does convincing measurements.
Quoted 2 lines
- It may use a lot of memory, so should be something controlled by the user.
Lamest excuse evar: if your box cannot take NR_CPUs make jobs then you can tune it down. (You'll run into many other problems first though, before you start worrying about the perf build memory use.)
In the unlikely case of building it on a limited but SMP capable system with less than ~100 MB of free RAM you can override it:
$ make
BUILD: Doing 'make -j12' parallel build $ make JOBS=1
BUILD: Doing 'make -j1' parallel buildProblem solved.
Quoted 2 lines
- Often it's useful to use a few threads less to avoid interactivity problems on a workstation.
Many people use 2*NR_CPUS for kernel builds and report interactivity problems relentlessly.
Quoted 2 lines
- With LTO there can be rare cases where you need to lower it to avoid running out of memory.
Oh, so out you come with the real reason, near the end of your list of complaints. Not a very honest approach.
If LTO is implemented correctly for a project then the biggest memory usage peak is during the final linking stage - which is single threaded...
Quoted 2 lines
- Kernel build users should be already trained to set that parameter and it's not really a big burden.
Second lamest excuse evar.
Really, 'make' doing the right thing out of box is a basic usability feature.
All other concerns you listed are secondary: they occur for specialized users or usecases, which need special care and hand-tuning anyway.
Thanks,
Ingo