Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp2112853ybt; Fri, 3 Jul 2020 00:50:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy8si6SJ4M0NyCC0FwZGTzAswKKpIxhFRlQua2CNterU3tgq1zvtfcmNS7hzbSMNllvZhmW X-Received: by 2002:a17:907:10d4:: with SMTP id rv20mr15920633ejb.413.1593762609007; Fri, 03 Jul 2020 00:50:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593762608; cv=none; d=google.com; s=arc-20160816; b=z0pGwpYm1Ev+fjDJJ60uFQgkBufFgbCW50Z0ufkyn/gJyKZuGGhM2E4OlxD5z7+igw MsbSDUd89g6UKvdaLOeV4o5B4JzMjYodiYH1FHNK1FLby9Bwo/MW23toSWokW2hfy7Ab yYU4RJIhG+RF9eNDZVHSZRCB6543ubYNHmHWh8bCLJTgrrAaOc0Pu6EeabJcAnTnNPrI FKUfGEmXOrz+gpgfNMbNjsvaHxH1XdhPSggDyD7wtn6Vpdl+eZyxp8qC8wk2w+wVZ0KS 8sc3OwD0UWEm3Xiz/bbf355T8cHF/qeMXCENX8O3jy4u3RjjYOryjp39f+Vbb0GDesJ/ v6Sg== 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=b945bAL6QKdv29auBK/MREGW/TR9Cp1YHbMJ2S6QTNQKzfNWpKea+CYnrz8hE2wH8I tpwYEFnLCgRL/6l9aYqMKj6CPVb0NtWzZ837GUnLsADbl6UkEU4QKfsuOKw2os3tnxkH kYGa5it6QPuL0TOHbP94Tj2kv9/GCqFn4f6T5JZaqHrtmrLKkHp5+AKtsgB+MkQcX3Ga i8wRen+d0n+ud+xkJd44kb1oGa7gj8AIsWa90KZlN+mTYgtp6CfxLtpvtnuRtMtAH152 SY/oCuX6i8oNVzn+w5Gznv8iuZXh36mCr0VpuwbKexIbf/C1Li0vEixMQqsZmyG8Uw9C Trdg== 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 f10si6962118edm.214.2020.07.03.00.49.45; Fri, 03 Jul 2020 00:50:08 -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 S1726063AbgGCHtL (ORCPT + 99 others); Fri, 3 Jul 2020 03:49:11 -0400 Received: from mga07.intel.com ([134.134.136.100]:32645 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726575AbgGCHtJ (ORCPT ); Fri, 3 Jul 2020 03:49:09 -0400 IronPort-SDR: 2eo2iJ7eJlfj+zdz7wNCglZPq1Fy+f3lrWK0juC+tmOQRCsD4MESWHgZIXd5u5dtdmzovzqwAR kxpKKoXmdTSQ== X-IronPort-AV: E=McAfee;i="6000,8403,9670"; a="212129219" X-IronPort-AV: E=Sophos;i="5.75,307,1589266800"; d="scan'208";a="212129219" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jul 2020 00:49:09 -0700 IronPort-SDR: DKg7Hs0kvNu84Rc9qF431K802eYTWMJvAFOKUps3LZiIboOhvU/G6G4f9EsBX/eOjhHAvhkW9P +8eSRSiTLk4Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,307,1589266800"; d="scan'208";a="426219926" Received: from linux.intel.com ([10.54.29.200]) by orsmga004.jf.intel.com with ESMTP; 03 Jul 2020 00:49:07 -0700 Received: from [10.249.231.67] (abudanko-mobl.ccr.corp.intel.com [10.249.231.67]) by linux.intel.com (Postfix) with ESMTP id EC337580784; Fri, 3 Jul 2020 00:49:04 -0700 (PDT) Subject: [PATCH v9 14/15] perf record: implement control commands handling From: Alexey Budankov To: Arnaldo Carvalho de Melo , Jiri Olsa Cc: Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Ingo Molnar , Andi Kleen , linux-kernel References: Organization: Intel Corp. Message-ID: <11d03d88-ebc8-10ed-00ed-310233c50772@linux.intel.com> Date: Fri, 3 Jul 2020 10:49:03 +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: 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