From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756720AbcBCKWT (ORCPT ); Wed, 3 Feb 2016 05:22:19 -0500 Received: from terminus.zytor.com ([198.137.202.10]:54882 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751523AbcBCKWQ (ORCPT ); Wed, 3 Feb 2016 05:22:16 -0500 Date: Wed, 3 Feb 2016 02:21:41 -0800 From: tip-bot for Namhyung Kim Message-ID: Cc: acme@redhat.com, peterz@infradead.org, wangnan0@huawei.com, jolsa@kernel.org, andi@firstfloor.org, hpa@zytor.com, mingo@kernel.org, linux-kernel@vger.kernel.org, fweisbec@gmail.com, dsahern@gmail.com, namhyung@kernel.org, tglx@linutronix.de Reply-To: peterz@infradead.org, wangnan0@huawei.com, acme@redhat.com, tglx@linutronix.de, namhyung@kernel.org, fweisbec@gmail.com, dsahern@gmail.com, linux-kernel@vger.kernel.org, mingo@kernel.org, hpa@zytor.com, andi@firstfloor.org, jolsa@kernel.org In-Reply-To: <1453909257-26015-3-git-send-email-namhyung@kernel.org> References: <1453909257-26015-3-git-send-email-namhyung@kernel.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf hists: Update hists' total period when adding entries Git-Commit-ID: 0f58474ec835f6fc80af2cde2c7ed5495cd212ba X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Commit-ID: 0f58474ec835f6fc80af2cde2c7ed5495cd212ba Gitweb: http://git.kernel.org/tip/0f58474ec835f6fc80af2cde2c7ed5495cd212ba Author: Namhyung Kim AuthorDate: Thu, 28 Jan 2016 00:40:49 +0900 Committer: Arnaldo Carvalho de Melo CommitDate: Mon, 1 Feb 2016 16:45:44 -0300 perf hists: Update hists' total period when adding entries Currently the hist entry addition path doesn't update total_period of hists and it's calculated during 'resort' path. But the resort path needs to know the total period before doing its job because it's used for calculating percent limit of callchains in hist entries. So this patch update the total period during the addition path. It makes the percent limit of callchains working (again). Signed-off-by: Namhyung Kim Cc: Andi Kleen Cc: David Ahern Cc: Frederic Weisbecker Cc: Jiri Olsa Cc: Peter Zijlstra Cc: Wang Nan Link: http://lkml.kernel.org/r/1453909257-26015-3-git-send-email-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/hist.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c index b961946..098310b 100644 --- a/tools/perf/util/hist.c +++ b/tools/perf/util/hist.c @@ -432,8 +432,12 @@ static struct hist_entry *hists__findnew_entry(struct hists *hists, cmp = hist_entry__cmp(he, entry); if (!cmp) { - if (sample_self) + if (sample_self) { he_stat__add_period(&he->stat, period, weight); + hists->stats.total_period += period; + if (!he->filtered) + hists->stats.total_non_filtered_period += period; + } if (symbol_conf.cumulate_callchain) he_stat__add_period(he->stat_acc, period, weight); @@ -466,7 +470,10 @@ static struct hist_entry *hists__findnew_entry(struct hists *hists, if (!he) return NULL; - hists->nr_entries++; + if (sample_self) + hists__inc_stats(hists, he); + else + hists->nr_entries++; rb_link_node(&he->rb_node_in, parent, p); rb_insert_color(&he->rb_node_in, hists->entries_in);