Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1293470 > unrolled thread
| Started by | Arnaldo Carvalho de Melo <acme@kernel.org> |
|---|---|
| First post | 2015-12-17 02:00 +0100 |
| Last post | 2015-12-18 09:40 +0100 |
| Articles | 5 — 2 participants |
Back to article view | Back to linux.kernel
[GIT PULL 00/10] perf/core improvements Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-12-17 02:00 +0100
[PATCH 05/10] perf tools: Provide subcmd configuration at runtime Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-12-17 02:00 +0100
[PATCH 02/10] tools build: Fix feature Makefile issues with 'O=' Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-12-17 02:00 +0100
Re: [GIT PULL 00/10] perf/core improvements Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-12-17 18:40 +0100
Re: [GIT PULL 00/10] perf/core improvements Ingo Molnar <mingo@kernel.org> - 2015-12-18 09:40 +0100
| From | Arnaldo Carvalho de Melo <acme@kernel.org> |
|---|---|
| Date | 2015-12-17 02:00 +0100 |
| Subject | [GIT PULL 00/10] perf/core improvements |
| Message-ID | <qGuVA-Ae-11@gated-at.bofh.it> |
Hi Ingo,
Please consider pulling, this is on top of the perf-core-for-mingo
tag, that is not yet merged.
- Arnaldo
The following changes since commit 7efe0e034c713716060bc7794c7e332589980c70:
perf record: Support custom vmlinux path (2015-12-14 13:04:12 -0300)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-core-for-mingo-2
for you to fetch changes up to 5c560cfcf1c0f897f78aa5955e3eb05418891f34:
tools subcmd: Rename subcmd header include guards (2015-12-16 21:39:01 -0300)
----------------------------------------------------------------
perf/core improvements
User visible:
- Add record.build-id config option to 'perf record', to allow configuring
in the ~/.perfconfig file if and how build-ids should be processed, allowing
a permanent setting for options such as -B and -N: (Namhyung Kim)
$ perf record -h -B -N
Usage: perf record [<options>] [<command>]
or: perf record [<options>] -- <command> [<options>]
-B, --no-buildid do not collect buildids in perf.data
-N, --no-buildid-cache do not update the buildid cache
$
Infrastructure:
- Move code for options parsing and subcommand handling from tools/perf/
to tools/lib/subcmd/, so that it can be used by other tools/ living
utilities (Josh Poimboeuf)
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
----------------------------------------------------------------
Josh Poimboeuf (9):
tools build: Fix feature Makefile issues with 'O='
perf tools: Move strlcpy() from perf to tools/lib/string.c
perf tools: Document the fact that parse_options*() may exit
perf tools: Provide subcmd configuration at runtime
perf tools: Remove subcmd dependencies on strbuf
perf tools: Remove 'perf' from subcmd function and variable names
perf tools: Finalize subcmd independence
perf subcmd: Create subcmd library
tools subcmd: Rename subcmd header include guards
Namhyung Kim (1):
perf record: Add record.build-id config option
tools/build/Makefile.feature | 2 +-
tools/build/feature/Makefile | 93 +++++------
tools/include/linux/string.h | 4 +
tools/lib/string.c | 27 +++
tools/lib/subcmd/Build | 7 +
tools/lib/subcmd/Makefile | 48 ++++++
tools/lib/subcmd/exec-cmd.c | 209 ++++++++++++++++++++++++
tools/lib/subcmd/exec-cmd.h | 16 ++
tools/{perf/util => lib/subcmd}/help.c | 63 +++++--
tools/{perf/util => lib/subcmd}/help.h | 10 +-
tools/{perf/util => lib/subcmd}/pager.c | 15 +-
tools/lib/subcmd/pager.h | 9 +
tools/{perf/util => lib/subcmd}/parse-options.c | 116 +++++++------
tools/{perf/util => lib/subcmd}/parse-options.h | 12 +-
tools/{perf/util => lib/subcmd}/run-command.c | 24 ++-
tools/{perf/util => lib/subcmd}/run-command.h | 12 +-
tools/{perf/util => lib/subcmd}/sigchain.c | 3 +-
tools/{perf/util => lib/subcmd}/sigchain.h | 6 +-
tools/lib/subcmd/subcmd-config.c | 11 ++
tools/lib/subcmd/subcmd-config.h | 14 ++
tools/lib/subcmd/subcmd-util.h | 91 +++++++++++
tools/perf/Build | 5 +-
tools/perf/Documentation/perf-record.txt | 14 +-
tools/perf/MANIFEST | 1 +
tools/perf/Makefile.perf | 20 ++-
tools/perf/arch/x86/util/intel-pt.c | 2 +-
tools/perf/bench/futex-hash.c | 2 +-
tools/perf/bench/futex-lock-pi.c | 2 +-
tools/perf/bench/futex-requeue.c | 2 +-
tools/perf/bench/futex-wake-parallel.c | 2 +-
tools/perf/bench/futex-wake.c | 2 +-
tools/perf/bench/mem-functions.c | 2 +-
tools/perf/bench/numa.c | 2 +-
tools/perf/bench/sched-messaging.c | 2 +-
tools/perf/bench/sched-pipe.c | 2 +-
tools/perf/builtin-annotate.c | 2 +-
tools/perf/builtin-bench.c | 2 +-
tools/perf/builtin-buildid-cache.c | 2 +-
tools/perf/builtin-buildid-list.c | 2 +-
tools/perf/builtin-config.c | 2 +-
tools/perf/builtin-data.c | 2 +-
tools/perf/builtin-evlist.c | 2 +-
tools/perf/builtin-help.c | 10 +-
tools/perf/builtin-inject.c | 2 +-
tools/perf/builtin-kmem.c | 2 +-
tools/perf/builtin-kvm.c | 2 +-
tools/perf/builtin-list.c | 2 +-
tools/perf/builtin-lock.c | 2 +-
tools/perf/builtin-mem.c | 2 +-
tools/perf/builtin-probe.c | 2 +-
tools/perf/builtin-record.c | 15 +-
tools/perf/builtin-report.c | 2 +-
tools/perf/builtin-sched.c | 2 +-
tools/perf/builtin-script.c | 12 +-
tools/perf/builtin-stat.c | 2 +-
tools/perf/builtin-timechart.c | 2 +-
tools/perf/builtin-top.c | 2 +-
tools/perf/builtin-trace.c | 4 +-
tools/perf/perf.c | 18 +-
tools/perf/tests/attr.c | 4 +-
tools/perf/tests/builtin-test.c | 2 +-
tools/perf/util/Build | 7 -
tools/perf/util/auxtrace.c | 2 +-
tools/perf/util/cache.h | 10 +-
tools/perf/util/cgroup.c | 2 +-
tools/perf/util/config.c | 2 +-
tools/perf/util/evlist.c | 2 +-
tools/perf/util/exec_cmd.c | 149 -----------------
tools/perf/util/exec_cmd.h | 13 --
tools/perf/util/help-unknown-cmd.c | 2 +-
tools/perf/util/pager.h | 7 -
tools/perf/util/parse-branch-options.c | 2 +-
tools/perf/util/parse-events.c | 4 +-
tools/perf/util/parse-regs-options.c | 2 +-
tools/perf/util/path.c | 18 --
tools/perf/util/sort.h | 2 +-
tools/perf/util/util.h | 14 --
77 files changed, 775 insertions(+), 418 deletions(-)
create mode 100644 tools/lib/subcmd/Build
create mode 100644 tools/lib/subcmd/Makefile
create mode 100644 tools/lib/subcmd/exec-cmd.c
create mode 100644 tools/lib/subcmd/exec-cmd.h
rename tools/{perf/util => lib/subcmd}/help.c (81%)
rename tools/{perf/util => lib/subcmd}/help.h (87%)
rename tools/{perf/util => lib/subcmd}/pager.c (85%)
create mode 100644 tools/lib/subcmd/pager.h
rename tools/{perf/util => lib/subcmd}/parse-options.c (90%)
rename tools/{perf/util => lib/subcmd}/parse-options.h (96%)
rename tools/{perf/util => lib/subcmd}/run-command.c (90%)
rename tools/{perf/util => lib/subcmd}/run-command.h (86%)
rename tools/{perf/util => lib/subcmd}/sigchain.c (95%)
rename tools/{perf/util => lib/subcmd}/sigchain.h (55%)
create mode 100644 tools/lib/subcmd/subcmd-config.c
create mode 100644 tools/lib/subcmd/subcmd-config.h
create mode 100644 tools/lib/subcmd/subcmd-util.h
delete mode 100644 tools/perf/util/exec_cmd.c
delete mode 100644 tools/perf/util/exec_cmd.h
delete mode 100644 tools/perf/util/pager.h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Arnaldo Carvalho de Melo <acme@kernel.org> |
|---|---|
| Date | 2015-12-17 02:00 +0100 |
| Subject | [PATCH 05/10] perf tools: Provide subcmd configuration at runtime |
| Message-ID | <qGv5g-DM-1@gated-at.bofh.it> |
| In reply to | #1293470 |
From: Josh Poimboeuf <jpoimboe@redhat.com>
Create init functions for exec_cmd.c and pager.c. This allows their
configuration to be specified at runtime so they can be split out into a
separate library which can be used by other programs. Their
configuration is stored in a shared subcmd_config struct.
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/21f5f6b38da72c985a8dcfa185700d03e7eecd1d.1450193761.git.jpoimboe@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/Build | 5 ++++-
tools/perf/perf.c | 6 +++++-
tools/perf/util/Build | 2 +-
tools/perf/util/cache.h | 1 +
tools/perf/util/exec_cmd.c | 23 ++++++++++++++++-------
tools/perf/util/exec_cmd.h | 3 +++
tools/perf/util/pager.c | 8 +++++++-
tools/perf/util/pager.h | 2 ++
tools/perf/util/parse-options.c | 4 +++-
tools/perf/util/subcmd-config.c | 11 +++++++++++
tools/perf/util/subcmd-config.h | 14 ++++++++++++++
11 files changed, 67 insertions(+), 12 deletions(-)
create mode 100644 tools/perf/util/subcmd-config.c
create mode 100644 tools/perf/util/subcmd-config.h
diff --git a/tools/perf/Build b/tools/perf/Build
index 2a41217e9d88..00c4b8c3d8ca 100644
--- a/tools/perf/Build
+++ b/tools/perf/Build
@@ -36,7 +36,10 @@ paths += -DPERF_MAN_PATH="BUILD_STR($(mandir_SQ))"
CFLAGS_builtin-help.o += $(paths)
CFLAGS_builtin-timechart.o += $(paths)
-CFLAGS_perf.o += -DPERF_HTML_PATH="BUILD_STR($(htmldir_SQ))" -include $(OUTPUT)PERF-VERSION-FILE
+CFLAGS_perf.o += -DPERF_HTML_PATH="BUILD_STR($(htmldir_SQ))" \
+ -DPERF_EXEC_PATH="BUILD_STR($(perfexecdir_SQ))" \
+ -DPREFIX="BUILD_STR($(prefix_SQ))" \
+ -include $(OUTPUT)PERF-VERSION-FILE
CFLAGS_builtin-trace.o += -DSTRACE_GROUPS_DIR="BUILD_STR($(STRACE_GROUPS_DIR_SQ))"
libperf-y += util/
diff --git a/tools/perf/perf.c b/tools/perf/perf.c
index 59ea48c7e26c..783a3310a9d8 100644
--- a/tools/perf/perf.c
+++ b/tools/perf/perf.c
@@ -119,7 +119,7 @@ static void commit_pager_choice(void)
{
switch (use_pager) {
case 0:
- setenv("PERF_PAGER", "cat", 1);
+ setenv(PERF_PAGER_ENVIRONMENT, "cat", 1);
break;
case 1:
/* setup_pager(); */
@@ -530,6 +530,10 @@ int main(int argc, const char **argv)
const char *cmd;
char sbuf[STRERR_BUFSIZE];
+ /* libsubcmd init */
+ exec_cmd_init("perf", PREFIX, PERF_EXEC_PATH, EXEC_PATH_ENVIRONMENT);
+ pager_init(PERF_PAGER_ENVIRONMENT);
+
/* The page_size is placed in util object. */
page_size = sysconf(_SC_PAGE_SIZE);
cacheline_size = sysconf(_SC_LEVEL1_DCACHE_LINESIZE);
diff --git a/tools/perf/util/Build b/tools/perf/util/Build
index 99b3dae57806..196beefa16a9 100644
--- a/tools/perf/util/Build
+++ b/tools/perf/util/Build
@@ -88,6 +88,7 @@ libperf-y += parse-branch-options.o
libperf-y += parse-regs-options.o
libperf-y += term.o
libperf-y += help-unknown-cmd.o
+libperf-y += subcmd-config.o
libperf-$(CONFIG_LIBBPF) += bpf-loader.o
libperf-$(CONFIG_BPF_PROLOGUE) += bpf-prologue.o
@@ -113,7 +114,6 @@ libperf-$(CONFIG_ZLIB) += zlib.o
libperf-$(CONFIG_LZMA) += lzma.o
CFLAGS_config.o += -DETC_PERFCONFIG="BUILD_STR($(ETC_PERFCONFIG_SQ))"
-CFLAGS_exec_cmd.o += -DPERF_EXEC_PATH="BUILD_STR($(perfexecdir_SQ))" -DPREFIX="BUILD_STR($(prefix_SQ))"
$(OUTPUT)util/parse-events-flex.c: util/parse-events.l $(OUTPUT)util/parse-events-bison.c
$(call rule_mkdir)
diff --git a/tools/perf/util/cache.h b/tools/perf/util/cache.h
index d723ecb9b959..fc6a745d2ec6 100644
--- a/tools/perf/util/cache.h
+++ b/tools/perf/util/cache.h
@@ -21,6 +21,7 @@
#define DEFAULT_PERF_DIR_ENVIRONMENT ".perf"
#define PERF_DEBUGFS_ENVIRONMENT "PERF_DEBUGFS_DIR"
#define PERF_TRACEFS_ENVIRONMENT "PERF_TRACEFS_DIR"
+#define PERF_PAGER_ENVIRONMENT "PERF_PAGER"
typedef int (*config_fn_t)(const char *, const char *, void *);
extern int perf_default_config(const char *, const char *, void *);
diff --git a/tools/perf/util/exec_cmd.c b/tools/perf/util/exec_cmd.c
index 1099e92f5ee1..b935e4ce62a2 100644
--- a/tools/perf/util/exec_cmd.c
+++ b/tools/perf/util/exec_cmd.c
@@ -1,6 +1,7 @@
#include "cache.h"
#include "exec_cmd.h"
#include "quote.h"
+#include "subcmd-config.h"
#include <string.h>
@@ -9,15 +10,23 @@
static const char *argv_exec_path;
static const char *argv0_path;
+void exec_cmd_init(const char *exec_name, const char *prefix,
+ const char *exec_path, const char *exec_path_env)
+{
+ subcmd_config.exec_name = exec_name;
+ subcmd_config.prefix = prefix;
+ subcmd_config.exec_path = exec_path;
+ subcmd_config.exec_path_env = exec_path_env;
+}
+
char *system_path(const char *path)
{
- static const char *prefix = PREFIX;
struct strbuf d = STRBUF_INIT;
if (is_absolute_path(path))
return strdup(path);
- strbuf_addf(&d, "%s/%s", prefix, path);
+ strbuf_addf(&d, "%s/%s", subcmd_config.prefix, path);
path = strbuf_detach(&d, NULL);
return (char *)path;
}
@@ -47,7 +56,7 @@ void perf_set_argv_exec_path(const char *exec_path)
/*
* Propagate this setting to external programs.
*/
- setenv(EXEC_PATH_ENVIRONMENT, exec_path, 1);
+ setenv(subcmd_config.exec_path_env, exec_path, 1);
}
@@ -59,11 +68,11 @@ char *perf_exec_path(void)
if (argv_exec_path)
return strdup(argv_exec_path);
- env = getenv(EXEC_PATH_ENVIRONMENT);
+ env = getenv(subcmd_config.exec_path_env);
if (env && *env)
return strdup(env);
- return system_path(PERF_EXEC_PATH);
+ return system_path(subcmd_config.exec_path);
}
static void add_path(struct strbuf *out, const char *path)
@@ -107,7 +116,7 @@ static const char **prepare_perf_cmd(const char **argv)
; /* just counting */
nargv = malloc(sizeof(*nargv) * (argc + 2));
- nargv[0] = "perf";
+ nargv[0] = subcmd_config.exec_name;
for (argc = 0; argv[argc]; argc++)
nargv[argc + 1] = argv[argc];
nargv[argc + 1] = NULL;
@@ -118,7 +127,7 @@ int execv_perf_cmd(const char **argv) {
const char **nargv = prepare_perf_cmd(argv);
/* execvp() can only ever return if it fails */
- execvp("perf", (char **)nargv);
+ execvp(subcmd_config.exec_name, (char **)nargv);
free(nargv);
return -1;
diff --git a/tools/perf/util/exec_cmd.h b/tools/perf/util/exec_cmd.h
index 48b4175f1e11..fd4434e48d21 100644
--- a/tools/perf/util/exec_cmd.h
+++ b/tools/perf/util/exec_cmd.h
@@ -1,6 +1,9 @@
#ifndef __PERF_EXEC_CMD_H
#define __PERF_EXEC_CMD_H
+extern void exec_cmd_init(const char *exec_name, const char *prefix,
+ const char *exec_path, const char *exec_path_env);
+
extern void perf_set_argv_exec_path(const char *exec_path);
extern const char *perf_extract_argv0_path(const char *path);
extern void setup_path(void);
diff --git a/tools/perf/util/pager.c b/tools/perf/util/pager.c
index 7dcbef64b609..d5ef62eaa413 100644
--- a/tools/perf/util/pager.c
+++ b/tools/perf/util/pager.c
@@ -1,6 +1,7 @@
#include "cache.h"
#include "run-command.h"
#include "sigchain.h"
+#include "subcmd-config.h"
/*
* This is split up from the rest of git so that we can do
@@ -9,6 +10,11 @@
static int spawned_pager;
+void pager_init(const char *pager_env)
+{
+ subcmd_config.pager_env = pager_env;
+}
+
static void pager_preexec(void)
{
/*
@@ -46,7 +52,7 @@ static void wait_for_pager_signal(int signo)
void setup_pager(void)
{
- const char *pager = getenv("PERF_PAGER");
+ const char *pager = getenv(subcmd_config.pager_env);
if (!isatty(1))
return;
diff --git a/tools/perf/util/pager.h b/tools/perf/util/pager.h
index 2794a83b7e85..d6a591a4c017 100644
--- a/tools/perf/util/pager.h
+++ b/tools/perf/util/pager.h
@@ -1,6 +1,8 @@
#ifndef __PERF_PAGER_H
#define __PERF_PAGER_H
+extern void pager_init(const char *pager_env);
+
extern void setup_pager(void);
extern int pager_in_use(void);
diff --git a/tools/perf/util/parse-options.c b/tools/perf/util/parse-options.c
index 0ad1384783dd..da4ba21cad21 100644
--- a/tools/perf/util/parse-options.c
+++ b/tools/perf/util/parse-options.c
@@ -2,6 +2,7 @@
#include "parse-options.h"
#include "cache.h"
#include "header.h"
+#include "subcmd-config.h"
#include <linux/string.h>
#define OPT_SHORT 1
@@ -577,7 +578,8 @@ int parse_options_subcommand(int argc, const char **argv, const struct option *o
if (subcommands && !usagestr[0]) {
struct strbuf buf = STRBUF_INIT;
- strbuf_addf(&buf, "perf %s [<options>] {", argv[0]);
+ strbuf_addf(&buf, "%s %s [<options>] {",
+ subcmd_config.exec_name, argv[0]);
for (int i = 0; subcommands[i]; i++) {
if (i)
strbuf_addstr(&buf, "|");
diff --git a/tools/perf/util/subcmd-config.c b/tools/perf/util/subcmd-config.c
new file mode 100644
index 000000000000..d017c728bd1b
--- /dev/null
+++ b/tools/perf/util/subcmd-config.c
@@ -0,0 +1,11 @@
+#include "subcmd-config.h"
+
+#define UNDEFINED "SUBCMD_HAS_NOT_BEEN_INITIALIZED"
+
+struct subcmd_config subcmd_config = {
+ .exec_name = UNDEFINED,
+ .prefix = UNDEFINED,
+ .exec_path = UNDEFINED,
+ .exec_path_env = UNDEFINED,
+ .pager_env = UNDEFINED,
+};
diff --git a/tools/perf/util/subcmd-config.h b/tools/perf/util/subcmd-config.h
new file mode 100644
index 000000000000..cc8514030b5c
--- /dev/null
+++ b/tools/perf/util/subcmd-config.h
@@ -0,0 +1,14 @@
+#ifndef __PERF_SUBCMD_CONFIG_H
+#define __PERF_SUBCMD_CONFIG_H
+
+struct subcmd_config {
+ const char *exec_name;
+ const char *prefix;
+ const char *exec_path;
+ const char *exec_path_env;
+ const char *pager_env;
+};
+
+extern struct subcmd_config subcmd_config;
+
+#endif /* __PERF_SUBCMD_CONFIG_H */
--
2.1.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Arnaldo Carvalho de Melo <acme@kernel.org> |
|---|---|
| Date | 2015-12-17 02:00 +0100 |
| Subject | [PATCH 02/10] tools build: Fix feature Makefile issues with 'O=' |
| Message-ID | <qGv5i-DM-55@gated-at.bofh.it> |
| In reply to | #1293470 |
From: Josh Poimboeuf <jpoimboe@redhat.com>
When building perf binaries outside the source tree with 'make O=<dir>',
the auto-detected features get re-tested for every build, which is
unnecessary and inconsistent with the behavior seen when building
directly in the source tree.
Another issue is that 'make O=<dir> clean' doesn't remove the feature
files from the object tree.
Fix these problems by looking for the binaries in the $(OUTPUT)
directory.
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/113bd01530e9761778c60a75a96c65fc59860f68.1450193761.git.jpoimboe@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/build/Makefile.feature | 2 +-
tools/build/feature/Makefile | 93 ++++++++++++++++++++++----------------------
2 files changed, 48 insertions(+), 47 deletions(-)
diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature
index b8c31ece2d96..6c0519de765d 100644
--- a/tools/build/Makefile.feature
+++ b/tools/build/Makefile.feature
@@ -7,7 +7,7 @@ endif
feature_check = $(eval $(feature_check_code))
define feature_check_code
- feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) CFLAGS="$(EXTRA_CFLAGS) $(FEATURE_CHECK_CFLAGS-$(1))" LDFLAGS="$(LDFLAGS) $(FEATURE_CHECK_LDFLAGS-$(1))" -C $(feature_dir) test-$1.bin >/dev/null 2>/dev/null && echo 1 || echo 0)
+ feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) CFLAGS="$(EXTRA_CFLAGS) $(FEATURE_CHECK_CFLAGS-$(1))" LDFLAGS="$(LDFLAGS) $(FEATURE_CHECK_LDFLAGS-$(1))" -C $(feature_dir) $(OUTPUT_FEATURES)test-$1.bin >/dev/null 2>/dev/null && echo 1 || echo 0)
endef
feature_set = $(eval $(feature_set_code))
diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
index cea04ce9f35c..bf8f0352264d 100644
--- a/tools/build/feature/Makefile
+++ b/tools/build/feature/Makefile
@@ -1,4 +1,3 @@
-
FILES= \
test-all.bin \
test-backtrace.bin \
@@ -38,38 +37,40 @@ FILES= \
test-bpf.bin \
test-get_cpuid.bin
+FILES := $(addprefix $(OUTPUT),$(FILES))
+
CC := $(CROSS_COMPILE)gcc -MD
PKG_CONFIG := $(CROSS_COMPILE)pkg-config
all: $(FILES)
-__BUILD = $(CC) $(CFLAGS) -Wall -Werror -o $(OUTPUT)$@ $(patsubst %.bin,%.c,$@) $(LDFLAGS)
- BUILD = $(__BUILD) > $(OUTPUT)$(@:.bin=.make.output) 2>&1
+__BUILD = $(CC) $(CFLAGS) -Wall -Werror -o $@ $(patsubst %.bin,%.c,$(@F)) $(LDFLAGS)
+ BUILD = $(__BUILD) > $(@:.bin=.make.output) 2>&1
###############################
-test-all.bin:
+$(OUTPUT)test-all.bin:
$(BUILD) -fstack-protector-all -O2 -D_FORTIFY_SOURCE=2 -ldw -lelf -lnuma -lelf -laudit -I/usr/include/slang -lslang $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null) $(FLAGS_PERL_EMBED) $(FLAGS_PYTHON_EMBED) -DPACKAGE='"perf"' -lbfd -ldl -lz -llzma
-test-hello.bin:
+$(OUTPUT)test-hello.bin:
$(BUILD)
-test-pthread-attr-setaffinity-np.bin:
+$(OUTPUT)test-pthread-attr-setaffinity-np.bin:
$(BUILD) -D_GNU_SOURCE -lpthread
-test-stackprotector-all.bin:
+$(OUTPUT)test-stackprotector-all.bin:
$(BUILD) -fstack-protector-all
-test-fortify-source.bin:
+$(OUTPUT)test-fortify-source.bin:
$(BUILD) -O2 -D_FORTIFY_SOURCE=2
-test-bionic.bin:
+$(OUTPUT)test-bionic.bin:
$(BUILD)
-test-libelf.bin:
+$(OUTPUT)test-libelf.bin:
$(BUILD) -lelf
-test-glibc.bin:
+$(OUTPUT)test-glibc.bin:
$(BUILD)
DWARFLIBS := -ldw
@@ -77,37 +78,37 @@ ifeq ($(findstring -static,${LDFLAGS}),-static)
DWARFLIBS += -lelf -lebl -lz -llzma -lbz2
endif
-test-dwarf.bin:
+$(OUTPUT)test-dwarf.bin:
$(BUILD) $(DWARFLIBS)
-test-libelf-mmap.bin:
+$(OUTPUT)test-libelf-mmap.bin:
$(BUILD) -lelf
-test-libelf-getphdrnum.bin:
+$(OUTPUT)test-libelf-getphdrnum.bin:
$(BUILD) -lelf
-test-libnuma.bin:
+$(OUTPUT)test-libnuma.bin:
$(BUILD) -lnuma
-test-numa_num_possible_cpus.bin:
+$(OUTPUT)test-numa_num_possible_cpus.bin:
$(BUILD) -lnuma
-test-libunwind.bin:
+$(OUTPUT)test-libunwind.bin:
$(BUILD) -lelf
-test-libunwind-debug-frame.bin:
+$(OUTPUT)test-libunwind-debug-frame.bin:
$(BUILD) -lelf
-test-libaudit.bin:
+$(OUTPUT)test-libaudit.bin:
$(BUILD) -laudit
-test-libslang.bin:
+$(OUTPUT)test-libslang.bin:
$(BUILD) -I/usr/include/slang -lslang
-test-gtk2.bin:
+$(OUTPUT)test-gtk2.bin:
$(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null)
-test-gtk2-infobar.bin:
+$(OUTPUT)test-gtk2-infobar.bin:
$(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null)
grep-libs = $(filter -l%,$(1))
@@ -119,63 +120,63 @@ PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS))
PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null`
FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
-test-libperl.bin:
+$(OUTPUT)test-libperl.bin:
$(BUILD) $(FLAGS_PERL_EMBED)
-test-libpython.bin:
+$(OUTPUT)test-libpython.bin:
$(BUILD)
-test-libpython-version.bin:
+$(OUTPUT)test-libpython-version.bin:
$(BUILD)
-test-libbfd.bin:
+$(OUTPUT)test-libbfd.bin:
$(BUILD) -DPACKAGE='"perf"' -lbfd -lz -liberty -ldl
-test-liberty.bin:
- $(CC) $(CFLAGS) -Wall -Werror -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' $(LDFLAGS) -lbfd -ldl -liberty
+$(OUTPUT)test-liberty.bin:
+ $(CC) $(CFLAGS) -Wall -Werror -o $@ test-libbfd.c -DPACKAGE='"perf"' $(LDFLAGS) -lbfd -ldl -liberty
-test-liberty-z.bin:
- $(CC) $(CFLAGS) -Wall -Werror -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' $(LDFLAGS) -lbfd -ldl -liberty -lz
+$(OUTPUT)test-liberty-z.bin:
+ $(CC) $(CFLAGS) -Wall -Werror -o $@ test-libbfd.c -DPACKAGE='"perf"' $(LDFLAGS) -lbfd -ldl -liberty -lz
-test-cplus-demangle.bin:
+$(OUTPUT)test-cplus-demangle.bin:
$(BUILD) -liberty
-test-backtrace.bin:
+$(OUTPUT)test-backtrace.bin:
$(BUILD)
-test-timerfd.bin:
+$(OUTPUT)test-timerfd.bin:
$(BUILD)
-test-libdw-dwarf-unwind.bin:
+$(OUTPUT)test-libdw-dwarf-unwind.bin:
$(BUILD) # -ldw provided by $(FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind)
-test-libbabeltrace.bin:
+$(OUTPUT)test-libbabeltrace.bin:
$(BUILD) # -lbabeltrace provided by $(FEATURE_CHECK_LDFLAGS-libbabeltrace)
-test-sync-compare-and-swap.bin:
+$(OUTPUT)test-sync-compare-and-swap.bin:
$(BUILD)
-test-compile-32.bin:
- $(CC) -m32 -o $(OUTPUT)$@ test-compile.c
+$(OUTPUT)test-compile-32.bin:
+ $(CC) -m32 -o $@ test-compile.c
-test-compile-x32.bin:
- $(CC) -mx32 -o $(OUTPUT)$@ test-compile.c
+$(OUTPUT)test-compile-x32.bin:
+ $(CC) -mx32 -o $@ test-compile.c
-test-zlib.bin:
+$(OUTPUT)test-zlib.bin:
$(BUILD) -lz
-test-lzma.bin:
+$(OUTPUT)test-lzma.bin:
$(BUILD) -llzma
-test-get_cpuid.bin:
+$(OUTPUT)test-get_cpuid.bin:
$(BUILD)
-test-bpf.bin:
+$(OUTPUT)test-bpf.bin:
$(BUILD)
--include *.d
+-include $(OUTPUT)*.d
###############################
clean:
- rm -f $(FILES) *.d $(FILES:.bin=.make.output)
+ rm -f $(FILES) $(OUTPUT)*.d $(FILES:.bin=.make.output)
--
2.1.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Arnaldo Carvalho de Melo <acme@kernel.org> |
|---|---|
| Date | 2015-12-17 18:40 +0100 |
| Message-ID | <qGKH1-2up-9@gated-at.bofh.it> |
| In reply to | #1293470 |
Em Wed, Dec 16, 2015 at 09:47:53PM -0300, Arnaldo Carvalho de Melo escreveu:
> Hi Ingo,
>
> Please consider pulling, this is on top of the perf-core-for-mingo
> tag, that is not yet merged.
Ingo, this wasn't building on older distros such as RHEL6.7 due to a
typedef problem, a one-liner, so to preserve bisection in such systems,
I ammended the commit, kept this perf-core-for-mingo-2 tag, but now
there is a perf-core-for-mingo-2.1 signed tag pointing to the good
stuff, take your pick.
- Arnaldo
> - Arnaldo
>
> The following changes since commit 7efe0e034c713716060bc7794c7e332589980c70:
>
> perf record: Support custom vmlinux path (2015-12-14 13:04:12 -0300)
>
> are available in the git repository at:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-core-for-mingo-2
>
> for you to fetch changes up to 5c560cfcf1c0f897f78aa5955e3eb05418891f34:
>
> tools subcmd: Rename subcmd header include guards (2015-12-16 21:39:01 -0300)
>
> ----------------------------------------------------------------
> perf/core improvements
>
> User visible:
>
> - Add record.build-id config option to 'perf record', to allow configuring
> in the ~/.perfconfig file if and how build-ids should be processed, allowing
> a permanent setting for options such as -B and -N: (Namhyung Kim)
>
> $ perf record -h -B -N
>
> Usage: perf record [<options>] [<command>]
> or: perf record [<options>] -- <command> [<options>]
>
> -B, --no-buildid do not collect buildids in perf.data
> -N, --no-buildid-cache do not update the buildid cache
>
> $
>
> Infrastructure:
>
> - Move code for options parsing and subcommand handling from tools/perf/
> to tools/lib/subcmd/, so that it can be used by other tools/ living
> utilities (Josh Poimboeuf)
>
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
>
> ----------------------------------------------------------------
> Josh Poimboeuf (9):
> tools build: Fix feature Makefile issues with 'O='
> perf tools: Move strlcpy() from perf to tools/lib/string.c
> perf tools: Document the fact that parse_options*() may exit
> perf tools: Provide subcmd configuration at runtime
> perf tools: Remove subcmd dependencies on strbuf
> perf tools: Remove 'perf' from subcmd function and variable names
> perf tools: Finalize subcmd independence
> perf subcmd: Create subcmd library
> tools subcmd: Rename subcmd header include guards
>
> Namhyung Kim (1):
> perf record: Add record.build-id config option
>
> tools/build/Makefile.feature | 2 +-
> tools/build/feature/Makefile | 93 +++++------
> tools/include/linux/string.h | 4 +
> tools/lib/string.c | 27 +++
> tools/lib/subcmd/Build | 7 +
> tools/lib/subcmd/Makefile | 48 ++++++
> tools/lib/subcmd/exec-cmd.c | 209 ++++++++++++++++++++++++
> tools/lib/subcmd/exec-cmd.h | 16 ++
> tools/{perf/util => lib/subcmd}/help.c | 63 +++++--
> tools/{perf/util => lib/subcmd}/help.h | 10 +-
> tools/{perf/util => lib/subcmd}/pager.c | 15 +-
> tools/lib/subcmd/pager.h | 9 +
> tools/{perf/util => lib/subcmd}/parse-options.c | 116 +++++++------
> tools/{perf/util => lib/subcmd}/parse-options.h | 12 +-
> tools/{perf/util => lib/subcmd}/run-command.c | 24 ++-
> tools/{perf/util => lib/subcmd}/run-command.h | 12 +-
> tools/{perf/util => lib/subcmd}/sigchain.c | 3 +-
> tools/{perf/util => lib/subcmd}/sigchain.h | 6 +-
> tools/lib/subcmd/subcmd-config.c | 11 ++
> tools/lib/subcmd/subcmd-config.h | 14 ++
> tools/lib/subcmd/subcmd-util.h | 91 +++++++++++
> tools/perf/Build | 5 +-
> tools/perf/Documentation/perf-record.txt | 14 +-
> tools/perf/MANIFEST | 1 +
> tools/perf/Makefile.perf | 20 ++-
> tools/perf/arch/x86/util/intel-pt.c | 2 +-
> tools/perf/bench/futex-hash.c | 2 +-
> tools/perf/bench/futex-lock-pi.c | 2 +-
> tools/perf/bench/futex-requeue.c | 2 +-
> tools/perf/bench/futex-wake-parallel.c | 2 +-
> tools/perf/bench/futex-wake.c | 2 +-
> tools/perf/bench/mem-functions.c | 2 +-
> tools/perf/bench/numa.c | 2 +-
> tools/perf/bench/sched-messaging.c | 2 +-
> tools/perf/bench/sched-pipe.c | 2 +-
> tools/perf/builtin-annotate.c | 2 +-
> tools/perf/builtin-bench.c | 2 +-
> tools/perf/builtin-buildid-cache.c | 2 +-
> tools/perf/builtin-buildid-list.c | 2 +-
> tools/perf/builtin-config.c | 2 +-
> tools/perf/builtin-data.c | 2 +-
> tools/perf/builtin-evlist.c | 2 +-
> tools/perf/builtin-help.c | 10 +-
> tools/perf/builtin-inject.c | 2 +-
> tools/perf/builtin-kmem.c | 2 +-
> tools/perf/builtin-kvm.c | 2 +-
> tools/perf/builtin-list.c | 2 +-
> tools/perf/builtin-lock.c | 2 +-
> tools/perf/builtin-mem.c | 2 +-
> tools/perf/builtin-probe.c | 2 +-
> tools/perf/builtin-record.c | 15 +-
> tools/perf/builtin-report.c | 2 +-
> tools/perf/builtin-sched.c | 2 +-
> tools/perf/builtin-script.c | 12 +-
> tools/perf/builtin-stat.c | 2 +-
> tools/perf/builtin-timechart.c | 2 +-
> tools/perf/builtin-top.c | 2 +-
> tools/perf/builtin-trace.c | 4 +-
> tools/perf/perf.c | 18 +-
> tools/perf/tests/attr.c | 4 +-
> tools/perf/tests/builtin-test.c | 2 +-
> tools/perf/util/Build | 7 -
> tools/perf/util/auxtrace.c | 2 +-
> tools/perf/util/cache.h | 10 +-
> tools/perf/util/cgroup.c | 2 +-
> tools/perf/util/config.c | 2 +-
> tools/perf/util/evlist.c | 2 +-
> tools/perf/util/exec_cmd.c | 149 -----------------
> tools/perf/util/exec_cmd.h | 13 --
> tools/perf/util/help-unknown-cmd.c | 2 +-
> tools/perf/util/pager.h | 7 -
> tools/perf/util/parse-branch-options.c | 2 +-
> tools/perf/util/parse-events.c | 4 +-
> tools/perf/util/parse-regs-options.c | 2 +-
> tools/perf/util/path.c | 18 --
> tools/perf/util/sort.h | 2 +-
> tools/perf/util/util.h | 14 --
> 77 files changed, 775 insertions(+), 418 deletions(-)
> create mode 100644 tools/lib/subcmd/Build
> create mode 100644 tools/lib/subcmd/Makefile
> create mode 100644 tools/lib/subcmd/exec-cmd.c
> create mode 100644 tools/lib/subcmd/exec-cmd.h
> rename tools/{perf/util => lib/subcmd}/help.c (81%)
> rename tools/{perf/util => lib/subcmd}/help.h (87%)
> rename tools/{perf/util => lib/subcmd}/pager.c (85%)
> create mode 100644 tools/lib/subcmd/pager.h
> rename tools/{perf/util => lib/subcmd}/parse-options.c (90%)
> rename tools/{perf/util => lib/subcmd}/parse-options.h (96%)
> rename tools/{perf/util => lib/subcmd}/run-command.c (90%)
> rename tools/{perf/util => lib/subcmd}/run-command.h (86%)
> rename tools/{perf/util => lib/subcmd}/sigchain.c (95%)
> rename tools/{perf/util => lib/subcmd}/sigchain.h (55%)
> create mode 100644 tools/lib/subcmd/subcmd-config.c
> create mode 100644 tools/lib/subcmd/subcmd-config.h
> create mode 100644 tools/lib/subcmd/subcmd-util.h
> delete mode 100644 tools/perf/util/exec_cmd.c
> delete mode 100644 tools/perf/util/exec_cmd.h
> delete mode 100644 tools/perf/util/pager.h
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Ingo Molnar <mingo@kernel.org> |
|---|---|
| Date | 2015-12-18 09:40 +0100 |
| Message-ID | <qGYJY-3eE-7@gated-at.bofh.it> |
| In reply to | #1294080 |
* Arnaldo Carvalho de Melo <acme@kernel.org> wrote: > Em Wed, Dec 16, 2015 at 09:47:53PM -0300, Arnaldo Carvalho de Melo escreveu: > > Hi Ingo, > > > > Please consider pulling, this is on top of the perf-core-for-mingo > > tag, that is not yet merged. > > Ingo, this wasn't building on older distros such as RHEL6.7 due to a > typedef problem, a one-liner, so to preserve bisection in such systems, > I ammended the commit, kept this perf-core-for-mingo-2 tag, but now > there is a perf-core-for-mingo-2.1 signed tag pointing to the good > stuff, take your pick. I pulled perf-core-for-mingo-2.1, thanks a lot Arnaldo! Ingo -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web