Received: by 2002:a25:2c96:0:0:0:0:0 with SMTP id s144csp1393694ybs; Mon, 25 May 2020 15:07:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJws4wGivQNj6J/QaAhbiWiUMFSFeoXRVWXX1fQMytUzTzW8oJuAOVjnFpAHggFmXeVDt1EK X-Received: by 2002:a17:906:468e:: with SMTP id a14mr70783ejr.124.1590444454321; Mon, 25 May 2020 15:07:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590444454; cv=none; d=google.com; s=arc-20160816; b=xKeza/tES8fI50xCnXh7l5/JCQ1mk8Dvtn1Qv0eqNQUdNg5THivE01Mh+re0kenRZ/ qLQg3tlC20H2nOIg4KjiikfybYj+Vyn/xmivX06yzVzJd+hmAesfvc+XvuNGpFqOd7JM wXrjKhy00uo6pPxSxvVzyJfUjkBWZjJ7ysGAAp5lef2mEDM/yYUOPY1deIRfakswhOx8 1Plwp0ujPsyyt/MoniRPbjmHe/dEF00jCMMhbhjJjhR90P4NKn2/g+/T6WmQBdKcrnm1 ZRFHplh5uBhZmRTAZv1ghf/QwEkCJL0wVgve727m13npuLdHZioTN8BczXneUcDNrKzH pn7Q== 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=LIK3T1MlpvglSKJ/zHZXBWjIsYadHusXdrsQTm38oOo=; b=03CEk2zIIg5YbjNx3yIdDZRBNmPYrCeyLm4hxNnXoDogghVxVe0kRlqMcrb6Eaf+fg 6IXggsentFldjIEJTRuBGUTTKQJZo8W3g4AlLo0TPh8ztOHJvhoRHRfyD9wq9kfOcw5W oG3ZyIaP988gum38tpH/Hb7hoa9PLujK1OOQcbbJeAn7sLxSapU+QP0LAjZY+HCo4pyQ G7aQ2i3JszMaDqS0ljZ38E0xZdBOqBKgM2DXzUJA9WrKgg+ulBxTQRU75hOyBnoIXl0T 65s/H/MEcBDbhmdG4964V/nCnWud0BGBQEXxIKw73A6KZ1OiWLFYUhx1DJKTbCX5d22X FYHA== 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 f26si330718ejj.168.2020.05.25.15.07.11; Mon, 25 May 2020 15:07:34 -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 S2403979AbgEYOXK (ORCPT + 99 others); Mon, 25 May 2020 10:23:10 -0400 Received: from mga05.intel.com ([192.55.52.43]:46655 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2403968AbgEYOXJ (ORCPT ); Mon, 25 May 2020 10:23:09 -0400 IronPort-SDR: dOZ2r4ip5fYrWWUr07pD81MO+vKgFfhQ9pslAd9xjiXLrO2r1WItXpGBX85GRxSGPTNooyBpbN ZTWb+Pz6jVHg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 May 2020 07:23:07 -0700 IronPort-SDR: CiyCL70qIehdpzsAeNpC5I0Mrs8zvoafG8AiGtMU9s0QGajGtjgoibzJSJjODWTqnW74vbIUS4 Gq+pi/Imh22A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,433,1583222400"; d="scan'208";a="441746220" Received: from linux.intel.com ([10.54.29.200]) by orsmga005.jf.intel.com with ESMTP; 25 May 2020 07:23:08 -0700 Received: from [10.249.227.191] (abudanko-mobl.ccr.corp.intel.com [10.249.227.191]) by linux.intel.com (Postfix) with ESMTP id 25A7558056A; Mon, 25 May 2020 07:23:05 -0700 (PDT) Subject: [PATCH v4 09/10] 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: <653fe5f3-c986-a841-1ed8-0a7d2fa24c00@linux.intel.com> Organization: Intel Corp. Message-ID: Date: Mon, 25 May 2020 17:23:04 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <653fe5f3-c986-a841-1ed8-0a7d2fa24c00@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 8c3ec29e7e80..1ff3b7a77283 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c @@ -1526,6 +1526,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); @@ -1842,6 +1843,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