From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758780AbcISHsf (ORCPT ); Mon, 19 Sep 2016 03:48:35 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58346 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750745AbcISHs1 (ORCPT ); Mon, 19 Sep 2016 03:48:27 -0400 Date: Mon, 19 Sep 2016 09:48:24 +0200 From: Jiri Olsa To: Namhyung Kim Cc: Arnaldo Carvalho de Melo , Ingo Molnar , Peter Zijlstra , Jiri Olsa , LKML , Andi Kleen Subject: Re: [PATCH 1/7] perf hist: Introduce hists__match_hierarchy() Message-ID: <20160919074824.GA26906@krava> References: <20160913074552.13284-1-namhyung@kernel.org> <20160913074552.13284-2-namhyung@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160913074552.13284-2-namhyung@kernel.org> User-Agent: Mutt/1.7.0 (2016-08-17) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Mon, 19 Sep 2016 07:48:27 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 13, 2016 at 04:45:46PM +0900, Namhyung Kim wrote: SNIP > +static struct hist_entry *hists__find_hierarchy_entry(struct rb_root *root, > + struct hist_entry *he) > +{ > + struct rb_node *n = root->rb_node; > + > + while (n) { > + struct hist_entry *iter; > + struct perf_hpp_fmt *fmt; > + int64_t cmp = 0; > + > + iter = rb_entry(n, struct hist_entry, rb_node_in); > + perf_hpp_list__for_each_sort_list(he->hpp_list, fmt) { > + cmp = fmt->collapse(fmt, iter, he); > + if (cmp) > + break; > + } could you call hist_entry__collapse in here instead of above code? thanks, jirka > + > + if (cmp < 0) > + n = n->rb_left; > + else if (cmp > 0) > + n = n->rb_right; > + else > + return iter; > + } > + > + return NULL; > +} > +