Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1603790ybh; Tue, 14 Jul 2020 02:14:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwJTaLbbBUxbHE5yM3PQC4YAb5h1BGmHltFjnEHVVfc6OmZV6PEcdeIqBsPe+GqS5pIPppY X-Received: by 2002:a17:906:1a16:: with SMTP id i22mr3678790ejf.439.1594718061393; Tue, 14 Jul 2020 02:14:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594718061; cv=none; d=google.com; s=arc-20160816; b=p0HnOTp0lNNHLA1rc0/DXvop50wDSZ3TngJ+VSLt8wv8HmR9YRm8OtMx3/l+hg8TuG 0SgiY8l/flqFpSIfUGLkHKlFKUS1dUoNAngjBP54S+vpxRlBXa21B/RrxSpOgHz1NNaH OFNw1PdXdSSirR1lDrB5f5miRny4f1qf4weN31IC/T9NlvdN5UxQ928yAxbmLvX1PImD MxzEXn3sTvl3jGRnpwAV7v1h7MqFHUMT3q6qd3vKU0wVupDZRQrr0X+SrFlivw382pVg ilJqlkPHg+wSSYg21vRueb+Pgoth6X+siLh58i8Thm79vM3NEePhMj/eHTT9nrEotbGT Nmgw== 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=ZY91fQ1zORveENeqn5U829PlxDcNnCsLUwm/oVeMqD8=; b=qxmPO1yfkyLduGZ9L+1oyTy90zKPIj4n95RSx9NvgF1RVZXjxKxJ2NKvr9R9dto1iY NVC5g/opa1IOxZYunKtujdNMKnusJOk9jTnXpOyW6M+TygNKn8ePufbcmDKIjiJy9SdO Gk7zFEK0NLmmNah38C3/KbA974WSHFW6HKE3sG6Mc7jLtqS40qq0u0wdSq+XMWHmWHgE zoinkNIX+mgNeMMspONZo9ICGAglFF8LUOWHeQ85RYTHgN4qNhbI7w9m8+rNdS1vOR37 gZ7aaUP/C3Ebn63tY5m2F4Q9ZpmHYLLTj4hGFucd9vy318nfGTfj8HK/rGuHgfc+jt0L gPxg== 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 g22si12305502edj.310.2020.07.14.02.13.58; Tue, 14 Jul 2020 02:14:21 -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 S1726729AbgGNJLn (ORCPT + 99 others); Tue, 14 Jul 2020 05:11:43 -0400 Received: from mga01.intel.com ([192.55.52.88]:51784 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725793AbgGNJLn (ORCPT ); Tue, 14 Jul 2020 05:11:43 -0400 IronPort-SDR: VTNfzNegfJLfmnmvWwydm76dqsLRdPQS/M24Y5d+z8Mm2NB/Zq2U0A7LNSpj6ziyqpJol3bOwx XHHPq9L8bPYQ== X-IronPort-AV: E=McAfee;i="6000,8403,9681"; a="166951111" X-IronPort-AV: E=Sophos;i="5.75,350,1589266800"; d="scan'208";a="166951111" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jul 2020 02:11:42 -0700 IronPort-SDR: 8IgCJ8yjKqXlI5urFxrmScv/1aNmCdWKmJBlmoHXTnul5l5XcQONJqUYlqyS1WG2KC321sga1I zCTuAoEA6VVA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,350,1589266800"; d="scan'208";a="269957851" Received: from linux.intel.com ([10.54.29.200]) by fmsmga008.fm.intel.com with ESMTP; 14 Jul 2020 02:11:42 -0700 Received: from [10.249.230.149] (abudanko-mobl.ccr.corp.intel.com [10.249.230.149]) by linux.intel.com (Postfix) with ESMTP id D5CBA580810; Tue, 14 Jul 2020 02:11:40 -0700 (PDT) Subject: [PATCH v11 14/15] 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: <037d737f-0ada-a9f0-9686-f7521ca6fbc3@linux.intel.com> Organization: Intel Corp. Message-ID: <87484304-ef8b-9410-571c-b90417e0f847@linux.intel.com> Date: Tue, 14 Jul 2020 12:11:39 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <037d737f-0ada-a9f0-9686-f7521ca6fbc3@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 cd1892c4844b..632e61fe70bd 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); @@ -1846,6 +1847,21 @@ static int __cmd_record(struct record *rec, int argc, const char **argv) draining = true; } + 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; + } + } + /* * When perf is starting the traced process, at the end events * die with the process and we wait for that. Thus no need to -- 2.24.1