From: Adrian Hunter <adrian.hunter@intel.com>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>,
linux-kernel@vger.kernel.org, David Ahern <dsahern@gmail.com>,
Frederic Weisbecker <fweisbec@gmail.com>,
Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@gmail.com>,
Stephane Eranian <eranian@google.com>
Subject: [PATCH V4 04/24] perf tools: Add build option NO_AUXTRACE to exclude AUX area tracing
Date: Thu, 30 Apr 2015 17:37:27 +0300 [thread overview]
Message-ID: <1430404667-10593-5-git-send-email-adrian.hunter@intel.com> (raw)
In-Reply-To: <1430404667-10593-1-git-send-email-adrian.hunter@intel.com>
Add build option NO_AUXTRACE to exclude compiling support
for AUX area tracing. Support for both recording and
processing is excluded and by implication any future
additions such as Intel PT and Intel BTS will also not
be compiled in with this option.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
tools/perf/Makefile.perf | 2 +
tools/perf/builtin-inject.c | 53 +++++++++++-------
tools/perf/builtin-record.c | 13 +++++
tools/perf/config/Makefile | 5 ++
tools/perf/tests/make | 4 +-
tools/perf/util/Build | 2 +-
tools/perf/util/auxtrace.h | 128 ++++++++++++++++++++++++++++++++++++++++++++
7 files changed, 186 insertions(+), 21 deletions(-)
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index c43a205..03409cc 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -73,6 +73,8 @@ include config/utilities.mak
# for CTF data format.
#
# Define NO_LZMA if you do not want to support compressed (xz) kernel modules
+#
+# Define NO_AUXTRACE if you do not want AUX area tracing support
ifeq ($(srctree),)
srctree := $(patsubst %/,%,$(dir $(shell pwd)))
diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c
index cc905f1..7c7a7ee 100644
--- a/tools/perf/builtin-inject.c
+++ b/tools/perf/builtin-inject.c
@@ -53,25 +53,6 @@ static int output_bytes(struct perf_inject *inject, void *buf, size_t sz)
return 0;
}
-static int copy_bytes(struct perf_inject *inject, int fd, off_t size)
-{
- char buf[4096];
- ssize_t ssz;
- int ret;
-
- while (size > 0) {
- ssz = read(fd, buf, min(size, (off_t)sizeof(buf)));
- if (ssz < 0)
- return -errno;
- ret = output_bytes(inject, buf, ssz);
- if (ret)
- return ret;
- size -= ssz;
- }
-
- return 0;
-}
-
static int perf_event__repipe_synth(struct perf_tool *tool,
union perf_event *event)
{
@@ -114,6 +95,27 @@ static int perf_event__repipe_attr(struct perf_tool *tool,
return perf_event__repipe_synth(tool, event);
}
+#ifdef HAVE_AUXTRACE_SUPPORT
+
+static int copy_bytes(struct perf_inject *inject, int fd, off_t size)
+{
+ char buf[4096];
+ ssize_t ssz;
+ int ret;
+
+ while (size > 0) {
+ ssz = read(fd, buf, min(size, (off_t)sizeof(buf)));
+ if (ssz < 0)
+ return -errno;
+ ret = output_bytes(inject, buf, ssz);
+ if (ret)
+ return ret;
+ size -= ssz;
+ }
+
+ return 0;
+}
+
static s64 perf_event__repipe_auxtrace(struct perf_tool *tool,
union perf_event *event,
struct perf_session *session
@@ -153,6 +155,19 @@ static s64 perf_event__repipe_auxtrace(struct perf_tool *tool,
return event->auxtrace.size;
}
+#else
+
+static s64
+perf_event__repipe_auxtrace(struct perf_tool *tool __maybe_unused,
+ union perf_event *event __maybe_unused,
+ struct perf_session *session __maybe_unused)
+{
+ pr_err("AUX area tracing not supported\n");
+ return -EINVAL;
+}
+
+#endif
+
static int perf_event__repipe(struct perf_tool *tool,
union perf_event *event,
struct perf_sample *sample __maybe_unused,
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 4d0ebbb..dbb2c02 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -112,6 +112,8 @@ out:
return rc;
}
+#ifdef HAVE_AUXTRACE_SUPPORT
+
static int record__process_auxtrace(struct perf_tool *tool,
union perf_event *event, void *data1,
size_t len1, void *data2, size_t len2)
@@ -165,6 +167,17 @@ static int record__auxtrace_mmap_read(struct record *rec,
return 0;
}
+#else
+
+static inline
+int record__auxtrace_mmap_read(struct record *rec __maybe_unused,
+ struct auxtrace_mmap *mm __maybe_unused)
+{
+ return 0;
+}
+
+#endif
+
static volatile int done = 0;
static volatile int signr = -1;
static volatile int child_finished = 0;
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 59a98c6..435b6ca 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -610,6 +610,11 @@ ifdef LIBBABELTRACE
endif
endif
+ifndef NO_AUXTRACE
+ $(call detected,CONFIG_AUXTRACE)
+ CFLAGS += -DHAVE_AUXTRACE_SUPPORT
+endif
+
# Among the variables below, these:
# perfexecdir
# template_dir
diff --git a/tools/perf/tests/make b/tools/perf/tests/make
index 901ec91..65280d2 100644
--- a/tools/perf/tests/make
+++ b/tools/perf/tests/make
@@ -32,6 +32,7 @@ make_no_backtrace := NO_BACKTRACE=1
make_no_libnuma := NO_LIBNUMA=1
make_no_libaudit := NO_LIBAUDIT=1
make_no_libbionic := NO_LIBBIONIC=1
+make_no_auxtrace := NO_AUXTRACE=1
make_tags := tags
make_cscope := cscope
make_help := help
@@ -52,7 +53,7 @@ make_static := LDFLAGS=-static
make_minimal := NO_LIBPERL=1 NO_LIBPYTHON=1 NO_NEWT=1 NO_GTK2=1
make_minimal += NO_DEMANGLE=1 NO_LIBELF=1 NO_LIBUNWIND=1 NO_BACKTRACE=1
make_minimal += NO_LIBNUMA=1 NO_LIBAUDIT=1 NO_LIBBIONIC=1
-make_minimal += NO_LIBDW_DWARF_UNWIND=1
+make_minimal += NO_LIBDW_DWARF_UNWIND=1 NO_AUXTRACE=1
# $(run) contains all available tests
run := make_pure
@@ -74,6 +75,7 @@ run += make_no_backtrace
run += make_no_libnuma
run += make_no_libaudit
run += make_no_libbionic
+run += make_no_auxtrace
run += make_help
run += make_doc
run += make_perf_o
diff --git a/tools/perf/util/Build b/tools/perf/util/Build
index 28af8e2..d552203 100644
--- a/tools/perf/util/Build
+++ b/tools/perf/util/Build
@@ -74,7 +74,7 @@ libperf-y += data.o
libperf-$(CONFIG_X86) += tsc.o
libperf-y += cloexec.o
libperf-y += thread-stack.o
-libperf-y += auxtrace.o
+libperf-$(CONFIG_AUXTRACE) += auxtrace.o
libperf-$(CONFIG_LIBELF) += symbol-elf.o
libperf-$(CONFIG_LIBELF) += probe-event.o
diff --git a/tools/perf/util/auxtrace.h b/tools/perf/util/auxtrace.h
index b9e4b9d..77b4699 100644
--- a/tools/perf/util/auxtrace.h
+++ b/tools/perf/util/auxtrace.h
@@ -26,6 +26,7 @@
#include "../perf.h"
#include "event.h"
#include "session.h"
+#include "debug.h"
union perf_event;
struct perf_session;
@@ -290,6 +291,8 @@ struct auxtrace_record {
int (*read_finish)(struct auxtrace_record *itr, int idx);
};
+#ifdef HAVE_AUXTRACE_SUPPORT
+
static inline u64 auxtrace_mmap__read_head(struct auxtrace_mmap *mm)
{
struct perf_event_mmap_page *pc = mm->userpg;
@@ -458,4 +461,129 @@ static inline void auxtrace__free(struct perf_session *session)
return session->auxtrace->free(session);
}
+#else
+
+static inline struct auxtrace_record *
+auxtrace_record__init(struct perf_evlist *evlist __maybe_unused,
+ int *err __maybe_unused)
+{
+ *err = 0;
+ return NULL;
+}
+
+static inline
+void auxtrace_record__free(struct auxtrace_record *itr __maybe_unused)
+{
+}
+
+static inline int
+perf_event__synthesize_auxtrace_info(struct auxtrace_record *itr __maybe_unused,
+ struct perf_tool *tool __maybe_unused,
+ struct perf_session *session __maybe_unused,
+ perf_event__handler_t process __maybe_unused)
+{
+ return -EINVAL;
+}
+
+static inline
+int auxtrace_record__options(struct auxtrace_record *itr __maybe_unused,
+ struct perf_evlist *evlist __maybe_unused,
+ struct record_opts *opts __maybe_unused)
+{
+ return 0;
+}
+
+#define perf_event__process_auxtrace_info 0
+#define perf_event__process_auxtrace 0
+#define perf_event__process_auxtrace_error 0
+
+static inline
+void perf_session__auxtrace_error_inc(struct perf_session *session
+ __maybe_unused,
+ union perf_event *event
+ __maybe_unused)
+{
+}
+
+static inline
+void events_stats__auxtrace_error_warn(const struct events_stats *stats
+ __maybe_unused)
+{
+}
+
+static inline
+int itrace_parse_synth_opts(const struct option *opt __maybe_unused,
+ const char *str __maybe_unused,
+ int unset __maybe_unused)
+{
+ pr_err("AUX area tracing not supported\n");
+ return -EINVAL;
+}
+
+static inline
+int auxtrace__process_event(struct perf_session *session __maybe_unused,
+ union perf_event *event __maybe_unused,
+ struct perf_sample *sample __maybe_unused,
+ struct perf_tool *tool __maybe_unused)
+{
+ return 0;
+}
+
+static inline
+int auxtrace__flush_events(struct perf_session *session __maybe_unused,
+ struct perf_tool *tool __maybe_unused)
+{
+ return 0;
+}
+
+static inline
+void auxtrace__free_events(struct perf_session *session __maybe_unused)
+{
+}
+
+static inline
+void auxtrace_cache__free(struct auxtrace_cache *auxtrace_cache __maybe_unused)
+{
+}
+
+static inline
+void auxtrace__free(struct perf_session *session __maybe_unused)
+{
+}
+
+static inline
+int auxtrace_index__write(int fd __maybe_unused,
+ struct list_head *head __maybe_unused)
+{
+ return -EINVAL;
+}
+
+static inline
+int auxtrace_index__process(int fd __maybe_unused,
+ u64 size __maybe_unused,
+ struct perf_session *session __maybe_unused,
+ bool needs_swap __maybe_unused)
+{
+ return -EINVAL;
+}
+
+static inline
+void auxtrace_index__free(struct list_head *head __maybe_unused)
+{
+}
+
+int auxtrace_mmap__mmap(struct auxtrace_mmap *mm,
+ struct auxtrace_mmap_params *mp,
+ void *userpg, int fd);
+void auxtrace_mmap__munmap(struct auxtrace_mmap *mm);
+void auxtrace_mmap_params__init(struct auxtrace_mmap_params *mp,
+ off_t auxtrace_offset,
+ unsigned int auxtrace_pages,
+ bool auxtrace_overwrite);
+void auxtrace_mmap_params__set_idx(struct auxtrace_mmap_params *mp,
+ struct perf_evlist *evlist, int idx,
+ bool per_cpu);
+
+#endif
+
#endif
--
1.9.1
next prev parent reply other threads:[~2015-04-30 14:40 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-30 14:37 [PATCH V4 00/24] perf tools: Introduce an abstraction for AUX Area and Instruction Tracing Adrian Hunter
2015-04-30 14:37 ` [PATCH V4 01/24] perf report: Fix placement of itrace option in documentation Adrian Hunter
2015-05-06 3:15 ` [tip:perf/core] " tip-bot for Adrian Hunter
2015-04-30 14:37 ` [PATCH V4 02/24] perf tools: Add AUX area tracing index Adrian Hunter
2015-05-04 20:02 ` Jiri Olsa
2015-05-06 3:16 ` [tip:perf/core] " tip-bot for Adrian Hunter
2015-04-30 14:37 ` [PATCH V4 03/24] perf tools: Hit all build ids when AUX area tracing Adrian Hunter
2015-05-04 20:03 ` Jiri Olsa
2015-05-06 3:16 ` [tip:perf/core] " tip-bot for Adrian Hunter
2015-04-30 14:37 ` Adrian Hunter [this message]
2015-05-04 20:06 ` [PATCH V4 04/24] perf tools: Add build option NO_AUXTRACE to exclude " Jiri Olsa
2015-05-06 3:16 ` [tip:perf/core] " tip-bot for Adrian Hunter
2015-04-30 14:37 ` [PATCH V4 05/24] perf auxtrace: Add option to synthesize events for transactions Adrian Hunter
2015-05-04 20:08 ` Jiri Olsa
2015-05-06 3:17 ` [tip:perf/core] " tip-bot for Adrian Hunter
2015-04-30 14:37 ` [PATCH V4 06/24] perf tools: Add support for PERF_RECORD_AUX Adrian Hunter
2015-05-04 20:09 ` Jiri Olsa
2015-05-06 3:17 ` [tip:perf/core] " tip-bot for Adrian Hunter
2015-04-30 14:37 ` [PATCH V4 07/24] perf tools: Add support for PERF_RECORD_ITRACE_START Adrian Hunter
2015-05-04 20:10 ` Jiri Olsa
2015-05-06 3:17 ` [tip:perf/core] " tip-bot for Adrian Hunter
2015-04-30 14:37 ` [PATCH V4 08/24] perf tools: Add AUX area tracing Snapshot Mode Adrian Hunter
2015-05-04 20:10 ` Jiri Olsa
2015-05-06 3:17 ` [tip:perf/core] " tip-bot for Adrian Hunter
2015-04-30 14:37 ` [PATCH V4 09/24] perf record: Add AUX area tracing Snapshot Mode support Adrian Hunter
2015-05-04 20:11 ` Jiri Olsa
2015-05-06 3:18 ` [tip:perf/core] " tip-bot for Adrian Hunter
2015-04-30 14:37 ` [PATCH V4 10/24] perf auxtrace: Add Intel PT as an AUX area tracing type Adrian Hunter
2015-05-04 20:11 ` Jiri Olsa
2015-04-30 14:37 ` [PATCH V4 11/24] perf tools: Add Intel PT packet decoder Adrian Hunter
2015-04-30 14:37 ` [PATCH V4 12/24] perf tools: Add Intel PT instruction decoder Adrian Hunter
2015-04-30 14:37 ` [PATCH V4 13/24] perf tools: Add Intel PT log Adrian Hunter
2015-04-30 14:37 ` [PATCH V4 14/24] perf tools: Add Intel PT decoder Adrian Hunter
2015-05-11 13:22 ` Arnaldo Carvalho de Melo
2015-05-21 12:58 ` Adrian Hunter
2015-04-30 14:37 ` [PATCH V4 15/24] perf tools: Add Intel PT support Adrian Hunter
2015-04-30 14:37 ` [PATCH V4 16/24] perf tools: Take Intel PT into use Adrian Hunter
2015-04-30 14:37 ` [PATCH V4 17/24] perf tools: Allow auxtrace data alignment Adrian Hunter
2015-04-30 14:37 ` [PATCH V4 18/24] perf tools: Add Intel BTS support Adrian Hunter
2015-05-05 19:51 ` Arnaldo Carvalho de Melo
2015-05-05 21:09 ` Arnaldo Carvalho de Melo
2015-05-06 7:14 ` Adrian Hunter
2015-05-06 13:35 ` Arnaldo Carvalho de Melo
2015-05-07 7:05 ` Adrian Hunter
2015-05-08 19:41 ` Arnaldo Carvalho de Melo
2015-04-30 14:37 ` [PATCH V4 19/24] perf tools: Output sample flags and insn_len from intel_pt Adrian Hunter
2015-04-30 14:37 ` [PATCH V4 20/24] perf tools: Output sample flags and insn_len from intel_bts Adrian Hunter
2015-04-30 14:37 ` [PATCH V4 21/24] perf tools: Intel PT to always update thread stack trace number Adrian Hunter
2015-04-30 14:37 ` [PATCH V4 22/24] perf tools: Intel BTS " Adrian Hunter
2015-04-30 14:37 ` [PATCH V4 23/24] perf tools: Add example call-graph script Adrian Hunter
2015-04-30 14:37 ` [PATCH V4 24/24] perf tools: Put itrace options into an asciidoc include Adrian Hunter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1430404667-10593-5-git-send-email-adrian.hunter@intel.com \
--to=adrian.hunter@intel.com \
--cc=acme@kernel.org \
--cc=dsahern@gmail.com \
--cc=eranian@google.com \
--cc=fweisbec@gmail.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=namhyung@gmail.com \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.