aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/tests
diff options
context:
space:
mode:
authorStephane Eranian <eranian@google.com>2013-08-21 06:10:25 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2013-09-11 09:09:32 -0400
commit5c5e854bc760a2e2c878df3cfcf2afa4febcd511 (patch)
treecc0c44e8d8d9804f30c90f067d08c6cb4c9565ac /tools/perf/tests
parente71aa28312b208a14cd87fa61e941ac8c85072f4 (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/tests')
-rw-r--r--tools/perf/tests/perf-record.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/tools/perf/tests/perf-record.c b/tools/perf/tests/perf-record.c
index 72d8881873b0..b8a7056519ac 100644
--- a/tools/perf/tests/perf-record.c
+++ b/tools/perf/tests/perf-record.c
@@ -50,7 +50,7 @@ int test__PERF_RECORD(void)
50 struct perf_sample sample; 50 struct perf_sample sample;
51 const char *cmd = "sleep"; 51 const char *cmd = "sleep";
52 const char *argv[] = { cmd, "1", NULL, }; 52 const char *argv[] = { cmd, "1", NULL, };
53 char *bname; 53 char *bname, *mmap_filename;
54 u64 prev_time = 0; 54 u64 prev_time = 0;
55 bool found_cmd_mmap = false, 55 bool found_cmd_mmap = false,
56 found_libc_mmap = false, 56 found_libc_mmap = false,
@@ -212,6 +212,7 @@ int test__PERF_RECORD(void)
212 212
213 if ((type == PERF_RECORD_COMM || 213 if ((type == PERF_RECORD_COMM ||
214 type == PERF_RECORD_MMAP || 214 type == PERF_RECORD_MMAP ||
215 type == PERF_RECORD_MMAP2 ||
215 type == PERF_RECORD_FORK || 216 type == PERF_RECORD_FORK ||
216 type == PERF_RECORD_EXIT) && 217 type == PERF_RECORD_EXIT) &&
217 (pid_t)event->comm.pid != evlist->workload.pid) { 218 (pid_t)event->comm.pid != evlist->workload.pid) {
@@ -220,7 +221,8 @@ int test__PERF_RECORD(void)
220 } 221 }
221 222
222 if ((type == PERF_RECORD_COMM || 223 if ((type == PERF_RECORD_COMM ||
223 type == PERF_RECORD_MMAP) && 224 type == PERF_RECORD_MMAP ||
225 type == PERF_RECORD_MMAP2) &&
224 event->comm.pid != event->comm.tid) { 226 event->comm.pid != event->comm.tid) {
225 pr_debug("%s with different pid/tid!\n", name); 227 pr_debug("%s with different pid/tid!\n", name);
226 ++errs; 228 ++errs;
@@ -236,7 +238,12 @@ int test__PERF_RECORD(void)
236 case PERF_RECORD_EXIT: 238 case PERF_RECORD_EXIT:
237 goto found_exit; 239 goto found_exit;
238 case PERF_RECORD_MMAP: 240 case PERF_RECORD_MMAP:
239 bname = strrchr(event->mmap.filename, '/'); 241 mmap_filename = event->mmap.filename;
242 goto check_bname;
243 case PERF_RECORD_MMAP2:
244 mmap_filename = event->mmap2.filename;
245 check_bname:
246 bname = strrchr(mmap_filename, '/');
240 if (bname != NULL) { 247 if (bname != NULL) {
241 if (!found_cmd_mmap) 248 if (!found_cmd_mmap)
242 found_cmd_mmap = !strcmp(bname + 1, cmd); 249 found_cmd_mmap = !strcmp(bname + 1, cmd);
@@ -245,7 +252,7 @@ int test__PERF_RECORD(void)
245 if (!found_ld_mmap) 252 if (!found_ld_mmap)
246 found_ld_mmap = !strncmp(bname + 1, "ld", 2); 253 found_ld_mmap = !strncmp(bname + 1, "ld", 2);
247 } else if (!found_vdso_mmap) 254 } else if (!found_vdso_mmap)
248 found_vdso_mmap = !strcmp(event->mmap.filename, "[vdso]"); 255 found_vdso_mmap = !strcmp(mmap_filename, "[vdso]");
249 break; 256 break;
250 257
251 case PERF_RECORD_SAMPLE: 258 case PERF_RECORD_SAMPLE: