Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp748644ybg; Mon, 1 Jun 2020 13:24:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxxU6FDePqrg7ZxZ3eSGnCNKE/gjvLQzqovkNqQ7wZdSMEWGcphJe2lFK3g/YTaa+qTaBBY X-Received: by 2002:a17:906:4a03:: with SMTP id w3mr20556750eju.154.1591043078926; Mon, 01 Jun 2020 13:24:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591043078; cv=none; d=google.com; s=arc-20160816; b=pLiPbHxazyceB8zX+0nX1Nhu1USLkHLKWLlc8nmuPalB0IKpfN/+AcLi+L3H/J0Sku t7Evr/K8yOCuEbDT/PefkfOVLVy5koZKLXV2iOrCUIo0bqQ8Io/p7InhvYk1Sv+/FC81 susmujPbD79hvmqfhhj6iWZ1bPHkm4ZBinSkwJbWrc1PlBM7lvGxMPEJr7ISLQFzSyGq Vj5Xm8gHdiVFhXtTuvbFRdcSynaIuVzaYOet1MmAu0WQNfwHRqVeVn8PrCk5TFWQSTLp PNzIZ5YbJg6kGNkruOLU67O4YO25FhnJblH2aMsdxkxsTR+Vfd1CUyNZLMgMrHBEgIUD GhUQ== 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=wtWjzrfhGX77wJvT+D7WtgzWj9qx9OCUl4S+UcRigcRsOZmi7c1WO6QR6X3T8Yt9Wj P0Uy+Wquo5tThzZ74vhoE1jujZeKC+R1cuZ5f+WSKW0g+pww7Wewnu+Nk/lEtrxefXtQ FpCPPQKBFMaX/CX9+CKScyNBlIs+G2a1xly39yZuKLSW2xIHGMVWvlBYGHmC+lXW+IkX AHIyfcI0Q0IFxIlpMlf5/iT9y7rsrFanRNWFK5F0Z7cz3J5lz+iILSDcKDpMqvolVxvO d6NSXqe7LxvTOb666jcSrQ0TRnreIcg1K8Y0u5+UHlfXahhh8lKD/MIg/hNhDnZ+NSUo Vy2Q== 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 a4si240572edy.169.2020.06.01.13.24.15; Mon, 01 Jun 2020 13:24:38 -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 S1728593AbgFAUTn (ORCPT + 99 others); Mon, 1 Jun 2020 16:19:43 -0400 Received: from mga17.intel.com ([192.55.52.151]:5984 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728167AbgFAUTm (ORCPT ); Mon, 1 Jun 2020 16:19:42 -0400 IronPort-SDR: 3HJUq6djVQskMHb9oQ39g36mr0y3UP5xvNyaoBsqXav1+11GT0g6c2lWHiot/7zlXLC9Mpb1v4 XVcWgmUIWkEA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Jun 2020 13:19:42 -0700 IronPort-SDR: a8YMb+FJ9tPSjLYmd5K79DoorFtWuCmkFWZLLaYdKvN0U7qScfq1UZDdD52EdMxsiFY7xB+NXW 62Cyk6HEZO9g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,462,1583222400"; d="scan'208";a="286391443" Received: from linux.intel.com ([10.54.29.200]) by orsmga002.jf.intel.com with ESMTP; 01 Jun 2020 13:19:42 -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 9145658010E; Mon, 1 Jun 2020 13:19:40 -0700 (PDT) Subject: [PATCH v6 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: Date: Mon, 1 Jun 2020 23:19:39 +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