Skip to contentSkip to conversation

perf annotate: Allocate history size correctly

tip:perf/urgent tip-bot for Nick Piggin 1 participant 1 message Nov 17, 2009 perf events

lore
Share & tools
lore
#0 lore raw
Commit-ID:  d62d77fd18cc82e839e49b7ef3360e4411f7d2e5
Gitweb:     http://git.kernel.org/tip/d62d77fd18cc82e839e49b7ef3360e4411f7d2e5
Author:     Nick Piggin <[email protected]>
AuthorDate: Tue, 17 Nov 2009 12:29:38 +0100
Committer:  Ingo Molnar <[email protected]>
CommitDate: Tue, 17 Nov 2009 16:47:09 +0100

perf annotate: Allocate history size correctly

Symbol offset history table size does not get updated properly when it is being resized. This leads to garbage results in perf annotate.

Cc Peter Zijlstra <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Mike Galbraith <[email protected]>

LKML-Reference: <new-submission>

---
 tools/perf/util/symbol.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
tools/perf/util/symbol.c +8 -0
index 226f44a..cbac575 100644
@@ -227,6 +227,10 @@ static int dso__load_kallsyms(struct dso *self, symbol_filter_t filter, int v)
 			      *curr = rb_entry(nd, struct symbol, rb_node);
 
 		prev->end = curr->start - 1;
+		if (prev->hist) {
+			free(prev->hist);
+			prev->hist = calloc(sizeof(u64), prev->end - prev->start);
+		}
 		prevnd = nd;
 	}
 
@@ -883,6 +887,10 @@ static inline void dso__fill_symbol_holes(struct dso *self)
 					pos->end = prev->end;
 				else if (hole)
 					pos->end = prev->start - 1;
+				if (pos->hist) {
+					free(pos->hist);
+					pos->hist = calloc(sizeof(u64), pos->end - pos->start);
+				}
 			}
 		}
 		prev = pos;