diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2011-11-11 19:17:32 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2011-11-28 07:37:11 -0500 |
commit | d04b35f8085f0d4c5c874515b8f65e7664357148 (patch) | |
tree | 8115d7e30c274756097ce27742338438a14fabd5 /tools/perf/builtin-annotate.c | |
parent | 18b552350515188a732db6ccdb81e9cefb8b58c9 (diff) |
perf symbols: Add nr_events to symbol_conf
Since symbol__alloc_hists need it, to avoid passing it around in many
functions have it in the symbol_conf struct.
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
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-cwv8ysvpywzjq4v3xtbd4zwv@git.kernel.org
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.c | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c index 46b4c24f338e..8b9091bce98d 100644 --- a/tools/perf/builtin-annotate.c +++ b/tools/perf/builtin-annotate.c | |||
@@ -43,10 +43,9 @@ static const char *sym_hist_filter; | |||
43 | static const char *cpu_list; | 43 | static const char *cpu_list; |
44 | static DECLARE_BITMAP(cpu_bitmap, MAX_NR_CPUS); | 44 | static DECLARE_BITMAP(cpu_bitmap, MAX_NR_CPUS); |
45 | 45 | ||
46 | static int perf_evlist__add_sample(struct perf_evlist *evlist, | 46 | static int perf_evsel__add_sample(struct perf_evsel *evsel, |
47 | struct perf_sample *sample, | 47 | struct perf_sample *sample, |
48 | struct perf_evsel *evsel, | 48 | struct addr_location *al) |
49 | struct addr_location *al) | ||
50 | { | 49 | { |
51 | struct hist_entry *he; | 50 | struct hist_entry *he; |
52 | int ret; | 51 | int ret; |
@@ -69,8 +68,7 @@ static int perf_evlist__add_sample(struct perf_evlist *evlist, | |||
69 | ret = 0; | 68 | ret = 0; |
70 | if (he->ms.sym != NULL) { | 69 | if (he->ms.sym != NULL) { |
71 | struct annotation *notes = symbol__annotation(he->ms.sym); | 70 | struct annotation *notes = symbol__annotation(he->ms.sym); |
72 | if (notes->src == NULL && | 71 | if (notes->src == NULL && symbol__alloc_hist(he->ms.sym) < 0) |
73 | symbol__alloc_hist(he->ms.sym, evlist->nr_entries) < 0) | ||
74 | return -ENOMEM; | 72 | return -ENOMEM; |
75 | 73 | ||
76 | ret = hist_entry__inc_addr_samples(he, evsel->idx, al->addr); | 74 | ret = hist_entry__inc_addr_samples(he, evsel->idx, al->addr); |
@@ -98,8 +96,7 @@ static int process_sample_event(union perf_event *event, | |||
98 | if (cpu_list && !test_bit(sample->cpu, cpu_bitmap)) | 96 | if (cpu_list && !test_bit(sample->cpu, cpu_bitmap)) |
99 | return 0; | 97 | return 0; |
100 | 98 | ||
101 | if (!al.filtered && | 99 | if (!al.filtered && perf_evsel__add_sample(evsel, sample, &al)) { |
102 | perf_evlist__add_sample(session->evlist, sample, evsel, &al)) { | ||
103 | pr_warning("problem incrementing symbol count, " | 100 | pr_warning("problem incrementing symbol count, " |
104 | "skipping event\n"); | 101 | "skipping event\n"); |
105 | return -1; | 102 | return -1; |
@@ -114,8 +111,7 @@ static int hist_entry__tty_annotate(struct hist_entry *he, int evidx) | |||
114 | print_line, full_paths, 0, 0); | 111 | print_line, full_paths, 0, 0); |
115 | } | 112 | } |
116 | 113 | ||
117 | static void hists__find_annotations(struct hists *self, int evidx, | 114 | static void hists__find_annotations(struct hists *self, int evidx) |
118 | int nr_events) | ||
119 | { | 115 | { |
120 | struct rb_node *nd = rb_first(&self->entries), *next; | 116 | struct rb_node *nd = rb_first(&self->entries), *next; |
121 | int key = K_RIGHT; | 117 | int key = K_RIGHT; |
@@ -138,8 +134,7 @@ find_next: | |||
138 | } | 134 | } |
139 | 135 | ||
140 | if (use_browser > 0) { | 136 | if (use_browser > 0) { |
141 | key = hist_entry__tui_annotate(he, evidx, nr_events, | 137 | key = hist_entry__tui_annotate(he, evidx, NULL, NULL, 0); |
142 | NULL, NULL, 0); | ||
143 | switch (key) { | 138 | switch (key) { |
144 | case K_RIGHT: | 139 | case K_RIGHT: |
145 | next = rb_next(nd); | 140 | next = rb_next(nd); |
@@ -217,8 +212,7 @@ static int __cmd_annotate(void) | |||
217 | total_nr_samples += nr_samples; | 212 | total_nr_samples += nr_samples; |
218 | hists__collapse_resort(hists); | 213 | hists__collapse_resort(hists); |
219 | hists__output_resort(hists); | 214 | hists__output_resort(hists); |
220 | hists__find_annotations(hists, pos->idx, | 215 | hists__find_annotations(hists, pos->idx); |
221 | session->evlist->nr_entries); | ||
222 | } | 216 | } |
223 | } | 217 | } |
224 | 218 | ||