From: tip-bot for Wang Nan <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: namhyung@kernel.org, jolsa@kernel.org, mhiramat@kernel.org,
wangnan0@huawei.com, acme@redhat.com, hekuang@huawei.com,
hpa@zytor.com, mingo@kernel.org, lizefan@huawei.com,
nilayvaish@gmail.com, linux-kernel@vger.kernel.org,
tglx@linutronix.de
Subject: [tip:perf/core] perf record: Prepare reading from multiple evlists in record__mmap_read_all()
Date: Wed, 29 Jun 2016 02:43:51 -0700 [thread overview]
Message-ID: <tip-cb21686b7d37776cfd34793f08d6466ce9091a7d@git.kernel.org> (raw)
In-Reply-To: <1467023052-146749-3-git-send-email-wangnan0@huawei.com>
Commit-ID: cb21686b7d37776cfd34793f08d6466ce9091a7d
Gitweb: http://git.kernel.org/tip/cb21686b7d37776cfd34793f08d6466ce9091a7d
Author: Wang Nan <wangnan0@huawei.com>
AuthorDate: Mon, 27 Jun 2016 10:24:04 +0000
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 28 Jun 2016 10:54:53 -0300
perf record: Prepare reading from multiple evlists in record__mmap_read_all()
Following commits introduce new evlists to record. This patch adjusts
record__mmap_read_all() and record__mmap_read(): converting original
record__mmap_read_all() to record__mmap_read_evlist(), read from one
evlist; makes record__mmap_read() reading from specific evlist.
record__mmap_read_all() will be improved to read from multiple evlists.
Signed-off-by: Wang Nan <wangnan0@huawei.com>
Cc: He Kuang <hekuang@huawei.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Nilay Vaish <nilayvaish@gmail.com>
Cc: Zefan Li <lizefan@huawei.com>
Cc: pi3orama@163.com
Link: http://lkml.kernel.org/r/1467023052-146749-3-git-send-email-wangnan0@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/builtin-record.c | 34 ++++++++++++++++++++++++----------
1 file changed, 24 insertions(+), 10 deletions(-)
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 7eb8d7d..18e9abc 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -132,9 +132,9 @@ rb_find_range(struct perf_evlist *evlist,
return backward_rb_find_range(data, mask, head, start, end);
}
-static int record__mmap_read(struct record *rec, int idx)
+static int record__mmap_read(struct record *rec, struct perf_evlist *evlist, int idx)
{
- struct perf_mmap *md = &rec->evlist->mmap[idx];
+ struct perf_mmap *md = &evlist->mmap[idx];
u64 head = perf_mmap__read_head(md);
u64 old = md->prev;
u64 end = head, start = old;
@@ -143,7 +143,7 @@ static int record__mmap_read(struct record *rec, int idx)
void *buf;
int rc = 0;
- if (rb_find_range(rec->evlist, data, md->mask, head,
+ if (rb_find_range(evlist, data, md->mask, head,
old, &start, &end))
return -1;
@@ -157,7 +157,7 @@ static int record__mmap_read(struct record *rec, int idx)
WARN_ONCE(1, "failed to keep up with mmap data. (warn only once)\n");
md->prev = head;
- perf_evlist__mmap_consume(rec->evlist, idx);
+ perf_evlist__mmap_consume(evlist, idx);
return 0;
}
@@ -182,7 +182,7 @@ static int record__mmap_read(struct record *rec, int idx)
}
md->prev = head;
- perf_evlist__mmap_consume(rec->evlist, idx);
+ perf_evlist__mmap_consume(evlist, idx);
out:
return rc;
}
@@ -498,17 +498,20 @@ static struct perf_event_header finished_round_event = {
.type = PERF_RECORD_FINISHED_ROUND,
};
-static int record__mmap_read_all(struct record *rec)
+static int record__mmap_read_evlist(struct record *rec, struct perf_evlist *evlist)
{
u64 bytes_written = rec->bytes_written;
int i;
int rc = 0;
- for (i = 0; i < rec->evlist->nr_mmaps; i++) {
- struct auxtrace_mmap *mm = &rec->evlist->mmap[i].auxtrace_mmap;
+ if (!evlist)
+ return 0;
+
+ for (i = 0; i < evlist->nr_mmaps; i++) {
+ struct auxtrace_mmap *mm = &evlist->mmap[i].auxtrace_mmap;
- if (rec->evlist->mmap[i].base) {
- if (record__mmap_read(rec, i) != 0) {
+ if (evlist->mmap[i].base) {
+ if (record__mmap_read(rec, evlist, i) != 0) {
rc = -1;
goto out;
}
@@ -532,6 +535,17 @@ out:
return rc;
}
+static int record__mmap_read_all(struct record *rec)
+{
+ int err;
+
+ err = record__mmap_read_evlist(rec, rec->evlist);
+ if (err)
+ return err;
+
+ return err;
+}
+
static void record__init_features(struct record *rec)
{
struct perf_session *session = rec->session;
next prev parent reply other threads:[~2016-06-29 9:44 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-27 10:24 [PATCH v11 00/10] perf tools: Support overwritable ring buffer Wang Nan
2016-06-27 10:24 ` [PATCH v11 01/10] perf record: Prepare mmap multiple evlists Wang Nan
2016-06-27 17:45 ` Arnaldo Carvalho de Melo
2016-06-29 9:43 ` [tip:perf/core] perf record: Move mmap setup block to separate function tip-bot for Wang Nan
2016-06-27 10:24 ` [PATCH v11 02/10] perf record: Prepare reading from multiple evlists in record__mmap_read_all() Wang Nan
2016-06-29 9:43 ` tip-bot for Wang Nan [this message]
2016-06-27 10:24 ` [PATCH v11 03/10] perf record: Prepare picking perf_event_mmap_page from multiple evlists Wang Nan
2016-06-29 9:44 ` [tip:perf/core] " tip-bot for Wang Nan
2016-06-27 10:24 ` [PATCH v11 04/10] perf evlist: Introduce aux evlist Wang Nan
2016-06-27 10:24 ` [PATCH v11 05/10] perf tests: Add testcase for auxiliary evlist Wang Nan
2016-06-27 10:24 ` [PATCH v11 06/10] perf record: Introduce rec->overwrite_evlist for overwritable events Wang Nan
2016-06-27 10:24 ` [PATCH v11 07/10] perf record: Read from overwritable ring buffer Wang Nan
2016-06-27 10:24 ` [PATCH v11 08/10] perf tools: Enable overwrite settings Wang Nan
2016-06-27 10:24 ` [PATCH v11 09/10] perf tools: Don't warn about out of order event if write_backward is used Wang Nan
2016-06-27 10:24 ` [PATCH v11 10/10] perf tools: Add --tail-synthesize option Wang Nan
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=tip-cb21686b7d37776cfd34793f08d6466ce9091a7d@git.kernel.org \
--to=tipbot@zytor.com \
--cc=acme@redhat.com \
--cc=hekuang@huawei.com \
--cc=hpa@zytor.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=lizefan@huawei.com \
--cc=mhiramat@kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=nilayvaish@gmail.com \
--cc=tglx@linutronix.de \
--cc=wangnan0@huawei.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.