Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp610006ybg; Wed, 3 Jun 2020 09:03:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzWNm5/+Sb8NNrhnsDYS9l7+gzr6Qe8WYrbiiLR8cK0u4OUYsEYQ+BPVMsUA1NCyu6H8Jxq X-Received: by 2002:a17:906:a44:: with SMTP id x4mr18034592ejf.237.1591200190887; Wed, 03 Jun 2020 09:03:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591200190; cv=none; d=google.com; s=arc-20160816; b=dxNM/A1nGJFWzS8OQTDtkAvlGgv+L6CZHhcvcpj750UU0qXJJAHsqk5fCQGCR/vYlW 4t1+onpFcP+d/rYSZ07iguLHGkQHdMzGc7sQ0HRMec925OUQZFlmJ0MTuQALQtSaCouR qZxqC7A1mUMR8GbXCS7XdXIWgeV+AHfFpe6e3TQf2JnKL5qIoYXTwPiZZu5gJ14a+v/j zYz6OOx+I3cUnbG09cI05AuD9tYQNU7AK1BiUefRzv/LxRiO2TIeVo1RRIjzNFPG+3CU T9m2Zmek5eHiCa/IhSC2CuzbnqDBTnIQ3eaQSIVynbSG5FyAqQeTzBXr3GdjyxtrHzp/ h4jQ== 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=aAlaZ3uqXBeDERf/uqVLjtH17RPPYUQdct3EDjWn1lw=; b=hCRTNG7llpSUaUc4IGQywxvcVNqLebxK9XDJ0uiSGTRHQtCCsrF+Pt4fJwDAHxitux 4uBcX0DhGr93la29LYP1i3H3Q0Z/5Jee5JP3JiE3s5wqqFgq70L6NBCFIqE59ehAYWdC oqgrCOIMyJEmfpClFpO2dWth7WOEd2na19Gu5OxhaXtY8h4HN7Gvk9is16MrYNrtjshN K7J3L75K/nX/ecZED/B94EGpy4kKPmImghKH6Rlf2uH9LfoD9zFwiwNKAFo2ay0AjlSW vQTYCwKQiqi9LwAv08NnMxbAkFZr6MRrUxvfHuEzFr9w+K6WnKfkTyI5qC1oriNEqnha mb5Q== 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 lj13si1347878ejb.528.2020.06.03.09.02.46; Wed, 03 Jun 2020 09:03:10 -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 S1726032AbgFCQAs (ORCPT + 99 others); Wed, 3 Jun 2020 12:00:48 -0400 Received: from mga17.intel.com ([192.55.52.151]:28715 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725939AbgFCQAs (ORCPT ); Wed, 3 Jun 2020 12:00:48 -0400 IronPort-SDR: eh5wNYL2Di2E7TmY34SNRaNBYJ2YtvnZQVk19D4TRxs58EaxA3IBbohb1Ng39C+9sy5gUpCD3F OI+INP1TosAg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jun 2020 09:00:37 -0700 IronPort-SDR: lRc4FcuhxKa80lKnzNnrilFyI4+x3G2uJEZuM9rw0AqsTbryviKXqCdfC7sOAfBiUq0V5tGXgD IbG3LXcQuEaQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,468,1583222400"; d="scan'208";a="304649619" Received: from linux.intel.com ([10.54.29.200]) by orsmga008.jf.intel.com with ESMTP; 03 Jun 2020 09:00:36 -0700 Received: from [10.249.225.188] (abudanko-mobl.ccr.corp.intel.com [10.249.225.188]) by linux.intel.com (Postfix) with ESMTP id 3AE0F5800E3; Wed, 3 Jun 2020 09:00:34 -0700 (PDT) Subject: [PATCH v7 11/13] perf record: extend -D,--delay option with -1 value From: Alexey Budankov To: Arnaldo Carvalho de Melo Cc: Jiri Olsa , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Ingo Molnar , Andi Kleen , linux-kernel References: <5de4b954-24f0-1e8d-5a0d-7b12783b8218@linux.intel.com> Organization: Intel Corp. Message-ID: <64b794ad-9fd9-2f67-31b0-5af182b29ed8@linux.intel.com> Date: Wed, 3 Jun 2020 19:00:32 +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: <5de4b954-24f0-1e8d-5a0d-7b12783b8218@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 enbled 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 e108d90ae2ed..d0b29a1070a0 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 4cbb64edc998..290149b1b3b5 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c @@ -4813,7 +4813,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