From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751482AbcBJMw4 (ORCPT ); Wed, 10 Feb 2016 07:52:56 -0500 Received: from mx1.redhat.com ([209.132.183.28]:54046 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751346AbcBJMwQ (ORCPT ); Wed, 10 Feb 2016 07:52:16 -0500 Date: Wed, 10 Feb 2016 13:52:08 +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 16/23] perf hists browser: Count number of hierarchy entries Message-ID: <20160210125208.GA15597@krava.redhat.com> References: <1454677315-7515-1-git-send-email-namhyung@kernel.org> <1454677315-7515-17-git-send-email-namhyung@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1454677315-7515-17-git-send-email-namhyung@kernel.org> 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 On Fri, Feb 05, 2016 at 10:01:48PM +0900, Namhyung Kim wrote: SNIP > +static int hierarchy_count_rows(struct hist_browser *hb, struct hist_entry *he, > + bool include_children) > +{ > + int count = 0; > + struct rb_node *node; > + struct hist_entry *child; > + > + if (he->leaf) > + return callchain__count_rows(&he->sorted_chain); > + > + node = rb_first(&he->hroot_out); > + while (node) { > + float percent; > + > + child = rb_entry(node, struct hist_entry, rb_node); > + percent = hist_entry__get_percent_limit(child); > + > + if (!child->filtered && percent >= hb->min_pcnt) { > + count++; > + > + if (include_children && child->unfolded) > + count += hierarchy_count_rows(hb, child, true); > + } > + > + node = rb_next(node); > + } > + return count; > +} SNIP > + if (he->leaf) > + browser->nr_callchain_rows -= he->nr_rows; > else > + browser->nr_hierarchy_entries -= he->nr_rows; > + > + if (symbol_conf.report_hierarchy) > + child_rows = hierarchy_count_rows(browser, he, true); > + > + if (he->unfolded) { > + if (he->leaf) > + he->nr_rows = callchain__count_rows(&he->sorted_chain); > + else > + he->nr_rows = hierarchy_count_rows(browser, he, false); looks like above condition could go to just following call: he->nr_rows = hierarchy_count_rows(browser, he, false); because there's same condtiion in the hierarchy_count_rows function thanks, jirka