From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org, Wang Nan <wangnan0@huawei.com>,
He Kuang <hekuang@huawei.com>, Jiri Olsa <jolsa@kernel.org>,
Masami Hiramatsu <mhiramat@kernel.org>,
Namhyung Kim <namhyung@kernel.org>, Zefan Li <lizefan@huawei.com>,
pi3orama@163.com, Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 07/12] perf evlist: Choose correct reading direction according to evlist->backward
Date: Mon, 30 May 2016 16:24:53 -0300 [thread overview]
Message-ID: <1464636298-7709-8-git-send-email-acme@kernel.org> (raw)
In-Reply-To: <1464636298-7709-1-git-send-email-acme@kernel.org>
From: Wang Nan <wangnan0@huawei.com>
Now we have evlist->backward to indicate the mmap direction. Make
perf_evlist__mmap_read() choose right direction automatically.
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: Zefan Li <lizefan@huawei.com>
Cc: pi3orama@163.com
Link: http://lkml.kernel.org/r/1464183898-174512-3-git-send-email-wangnan0@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/evlist.c | 9 ++++++++-
tools/perf/util/evlist.h | 2 ++
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index 58ede3257c61..719729ef9d7c 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -777,7 +777,7 @@ broken_event:
return event;
}
-union perf_event *perf_evlist__mmap_read(struct perf_evlist *evlist, int idx)
+union perf_event *perf_evlist__mmap_read_forward(struct perf_evlist *evlist, int idx)
{
struct perf_mmap *md = &evlist->mmap[idx];
u64 head;
@@ -832,6 +832,13 @@ perf_evlist__mmap_read_backward(struct perf_evlist *evlist, int idx)
return perf_mmap__read(md, false, start, end, &md->prev);
}
+union perf_event *perf_evlist__mmap_read(struct perf_evlist *evlist, int idx)
+{
+ if (!evlist->backward)
+ return perf_evlist__mmap_read_forward(evlist, idx);
+ return perf_evlist__mmap_read_backward(evlist, idx);
+}
+
void perf_evlist__mmap_read_catchup(struct perf_evlist *evlist, int idx)
{
struct perf_mmap *md = &evlist->mmap[idx];
diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h
index d740fb877ab6..68cb1361c97c 100644
--- a/tools/perf/util/evlist.h
+++ b/tools/perf/util/evlist.h
@@ -131,6 +131,8 @@ struct perf_sample_id *perf_evlist__id2sid(struct perf_evlist *evlist, u64 id);
union perf_event *perf_evlist__mmap_read(struct perf_evlist *evlist, int idx);
+union perf_event *perf_evlist__mmap_read_forward(struct perf_evlist *evlist,
+ int idx);
union perf_event *perf_evlist__mmap_read_backward(struct perf_evlist *evlist,
int idx);
void perf_evlist__mmap_read_catchup(struct perf_evlist *evlist, int idx);
--
2.5.5
next prev parent reply other threads:[~2016-05-30 19:27 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-30 19:24 [GIT PULL 00/12] perf/core improvements and fixes Arnaldo Carvalho de Melo
2016-05-30 19:24 ` [PATCH 01/12] perf thread: Adopt get_main_thread from db-export.c Arnaldo Carvalho de Melo
2016-05-30 19:24 ` [PATCH 02/12] perf core: Per event callchain limit Arnaldo Carvalho de Melo
2016-05-30 19:24 ` [PATCH 03/12] perf tools: Per event max-stack settings Arnaldo Carvalho de Melo
2016-05-30 19:24 ` [PATCH 04/12] perf record: Robustify perf_event__synth_time_conv() Arnaldo Carvalho de Melo
2016-05-30 19:24 ` [PATCH 05/12] perf evlist: Don't poll and mmap overwritable events Arnaldo Carvalho de Melo
2016-05-30 19:24 ` [PATCH 06/12] perf evlist: Check 'base' pointer before checking refcnt when put a mmap Arnaldo Carvalho de Melo
2016-05-30 19:24 ` Arnaldo Carvalho de Melo [this message]
2016-05-30 19:24 ` [PATCH 08/12] tools: Pass arg to fdarray__filter's call back function Arnaldo Carvalho de Melo
2016-05-30 19:24 ` [PATCH 09/12] perf tools: Add arch/*/include/generated/ to .gitignore Arnaldo Carvalho de Melo
2016-05-30 19:24 ` [PATCH 10/12] perf symbols: Introduce filename__readable to check readability Arnaldo Carvalho de Melo
2016-05-30 19:24 ` [PATCH 11/12] perf symbols: Cleanup the code flow of dso__find_kallsyms Arnaldo Carvalho de Melo
2016-05-30 19:24 ` [PATCH 12/12] perf buildid-cache: Use path/to/bin/buildid/elf instead of path/to/bin/buildid Arnaldo Carvalho de Melo
2016-05-31 7:24 ` [GIT PULL 00/12] perf/core improvements and fixes Ingo Molnar
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=1464636298-7709-8-git-send-email-acme@kernel.org \
--to=acme@kernel.org \
--cc=acme@redhat.com \
--cc=hekuang@huawei.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lizefan@huawei.com \
--cc=mhiramat@kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=pi3orama@163.com \
--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.