linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
To: Stephane Eranian <eranian@google.com>
Cc: linux-kernel@vger.kernel.org, peterz@infradead.org,
	mingo@elte.hu, ak@linux.intel.com, jolsa@redhat.com,
	namhyung.kim@lge.com, dsahern@gmail.com
Subject: Re: [PATCH v2 2/2] perf tools: add attr->mmap2 support
Date: Mon, 9 Sep 2013 16:48:44 -0300	[thread overview]
Message-ID: <20130909194844.GB28428@ghostprotocols.net> (raw)
In-Reply-To: <20130909192810.GA3825@infradead.org>

Em Mon, Sep 09, 2013 at 04:47:45PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Wed, Aug 21, 2013 at 12:10:25PM +0200, Stephane Eranian escreveu:
> > 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.
> 
> I noticed the kernel part is in, and I'm going to use MMAP2 on that new
> tool, so tried merging it, but:
> 
> I fixed it up wrt another patch that makes machine__find_thread receive pid/tid
> but then 'perf test' complains about it, see below, trying to fix...

Following patch makes it progress a bit, still checking why it is not
enough...

- Arnaldo

diff --git a/tools/perf/tests/perf-record.c b/tools/perf/tests/perf-record.c
index 72d8881..b8a7056 100644
--- a/tools/perf/tests/perf-record.c
+++ b/tools/perf/tests/perf-record.c
@@ -50,7 +50,7 @@ int test__PERF_RECORD(void)
 	struct perf_sample sample;
 	const char *cmd = "sleep";
 	const char *argv[] = { cmd, "1", NULL, };
-	char *bname;
+	char *bname, *mmap_filename;
 	u64 prev_time = 0;
 	bool found_cmd_mmap = false,
 	     found_libc_mmap = false,
@@ -212,6 +212,7 @@ int test__PERF_RECORD(void)
 
 				if ((type == PERF_RECORD_COMM ||
 				     type == PERF_RECORD_MMAP ||
+				     type == PERF_RECORD_MMAP2 ||
 				     type == PERF_RECORD_FORK ||
 				     type == PERF_RECORD_EXIT) &&
 				     (pid_t)event->comm.pid != evlist->workload.pid) {
@@ -220,7 +221,8 @@ int test__PERF_RECORD(void)
 				}
 
 				if ((type == PERF_RECORD_COMM ||
-				     type == PERF_RECORD_MMAP) &&
+				     type == PERF_RECORD_MMAP ||
+				     type == PERF_RECORD_MMAP2) &&
 				     event->comm.pid != event->comm.tid) {
 					pr_debug("%s with different pid/tid!\n", name);
 					++errs;
@@ -236,7 +238,12 @@ int test__PERF_RECORD(void)
 				case PERF_RECORD_EXIT:
 					goto found_exit;
 				case PERF_RECORD_MMAP:
-					bname = strrchr(event->mmap.filename, '/');
+					mmap_filename = event->mmap.filename;
+					goto check_bname;
+				case PERF_RECORD_MMAP2:
+					mmap_filename = event->mmap2.filename;
+				check_bname:
+					bname = strrchr(mmap_filename, '/');
 					if (bname != NULL) {
 						if (!found_cmd_mmap)
 							found_cmd_mmap = !strcmp(bname + 1, cmd);
@@ -245,7 +252,7 @@ int test__PERF_RECORD(void)
 						if (!found_ld_mmap)
 							found_ld_mmap = !strncmp(bname + 1, "ld", 2);
 					} else if (!found_vdso_mmap)
-						found_vdso_mmap = !strcmp(event->mmap.filename, "[vdso]");
+						found_vdso_mmap = !strcmp(mmap_filename, "[vdso]");
 					break;
 
 				case PERF_RECORD_SAMPLE:

  reply	other threads:[~2013-09-09 19:48 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-21 10:10 [PATCH v2 0/2] perf: add new PERF_RECORD_MMAP2 record type Stephane Eranian
2013-08-21 10:10 ` [PATCH v2 1/2] perf: add attr->mmap2 attribute to an event Stephane Eranian
2013-08-22 15:57   ` Arnaldo Carvalho de Melo
2013-09-02  7:41   ` [tip:perf/core] perf: Add " tip-bot for Stephane Eranian
2013-08-21 10:10 ` [PATCH v2 2/2] perf tools: add attr->mmap2 support Stephane Eranian
2013-08-22 10:51   ` Peter Zijlstra
2013-08-30 14:03     ` Stephane Eranian
2013-08-30 14:08       ` Peter Zijlstra
2013-08-30 14:15         ` Stephane Eranian
2013-08-30 17:32           ` Stephane Eranian
2013-08-31  6:00             ` Ingo Molnar
2013-09-09 19:47   ` Arnaldo Carvalho de Melo
2013-09-09 19:48     ` Arnaldo Carvalho de Melo [this message]
2013-09-10 13:00       ` Arnaldo Carvalho de Melo
2013-09-10 13:05         ` Stephane Eranian
2013-09-10 13:17           ` Arnaldo Carvalho de Melo
2013-09-10 19:58             ` Arnaldo Carvalho de Melo
2013-09-10 20:16               ` Arnaldo Carvalho de Melo
2013-09-11 14:42                 ` Stephane Eranian
2013-09-11 14:53                   ` Arnaldo Carvalho de Melo
2013-09-11 15:28                     ` Arnaldo Carvalho de Melo
2013-09-12  6:35                       ` Ingo Molnar
2013-09-10  9:17     ` Peter Zijlstra
2013-09-12 11:10   ` [tip:perf/urgent] perf tools: Add " tip-bot for Stephane Eranian

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=20130909194844.GB28428@ghostprotocols.net \
    --to=acme@ghostprotocols.net \
    --cc=ak@linux.intel.com \
    --cc=dsahern@gmail.com \
    --cc=eranian@google.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=namhyung.kim@lge.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).