From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1946195AbdKRIY0 (ORCPT ); Sat, 18 Nov 2017 03:24:26 -0500 Received: from terminus.zytor.com ([65.50.211.136]:43385 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1946191AbdKRIYP (ORCPT ); Sat, 18 Nov 2017 03:24:15 -0500 Date: Sat, 18 Nov 2017 00:20:40 -0800 From: tip-bot for Jiri Olsa Message-ID: Cc: namhyung@kernel.org, mingo@kernel.org, andi@firstfloor.org, dsahern@gmail.com, hpa@zytor.com, tglx@linutronix.de, peterz@infradead.org, jolsa@kernel.org, acme@redhat.com, linux-kernel@vger.kernel.org Reply-To: mingo@kernel.org, namhyung@kernel.org, linux-kernel@vger.kernel.org, acme@redhat.com, jolsa@kernel.org, peterz@infradead.org, tglx@linutronix.de, dsahern@gmail.com, hpa@zytor.com, andi@firstfloor.org In-Reply-To: <20171011150158.11895-27-jolsa@kernel.org> References: <20171011150158.11895-27-jolsa@kernel.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf annotate browser: Do not pass nr_events in disasm_rb_tree__insert Git-Commit-ID: b15636c62f3a32a8560ea6a32245ec49edd60c6b 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: b15636c62f3a32a8560ea6a32245ec49edd60c6b Gitweb: https://git.kernel.org/tip/b15636c62f3a32a8560ea6a32245ec49edd60c6b Author: Jiri Olsa AuthorDate: Wed, 11 Oct 2017 17:01:49 +0200 Committer: Arnaldo Carvalho de Melo CommitDate: Thu, 16 Nov 2017 14:49:45 -0300 perf annotate browser: Do not pass nr_events in disasm_rb_tree__insert We now keep samples_nr in struct annotation_line, so there's no need to pass nr_events to disasm_rb_tree__insert function. Signed-off-by: Jiri Olsa Cc: Andi Kleen Cc: David Ahern Cc: Namhyung Kim Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/20171011150158.11895-27-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/ui/browsers/annotate.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/tools/perf/ui/browsers/annotate.c b/tools/perf/ui/browsers/annotate.c index 5d99429..67e5955 100644 --- a/tools/perf/ui/browsers/annotate.c +++ b/tools/perf/ui/browsers/annotate.c @@ -356,12 +356,11 @@ static unsigned int annotate_browser__refresh(struct ui_browser *browser) return ret; } -static int disasm__cmp(struct annotation_line *a, - struct annotation_line *b, int nr_pcnt) +static int disasm__cmp(struct annotation_line *a, struct annotation_line *b) { int i; - for (i = 0; i < nr_pcnt; i++) { + for (i = 0; i < a->samples_nr; i++) { if (a->samples[i].percent == b->samples[i].percent) continue; return a->samples[i].percent < b->samples[i].percent; @@ -369,8 +368,7 @@ static int disasm__cmp(struct annotation_line *a, return 0; } -static void disasm_rb_tree__insert(struct rb_root *root, struct annotation_line *al, - int nr_events) +static void disasm_rb_tree__insert(struct rb_root *root, struct annotation_line *al) { struct rb_node **p = &root->rb_node; struct rb_node *parent = NULL; @@ -380,7 +378,7 @@ static void disasm_rb_tree__insert(struct rb_root *root, struct annotation_line parent = *p; l = rb_entry(parent, struct annotation_line, rb_node); - if (disasm__cmp(al, l, nr_events)) + if (disasm__cmp(al, l)) p = &(*p)->rb_left; else p = &(*p)->rb_right; @@ -452,7 +450,7 @@ static void annotate_browser__calc_percent(struct annotate_browser *browser, continue; } - for (i = 0; i < browser->nr_events; i++) { + for (i = 0; i < pos->al.samples_nr; i++) { struct annotation_data *sample = &pos->al.samples[i]; if (max_percent < sample->percent) @@ -463,8 +461,7 @@ static void annotate_browser__calc_percent(struct annotate_browser *browser, RB_CLEAR_NODE(&pos->al.rb_node); continue; } - disasm_rb_tree__insert(&browser->entries, &pos->al, - browser->nr_events); + disasm_rb_tree__insert(&browser->entries, &pos->al); } pthread_mutex_unlock(¬es->lock);