From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755499Ab2LMNJg (ORCPT ); Thu, 13 Dec 2012 08:09:36 -0500 Received: from mx1.redhat.com ([209.132.183.28]:5696 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753343Ab2LMNJf (ORCPT ); Thu, 13 Dec 2012 08:09:35 -0500 From: Jiri Olsa To: linux-kernel@vger.kernel.org Cc: Jiri Olsa , Arnaldo Carvalho de Melo , Peter Zijlstra , Ingo Molnar , Paul Mackerras , Corey Ashford , Frederic Weisbecker , Namhyung Kim Subject: [PATCH 01/14] perf diff: Use internal rb tree for hists__precompute Date: Thu, 13 Dec 2012 14:08:59 +0100 Message-Id: <1355404152-16523-2-git-send-email-jolsa@redhat.com> In-Reply-To: <1355404152-16523-1-git-send-email-jolsa@redhat.com> References: <1355404152-16523-1-git-send-email-jolsa@redhat.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There's missing change for hists__precompute to iterate either entries_collapsed or entries_in tree. The change was initiated for hists_compute_resort function in commit: 2a2d3ce perf diff: Use internal rb tree for compute resort but was missing for hists__precompute function changes. Signed-off-by: Jiri Olsa Cc: Arnaldo Carvalho de Melo Cc: Peter Zijlstra Cc: Ingo Molnar Cc: Paul Mackerras Cc: Corey Ashford Cc: Frederic Weisbecker Cc: Namhyung Kim --- tools/perf/builtin-diff.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c index 4af0b58..1f0a22d 100644 --- a/tools/perf/builtin-diff.c +++ b/tools/perf/builtin-diff.c @@ -322,13 +322,22 @@ static void hists__baseline_only(struct hists *hists) static void hists__precompute(struct hists *hists) { - struct rb_node *next = rb_first(&hists->entries); + struct rb_root *root; + struct rb_node *next; + + if (sort__need_collapse) + root = &hists->entries_collapsed; + else + root = hists->entries_in; + next = rb_first(root); while (next != NULL) { - struct hist_entry *he = rb_entry(next, struct hist_entry, rb_node); - struct hist_entry *pair = hist_entry__next_pair(he); + struct hist_entry *he, *pair; - next = rb_next(&he->rb_node); + he = rb_entry(next, struct hist_entry, rb_node_in); + pair = hist_entry__next_pair(he); + + next = rb_next(&he->rb_node_in); if (!pair) continue; -- 1.7.11.7