Skip to content

Commit 8b84a56

Browse files
committed
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 <[email protected]> Cc: David Ahern <[email protected]> Cc: Frederic Weisbecker <[email protected]> Cc: Mike Galbraith <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Paul Mackerras <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Stephane Eranian <[email protected]> Link: http://lkml.kernel.org/n/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 4bea8b5 commit 8b84a56

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

tools/perf/util/annotate.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -561,16 +561,12 @@ void symbol__annotate_decay_histogram(struct symbol *sym, int evidx)
561561
{
562562
struct annotation *notes = symbol__annotation(sym);
563563
struct sym_hist *h = annotation__histogram(notes, evidx);
564-
struct objdump_line *pos;
565-
int len = sym->end - sym->start;
564+
int len = sym->end - sym->start, offset;
566565

567566
h->sum = 0;
568-
569-
list_for_each_entry(pos, &notes->src->source, node) {
570-
if (pos->offset != -1 && pos->offset < len) {
571-
h->addr[pos->offset] = h->addr[pos->offset] * 7 / 8;
572-
h->sum += h->addr[pos->offset];
573-
}
567+
for (offset = 0; offset < len; ++offset) {
568+
h->addr[offset] = h->addr[offset] * 7 / 8;
569+
h->sum += h->addr[offset];
574570
}
575571
}
576572

0 commit comments

Comments
 (0)