Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp349860ybt; Wed, 8 Jul 2020 01:17:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz/vIGmxF8uB+HtN1ynhZk/Stwxe2rolEosIXcKuHrbZY3KTU8mPcvIcccThyAfyeVpYTSz X-Received: by 2002:a17:906:408c:: with SMTP id u12mr44342760ejj.162.1594196233517; Wed, 08 Jul 2020 01:17:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594196233; cv=none; d=google.com; s=arc-20160816; b=RP6uIqVpj4r23GnIltn9Do0l29sFfVkICRll4xob6EC7LkXIsWLoz0OHXaT180B4+4 6gl/0EkG001A+LlSyZn3xUvhVKWG23GF7GszVqPo2jHWaDud3EhC6BKPKHUn7Nbx0Dcc vH5lI1NKfogJjGstFKNnfYYgtqvNzs4ndfnMX1TZh6hyvvk3Ku86jXjWjLJCT19y7eKn 1AdRRQBg+tX38mi+Pzf0poY9zsrR7D1LxcyZy/CWlYiMPMSMD2NJ0Gb9syprkQuoONes uPRQj5jZe6QpSeE4LE9RzpMJmBme9jatlwfn4TLbmgU0cxkvbI8Qv+VSg6kNMPluFOqI DOgQ== 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=jtfMNo5J/NcaOE/KI2ESjZYjx0sq9yclXMB0cPp0OUY=; b=U3wuZmvU31/5c17qlnMRmr933lATJHk+PoeXgy1i17xjMhpFj3f0t6HbUM1P8INaAb J2Xp/7FwERj6Sbk56tMSxbhxcrJ4GG/+hjbo7No/Cj9KlivRPMDr97VbbEUPQApyDZfP 8Mw4VmLnRm224ecgs3Wi8kemPjwLUIrrCwCQAFttCTYWfKXqaHT8JQJNH5Le3wVjcCNj qLiTpViBBaXpsVeIx14puzisGgKMUgSFFvC1NCW/44Y1HIttN2atcgcCc82OugPxhA5j 7LIrEGle2MkOR7lb6gzlAZFd5KKbxhTdwIK0QGp1D59/e8VdehDLAceh3QqkmlooZaj7 hd4Q== 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 v12si16347794eja.379.2020.07.08.01.16.48; Wed, 08 Jul 2020 01:17:13 -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 S1728049AbgGHHyn (ORCPT + 99 others); Wed, 8 Jul 2020 03:54:43 -0400 Received: from mga02.intel.com ([134.134.136.20]:60905 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726081AbgGHHyn (ORCPT ); Wed, 8 Jul 2020 03:54:43 -0400 IronPort-SDR: TAO553oz0N+Zrz/lAIhQECtrU2N2ewZZVclUpboUQhnM2quGSIz0C+g8h4YbP7gD8kBbsm07kN 9fuIiOUPC2pA== X-IronPort-AV: E=McAfee;i="6000,8403,9675"; a="135988430" X-IronPort-AV: E=Sophos;i="5.75,327,1589266800"; d="scan'208";a="135988430" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jul 2020 00:54:42 -0700 IronPort-SDR: EU3Bul7WZbNyZKuqBvf7MnPii6kmjUXz5JbwuONkTv2Jw0LtHKRMJ+2DqltGew1f5IagkxA/MX xAryyKK6fV5g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,327,1589266800"; d="scan'208";a="457420625" Received: from linux.intel.com ([10.54.29.200]) by orsmga005.jf.intel.com with ESMTP; 08 Jul 2020 00:54:42 -0700 Received: from [10.249.226.44] (abudanko-mobl.ccr.corp.intel.com [10.249.226.44]) by linux.intel.com (Postfix) with ESMTP id 72F915807FC; Wed, 8 Jul 2020 00:54:40 -0700 (PDT) Subject: [PATCH v10 13/15] 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: <4af50c95-36f6-7a61-5a22-2949970fe7a5@linux.intel.com> Organization: Intel Corp. Message-ID: <7f4b1098-d2d2-dc95-8ee9-29aade32ba6a@linux.intel.com> Date: Wed, 8 Jul 2020 10:54:39 +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: <4af50c95-36f6-7a61-5a22-2949970fe7a5@linux.intel.com> 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 enabled later by 'enable' command provided via control file descriptor. Signed-off-by: Alexey Budankov --- tools/perf/Documentation/perf-record.txt | 5 +++-- tools/perf/builtin-record.c | 12 ++++++++---- tools/perf/builtin-trace.c | 2 +- tools/perf/util/record.h | 2 +- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/tools/perf/Documentation/perf-record.txt b/tools/perf/Documentation/perf-record.txt index fa8a5fcd27ab..a84376605805 100644 --- a/tools/perf/Documentation/perf-record.txt +++ b/tools/perf/Documentation/perf-record.txt @@ -407,8 +407,9 @@ if combined with -a or -C options. -D:: --delay=:: -After starting the program, wait msecs before measuring. This is useful to -filter out the startup phase of the program, which is often very different. +After starting the program, wait msecs before measuring (-1: start with events +disabled). This is useful to filter out the startup phase of the program, which +is often very different. -I:: --intr-regs:: diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index 19b1d5effb7a..cd1892c4844b 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c @@ -1749,8 +1749,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(EVLIST_DISABLED_MSG); + if (opts->initial_delay > 0) { + usleep(opts->initial_delay * USEC_PER_MSEC); + evlist__enable(rec->evlist); + pr_info(EVLIST_ENABLED_MSG); + } } trigger_ready(&auxtrace_snapshot_trigger); @@ -2462,8 +2466,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 a333a9a64f27..bea461b6f937 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c @@ -4812,7 +4812,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 39d1de4b2a36..da138dcb4d34 100644 --- a/tools/perf/util/record.h +++ b/tools/perf/util/record.h @@ -61,7 +61,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