Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp60688ybj; Wed, 6 May 2020 11:32:51 -0700 (PDT) X-Google-Smtp-Source: APiQypJ6qf2uYkLc/F+XrQtQmI4C3i7tSN4QxCMlb9s7YmdKk7qA81qOB4O0apNcjguymvRYem7m X-Received: by 2002:a50:e8c1:: with SMTP id l1mr8557484edn.81.1588789971313; Wed, 06 May 2020 11:32:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588789971; cv=none; d=google.com; s=arc-20160816; b=YhRqapMMeIOKRuXnmWZk6ig9B3KebXjV0uPEIktqbzhNZ/DgSCp/q2jrfJPCuFhaha TTLAkaKGkRtTkyCuWzjmNbjemfonUeEPdSTlkZ1Nap/6iUSiwRieLIYXMssuHw343ePz x4e4CSmXlg0mQ+0WOLNqe53Mhti8dZTZoy85oXNYgq9gXYBKya1XrHM5Hpt40gyF6f2F 2VvzetYDKRd0Ep6LmQ7wcPax7Rld0LEUiSCxUx/7Vbz8ZqnFe0g07HnboG15voCKdzhA 1voe9RlEoUzSQD31OGDWifZYdM5/M64RH1akcZ/jCel6WPa8HIleHnNkcPYPUD1g6jgi huSA== 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=IH5bYAEuXXCQMlrRmTkUD30Id8awS4cxGNcNEEFeLVU=; b=IGlPAmcLxDaNgOPwQgU3xHASQlXv1gn6S19yUv1iU+r94NQspdQIs+83gxkEtA+myU J7wcun5h4UVJ8DPqy04qgtE2PfKO/7SxckV42wCvcYw2VkyMP1Az248VYYvAdloi9c55 8w1Vmnz/jwPgEmh9gT/tU4vyIjNUK53/2OtVYaLmc8Hjqkqr+nNTvH+AOu7RgaULBWjk HZ+ypqU2S/1VKmOTt761I01CelrwiRAC34brc53dBQufb5XNk5+kILhKadkkDujoHTQj gQFi6S7nqzPNlWfUyszVWTYbve5vnVFchHb+c81GwmbOkPMhXsSvWi/NbTR+4iJsXX2m jE/w== 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 h13si1658307edw.475.2020.05.06.11.32.28; Wed, 06 May 2020 11:32:51 -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 S1730398AbgEFSaB (ORCPT + 99 others); Wed, 6 May 2020 14:30:01 -0400 Received: from mga06.intel.com ([134.134.136.31]:8173 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729400AbgEFSaB (ORCPT ); Wed, 6 May 2020 14:30:01 -0400 IronPort-SDR: LqA7mPMj3NDnLfJI6xFfyNyKxJkNixKrsBPjtDQpOo7zCtFVQldqzG0i39NfTt5jbk35PctAok peqM4D9KTVlg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2020 11:30:00 -0700 IronPort-SDR: 7xU5fC797kZq1Q8BLkfF4baR70umvgpfV9sBP+oV3Y5rcDCnJi8Rwwt1VAh4G9bGxVykaR1YeM QVgfNJ9Mmdsw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,360,1583222400"; d="scan'208";a="295428909" Received: from linux.intel.com ([10.54.29.200]) by fmsmga002.fm.intel.com with ESMTP; 06 May 2020 11:29:59 -0700 Received: from [10.249.228.227] (abudanko-mobl.ccr.corp.intel.com [10.249.228.227]) by linux.intel.com (Postfix) with ESMTP id B95B358043A; Wed, 6 May 2020 11:29:57 -0700 (PDT) Subject: [PATCH v2 10/11] perf record: introduce --ctl-fd[-ack] options 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: Date: Wed, 6 May 2020 21:29:56 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.7.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 Introduce --ctl-fd[-ack] options to pass open file descriptors numbers from command line. Signed-off-by: Alexey Budankov --- tools/perf/builtin-record.c | 9 +++++++++ tools/perf/util/record.h | 2 ++ 2 files changed, 11 insertions(+) diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index 2278a3efc747..9cf738ff1cae 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c @@ -1704,6 +1704,8 @@ static int __cmd_record(struct record *rec, int argc, const char **argv) perf_evlist__start_workload(rec->evlist); } + perf_evlist__initialize_ctlfd(rec->evlist, opts->ctl_fd, opts->ctl_fd_ack); + if (opts->initial_delay) { pr_info(PERF_EVLIST__DISABLED_MSG); if (opts->initial_delay > 0) { @@ -1850,6 +1852,7 @@ static int __cmd_record(struct record *rec, int argc, const char **argv) record__synthesize_workload(rec, true); out_child: + perf_evlist__finalize_ctlfd(rec->evlist); record__mmap_read_all(rec, true); record__aio_mmap_read_sync(rec); @@ -2331,6 +2334,8 @@ static struct record record = { }, .mmap_flush = MMAP_FLUSH_DEFAULT, .nr_threads_synthesize = 1, + .ctl_fd = -1, + .ctl_fd_ack = -1, }, .tool = { .sample = process_sample_event, @@ -2526,6 +2531,10 @@ static struct option __record_options[] = { OPT_UINTEGER(0, "num-thread-synthesize", &record.opts.nr_threads_synthesize, "number of threads to run for event synthesis"), + OPT_INTEGER(0, "ctl-fd", &record.opts.ctl_fd, + "Listen on fd descriptor for command to control measurement ('e': enable events, 'd': disable events)"), + OPT_INTEGER(0, "ctl-fd-ack", &record.opts.ctl_fd_ack, + "Send control command completion ('a') to fd ack descriptor"), OPT_END() }; diff --git a/tools/perf/util/record.h b/tools/perf/util/record.h index 96a73bbd8cd4..da18aeca3623 100644 --- a/tools/perf/util/record.h +++ b/tools/perf/util/record.h @@ -69,6 +69,8 @@ struct record_opts { int mmap_flush; unsigned int comp_level; unsigned int nr_threads_synthesize; + int ctl_fd; + int ctl_fd_ack; }; extern const char * const *record_usage; -- 2.24.1