Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp653459ybg; Wed, 3 Jun 2020 10:02:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy8ShM6kS9TZzhGZo4srFpKMWoCenZ/0QxPJueJK+HL4H1z1xVxuhA0b56I3mmPNHQ3b93T X-Received: by 2002:a50:9b13:: with SMTP id o19mr364700edi.143.1591203721225; Wed, 03 Jun 2020 10:02:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591203721; cv=none; d=google.com; s=arc-20160816; b=uAEtXbHuoB0WjmZBAVhmCjEbfMgS3/nq9kx/AR47wPCgwmDnORlgx3aogmJsIoYbkH +lh2yMSAfKcqxV/V7tZP/6uhIk5TB6hTdopS1RDfNyUJ3dBVcbdR6ka0GuDt/v0d3m+6 x5Byc/bQGSrvW6ni2GiBMGj6bPARTZnViYjfCFHU1H45B2n1ZE6mB13EDBGovELvqoqg VYl9Xk1adL7MNg3CbTtO8MA59EqcTVdtzR6oEUQJmdOwWTvbre6shJpvy0C9Nd/phFzN fwTnD3QvKxsGkClomggsz/9ZslXCfkRKLJzavjfWK33/Zq+5EceEqwlfuBwZZ38AbgF2 GpSw== 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=P15J06ybiMKMRjsn8DJT/ysbPDQmPNdyjrWc04V4TLfLwonDMs6T/oF74rK4YQ+UeT x7jYicqRJwjF94z/Oim4imPaxoCz10t8pTjfyPyJAO1Lo8k3+7eSsIj+e1s2nY2DSuz/ 4XuDNFbroEJ1BcmXkNq2jaE7D4cFOxHcdus2CYLCojM1uKrvcPAN8/64B5h1gfy3IBd8 9gSL3tSEAGu70pEiRHyUIwYvnc+ci7+zY3m0gAafHe4EE6A6Lq6M1EhhCS+q186+b4o4 c9yEue6HKxag7BCJ4nWwJH80Wj8EXCAIhmrnq6DJ8Ij/y226olFSVpaQtXYoFvJ/FZdR Tmpg== 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 l26si69085ejc.496.2020.06.03.10.01.34; Wed, 03 Jun 2020 10:02:01 -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 S1725926AbgFCQBV (ORCPT + 99 others); Wed, 3 Jun 2020 12:01:21 -0400 Received: from mga12.intel.com ([192.55.52.136]:62513 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725834AbgFCQBV (ORCPT ); Wed, 3 Jun 2020 12:01:21 -0400 IronPort-SDR: amRrVsGs4TEC5wzUk86tzr1gDbGCjufprIS02Vb3AW1qMd732gJRwxJNQlzEC8ftLzfWt+JlW+ uFen5F04KUBw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jun 2020 09:01:20 -0700 IronPort-SDR: 6NF3k9gPqbYlMZCTbyncpZO1Xp8lsD/MyU3tXkU/D+S5L7Q6efGkplCrmQ/6pICaEG19rvYUWV YO5RlcBmqWNg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,468,1583222400"; d="scan'208";a="287079597" Received: from linux.intel.com ([10.54.29.200]) by orsmga002.jf.intel.com with ESMTP; 03 Jun 2020 09:01:20 -0700 Received: from [10.249.225.188] (abudanko-mobl.ccr.corp.intel.com [10.249.225.188]) by linux.intel.com (Postfix) with ESMTP id 5BEA958045A; Wed, 3 Jun 2020 09:01:18 -0700 (PDT) Subject: [PATCH v7 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: <5de4b954-24f0-1e8d-5a0d-7b12783b8218@linux.intel.com> Organization: Intel Corp. Message-ID: <3f442038-a879-73fa-7762-a3f0c7091f47@linux.intel.com> Date: Wed, 3 Jun 2020 19:01:16 +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: <5de4b954-24f0-1e8d-5a0d-7b12783b8218@linux.intel.com> 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