diff options
author | Stephane Eranian <eranian@google.com> | 2013-08-21 06:10:25 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-09-11 09:09:32 -0400 |
commit | 5c5e854bc760a2e2c878df3cfcf2afa4febcd511 (patch) | |
tree | cc0c44e8d8d9804f30c90f067d08c6cb4c9565ac /tools/perf/builtin-inject.c | |
parent | e71aa28312b208a14cd87fa61e941ac8c85072f4 (diff) |
perf tools: Add attr->mmap2 support
This patch adds support for the new PERF_RECORD_MMAP2 record type
exposed by the kernel. This is an extended PERF_RECORD_MMAP record.
It adds for each file-backed mapping the device major, minor number and
the inode number and generation.
This triplet uniquely identifies the source of a file-backed mapping. It
can be used to detect identical virtual mappings between processes, for
instance.
The patch will prefer MMAP2 over MMAP.
Signed-off-by: Stephane Eranian <eranian@google.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung.kim@lge.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1377079825-19057-3-git-send-email-eranian@google.com
[ Cope with 314add6 "Change machine__findnew_thread() to set thread pid",
fix 'perf test' regression test entry affected,
use perf_missing_features.mmap2 to fallback to not using .mmap2 in older kernels,
so that new tools can work with kernels where this feature is not present ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-inject.c')
-rw-r--r-- | tools/perf/builtin-inject.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c index 9b336fdb6f71..423875c999b2 100644 --- a/tools/perf/builtin-inject.c +++ b/tools/perf/builtin-inject.c | |||
@@ -123,6 +123,19 @@ static int perf_event__repipe_mmap(struct perf_tool *tool, | |||
123 | return err; | 123 | return err; |
124 | } | 124 | } |
125 | 125 | ||
126 | static int perf_event__repipe_mmap2(struct perf_tool *tool, | ||
127 | union perf_event *event, | ||
128 | struct perf_sample *sample, | ||
129 | struct machine *machine) | ||
130 | { | ||
131 | int err; | ||
132 | |||
133 | err = perf_event__process_mmap2(tool, event, sample, machine); | ||
134 | perf_event__repipe(tool, event, sample, machine); | ||
135 | |||
136 | return err; | ||
137 | } | ||
138 | |||
126 | static int perf_event__repipe_fork(struct perf_tool *tool, | 139 | static int perf_event__repipe_fork(struct perf_tool *tool, |
127 | union perf_event *event, | 140 | union perf_event *event, |
128 | struct perf_sample *sample, | 141 | struct perf_sample *sample, |
@@ -339,6 +352,7 @@ static int __cmd_inject(struct perf_inject *inject) | |||
339 | 352 | ||
340 | if (inject->build_ids || inject->sched_stat) { | 353 | if (inject->build_ids || inject->sched_stat) { |
341 | inject->tool.mmap = perf_event__repipe_mmap; | 354 | inject->tool.mmap = perf_event__repipe_mmap; |
355 | inject->tool.mmap2 = perf_event__repipe_mmap2; | ||
342 | inject->tool.fork = perf_event__repipe_fork; | 356 | inject->tool.fork = perf_event__repipe_fork; |
343 | inject->tool.tracing_data = perf_event__repipe_tracing_data; | 357 | inject->tool.tracing_data = perf_event__repipe_tracing_data; |
344 | } | 358 | } |
@@ -390,6 +404,7 @@ int cmd_inject(int argc, const char **argv, const char *prefix __maybe_unused) | |||
390 | .tool = { | 404 | .tool = { |
391 | .sample = perf_event__repipe_sample, | 405 | .sample = perf_event__repipe_sample, |
392 | .mmap = perf_event__repipe, | 406 | .mmap = perf_event__repipe, |
407 | .mmap2 = perf_event__repipe, | ||
393 | .comm = perf_event__repipe, | 408 | .comm = perf_event__repipe, |
394 | .fork = perf_event__repipe, | 409 | .fork = perf_event__repipe, |
395 | .exit = perf_event__repipe, | 410 | .exit = perf_event__repipe, |