Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp864855ybk; Wed, 20 May 2020 14:07:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyzQuF5LC0giIRlk0V8TI+Ioz26PGM5k8IjCijtMXbG3YF62Vfl6iLL+qSglqoZV5SPeYl9 X-Received: by 2002:aa7:c6d5:: with SMTP id b21mr5049945eds.97.1590008825245; Wed, 20 May 2020 14:07:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590008825; cv=none; d=google.com; s=arc-20160816; b=Y+nxm1zYW+WNM2hxTVSAfqj10iSCQ/QuNSFHhjRk1eko6y5o0N7kNl+RVEWjjkalgD ctKSPxo/u3W20seDRv1KITorKRkGFP1/UxL3fx3HogwLs1t363l8yZUcDvc8YD9Wflwz Dlpsl/gGjuwpahxxHpoR17NKFfHIM7gJ0+jNAhJkMGAPjMw3jbBlC8BI+5i6gUGfkvcr RXYZNorbRa7TPBMUkXdVIWCxbkwcD4OZ8hOOsLD0P67oNAccdWd3dMVNI3/axlUzlFla v3fOWNBos8nACXMZM2n6zIevCnCHmS7MpRLy4GgzXiGWAq6wJzHVouRr3gi6weutvZ8/ WjYg== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=BJug9Q76S0WRgODUTLQ83dZpH9sd8R9MWBSQlu0uw+g=; b=SgO1y91gWrOqRIy3K30eHyF/Rk56PpYjuiSBzawBHimqrY1NMAkRTessrxMYAAl/n1 7YS1cAl5BPZWDo7/t82+8QIgfAFnmRDgQZUomGfX23GhfgwQD3DUbVguY5AGkoMyVXu+ LW/KcGdAM+ofQjW2o5OYMZCa6AIfEzNAF2ltyKAkM7oOSe7mYyUCcuJA/ai0utKrK36B AJKP2GJVXdmIz0fQg0QMagD10K9qc36lvJZjisuvkOp1FOdOD/YpwgBT7ode7dmky9K5 9nYemJdKZrIcpyA6wTs4iMVfdQ4RScrIkgMAuZHJMN8XebyRSfBdGzwmGQFtc67jNkT+ i6mA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=sHlXw6xx; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i14si2281416ejr.238.2020.05.20.14.06.41; Wed, 20 May 2020 14:07:05 -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=@kernel.org header.s=default header.b=sHlXw6xx; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728210AbgETVDO (ORCPT + 99 others); Wed, 20 May 2020 17:03:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:60822 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727018AbgETVDO (ORCPT ); Wed, 20 May 2020 17:03:14 -0400 Received: from quaco.ghostprotocols.net (unknown [179.97.37.151]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6FAA42084C; Wed, 20 May 2020 21:03:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590008593; bh=SBUiOIx2KjFTYdpaOV6/FsM6KzAmcEnDPhSPp16qsvI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=sHlXw6xxm/weg4Uhvcy011U1a3gw3idnijKcdJeb0AjynRsRfro7/SYsE6+e/HY9z 2A1/hYUlrMsQxsCZjV29VwRTFjfbKGi3WeebzEn9668nbP2DflzCxe5mk38DX2y2yg x7MzBeB3vviOy1hVRoqTjJMKBOPciXz1omQTKoIc= Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id A2FBB40AFD; Wed, 20 May 2020 18:03:11 -0300 (-03) Date: Wed, 20 May 2020 18:03:11 -0300 From: Arnaldo Carvalho de Melo To: Changbin Du Cc: Jiri Olsa , Peter Zijlstra , Ingo Molnar , Namhyung Kim , Steven Rostedt , linux-kernel@vger.kernel.org Subject: Re: [PATCH 09/19] perf ftrace: add support for trace option tracing_thresh Message-ID: <20200520210311.GW32678@kernel.org> References: <20200510150628.16610-1-changbin.du@gmail.com> <20200510150628.16610-10-changbin.du@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20200510150628.16610-10-changbin.du@gmail.com> X-Url: http://acmel.wordpress.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Sun, May 10, 2020 at 11:06:18PM +0800, Changbin Du escreveu: > This adds an option '--tracing-thresh' to setup trace duration threshold > for funcgraph tracer. Ditto > Signed-off-by: Changbin Du > --- > tools/perf/builtin-ftrace.c | 26 ++++++++++++++++++++++++++ > 1 file changed, 26 insertions(+) > > diff --git a/tools/perf/builtin-ftrace.c b/tools/perf/builtin-ftrace.c > index f11f2d3431b0..20bc14d6c5fb 100644 > --- a/tools/perf/builtin-ftrace.c > +++ b/tools/perf/builtin-ftrace.c > @@ -43,6 +43,7 @@ struct perf_ftrace { > bool nosleep_time; > bool nofuncgraph_irqs; > bool long_info; > + unsigned tracing_thresh; > }; > > struct filter_entry { > @@ -213,6 +214,9 @@ static int reset_tracing_files(struct perf_ftrace *ftrace __maybe_unused) > if (write_tracing_file("max_graph_depth", "0") < 0) > return -1; > > + if (write_tracing_file("tracing_thresh", "0") < 0) > + return -1; > + > reset_tracing_filters(); > reset_tracing_options(ftrace); > return 0; > @@ -392,6 +396,21 @@ static int set_tracing_long_info(struct perf_ftrace *ftrace) > return 0; > } > > +static int set_tracing_thresh(struct perf_ftrace *ftrace) > +{ > + char buf[16]; > + > + if (ftrace->tracing_thresh == 0) > + return 0; > + > + snprintf(buf, sizeof(buf), "%d", ftrace->tracing_thresh); > + > + if (write_tracing_file("tracing_thresh", buf) < 0) > + return -1; > + > + return 0; > +} > + > static int __cmd_ftrace(struct perf_ftrace *ftrace, int argc, const char **argv) > { > char *trace_file; > @@ -475,6 +494,11 @@ static int __cmd_ftrace(struct perf_ftrace *ftrace, int argc, const char **argv) > goto out_reset; > } > > + if (set_tracing_thresh(ftrace) < 0) { > + pr_err("failed to set tracing thresh\n"); > + goto out_reset; > + } > + > if (write_tracing_file("current_tracer", ftrace->tracer) < 0) { > pr_err("failed to set current_tracer to %s\n", ftrace->tracer); > goto out_reset; > @@ -616,6 +640,8 @@ int cmd_ftrace(int argc, const char **argv) > "Ignore functions that happen inside interrupt (function_graph only)"), > OPT_BOOLEAN('l', "long-info", &ftrace.long_info, > "Show process names, PIDs, timestamps, irq-info if available"), > + OPT_UINTEGER(0, "tracing-thresh", &ftrace.tracing_thresh, > + "Only show functions of which the duration is greater than ?s"), > OPT_END() > }; > > -- > 2.25.1 > -- - Arnaldo