Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp871190ybk; Wed, 20 May 2020 14:17:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxyYNHT1kNE5P8VqVq07LxVyanANkVHMRy4MTTmUAG3KnxcPSFnXbbRxoxM3i210hGLIkbt X-Received: by 2002:a17:906:f198:: with SMTP id gs24mr846115ejb.547.1590009443552; Wed, 20 May 2020 14:17:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590009443; cv=none; d=google.com; s=arc-20160816; b=dN1gBOuFyRURxogkgbbsekbPP0Vd2vspeZ2g+kKm+aHgsBfER1+qc0Z6RjTdKnKWNi KNBufIKvuDWFwbiNvfVXAKP6ViLdCcDKS5srLs7s8CZdmbuuDL501GzXQeDLifUwPb/t zfP7IJVUSmbSlrH3Wa4iL3ymoLFeyOyj+hRPp8gThXClZWkpCtTRnQgZ+glJHuUIZtSF oWxmKtlTUOBXY2FfUAJXubC7FcmyPc71Drof+fQuDEP1VF3FDA+ecBAu6qnsuqn6PDiZ uOyc1Hay929wzvK5DWTBEAB05i4o3AW0ox173159W8fcgBPgkObGxQizRfEt10CL1+Ct DeQA== 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=8bzPj/rskSh/mHcA0v+H4GK0bIN6E5jDrJ/bZzJu7tg=; b=xgTRbIqOVZArrshTblGIrZoTvuu8mBA7pDWsCk+Q+GOk+L1CF1sH+0pJabYQqy9ryS EhDRx2yMNPcYEbvvgFOsPTJeTw+VQgvy69mCy3R9UjeKMsqInd++PT+N35yL2Gf7ogBs OUS6DNTWYeGEdlUHKzB3orZ22R6q6A2K81eYNJktDoCn19E/u1HF2ibsd4uDEBsPyIgV hZVZNLBgxzCpmTwA0dqLs3CTUiqQiWGGSIskt5luNCl6taOfHfHvZlIZcZZ+IqDTc/4m nRsqi5Dwg1g5PPskrD7gb0amO4Szr1K7a4o+02R24RVZOgDMM2cCG0rnnVyp29CVPuYV 7YVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=YxeLBoQW; 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 i11si2264621ejc.641.2020.05.20.14.17.01; Wed, 20 May 2020 14:17:23 -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=YxeLBoQW; 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 S1728250AbgETVO1 (ORCPT + 99 others); Wed, 20 May 2020 17:14:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:36296 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728117AbgETVO0 (ORCPT ); Wed, 20 May 2020 17:14:26 -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 CA0F720829; Wed, 20 May 2020 21:14:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590009266; bh=ogmmMv3wWB+wC0mzCxOQhYH+rGKcs7Y7AtmDBuRdh5s=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=YxeLBoQWsqIdUNHbCkMdKCXeGqKqyUvl5ylLVWObfeDkbRUc13AKHtWX8PjhaOUdL DRWBa07gfKg0JKpDP6oDmwusqAMvESN5B9200voKXuGzmuHho0uDfVSiHwPlMGPUA2 YCUTAXud3T7RUdkhi7u+KQMNvX2cM7hPUNPC2pBA= Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id C8DE140AFD; Wed, 20 May 2020 18:14:23 -0300 (-03) Date: Wed, 20 May 2020 18:14:23 -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 18/19] perf ftrace: add option --latency-format to display more info about delay Message-ID: <20200520211423.GB3898@kernel.org> References: <20200510150628.16610-1-changbin.du@gmail.com> <20200510150628.16610-19-changbin.du@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200510150628.16610-19-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:27PM +0800, Changbin Du escreveu: > This is for the function graph tracer to display more info about latency. > The execution context is shown in this case. Ok, another --function-graph-opts entry, maybe you can just make -G receive optional args. - Arnaldo > $ sudo perf ftrace -G --latency-format > \# tracer: function_graph > \# > 1) .... | 0.992 us | mutex_unlock(); > 1) .... | 1.404 us | __fsnotify_parent(); > 1) .... | 1.023 us | fsnotify(); > 1) .... | 0.335 us | __sb_end_write(); > 1) d... | 0.439 us | fpregs_assert_state_consistent(); > 1) d... | | do_syscall_64() { > 1) .... | | __x64_sys_close() { > > Signed-off-by: Changbin Du > --- > tools/perf/builtin-ftrace.c | 20 ++++++++++++++++++++ > 1 file changed, 20 insertions(+) > > diff --git a/tools/perf/builtin-ftrace.c b/tools/perf/builtin-ftrace.c > index d376b37c53fc..fd8e2f305136 100644 > --- a/tools/perf/builtin-ftrace.c > +++ b/tools/perf/builtin-ftrace.c > @@ -44,6 +44,7 @@ struct perf_ftrace { > bool nosleep_time; > bool nofuncgraph_irqs; > bool funcgraph_tail; > + bool latency_format; > bool long_info; > unsigned tracing_thresh; > bool trace_children; > @@ -217,6 +218,7 @@ static void reset_tracing_options(struct perf_ftrace *ftrace __maybe_unused) > write_tracing_option_file("sleep-time", "1"); > write_tracing_option_file("funcgraph-irqs", "1"); > write_tracing_option_file("funcgraph-tail", "0"); > + write_tracing_option_file("latency-format", "0"); > write_tracing_option_file("funcgraph-proc", "0"); > write_tracing_option_file("funcgraph-abstime", "0"); > write_tracing_option_file("irq-info", "0"); > @@ -456,6 +458,17 @@ static int set_tracing_funcgraph_tail(struct perf_ftrace *ftrace) > return 0; > } > > +static int set_tracing_latency_format(struct perf_ftrace *ftrace) > +{ > + if (!ftrace->latency_format) > + return 0; > + > + if (write_tracing_option_file("latency-format", "1") < 0) > + return -1; > + > + return 0; > +} > + > static int set_tracing_trace_children(struct perf_ftrace *ftrace) > { > if (!ftrace->trace_children) > @@ -579,6 +592,11 @@ static int __cmd_ftrace(struct perf_ftrace *ftrace, int argc, const char **argv) > goto out_reset; > } > > + if (set_tracing_latency_format(ftrace) < 0) { > + pr_err("failed to set tracing option latency-format\n"); > + goto out_reset; > + } > + > if (set_tracing_trace_children(ftrace) < 0) { > pr_err("failed to set tracing option function-fork\n"); > goto out_reset; > @@ -748,6 +766,8 @@ int cmd_ftrace(int argc, const char **argv) > "Ignore functions that happen inside interrupt (function_graph only)"), > OPT_BOOLEAN(0, "funcgraph-tail", &ftrace.funcgraph_tail, > "Show function tails comment (function_graph only)"), > + OPT_BOOLEAN(0, "latency-format", &ftrace.latency_format, > + "displays additional information about the latency (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, > -- > 2.25.1 > -- - Arnaldo