From patchwork Mon Jun 27 10:24:05 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Nan X-Patchwork-Id: 70909 Delivered-To: patch@linaro.org Received: by 10.140.28.4 with SMTP id 4csp995709qgy; Mon, 27 Jun 2016 03:25:30 -0700 (PDT) X-Received: by 10.98.64.193 with SMTP id f62mr32007703pfd.108.1467023130016; Mon, 27 Jun 2016 03:25:30 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i85si25964136pfa.231.2016.06.27.03.25.29; Mon, 27 Jun 2016 03:25:30 -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 S1751886AbcF0KYu (ORCPT + 30 others); Mon, 27 Jun 2016 06:24:50 -0400 Received: from szxga01-in.huawei.com ([58.251.152.64]:6438 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751215AbcF0KYp (ORCPT ); Mon, 27 Jun 2016 06:24:45 -0400 Received: from 172.24.1.136 (EHLO SZXEML423-HUB.china.huawei.com) ([172.24.1.136]) by szxrg01-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id DMW10283; Mon, 27 Jun 2016 18:24:33 +0800 (CST) Received: from linux-4hy3.site (10.107.193.248) by SZXEML423-HUB.china.huawei.com (10.82.67.154) with Microsoft SMTP Server id 14.3.235.1; Mon, 27 Jun 2016 18:24:21 +0800 From: Wang Nan To: , CC: , , , Wang Nan , He Kuang , "Arnaldo Carvalho de Melo" , Jiri Olsa , "Masami Hiramatsu" , Namhyung Kim , "Nilay Vaish" Subject: [PATCH v11 03/10] perf record: Prepare picking perf_event_mmap_page from multiple evlists Date: Mon, 27 Jun 2016 10:24:05 +0000 Message-ID: <1467023052-146749-4-git-send-email-wangnan0@huawei.com> X-Mailer: git-send-email 1.8.3.4 In-Reply-To: <1467023052-146749-1-git-send-email-wangnan0@huawei.com> References: <1467023052-146749-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.0A090203.5770FEE1.0070, 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: 3ecce56012c8f7cf21c87e141346e1c7 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Following commits introduce new evlists to record. This patch adjusts record__pick_pc() and introduces perf_evlist__pick_pc() to read control page from one specific evlist. record__pick_pc() will be improved to search control page from multiple evlists. Signed-off-by: Wang Nan Cc: He Kuang Cc: Arnaldo Carvalho de Melo Cc: Jiri Olsa Cc: Masami Hiramatsu Cc: Namhyung Kim Cc: Zefan Li Cc: Nilay Vaish Cc: pi3orama@163.com --- tools/perf/builtin-record.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) -- 1.8.3.4 diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index 18e9abc..b2b3b60 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c @@ -686,10 +686,21 @@ perf_event__synth_time_conv(const struct perf_event_mmap_page *pc __maybe_unused return 0; } +static const struct perf_event_mmap_page * +perf_evlist__pick_pc(struct perf_evlist *evlist) +{ + if (evlist && evlist->mmap && evlist->mmap[0].base) + return evlist->mmap[0].base; + return NULL; +} + static const struct perf_event_mmap_page *record__pick_pc(struct record *rec) { - if (rec->evlist && rec->evlist->mmap && rec->evlist->mmap[0].base) - return rec->evlist->mmap[0].base; + const struct perf_event_mmap_page *pc; + + pc = perf_evlist__pick_pc(rec->evlist); + if (pc) + return pc; return NULL; }