From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754482AbcHSCVe (ORCPT ); Thu, 18 Aug 2016 22:21:34 -0400 Received: from LGEAMRELO11.lge.com ([156.147.23.51]:44155 "EHLO lgeamrelo11.lge.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753786AbcHSCU4 (ORCPT ); Thu, 18 Aug 2016 22:20:56 -0400 X-Original-SENDERIP: 156.147.1.151 X-Original-MAILFROM: namhyung@kernel.org X-Original-SENDERIP: 165.244.98.150 X-Original-MAILFROM: namhyung@kernel.org X-Original-SENDERIP: 10.177.227.17 X-Original-MAILFROM: namhyung@kernel.org Date: Fri, 19 Aug 2016 11:20:53 +0900 From: Namhyung Kim To: Arnaldo Carvalho de Melo CC: Arnaldo Carvalho de Melo , Jiri Olsa , Linux Kernel Mailing List Subject: Re: RFC: callchain showing same entry as hist_entry Message-ID: <20160819022053.GA5253@sejong> References: <20160816143628.GG20972@kernel.org> <20160816145511.GA11382@danjae.aot.lge.com> <20160816150803.GI20972@kernel.org> <20160816152355.GC11382@danjae.aot.lge.com> <20160816153143.GJ20972@kernel.org> <20160816153244.GK20972@kernel.org> <20160816154118.GE11382@danjae.aot.lge.com> <20160816154657.GL20972@kernel.org> <20160816192131.GO20972@kernel.org> MIME-Version: 1.0 In-Reply-To: <20160816192131.GO20972@kernel.org> User-Agent: Mutt/1.6.2 (2016-07-01) X-MIMETrack: Itemize by SMTP Server on LGEKRMHUB08/LGE/LG Group(Release 8.5.3FP6|November 21, 2013) at 2016/08/19 11:20:52, Serialize by Router on LGEKRMHUB08/LGE/LG Group(Release 8.5.3FP6|November 21, 2013) at 2016/08/19 11:20:53, Serialize complete at 2016/08/19 11:20:53 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Arnaldo, On Tue, Aug 16, 2016 at 04:21:31PM -0300, Arnaldo Carvalho de Melo wrote: > Em Tue, Aug 16, 2016 at 12:46:57PM -0300, Arnaldo Carvalho de Melo escreveu: > > Em Wed, Aug 17, 2016 at 12:41:18AM +0900, Namhyung Kim escreveu: > > > Hmm.. if so, wouldn't it be better skipping the first callchain entry > > > when the user-given sort key contains "sym" too (not only when it > > > starts with 'sym')? > > > > Probably, I think, whatever causes the mentioned duplication. And do > > that at all the UIs, hence the suggestion for a callchain__first_node() > > or more suitably named routine where such logic would live, to be > > used for all the callchain rendering interfaces. > > So, it is not possible to have that callchain__first_node() one, since > we're dealing with one of the "list" entries, that are in each "node", > etc, we need to do that test when printing the first entry, how about > this one instead? Sorry for delay. If we don't care about the order of 'symbol' sort key, we need to consider output fields (-F option) too since they'll be used as sort keys eventually. Once it sets the perf_hpp_list fields correctly like below, the condition will be more simplified: Thanks, Namhyung ---------------8<----------------- diff --git a/tools/perf/ui/stdio/hist.c b/tools/perf/ui/stdio/hist.c index 9b65f4a6b35a..0ec907433dc0 100644 --- a/tools/perf/ui/stdio/hist.c +++ b/tools/perf/ui/stdio/hist.c @@ -206,8 +206,7 @@ static size_t callchain__fprintf_graph(FILE *fp, struct rb_root *root, * the symbol. No need to print it otherwise it appears as * displayed twice. */ - if (!i++ && field_order == NULL && - sort_order && !prefixcmp(sort_order, "sym")) + if (!i++ && perf_hpp_list.sym) continue; if (!printed) { ret += callchain__fprintf_left_margin(fp, left_margin); diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c index 1884d7f9b9d2..073e108d83f9 100644 --- a/tools/perf/util/sort.c +++ b/tools/perf/util/sort.c @@ -1720,6 +1720,19 @@ static int __sort_dimension__add_hpp_output(struct sort_dimension *sd, if (hse == NULL) return -1; + if (sd->entry == &sort_parent) + list->parent = 1; + else if (sd->entry == &sort_sym) + list->sym = 1; + else if (sd->entry == &sort_dso) + list->dso = 1; + else if (sd->entry == &sort_socket) + list->socket = 1; + else if (sd->entry == &sort_thread) + list->thread = 1; + else if (sd->entry == &sort_comm) + list->comm = 1; + perf_hpp_list__column_register(list, &hse->hpp); return 0; }