Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp114307ybj; Wed, 6 May 2020 12:53:54 -0700 (PDT) X-Google-Smtp-Source: APiQypJ0e9IV2IvPEdWjhiLfogghwHv3/kev/f7UPW220ujlFGZxJxmccZK7lHxkOReYKmrF04iP X-Received: by 2002:a05:6402:1a2f:: with SMTP id be15mr8814856edb.385.1588794833888; Wed, 06 May 2020 12:53:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588794833; cv=none; d=google.com; s=arc-20160816; b=IqM1UV6wuOU9FbyULYBwIdyAL1rTbJ4/5106NRfNa00OZhL1RCt54S5qqKvtzoSk4p 6U7at6d/JYIQK0ucQ5BtegtDS1O/DnMEmq9PsgffKseqSNqJj0L+XKx85XG+zZwcHyg+ 3k7s/jK3HY6elrTMXLe6hncL6aoNK+KzzG0Cjc9QPTlcqJ9Ti2Ari1h44bQSWyu14cU+ Lzz2VeIeVdXKw5ZfaarXJGNQvyjkQqJTSXXEvai0QBsrCRvt239DWSEyESnu96+RiAXl 8mBrU9/1qO87CKGFBjWKEKQRse+9OiuXRGarBl9CSl29OrRONuLGrCTq8BwU+JLo6Awq bTDg== 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=xEf6yjyDBD2mXVlMuYGW/VTA0HeA15l8rJWUC0yFKSM=; b=YSiCX9YJHkb+bhKAptbksMnj3hYyQ5jXeikAdCPsrpM88RL2Po4G3/+Aslxyzr2Ips t8I4aphpBLv79gERTwHuW4fLxa4DlluIdEiAdBl6frEUbBYdNB4O9ZZ6QT7S7N+y0TXM nvItFp03RG1av/BALgeLpSIXm9k5TzGPtQtEBYK3bstpWoW94VEMb5QmvVJTzfoLaf0T BiJaM8PsIW+raLlYhtAS6V7Z97sVEEA5qXFsvaRQ4boORpdlQwPGtPLa/O+eSUPVmFXu x7y3T1/2N7nXgvGLDGdlfiSTGtiHJACSqYfvvUexEaiy8YQfZBlzkBsHC8lSBYaw9qvT TiGQ== 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 x21si1850608ejw.432.2020.05.06.12.53.29; Wed, 06 May 2020 12:53:53 -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 S1729701AbgEFS21 (ORCPT + 99 others); Wed, 6 May 2020 14:28:27 -0400 Received: from mga14.intel.com ([192.55.52.115]:65275 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729313AbgEFS20 (ORCPT ); Wed, 6 May 2020 14:28:26 -0400 IronPort-SDR: QutpkligQ3gaieQiEvZN+jzYC0bdaeR/gdenjb3oJlxsApGhj4HqQ+nHZYmpDDE32FvtidHNZi dbAEbWnwwLNw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2020 11:28:26 -0700 IronPort-SDR: qllKGC5FxV8u4PU8uN8GyTOHn2W++2qlXT+hhSmqQzzvK3dwW0+VEHvdSUsptlQM5jWUHL7jY0 P4HFIeOIzmEg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,360,1583222400"; d="scan'208";a="284711675" Received: from linux.intel.com ([10.54.29.200]) by fmsmga004.fm.intel.com with ESMTP; 06 May 2020 11:28:25 -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 B214A580679; Wed, 6 May 2020 11:28:23 -0700 (PDT) Subject: [PATCH v2 08/11] perf record: extend -D,--delay option with -1 value 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: <44e55197-2328-3f86-1855-ad27ac4294c2@linux.intel.com> Date: Wed, 6 May 2020 21:28:22 +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 Extend -D,--delay option with -1 to start collection with events disabled to be enbled later by enable command provided via control file descriptor. Signed-off-by: Alexey Budankov --- tools/perf/builtin-record.c | 12 ++++++++---- tools/perf/builtin-trace.c | 2 +- tools/perf/util/record.h | 2 +- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index e4efdbf1a81e..8a14e68b86ad 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c @@ -1704,8 +1704,12 @@ static int __cmd_record(struct record *rec, int argc, const char **argv) } if (opts->initial_delay) { - usleep(opts->initial_delay * USEC_PER_MSEC); - evlist__enable(rec->evlist); + pr_info(PERF_EVLIST__DISABLED_MSG); + if (opts->initial_delay > 0) { + usleep(opts->initial_delay * USEC_PER_MSEC); + evlist__enable(rec->evlist); + pr_info(PERF_EVLIST__ENABLED_MSG); + } } trigger_ready(&auxtrace_snapshot_trigger); @@ -2413,8 +2417,8 @@ static struct option __record_options[] = { OPT_CALLBACK('G', "cgroup", &record.evlist, "name", "monitor event in cgroup name only", parse_cgroups), - OPT_UINTEGER('D', "delay", &record.opts.initial_delay, - "ms to wait before starting measurement after program start"), + OPT_INTEGER('D', "delay", &record.opts.initial_delay, + "ms to wait before starting measurement after program start (-1: start with events disabled )"), OPT_BOOLEAN(0, "kcore", &record.opts.kcore, "copy /proc/kcore"), OPT_STRING('u', "uid", &record.opts.target.uid_str, "user", "user to profile"), diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index a46efb907bd4..63f69a927f3c 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c @@ -4773,7 +4773,7 @@ int cmd_trace(int argc, const char **argv) "per thread proc mmap processing timeout in ms"), OPT_CALLBACK('G', "cgroup", &trace, "name", "monitor event in cgroup name only", trace__parse_cgroups), - OPT_UINTEGER('D', "delay", &trace.opts.initial_delay, + OPT_INTEGER('D', "delay", &trace.opts.initial_delay, "ms to wait before starting measurement after program " "start"), OPTS_EVSWITCH(&trace.evswitch), diff --git a/tools/perf/util/record.h b/tools/perf/util/record.h index 923565c3b155..96a73bbd8cd4 100644 --- a/tools/perf/util/record.h +++ b/tools/perf/util/record.h @@ -60,7 +60,7 @@ struct record_opts { const char *auxtrace_snapshot_opts; const char *auxtrace_sample_opts; bool sample_transaction; - unsigned initial_delay; + int initial_delay; bool use_clockid; clockid_t clockid; u64 clockid_res_ns; -- 2.24.1