From patchwork Mon Jan 25 09:56:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Nan X-Patchwork-Id: 60289 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp1254455lbb; Mon, 25 Jan 2016 01:59:23 -0800 (PST) X-Received: by 10.98.80.76 with SMTP id e73mr24548508pfb.24.1453715959819; Mon, 25 Jan 2016 01:59:19 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 7si32678622pfk.172.2016.01.25.01.59.19; Mon, 25 Jan 2016 01:59:19 -0800 (PST) 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 S1756680AbcAYJ7G (ORCPT + 30 others); Mon, 25 Jan 2016 04:59:06 -0500 Received: from szxga01-in.huawei.com ([58.251.152.64]:39147 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756611AbcAYJ6y (ORCPT ); Mon, 25 Jan 2016 04:58:54 -0500 Received: from 172.24.1.47 (EHLO szxeml428-hub.china.huawei.com) ([172.24.1.47]) by szxrg01-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id DDR51091; Mon, 25 Jan 2016 17:57:32 +0800 (CST) Received: from linux-4hy3.site (10.107.193.248) by szxeml428-hub.china.huawei.com (10.82.67.183) with Microsoft SMTP Server id 14.3.235.1; Mon, 25 Jan 2016 17:57:22 +0800 From: Wang Nan To: Alexei Starovoitov , Arnaldo Carvalho de Melo CC: Brendan Gregg , Daniel Borkmann , "David S. Miller" , He Kuang , Jiri Olsa , Li Zefan , Masami Hiramatsu , Namhyung Kim , Peter Zijlstra , , Will Deacon , , Wang Nan Subject: [PATCH 23/54] perf tools: Introduce API to pause ring buffer Date: Mon, 25 Jan 2016 09:56:10 +0000 Message-ID: <1453715801-7732-24-git-send-email-wangnan0@huawei.com> X-Mailer: git-send-email 1.8.3.4 In-Reply-To: <1453715801-7732-1-git-send-email-wangnan0@huawei.com> References: <1453715801-7732-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.56A5F18E.0004, 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: 489fae9615da187aa803f8a87714419c Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org perf_evsel__pause() is introduced to pause a ring buffer. Since output of a evsel is bound together, ioctl() on the first file is enough. Signed-off-by: Wang Nan Signed-off-by: He Kuang Cc: Arnaldo Carvalho de Melo Cc: Jiri Olsa Cc: Masami Hiramatsu Cc: Namhyung Kim Cc: Zefan Li Cc: pi3orama@163.com --- tools/perf/util/evsel.c | 6 ++++++ tools/perf/util/evsel.h | 1 + 2 files changed, 7 insertions(+) -- 1.8.3.4 diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index 7498d58..0b562cf 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c @@ -1009,6 +1009,12 @@ int perf_evsel__disable(struct perf_evsel *evsel) 0); } +int perf_evsel__pause(struct perf_evsel *evsel, bool pause) +{ + return perf_evsel__run_ioctl(evsel, 1, 1, PERF_EVENT_IOC_PAUSE_OUTPUT, + (void *)(pause ? 1UL : 0UL)); +} + int perf_evsel__alloc_id(struct perf_evsel *evsel, int ncpus, int nthreads) { if (ncpus == 0 || nthreads == 0) diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h index 022fcff..d5ae7ba 100644 --- a/tools/perf/util/evsel.h +++ b/tools/perf/util/evsel.h @@ -230,6 +230,7 @@ int perf_evsel__apply_filter(struct perf_evsel *evsel, int ncpus, int nthreads, const char *filter); int perf_evsel__enable(struct perf_evsel *evsel); int perf_evsel__disable(struct perf_evsel *evsel); +int perf_evsel__pause(struct perf_evsel *evsel, bool pause); int perf_evsel__open_per_cpu(struct perf_evsel *evsel, struct cpu_map *cpus);