Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965065AbdIZGKH (ORCPT ); Tue, 26 Sep 2017 02:10:07 -0400 Received: from mga11.intel.com ([192.55.52.93]:29462 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935258AbdIZGKG (ORCPT ); Tue, 26 Sep 2017 02:10:06 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,439,1500966000"; d="asc'?scan'208";a="1199034010" Date: Tue, 26 Sep 2017 14:03:41 +0800 From: "Du, Changbin" To: changbin.du@intel.com Cc: peterz@infradead.org, mingo@redhat.com, acme@kernel.org, alexander.shishkin@linux.intel.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] perf ftrace: Add -O option to set trace option Message-ID: <20170926060341.GA8868@intel.com> References: <1505474371-13292-1-git-send-email-changbin.du@intel.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="vtzGhvizbBRQ85DL" Content-Disposition: inline In-Reply-To: <1505474371-13292-1-git-send-email-changbin.du@intel.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3316 Lines: 110 --vtzGhvizbBRQ85DL Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Ping for review status, thanks. On Fri, Sep 15, 2017 at 07:19:31PM +0800, changbin.du@intel.com wrote: > From: Changbin Du >=20 > There are some trace options to control what gets printed in the trace > output or manipulate the tracers. This patch add a commandline option > to set it. >=20 > Example: > perf ftrace -t function -O noprint-parent --trace-funcs "__kmalloc" -a > Xorg-1874 [002] .... 4107.182911: __kmalloc > Xorg-1874 [002] .... 4107.182920: __kmalloc >=20 > perf ftrace -t function -O print-parent --trace-funcs "__kmalloc" -a > Xorg-1874 [000] .... 3924.917243: __kmalloc <-drm_atomic_st= ate_init > Xorg-1874 [000] .... 3924.917251: __kmalloc <-drm_atomic_st= ate_init >=20 > Signed-off-by: Changbin Du > --- > tools/perf/builtin-ftrace.c | 19 +++++++++++++++++++ > 1 file changed, 19 insertions(+) >=20 > diff --git a/tools/perf/builtin-ftrace.c b/tools/perf/builtin-ftrace.c > index 25a42ac..8b473e2 100644 > --- a/tools/perf/builtin-ftrace.c > +++ b/tools/perf/builtin-ftrace.c > @@ -36,6 +36,7 @@ struct perf_ftrace { > struct list_head graph_funcs; > struct list_head nograph_funcs; > int graph_depth; > + const char *trace_option; > }; > =20 > struct filter_entry { > @@ -261,6 +262,17 @@ static int set_tracing_depth(struct perf_ftrace *ftr= ace) > return 0; > } > =20 > +static int set_tracing_option(struct perf_ftrace *ftrace) > +{ > + if (ftrace->trace_option =3D=3D NULL) > + return 0; > + > + if (write_tracing_file("trace_options", ftrace->trace_option) < 0) > + return -1; > + > + return 0; > +} > + > static int __cmd_ftrace(struct perf_ftrace *ftrace, int argc, const char= **argv) > { > char *trace_file; > @@ -313,6 +325,11 @@ static int __cmd_ftrace(struct perf_ftrace *ftrace, = int argc, const char **argv) > goto out_reset; > } > =20 > + if (set_tracing_option(ftrace) < 0) { > + pr_err("failed to set trace option\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; > @@ -456,6 +473,8 @@ int cmd_ftrace(int argc, const char **argv) > "Set nograph filter on given functions", parse_filter_func), > OPT_INTEGER('D', "graph-depth", &ftrace.graph_depth, > "Max depth for function graph tracer"), > + OPT_STRING('O', "trace-option", &ftrace.trace_option, "option", > + "Set a trace option"), > OPT_END() > }; > =20 > --=20 > 2.7.4 >=20 --=20 Thanks, Changbin Du --vtzGhvizbBRQ85DL Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJZye29AAoJEAanuZwLnPNU/EsH/1Euk1mYNceCZh+oRd6gH4ZP OCLnHy7iDmBcC0Orx7XtPyc9u2Tr5Fhr9fbp4uHK9J85Bq2V3GzCOzT6Gh6wB4MU CKAlC55aNUiRZcuI7uK4Ilg+gePVDNwFmukbZMgN3JR1m/nRmlFv6pTUAUYsr8Bm g4bWv1sTDve7Os+cE34PWHrTDbZ9KSRckT8qFte5iF0258h6FbGtHVzXpMGmW3l8 RBQJQeML2NLUAZ1xjSbUB9OsXsTFId+0xssT5MXaPGudCQ54ZDL8/dW32LhSofC3 09VX1ocr/E1v8WHBIzTJ0mblMgZV4B3brSkNvcYY89pLVj2SVrwzEILGqDG/3Uw= =IRlJ -----END PGP SIGNATURE----- --vtzGhvizbBRQ85DL--