From patchwork Fri May 13 07:55:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Nan X-Patchwork-Id: 67734 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp135879qge; Fri, 13 May 2016 00:58:16 -0700 (PDT) X-Received: by 10.98.16.150 with SMTP id 22mr20632986pfq.165.1463126296351; Fri, 13 May 2016 00:58:16 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z25si23078390pfa.82.2016.05.13.00.58.16; Fri, 13 May 2016 00:58:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752024AbcEMH6J (ORCPT + 29 others); Fri, 13 May 2016 03:58:09 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:29799 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751316AbcEMH6G (ORCPT ); Fri, 13 May 2016 03:58:06 -0400 Received: from 172.24.1.137 (EHLO szxeml433-hub.china.huawei.com) ([172.24.1.137]) by szxrg02-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id DHB52315; Fri, 13 May 2016 15:56:30 +0800 (CST) Received: from linux-4hy3.site (10.107.193.248) by szxeml433-hub.china.huawei.com (10.82.67.210) with Microsoft SMTP Server id 14.3.235.1; Fri, 13 May 2016 15:56:20 +0800 From: Wang Nan To: CC: , , Wang Nan , Arnaldo Carvalho de Melo , "Peter Zijlstra" , Zefan Li , Subject: [PATCH 01/17] perf tools: Extract __perf_evlist__mmap_read() Date: Fri, 13 May 2016 07:55:58 +0000 Message-ID: <1463126174-119290-2-git-send-email-wangnan0@huawei.com> X-Mailer: git-send-email 1.8.3.4 In-Reply-To: <1463126174-119290-1-git-send-email-wangnan0@huawei.com> References: <1463126174-119290-1-git-send-email-wangnan0@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.107.193.248] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020203.573588AF.010A, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2013-06-18 04:22:30, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: e762894e3f7f795ae9aa8fc89d8d4ec4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Extract event reader to __perf_evlist__mmap_read(). Future commit will feed it with manually computed 'head' and 'old' pointers. Signed-off-by: Wang Nan Cc: Arnaldo Carvalho de Melo Cc: Peter Zijlstra Cc: Zefan Li Cc: pi3orama@163.com --- tools/perf/util/evlist.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) -- 1.8.3.4 diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c index c4bfe11..5e86972 100644 --- a/tools/perf/util/evlist.c +++ b/tools/perf/util/evlist.c @@ -749,6 +749,13 @@ broken_event: return event; } +static union perf_event * +__perf_evlist__mmap_read(struct perf_mmap *md, bool overwrite, u64 head, + u64 old, u64 *prev) +{ + return perf_mmap__read(md, overwrite, old, head, prev); +} + union perf_event *perf_evlist__mmap_read(struct perf_evlist *evlist, int idx) { struct perf_mmap *md = &evlist->mmap[idx]; @@ -763,7 +770,8 @@ union perf_event *perf_evlist__mmap_read(struct perf_evlist *evlist, int idx) head = perf_mmap__read_head(md); - return perf_mmap__read(md, evlist->overwrite, old, head, &md->prev); + return __perf_evlist__mmap_read(md, evlist->overwrite, head, + old, &md->prev); } union perf_event *