From 5c5e854bc760a2e2c878df3cfcf2afa4febcd511 Mon Sep 17 00:00:00 2001 From: Stephane Eranian Date: Wed, 21 Aug 2013 12:10:25 +0200 Subject: 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 Cc: Andi Kleen Cc: David Ahern Cc: Ingo Molnar Cc: Jiri Olsa Cc: Namhyung Kim Cc: Peter Zijlstra 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 --- tools/perf/util/event.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'tools/perf/util/event.h') diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h index 93130d856bf0..c67ecc457d29 100644 --- a/tools/perf/util/event.h +++ b/tools/perf/util/event.h @@ -17,6 +17,19 @@ struct mmap_event { char filename[PATH_MAX]; }; +struct mmap2_event { + struct perf_event_header header; + u32 pid, tid; + u64 start; + u64 len; + u64 pgoff; + u32 maj; + u32 min; + u64 ino; + u64 ino_generation; + char filename[PATH_MAX]; +}; + struct comm_event { struct perf_event_header header; u32 pid, tid; @@ -159,6 +172,7 @@ struct tracing_data_event { union perf_event { struct perf_event_header header; struct mmap_event mmap; + struct mmap2_event mmap2; struct comm_event comm; struct fork_event fork; struct lost_event lost; @@ -208,6 +222,10 @@ int perf_event__process_mmap(struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct machine *machine); +int perf_event__process_mmap2(struct perf_tool *tool, + union perf_event *event, + struct perf_sample *sample, + struct machine *machine); int perf_event__process_fork(struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, @@ -238,6 +256,7 @@ int perf_event__synthesize_sample(union perf_event *event, u64 type, size_t perf_event__fprintf_comm(union perf_event *event, FILE *fp); size_t perf_event__fprintf_mmap(union perf_event *event, FILE *fp); +size_t perf_event__fprintf_mmap2(union perf_event *event, FILE *fp); size_t perf_event__fprintf_task(union perf_event *event, FILE *fp); size_t perf_event__fprintf(union perf_event *event, FILE *fp); -- cgit v1.2.1