aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2012-04-05 15:15:59 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-04-05 17:49:18 -0400
commit8b84a568117fde9b77575f2060274eddab424c32 (patch)
treedadc32f7df64619334f252c9c5206b82b99a73a6 /tools
parent4bea8b5cf8c6e875fa43e617cd52858a07ae8ea8 (diff)
perf annotate: Fix hist decay
We were only decaying the entries for the offsets that were associated with an objdump line. That way, when we accrued the whole instruction addr range, more than 100% was appearing in some cases in the live annotation TUI. Fix it by not traversing the source code line at all, just iterate thru the complete addr range decaying each one. Reported-by: Mike Galbraith <mgalbraith@suse.de> Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Namhyung Kim <namhyung@gmail.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/n/tip-hcae5oxa22syjrnalsxz7s6n@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/util/annotate.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index 199f69ec656f..70f5a4dc17e9 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -561,16 +561,12 @@ void symbol__annotate_decay_histogram(struct symbol *sym, int evidx)
561{ 561{
562 struct annotation *notes = symbol__annotation(sym); 562 struct annotation *notes = symbol__annotation(sym);
563 struct sym_hist *h = annotation__histogram(notes, evidx); 563 struct sym_hist *h = annotation__histogram(notes, evidx);
564 struct objdump_line *pos; 564 int len = sym->end - sym->start, offset;
565 int len = sym->end - sym->start;
566 565
567 h->sum = 0; 566 h->sum = 0;
568 567 for (offset = 0; offset < len; ++offset) {
569 list_for_each_entry(pos, &notes->src->source, node) { 568 h->addr[offset] = h->addr[offset] * 7 / 8;
570 if (pos->offset != -1 && pos->offset < len) { 569 h->sum += h->addr[offset];
571 h->addr[pos->offset] = h->addr[pos->offset] * 7 / 8;
572 h->sum += h->addr[pos->offset];
573 }
574 } 570 }
575} 571}
576 572