From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752901AbcFBGdd (ORCPT ); Thu, 2 Jun 2016 02:33:33 -0400 Received: from terminus.zytor.com ([198.137.202.10]:55854 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750754AbcFBGda (ORCPT ); Thu, 2 Jun 2016 02:33:30 -0400 Date: Wed, 1 Jun 2016 23:33:17 -0700 From: tip-bot for Wang Nan Message-ID: Cc: mingo@kernel.org, mhiramat@kernel.org, hekuang@huawei.com, tglx@linutronix.de, linux-kernel@vger.kernel.org, jolsa@kernel.org, namhyung@kernel.org, wangnan0@huawei.com, hpa@zytor.com, lizefan@huawei.com, acme@redhat.com Reply-To: mhiramat@kernel.org, hekuang@huawei.com, mingo@kernel.org, tglx@linutronix.de, linux-kernel@vger.kernel.org, namhyung@kernel.org, jolsa@kernel.org, wangnan0@huawei.com, lizefan@huawei.com, hpa@zytor.com, acme@redhat.com In-Reply-To: <1464183898-174512-3-git-send-email-wangnan0@huawei.com> References: <1464183898-174512-3-git-send-email-wangnan0@huawei.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf evlist: Choose correct reading direction according to evlist->backward Git-Commit-ID: 5a5ddeb6e3559675070df6b39ba32a4dd1ab4dd5 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 5a5ddeb6e3559675070df6b39ba32a4dd1ab4dd5 Gitweb: http://git.kernel.org/tip/5a5ddeb6e3559675070df6b39ba32a4dd1ab4dd5 Author: Wang Nan AuthorDate: Wed, 25 May 2016 13:44:50 +0000 Committer: Arnaldo Carvalho de Melo CommitDate: Mon, 30 May 2016 12:41:45 -0300 perf evlist: Choose correct reading direction according to evlist->backward Now we have evlist->backward to indicate the mmap direction. Make perf_evlist__mmap_read() choose right direction automatically. Signed-off-by: Wang Nan Cc: He Kuang Cc: Jiri Olsa Cc: Masami Hiramatsu Cc: Namhyung Kim Cc: Zefan Li 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 --- 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 58ede32..719729e 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 d740fb8..68cb136 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);