aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-annotate.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2011-02-08 10:27:39 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2011-02-08 12:03:36 -0500
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 ea6a1165956f..427182953fd7 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)
62 * All aggregated on the first sym_hist. 62 * All aggregated on the first sym_hist.
63 */ 63 */
64 struct annotation *notes = symbol__annotation(he->ms.sym); 64 struct annotation *notes = symbol__annotation(he->ms.sym);
65 if (notes->histograms == NULL && symbol__alloc_hist(he->ms.sym, 1) < 0) 65 if (notes->src == NULL &&
66 symbol__alloc_hist(he->ms.sym, 1) < 0)
66 return -ENOMEM; 67 return -ENOMEM;
67 68
68 return hist_entry__inc_addr_samples(he, 0, al->addr); 69 return hist_entry__inc_addr_samples(he, 0, al->addr);
@@ -77,7 +78,8 @@ static int process_sample_event(union perf_event *event,
77{ 78{
78 struct addr_location al; 79 struct addr_location al;
79 80
80 if (perf_event__preprocess_sample(event, session, &al, sample, NULL) < 0) { 81 if (perf_event__preprocess_sample(event, session, &al, sample,
82 symbol__annotate_init) < 0) {
81 pr_warning("problem processing %d event, skipping it.\n", 83 pr_warning("problem processing %d event, skipping it.\n",
82 event->header.type); 84 event->header.type);
83 return -1; 85 return -1;
@@ -111,7 +113,7 @@ static void hists__find_annotations(struct hists *self)
111 goto find_next; 113 goto find_next;
112 114
113 notes = symbol__annotation(he->ms.sym); 115 notes = symbol__annotation(he->ms.sym);
114 if (notes->histograms == NULL) { 116 if (notes->src == NULL) {
115find_next: 117find_next:
116 if (key == KEY_LEFT) 118 if (key == KEY_LEFT)
117 nd = rb_prev(nd); 119 nd = rb_prev(nd);
@@ -142,11 +144,11 @@ find_next:
142 nd = rb_next(nd); 144 nd = rb_next(nd);
143 /* 145 /*
144 * Since we have a hist_entry per IP for the same 146 * Since we have a hist_entry per IP for the same
145 * symbol, free he->ms.sym->histogram to signal we already 147 * symbol, free he->ms.sym->src to signal we already
146 * processed this symbol. 148 * processed this symbol.
147 */ 149 */
148 free(notes->histograms); 150 free(notes->src);
149 notes->histograms = NULL; 151 notes->src = NULL;
150 } 152 }
151 } 153 }
152} 154}