From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932814AbcGHQhg (ORCPT ); Fri, 8 Jul 2016 12:37:36 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:47738 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755498AbcGHQgm (ORCPT ); Fri, 8 Jul 2016 12:36:42 -0400 Date: Fri, 8 Jul 2016 18:36:32 +0200 From: Peter Zijlstra To: Ingo Molnar Cc: acme@kernel.org, linux-kernel@vger.kernel.org, andi@firstfloor.org, eranian@google.com, jolsa@kernel.org, torvalds@linux-foundation.org, davidcc@google.com, alexander.shishkin@linux.intel.com, namhyung@kernel.org, kan.liang@intel.com, khandual@linux.vnet.ibm.com Subject: Re: [RFC][PATCH 7/7] perf/annotate: Add branch stack / basic block information Message-ID: <20160708163632.GK30927@twins.programming.kicks-ass.net> References: <20160708133059.031522978@infradead.org> <20160708134113.718203556@infradead.org> <20160708145555.GB17466@gmail.com> <20160708162733.GJ30909@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160708162733.GJ30909@twins.programming.kicks-ass.net> User-Agent: Mutt/1.5.23.1 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 08, 2016 at 06:27:33PM +0200, Peter Zijlstra wrote: > I've been thinking of filtering all targets and branches that are > smaller than 0.1% in order to avoid this, but so far I've just been > ignoring these things. Like so... seems to 'work'. --- tools/perf/util/annotate.c | 45 ++++++++++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c index 8eeb151..c78b16f0 100644 --- a/tools/perf/util/annotate.c +++ b/tools/perf/util/annotate.c @@ -907,6 +907,7 @@ static void annotate__branch_printf(struct block_range *br, u64 addr) #if 1 if (br->is_target && br->start == addr) { struct block_range *branch = br; + double p; /* * Find matching branch to our target. @@ -914,31 +915,37 @@ static void annotate__branch_printf(struct block_range *br, u64 addr) while (!branch->is_branch) branch = block_range__next(branch); - if (emit_comment) { - emit_comment = false; - printf("\t#"); - } + p = 100 *(double)br->entry / branch->coverage; - /* - * The percentage of coverage joined at this target in relation - * to the next branch. - */ - printf(" +%.2f%%", 100*(double)br->entry / branch->coverage); + if (p > 0.1) { + if (emit_comment) { + emit_comment = false; + printf("\t#"); + } + + /* + * The percentage of coverage joined at this target in relation + * to the next branch. + */ + printf(" +%.2f%%", p); + } } #endif if (br->is_branch && br->end == addr) { + double p = 100*(double)br->taken / br->coverage; - if (emit_comment) { - emit_comment = false; - printf("\t#"); - } + if (p > 0.1) { + if (emit_comment) { + emit_comment = false; + printf("\t#"); + } - /* - * The percentage of coverage leaving at this branch, and - * its prediction ratio. - */ - printf(" -%.2f%% / %.2f%%", 100*(double)br->taken / br->coverage, - 100*(double)br->pred / br->taken); + /* + * The percentage of coverage leaving at this branch, and + * its prediction ratio. + */ + printf(" -%.2f%% (p:%.2f%%)", p, 100*(double)br->pred / br->taken); + } } }