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>
This commit is contained in:

committed by
Arnaldo Carvalho de Melo

parent
e71aa28312
commit
5c5e854bc7
@@ -27,6 +27,7 @@
|
||||
static struct {
|
||||
bool sample_id_all;
|
||||
bool exclude_guest;
|
||||
bool mmap2;
|
||||
} perf_missing_features;
|
||||
|
||||
#define FD(e, x, y) (*(int *)xyarray__entry(e->fd, x, y))
|
||||
@@ -676,8 +677,9 @@ void perf_evsel__config(struct perf_evsel *evsel,
|
||||
if (opts->sample_weight)
|
||||
attr->sample_type |= PERF_SAMPLE_WEIGHT;
|
||||
|
||||
attr->mmap = track;
|
||||
attr->comm = track;
|
||||
attr->mmap = track;
|
||||
attr->mmap2 = track && !perf_missing_features.mmap2;
|
||||
attr->comm = track;
|
||||
|
||||
/*
|
||||
* XXX see the function comment above
|
||||
@@ -1016,6 +1018,8 @@ static int __perf_evsel__open(struct perf_evsel *evsel, struct cpu_map *cpus,
|
||||
}
|
||||
|
||||
fallback_missing_features:
|
||||
if (perf_missing_features.mmap2)
|
||||
evsel->attr.mmap2 = 0;
|
||||
if (perf_missing_features.exclude_guest)
|
||||
evsel->attr.exclude_guest = evsel->attr.exclude_host = 0;
|
||||
retry_sample_id:
|
||||
@@ -1080,8 +1084,11 @@ try_fallback:
|
||||
if (err != -EINVAL || cpu > 0 || thread > 0)
|
||||
goto out_close;
|
||||
|
||||
if (!perf_missing_features.exclude_guest &&
|
||||
(evsel->attr.exclude_guest || evsel->attr.exclude_host)) {
|
||||
if (!perf_missing_features.mmap2 && evsel->attr.mmap2) {
|
||||
perf_missing_features.mmap2 = true;
|
||||
goto fallback_missing_features;
|
||||
} else if (!perf_missing_features.exclude_guest &&
|
||||
(evsel->attr.exclude_guest || evsel->attr.exclude_host)) {
|
||||
perf_missing_features.exclude_guest = true;
|
||||
goto fallback_missing_features;
|
||||
} else if (!perf_missing_features.sample_id_all) {
|
||||
@@ -1925,6 +1932,7 @@ int perf_evsel__fprintf(struct perf_evsel *evsel,
|
||||
if_print(exclude_hv);
|
||||
if_print(exclude_idle);
|
||||
if_print(mmap);
|
||||
if_print(mmap2);
|
||||
if_print(comm);
|
||||
if_print(freq);
|
||||
if_print(inherit_stat);
|
||||
|
Reference in New Issue
Block a user