Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp749029ybg; Mon, 1 Jun 2020 13:25:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxC+z/UQbsxyR+YSdvQ3STFfu/IFau4qdU3m8cLctEhCrYCPgvYg17HSva0AjL7hYSizYtf X-Received: by 2002:a17:906:8253:: with SMTP id f19mr3751298ejx.470.1591043111140; Mon, 01 Jun 2020 13:25:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591043111; cv=none; d=google.com; s=arc-20160816; b=JoTnc+L6D3ZSI9BlIQX4Wm7+n6qgYKZnd7muvGmeQFOIQfu0+I7R0cUpTVkqVHx+tW 1MCQyYWPtPZSCF5EIk3y2V03JOye/ofqK9vmoOphRThmWBsRIag3CUI3R6gfW2Vxf0nS KAd+VvSRxnpC7/E75SZxAXPfSDnSFy/wOdl4WunVbrUZ0/GgOTctY3w5zvjg6ll1RoZQ WXsCZlWQ2pRUbrA8JJTD+2+9Fluo71RXiXfJC6CeJdJVqzlL3KzshzJeVpvMpQnyQLP0 rU9ERr+X9t/6gKCOZ0KlszKFHpSdsYswouG0mzd47fS+92gg6KbRUSnKGomIl1e53nzK JtlQ== 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=uoYUTPVcGbMRRlhlHrwYL5stMr/X+anUvCMv5EF1L7c=; b=Ya9NJGud5XwwizQvcxTwiOb5CPTU/Mf1BBcqcCebBspOy8ycOXtvWUwqFRhmmcybKz /GQAE2U8qo+aDrC5nr6bN5zNPKXVJPfjWtitLsK0h2ht+95iW1r67E9y/YS9fUtbPOyQ uEsoh4CSyqIBwfxkcQtDLWOY8ySHKUCDJmn7BCBdYyAag88AkiS2SBLdJQZOE2l11gW4 DCCY9EP0b2dGjCaHUuRfmeMLb27wW5bGVDmx7/z0rTuz/nuRDuJh0uxtBhqHkMaS891W vjjUJjkDWiXpeG88mLtqPZ36KQDjHVVwQwobBzgDmH4EUYAyyQZblNvAgjjEdTSkD8w/ OtNw== 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 t9si313060eju.485.2020.06.01.13.24.47; Mon, 01 Jun 2020 13:25:11 -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 S1728611AbgFAUU1 (ORCPT + 99 others); Mon, 1 Jun 2020 16:20:27 -0400 Received: from mga05.intel.com ([192.55.52.43]:7310 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728167AbgFAUU1 (ORCPT ); Mon, 1 Jun 2020 16:20:27 -0400 IronPort-SDR: g4PyI+KOW8tRhuszYTNv8W0atYGUwuTI2/+AuHaRkJ5JfMFc1aNm1TjwuTM3I6izbdztBsb0uL kF1UZz5C0wLA== 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; 01 Jun 2020 13:20:26 -0700 IronPort-SDR: /J5TaII/YyfkA3s7HxYYj3az0iZ0oh2fVZ9q2o5nNqxQgDd34tBhVM/TcUL4g3HKjK48256ttz P7lebgchMxcA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,462,1583222400"; d="scan'208";a="444415938" Received: from linux.intel.com ([10.54.29.200]) by orsmga005.jf.intel.com with ESMTP; 01 Jun 2020 13:20:26 -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 5D0A758010E; Mon, 1 Jun 2020 13:20:24 -0700 (PDT) Subject: [PATCH v6 13/13] perf record: introduce --ctl-fd[-ack] options 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:20:23 +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 Introduce --ctl-fd[-ack] options to pass open file descriptors numbers from command line. Extend perf-record.txt file with --ctl-fd[-ack] options description. Document possible usage model introduced by --ctl-fd[-ack] options by providing example bash shell script. Signed-off-by: Alexey Budankov --- tools/perf/builtin-record.c | 10 ++++++++++ tools/perf/util/record.h | 2 ++ 2 files changed, 12 insertions(+) diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index 0394e068dde8..8494ce964738 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c @@ -1749,6 +1749,9 @@ static int __cmd_record(struct record *rec, int argc, const char **argv) perf_evlist__start_workload(rec->evlist); } + if (evlist__initialize_ctlfd(rec->evlist, opts->ctl_fd, opts->ctl_fd_ack)) + goto out_child; + if (opts->initial_delay) { pr_info(EVLIST_DISABLED_MSG); if (opts->initial_delay > 0) { @@ -1895,6 +1898,7 @@ static int __cmd_record(struct record *rec, int argc, const char **argv) record__synthesize_workload(rec, true); out_child: + evlist__finalize_ctlfd(rec->evlist); record__mmap_read_all(rec, true); record__aio_mmap_read_sync(rec); @@ -2380,6 +2384,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, @@ -2581,6 +2587,10 @@ static struct option __record_options[] = { "libpfm4 event selector. use 'perf list' to list available events", parse_libpfm_events_option), #endif + OPT_INTEGER(0, "ctl-fd", &record.opts.ctl_fd, + "Listen on fd descriptor for command to control measurement ('enable': enable events, 'disable': disable events)"), + OPT_INTEGER(0, "ctl-fd-ack", &record.opts.ctl_fd_ack, + "Send control command completion ('ack') to fd ack descriptor"), OPT_END() }; diff --git a/tools/perf/util/record.h b/tools/perf/util/record.h index da138dcb4d34..4cb72a478af1 100644 --- a/tools/perf/util/record.h +++ b/tools/perf/util/record.h @@ -70,6 +70,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