diff options
author | Ingo Molnar <mingo@kernel.org> | 2014-02-27 06:47:59 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2014-02-27 06:47:59 -0500 |
commit | b6e53f321ee6f4b237d8cc54fbace3217fa96e05 (patch) | |
tree | 40c47bafa6bc1321e0ab2be82a5e4d618c1caa8b | |
parent | e3703f8cdfcf39c25c4338c3ad8e68891cca3731 (diff) | |
parent | 98e9f03bbf2cb21a60f94b8b700eb5d38470819d (diff) |
Merge tag 'perf-urgent-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent
Pull perf/urgent fixes from Arnaldo Carvalho de Melo:
* Fix annotation on stdio/GTK+ interfaces (Namhyung Kim)
* Fix file descriptor leaking while searching DSOs for suitable symtab (Namhyung Kim).
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r-- | tools/perf/builtin-report.c | 40 | ||||
-rw-r--r-- | tools/perf/builtin-top.c | 6 | ||||
-rw-r--r-- | tools/perf/util/annotate.c | 9 | ||||
-rw-r--r-- | tools/perf/util/annotate.h | 2 | ||||
-rw-r--r-- | tools/perf/util/symbol.c | 2 |
5 files changed, 40 insertions, 19 deletions
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index 3c53ec268fbc..02f985f3a396 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c | |||
@@ -113,14 +113,16 @@ static int report__add_mem_hist_entry(struct perf_tool *tool, struct addr_locati | |||
113 | if (!he) | 113 | if (!he) |
114 | return -ENOMEM; | 114 | return -ENOMEM; |
115 | 115 | ||
116 | err = hist_entry__inc_addr_samples(he, evsel->idx, al->addr); | 116 | if (ui__has_annotation()) { |
117 | if (err) | 117 | err = hist_entry__inc_addr_samples(he, evsel->idx, al->addr); |
118 | goto out; | 118 | if (err) |
119 | goto out; | ||
119 | 120 | ||
120 | mx = he->mem_info; | 121 | mx = he->mem_info; |
121 | err = addr_map_symbol__inc_samples(&mx->daddr, evsel->idx); | 122 | err = addr_map_symbol__inc_samples(&mx->daddr, evsel->idx); |
122 | if (err) | 123 | if (err) |
123 | goto out; | 124 | goto out; |
125 | } | ||
124 | 126 | ||
125 | evsel->hists.stats.total_period += cost; | 127 | evsel->hists.stats.total_period += cost; |
126 | hists__inc_nr_events(&evsel->hists, PERF_RECORD_SAMPLE); | 128 | hists__inc_nr_events(&evsel->hists, PERF_RECORD_SAMPLE); |
@@ -164,14 +166,18 @@ static int report__add_branch_hist_entry(struct perf_tool *tool, struct addr_loc | |||
164 | he = __hists__add_entry(&evsel->hists, al, parent, &bi[i], NULL, | 166 | he = __hists__add_entry(&evsel->hists, al, parent, &bi[i], NULL, |
165 | 1, 1, 0); | 167 | 1, 1, 0); |
166 | if (he) { | 168 | if (he) { |
167 | bx = he->branch_info; | 169 | if (ui__has_annotation()) { |
168 | err = addr_map_symbol__inc_samples(&bx->from, evsel->idx); | 170 | bx = he->branch_info; |
169 | if (err) | 171 | err = addr_map_symbol__inc_samples(&bx->from, |
170 | goto out; | 172 | evsel->idx); |
171 | 173 | if (err) | |
172 | err = addr_map_symbol__inc_samples(&bx->to, evsel->idx); | 174 | goto out; |
173 | if (err) | 175 | |
174 | goto out; | 176 | err = addr_map_symbol__inc_samples(&bx->to, |
177 | evsel->idx); | ||
178 | if (err) | ||
179 | goto out; | ||
180 | } | ||
175 | 181 | ||
176 | evsel->hists.stats.total_period += 1; | 182 | evsel->hists.stats.total_period += 1; |
177 | hists__inc_nr_events(&evsel->hists, PERF_RECORD_SAMPLE); | 183 | hists__inc_nr_events(&evsel->hists, PERF_RECORD_SAMPLE); |
@@ -205,7 +211,9 @@ static int report__add_hist_entry(struct perf_tool *tool, struct perf_evsel *evs | |||
205 | if (err) | 211 | if (err) |
206 | goto out; | 212 | goto out; |
207 | 213 | ||
208 | err = hist_entry__inc_addr_samples(he, evsel->idx, al->addr); | 214 | if (ui__has_annotation()) |
215 | err = hist_entry__inc_addr_samples(he, evsel->idx, al->addr); | ||
216 | |||
209 | evsel->hists.stats.total_period += sample->period; | 217 | evsel->hists.stats.total_period += sample->period; |
210 | hists__inc_nr_events(&evsel->hists, PERF_RECORD_SAMPLE); | 218 | hists__inc_nr_events(&evsel->hists, PERF_RECORD_SAMPLE); |
211 | out: | 219 | out: |
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index 76cd510d34d0..5f989a7d8bc2 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c | |||
@@ -176,7 +176,7 @@ static void perf_top__record_precise_ip(struct perf_top *top, | |||
176 | { | 176 | { |
177 | struct annotation *notes; | 177 | struct annotation *notes; |
178 | struct symbol *sym; | 178 | struct symbol *sym; |
179 | int err; | 179 | int err = 0; |
180 | 180 | ||
181 | if (he == NULL || he->ms.sym == NULL || | 181 | if (he == NULL || he->ms.sym == NULL || |
182 | ((top->sym_filter_entry == NULL || | 182 | ((top->sym_filter_entry == NULL || |
@@ -190,7 +190,9 @@ static void perf_top__record_precise_ip(struct perf_top *top, | |||
190 | return; | 190 | return; |
191 | 191 | ||
192 | ip = he->ms.map->map_ip(he->ms.map, ip); | 192 | ip = he->ms.map->map_ip(he->ms.map, ip); |
193 | err = hist_entry__inc_addr_samples(he, counter, ip); | 193 | |
194 | if (ui__has_annotation()) | ||
195 | err = hist_entry__inc_addr_samples(he, counter, ip); | ||
194 | 196 | ||
195 | pthread_mutex_unlock(¬es->lock); | 197 | pthread_mutex_unlock(¬es->lock); |
196 | 198 | ||
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c index 469eb679fb9d..3aa555ff9d89 100644 --- a/tools/perf/util/annotate.c +++ b/tools/perf/util/annotate.c | |||
@@ -8,6 +8,8 @@ | |||
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include "util.h" | 10 | #include "util.h" |
11 | #include "ui/ui.h" | ||
12 | #include "sort.h" | ||
11 | #include "build-id.h" | 13 | #include "build-id.h" |
12 | #include "color.h" | 14 | #include "color.h" |
13 | #include "cache.h" | 15 | #include "cache.h" |
@@ -489,7 +491,7 @@ static int symbol__inc_addr_samples(struct symbol *sym, struct map *map, | |||
489 | { | 491 | { |
490 | struct annotation *notes; | 492 | struct annotation *notes; |
491 | 493 | ||
492 | if (sym == NULL || use_browser != 1 || !sort__has_sym) | 494 | if (sym == NULL) |
493 | return 0; | 495 | return 0; |
494 | 496 | ||
495 | notes = symbol__annotation(sym); | 497 | notes = symbol__annotation(sym); |
@@ -1399,3 +1401,8 @@ int hist_entry__annotate(struct hist_entry *he, size_t privsize) | |||
1399 | { | 1401 | { |
1400 | return symbol__annotate(he->ms.sym, he->ms.map, privsize); | 1402 | return symbol__annotate(he->ms.sym, he->ms.map, privsize); |
1401 | } | 1403 | } |
1404 | |||
1405 | bool ui__has_annotation(void) | ||
1406 | { | ||
1407 | return use_browser == 1 && sort__has_sym; | ||
1408 | } | ||
diff --git a/tools/perf/util/annotate.h b/tools/perf/util/annotate.h index b2aef59d6bb2..56ad4f5287de 100644 --- a/tools/perf/util/annotate.h +++ b/tools/perf/util/annotate.h | |||
@@ -151,6 +151,8 @@ void symbol__annotate_zero_histogram(struct symbol *sym, int evidx); | |||
151 | void symbol__annotate_decay_histogram(struct symbol *sym, int evidx); | 151 | void symbol__annotate_decay_histogram(struct symbol *sym, int evidx); |
152 | void disasm__purge(struct list_head *head); | 152 | void disasm__purge(struct list_head *head); |
153 | 153 | ||
154 | bool ui__has_annotation(void); | ||
155 | |||
154 | int symbol__tty_annotate(struct symbol *sym, struct map *map, | 156 | int symbol__tty_annotate(struct symbol *sym, struct map *map, |
155 | struct perf_evsel *evsel, bool print_lines, | 157 | struct perf_evsel *evsel, bool print_lines, |
156 | bool full_paths, int min_pcnt, int max_lines); | 158 | bool full_paths, int min_pcnt, int max_lines); |
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index a9d758a3b371..e89afc097d8a 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c | |||
@@ -1336,6 +1336,8 @@ int dso__load(struct dso *dso, struct map *map, symbol_filter_t filter) | |||
1336 | 1336 | ||
1337 | if (syms_ss && runtime_ss) | 1337 | if (syms_ss && runtime_ss) |
1338 | break; | 1338 | break; |
1339 | } else { | ||
1340 | symsrc__destroy(ss); | ||
1339 | } | 1341 | } |
1340 | 1342 | ||
1341 | } | 1343 | } |