Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp2989660ybg; Sat, 6 Jun 2020 07:33:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJydu8GCgqIs1StXcjRpDVOSuBBXbAl/Frz88GWRdEJcKBpmyXnN2TelpMNikVRc7cgoMoKn X-Received: by 2002:a17:906:b7cd:: with SMTP id fy13mr13146020ejb.443.1591453981604; Sat, 06 Jun 2020 07:33:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591453981; cv=none; d=google.com; s=arc-20160816; b=nny6d1n+RSUihpIbi2H9mF7AUbT3Agf3MKJVeA3xznqG3nuaRTbpuTvI9ji8O0m/UC WPilaIebziYw+F0UaaZ7lLqaGcu2+WoEaIgU6YN3QPsgcywp6WcjRpoElmrwPY9GmOVg RY2e3+fJBMhm9XP6XgTz6XBFIevsG/zAAdtW/xTASeHMsXeUYAJqr7VQkqTwkpPtV10Z FfxfeRrI9Fmkv/FLjtap8kkSH7W0q0nUxgDeqdc4Xi6NHjjckarmzS5APRyh2XXfwUMd opEp3lpyonaOhhTF3oc/bqI3BYldzeLOejH66w5ltAS21FLhYSg8qj2SgXqwJortA0Zl AkIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=q9ACHO/wqUnF1zJ7y6x8firkYJLD6+Czjoa4v+iXsOw=; b=DBchLGJiCdVpxundYlKeb2C92iE5LWDF9/23a/oXGwgEkTItE0o1AZtlkHQRh0Ohng pXT3b8JSpV8nuM3AUBUUROoG9Sr0rWNIA6cn07rT/qduBAzSbLnmgGHMqAdYTlaR78Z+ QY/MwITeS7v9I5OLJqzOW2PfRm0Hbw8BEAZ5jeU6rEJE9cLQgcOsSzIZ5NGINm8dacpJ KH3Hxj+Xg/uyWZ6cR4qNJGX+adG1Fo0YiiDtHsfM+KZW8+TqyLzieIn0z3LbNILN2DB9 orp4hUadi0B5DCI7DfyECmXnpZtebYhoIldECVMtoBWNVzUwGgaZBpfKZynMnclA2z01 z00Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=dRaR2Pgg; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u27si5444623eje.558.2020.06.06.07.32.39; Sat, 06 Jun 2020 07:33:01 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=dRaR2Pgg; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728642AbgFFOa7 (ORCPT + 99 others); Sat, 6 Jun 2020 10:30:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726133AbgFFOa6 (ORCPT ); Sat, 6 Jun 2020 10:30:58 -0400 Received: from mail-pj1-x1041.google.com (mail-pj1-x1041.google.com [IPv6:2607:f8b0:4864:20::1041]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 382CEC03E96A for ; Sat, 6 Jun 2020 07:30:58 -0700 (PDT) Received: by mail-pj1-x1041.google.com with SMTP id h95so4058945pje.4 for ; Sat, 06 Jun 2020 07:30:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=q9ACHO/wqUnF1zJ7y6x8firkYJLD6+Czjoa4v+iXsOw=; b=dRaR2PggpUpkrojrzCcfbeVo5j59uju93fEO9CDVhTFooFQsBcSuiq6hDz85hqZmWj vOh9y/aJME6ffIiGynBcWATosuiUoIhImhCJ9j7KBvLe1ySIDf4jKx+j1NQt2ht+5OfN vZjaO3SsH+UFRKn3VbmyzIV601h/y4BsezeoJg6nz4v8a9balK2zSVrnj1r/S59c6xnC fo7VZ12i+QdEDsv9HK6abBHu2KfroJA9g5gsyBdRoBsfXjACbeV3Tck2C11EOFdF/pIV 0j3fZeAYHnGqpPPsd0GZk7Gwsl9gMkuR8z8eXfe1/3OlO3W7aa2b7l2VwxwFCM7VFox3 Yr6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=q9ACHO/wqUnF1zJ7y6x8firkYJLD6+Czjoa4v+iXsOw=; b=daWy9al9AAAIk5/tShjv91kJySUzhHqxmPn31dO+D01CNPiEBTfCHLTNMgU234mwH4 k1tuZdQowCcMIWFwhFNPGrVPSLcQjBx6Hehw9Bsc+Z+fEilbn514AM9vLmKffZDRwJZ3 wcZMpr4QjS8CvfBcKur0boe+pjW9E/HgdFnfxCIe0Vo6me81JngXxzTEt2o7oBhfFH5/ et/oIZtx2y3dZThTMmUPmtBsUy0/UXc2nxmtTKCwwRd+HNwWHzDk195+kmAI1TtpUwFo OUjHbNsHCh6Ea44/QNQmicJBJl/rfp0tS2khA1XMJbJq3FiYcKrP784Vs1x219AebwtY gmEw== X-Gm-Message-State: AOAM531ftpJygq017i/Rlknkj6rAAchxTPo5eHscUCTFB9tLsnmizFO8 /5uJ4VciN89Ta2T7Yg0oIGA= X-Received: by 2002:a17:902:74cb:: with SMTP id f11mr14083386plt.239.1591453857699; Sat, 06 Jun 2020 07:30:57 -0700 (PDT) Received: from mail.google.com ([149.248.10.52]) by smtp.gmail.com with ESMTPSA id j19sm2519104pfn.109.2020.06.06.07.30.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jun 2020 07:30:56 -0700 (PDT) Date: Sat, 6 Jun 2020 22:30:49 +0800 From: Changbin Du To: Arnaldo Carvalho de Melo Cc: Changbin Du , Jiri Olsa , Peter Zijlstra , Ingo Molnar , Namhyung Kim , Steven Rostedt , linux-kernel@vger.kernel.org Subject: Re: [PATCH 17/19] perf ftrace: add option -d/--delay to delay tracing Message-ID: <20200606143049.xvszf32j2bbpi4yx@mail.google.com> References: <20200510150628.16610-1-changbin.du@gmail.com> <20200510150628.16610-18-changbin.du@gmail.com> <20200520211331.GA3898@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200520211331.GA3898@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 20, 2020 at 06:13:31PM -0300, Arnaldo Carvalho de Melo wrote: > Em Sun, May 10, 2020 at 11:06:26PM +0800, Changbin Du escreveu: > > This adds an option '-d/--delay' to allow us to start tracing some > > times later after workload is launched. > > [acme@five perf]$ perf record -h delay > > Usage: perf record [] [] > or: perf record [] -- [] > > -D, --delay ms to wait before starting measurement after program start > > [acme@five perf]$ > Sure, will change the short option name. > > Signed-off-by: Changbin Du > > --- > > tools/perf/builtin-ftrace.c | 19 ++++++++++++++++--- > > 1 file changed, 16 insertions(+), 3 deletions(-) > > > > diff --git a/tools/perf/builtin-ftrace.c b/tools/perf/builtin-ftrace.c > > index 8d04e5afe2d3..d376b37c53fc 100644 > > --- a/tools/perf/builtin-ftrace.c > > +++ b/tools/perf/builtin-ftrace.c > > @@ -49,6 +49,7 @@ struct perf_ftrace { > > bool trace_children; > > unsigned buffer_size_kb; > > bool no_pager; > > + unsigned initial_delay; > > }; > > > > struct filter_entry { > > @@ -617,13 +618,23 @@ static int __cmd_ftrace(struct perf_ftrace *ftrace, int argc, const char **argv) > > /* display column headers */ > > read_tracing_file_to_stdout("trace"); > > > > - if (write_tracing_file("tracing_on", "1") < 0) { > > - pr_err("can't enable tracing\n"); > > - goto out_close_fd; > > + if (!ftrace->initial_delay) { > > + if (write_tracing_file("tracing_on", "1") < 0) { > > + pr_err("can't enable tracing\n"); > > + goto out_close_fd; > > + } > > } > > > > perf_evlist__start_workload(ftrace->evlist); > > > > + if (ftrace->initial_delay) { > > + usleep(ftrace->initial_delay * 1000); > > + if (write_tracing_file("tracing_on", "1") < 0) { > > + pr_err("can't enable tracing\n"); > > + goto out_close_fd; > > + } > > + } > > + > > while (!done) { > > if (poll(&pollfd, 1, -1) < 0) > > break; > > @@ -747,6 +758,8 @@ int cmd_ftrace(int argc, const char **argv) > > "size of per cpu buffer in kb"), > > OPT_BOOLEAN('P', "no-pager", &ftrace.no_pager, > > "Do not use pager"), > > + OPT_UINTEGER('d', "delay", &ftrace.initial_delay, > > + "Wait ms before tracing"), > > OPT_END() > > }; > > > > -- > > 2.25.1 > > > > -- > > - Arnaldo -- Cheers, Changbin Du