From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757729AbcCCNkl (ORCPT ); Thu, 3 Mar 2016 08:40:41 -0500 Received: from mx1.redhat.com ([209.132.183.28]:36708 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753423AbcCCNkj (ORCPT ); Thu, 3 Mar 2016 08:40:39 -0500 Date: Thu, 3 Mar 2016 14:40:33 +0100 From: Jiri Olsa To: Namhyung Kim Cc: Arnaldo Carvalho de Melo , Ingo Molnar , Peter Zijlstra , Jiri Olsa , LKML , David Ahern , Andi Kleen , Stephane Eranian , Wang Nan Subject: Re: [PATCH 2/8] perf tools: Introduce perf_hpp__setup_hists_formats() Message-ID: <20160303134033.GB5487@krava.redhat.com> References: <1456935128-31299-1-git-send-email-namhyung@kernel.org> <1456935128-31299-3-git-send-email-namhyung@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1456935128-31299-3-git-send-email-namhyung@kernel.org> User-Agent: Mutt/1.5.24 (2015-08-30) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 03 Mar 2016 13:40:39 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 03, 2016 at 01:12:02AM +0900, Namhyung Kim wrote: > The perf_hpp__setup_hists_formats() is to build hists-specific output > formats (and sort keys). Currently it's only used in order to build the > output format in a hierarchy with same sort keys, but it could be used > with different sort keys in non-hierarchy mode later. > > Signed-off-by: Namhyung Kim > --- > tools/perf/ui/hist.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++ > tools/perf/util/hist.c | 12 +++++++++ > tools/perf/util/hist.h | 10 ++++++++ > tools/perf/util/sort.c | 29 ++++++++++++++++++++++ > 4 files changed, 117 insertions(+) > > diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c > index 7c0585c146e1..ded564936701 100644 > --- a/tools/perf/ui/hist.c > +++ b/tools/perf/ui/hist.c > @@ -5,6 +5,7 @@ > #include "../util/util.h" > #include "../util/sort.h" > #include "../util/evsel.h" > +#include "../util/evlist.h" > > /* hist period print (hpp) functions */ > > @@ -715,3 +716,68 @@ void perf_hpp__set_user_width(const char *width_list_str) > break; > } > } > + > +static int add_hierarchy_fmt(struct hists *hists, struct perf_hpp_fmt *fmt) > +{ > + struct perf_hpp_list_node *node = NULL; > + struct perf_hpp_fmt *fmt_copy; > + bool found = false; > + > + list_for_each_entry(node, &hists->hpp_formats, list) { > + struct perf_hpp_fmt *pos; > + > + pos = list_first_entry(&node->hpp.fields, struct perf_hpp_fmt, list); the struct perf_hpp_list_node could hold 'level' as well, so you wouldn't need to query first fmt jirka