summaryrefslogtreecommitdiff
path: root/tools/perf/builtin-annotate.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2011-02-08 13:27:39 -0200
committerArnaldo Carvalho de Melo <acme@redhat.com>2011-02-08 15:03:36 -0200
commitce6f4fab4059cd72638a0cfa596a8ee2c79c1c8e (patch)
tree00416d7a54d9ef265b9358022e804217dcb5d870 /tools/perf/builtin-annotate.c
parente3087b80aa0bceda9863f33307460f3ba79f2b15 (diff)
perf annotate: Move locking to struct annotation
Since we'll need it when implementing the live annotate TUI browser. This also simplifies things a bit by having the list head for the source code to be in the dynamicly allocated part of struct annotation, that way we don't have to pass it around, it can be found from the struct symbol that is passed everywhere. Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Cc: Tom Zanussi <tzanussi@gmail.com> LKML-Reference: <new-submission> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-annotate.c')
-rw-r--r--tools/perf/builtin-annotate.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index ea6a1165956..427182953fd 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -62,7 +62,8 @@ static int hists__add_entry(struct hists *self, struct addr_location *al)
* All aggregated on the first sym_hist.
*/
struct annotation *notes = symbol__annotation(he->ms.sym);
- if (notes->histograms == NULL && symbol__alloc_hist(he->ms.sym, 1) < 0)
+ if (notes->src == NULL &&
+ symbol__alloc_hist(he->ms.sym, 1) < 0)
return -ENOMEM;
return hist_entry__inc_addr_samples(he, 0, al->addr);
@@ -77,7 +78,8 @@ static int process_sample_event(union perf_event *event,
{
struct addr_location al;
- if (perf_event__preprocess_sample(event, session, &al, sample, NULL) < 0) {
+ if (perf_event__preprocess_sample(event, session, &al, sample,
+ symbol__annotate_init) < 0) {
pr_warning("problem processing %d event, skipping it.\n",
event->header.type);
return -1;
@@ -111,7 +113,7 @@ static void hists__find_annotations(struct hists *self)
goto find_next;
notes = symbol__annotation(he->ms.sym);
- if (notes->histograms == NULL) {
+ if (notes->src == NULL) {
find_next:
if (key == KEY_LEFT)
nd = rb_prev(nd);
@@ -142,11 +144,11 @@ find_next:
nd = rb_next(nd);
/*
* Since we have a hist_entry per IP for the same
- * symbol, free he->ms.sym->histogram to signal we already
+ * symbol, free he->ms.sym->src to signal we already
* processed this symbol.
*/
- free(notes->histograms);
- notes->histograms = NULL;
+ free(notes->src);
+ notes->src = NULL;
}
}
}