Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp589538ybg; Mon, 1 Jun 2020 09:07:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyf5TOlF7QACRdleUUrIi29gRsouS50ZyLLOUMcO6JvSQOSSm8YPFfM7GH+ftTaxooKtKa+ X-Received: by 2002:aa7:da8c:: with SMTP id q12mr974459eds.385.1591027631453; Mon, 01 Jun 2020 09:07:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591027631; cv=none; d=google.com; s=arc-20160816; b=hFNtKt6wP/c17yhc79BKQQiz9B9dZtzlRGCohei/Npq6cd3SycVxOoeQfuDXZT9be0 tfDg2XKlWBLm/LpGjvKDOAsLmqiqrPjKxn4/9obNe0frcVSfKxabxKljHnXIgf3iKMup +MgN7aW02y23qkOgrNo3ZKx8X+VFP3DulyHAVCBz+JLHz0mF9Y/Z9llHMacn1Gi3JmZS TFy+bS0b55DYMLDyZR+OOwBOrgU9OCELVWzGLXAk6wJR3fH7gqkbqS8ospDmG+HvdUPD IIN482buTKoE4xKO9KIZjD8aboixTDO6Hnz1McvMrYcv4xcR7j8gx3EsA7Y0AaB/2aFB yC1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:references:cc:to:from:subject:ironport-sdr :ironport-sdr; bh=po8/7NlZ2m76RP6HrnqDudluoioPrcBSGE7udG2yW2s=; b=FdZBSZT9dvppdOaWPSlzXd0Ndp40lmQvpl2miLSz9dnKiJpuOrzzOe4eCmibokPnGU A1vEEryfVG+B542Z7lZkWgQjSs/1mUfxOlMOLckrh19HjeLAW+VLyowFKlMwmA/j05kZ ExsK+QqAnaUWjdiLGIl4i2x+77fOrXcvV4gPNUpsuxldXOVz6RPEvpUfShrhlY2RQz07 A+vGtzWCQJ3hN6wofHdwr6/UvAlaB+TjhMyBXxdMR5U9Z0DmYjltcboSqXW7jgTM5WIk ydSO7IYrBviWXdDYPEZIscZe5o0VB6UTZCc1/+ItdizxQMsya1cMYVkz86OqmOnFkf4M Drqg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d5si11116877edr.410.2020.06.01.09.06.47; Mon, 01 Jun 2020 09:07:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727815AbgFAQE1 (ORCPT + 99 others); Mon, 1 Jun 2020 12:04:27 -0400 Received: from mga11.intel.com ([192.55.52.93]:42453 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726067AbgFAQE0 (ORCPT ); Mon, 1 Jun 2020 12:04:26 -0400 IronPort-SDR: ECeWUsvYUkis8UlWAlgimbDwpGVqTi33tKnNHImI6YzIipc2sDWSAttx8E4MVll7c//9bObgcE 11C97Jnyzahg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Jun 2020 09:04:26 -0700 IronPort-SDR: c9ZLe/ZhlXwCIhd9QfMVvTGzy9s+IfERzadwRcesC00Uy/mAtdl4r8rPpxJh25xuyyNZVZD6QI p8qtfsMb4xMg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,461,1583222400"; d="scan'208";a="286323897" Received: from linux.intel.com ([10.54.29.200]) by orsmga002.jf.intel.com with ESMTP; 01 Jun 2020 09:04:25 -0700 Received: from [10.249.230.65] (abudanko-mobl.ccr.corp.intel.com [10.249.230.65]) by linux.intel.com (Postfix) with ESMTP id 1EBA9580646; Mon, 1 Jun 2020 09:04:23 -0700 (PDT) Subject: [PATCH v5 12/13] perf record: implement control commands handling From: Alexey Budankov To: Arnaldo Carvalho de Melo Cc: Jiri Olsa , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Ingo Molnar , Andi Kleen , linux-kernel References: Organization: Intel Corp. Message-ID: <141431de-49c9-093b-b784-b67b81e31b56@linux.intel.com> Date: Mon, 1 Jun 2020 19:04:23 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.8.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Implement handling of 'enable' and 'disable' control commands coming from control file descriptor. Signed-off-by: Alexey Budankov --- tools/perf/builtin-record.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index d0b29a1070a0..0394e068dde8 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c @@ -1527,6 +1527,7 @@ static int __cmd_record(struct record *rec, int argc, const char **argv) bool disabled = false, draining = false; int fd; float ratio = 0; + enum evlist_ctl_cmd cmd = EVLIST_CTL_CMD_UNSUPPORTED; atexit(record__sig_exit); signal(SIGCHLD, sig_handler); @@ -1830,6 +1831,21 @@ static int __cmd_record(struct record *rec, int argc, const char **argv) alarm(rec->switch_output.time); } + if (evlist__ctlfd_process(rec->evlist, &cmd) > 0) { + switch (cmd) { + case EVLIST_CTL_CMD_ENABLE: + pr_info(EVLIST_ENABLED_MSG); + break; + case EVLIST_CTL_CMD_DISABLE: + pr_info(EVLIST_DISABLED_MSG); + break; + case EVLIST_CTL_CMD_ACK: + case EVLIST_CTL_CMD_UNSUPPORTED: + default: + break; + } + } + if (hits == rec->samples) { if (done || draining) break; -- 2.24.1