diff options
Diffstat (limited to 'tools/perf')
-rw-r--r-- | tools/perf/builtin-report.c | 40 | ||||
-rw-r--r-- | tools/perf/builtin-top.c | 6 | ||||
-rw-r--r-- | tools/perf/builtin-trace.c | 10 | ||||
-rw-r--r-- | tools/perf/config/Makefile | 2 | ||||
-rw-r--r-- | tools/perf/config/feature-checks/Makefile | 2 | ||||
-rw-r--r-- | tools/perf/util/annotate.c | 9 | ||||
-rw-r--r-- | tools/perf/util/annotate.h | 2 | ||||
-rw-r--r-- | tools/perf/util/include/linux/bitops.h | 4 | ||||
-rw-r--r-- | tools/perf/util/machine.c | 2 | ||||
-rw-r--r-- | tools/perf/util/symbol-elf.c | 6 | ||||
-rw-r--r-- | tools/perf/util/symbol.c | 2 |
11 files changed, 58 insertions, 27 deletions
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index d882b6f96411..c47bf586fcba 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c | |||
@@ -110,14 +110,16 @@ static int report__add_mem_hist_entry(struct report *rep, struct addr_location * | |||
110 | if (!he) | 110 | if (!he) |
111 | return -ENOMEM; | 111 | return -ENOMEM; |
112 | 112 | ||
113 | err = hist_entry__inc_addr_samples(he, evsel->idx, al->addr); | 113 | if (ui__has_annotation()) { |
114 | if (err) | 114 | err = hist_entry__inc_addr_samples(he, evsel->idx, al->addr); |
115 | goto out; | 115 | if (err) |
116 | goto out; | ||
116 | 117 | ||
117 | mx = he->mem_info; | 118 | mx = he->mem_info; |
118 | err = addr_map_symbol__inc_samples(&mx->daddr, evsel->idx); | 119 | err = addr_map_symbol__inc_samples(&mx->daddr, evsel->idx); |
119 | if (err) | 120 | if (err) |
120 | goto out; | 121 | goto out; |
122 | } | ||
121 | 123 | ||
122 | evsel->hists.stats.total_period += cost; | 124 | evsel->hists.stats.total_period += cost; |
123 | hists__inc_nr_events(&evsel->hists, PERF_RECORD_SAMPLE); | 125 | hists__inc_nr_events(&evsel->hists, PERF_RECORD_SAMPLE); |
@@ -159,14 +161,18 @@ static int report__add_branch_hist_entry(struct report *rep, struct addr_locatio | |||
159 | he = __hists__add_entry(&evsel->hists, al, parent, &bi[i], NULL, | 161 | he = __hists__add_entry(&evsel->hists, al, parent, &bi[i], NULL, |
160 | 1, 1, 0); | 162 | 1, 1, 0); |
161 | if (he) { | 163 | if (he) { |
162 | bx = he->branch_info; | 164 | if (ui__has_annotation()) { |
163 | err = addr_map_symbol__inc_samples(&bx->from, evsel->idx); | 165 | bx = he->branch_info; |
164 | if (err) | 166 | err = addr_map_symbol__inc_samples(&bx->from, |
165 | goto out; | 167 | evsel->idx); |
166 | 168 | if (err) | |
167 | err = addr_map_symbol__inc_samples(&bx->to, evsel->idx); | 169 | goto out; |
168 | if (err) | 170 | |
169 | goto out; | 171 | err = addr_map_symbol__inc_samples(&bx->to, |
172 | evsel->idx); | ||
173 | if (err) | ||
174 | goto out; | ||
175 | } | ||
170 | 176 | ||
171 | evsel->hists.stats.total_period += 1; | 177 | evsel->hists.stats.total_period += 1; |
172 | hists__inc_nr_events(&evsel->hists, PERF_RECORD_SAMPLE); | 178 | hists__inc_nr_events(&evsel->hists, PERF_RECORD_SAMPLE); |
@@ -199,7 +205,9 @@ static int report__add_hist_entry(struct report *rep, struct perf_evsel *evsel, | |||
199 | if (err) | 205 | if (err) |
200 | goto out; | 206 | goto out; |
201 | 207 | ||
202 | err = hist_entry__inc_addr_samples(he, evsel->idx, al->addr); | 208 | if (ui__has_annotation()) |
209 | err = hist_entry__inc_addr_samples(he, evsel->idx, al->addr); | ||
210 | |||
203 | evsel->hists.stats.total_period += sample->period; | 211 | evsel->hists.stats.total_period += sample->period; |
204 | hists__inc_nr_events(&evsel->hists, PERF_RECORD_SAMPLE); | 212 | hists__inc_nr_events(&evsel->hists, PERF_RECORD_SAMPLE); |
205 | out: | 213 | out: |
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index ed99ec4a309f..65aaa5bbf7ec 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/builtin-trace.c b/tools/perf/builtin-trace.c index 6aa6fb6f7bd9..f954c26de231 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c | |||
@@ -825,7 +825,6 @@ static size_t syscall_arg__scnprintf_signum(char *bf, size_t size, struct syscal | |||
825 | P_SIGNUM(PIPE); | 825 | P_SIGNUM(PIPE); |
826 | P_SIGNUM(ALRM); | 826 | P_SIGNUM(ALRM); |
827 | P_SIGNUM(TERM); | 827 | P_SIGNUM(TERM); |
828 | P_SIGNUM(STKFLT); | ||
829 | P_SIGNUM(CHLD); | 828 | P_SIGNUM(CHLD); |
830 | P_SIGNUM(CONT); | 829 | P_SIGNUM(CONT); |
831 | P_SIGNUM(STOP); | 830 | P_SIGNUM(STOP); |
@@ -841,6 +840,15 @@ static size_t syscall_arg__scnprintf_signum(char *bf, size_t size, struct syscal | |||
841 | P_SIGNUM(IO); | 840 | P_SIGNUM(IO); |
842 | P_SIGNUM(PWR); | 841 | P_SIGNUM(PWR); |
843 | P_SIGNUM(SYS); | 842 | P_SIGNUM(SYS); |
843 | #ifdef SIGEMT | ||
844 | P_SIGNUM(EMT); | ||
845 | #endif | ||
846 | #ifdef SIGSTKFLT | ||
847 | P_SIGNUM(STKFLT); | ||
848 | #endif | ||
849 | #ifdef SIGSWI | ||
850 | P_SIGNUM(SWI); | ||
851 | #endif | ||
844 | default: break; | 852 | default: break; |
845 | } | 853 | } |
846 | 854 | ||
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile index f7c81d3e2422..c23418225c2c 100644 --- a/tools/perf/config/Makefile +++ b/tools/perf/config/Makefile | |||
@@ -503,7 +503,7 @@ else | |||
503 | endif | 503 | endif |
504 | 504 | ||
505 | ifeq ($(feature-libbfd), 1) | 505 | ifeq ($(feature-libbfd), 1) |
506 | EXTLIBS += -lbfd | 506 | EXTLIBS += -lbfd -lz -liberty |
507 | endif | 507 | endif |
508 | 508 | ||
509 | ifdef NO_DEMANGLE | 509 | ifdef NO_DEMANGLE |
diff --git a/tools/perf/config/feature-checks/Makefile b/tools/perf/config/feature-checks/Makefile index 2b492f5480e2..2da103c53f89 100644 --- a/tools/perf/config/feature-checks/Makefile +++ b/tools/perf/config/feature-checks/Makefile | |||
@@ -122,7 +122,7 @@ test-libpython-version.bin: | |||
122 | $(BUILD) $(FLAGS_PYTHON_EMBED) | 122 | $(BUILD) $(FLAGS_PYTHON_EMBED) |
123 | 123 | ||
124 | test-libbfd.bin: | 124 | test-libbfd.bin: |
125 | $(BUILD) -DPACKAGE='"perf"' -lbfd -ldl | 125 | $(BUILD) -DPACKAGE='"perf"' -lbfd -lz -liberty -ldl |
126 | 126 | ||
127 | test-liberty.bin: | 127 | test-liberty.bin: |
128 | $(CC) -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' -lbfd -ldl -liberty | 128 | $(CC) -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' -lbfd -ldl -liberty |
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/include/linux/bitops.h b/tools/perf/util/include/linux/bitops.h index 45cf10a562bd..dadfa7e54287 100644 --- a/tools/perf/util/include/linux/bitops.h +++ b/tools/perf/util/include/linux/bitops.h | |||
@@ -87,13 +87,15 @@ static __always_inline unsigned long __ffs(unsigned long word) | |||
87 | return num; | 87 | return num; |
88 | } | 88 | } |
89 | 89 | ||
90 | typedef const unsigned long __attribute__((__may_alias__)) long_alias_t; | ||
91 | |||
90 | /* | 92 | /* |
91 | * Find the first set bit in a memory region. | 93 | * Find the first set bit in a memory region. |
92 | */ | 94 | */ |
93 | static inline unsigned long | 95 | static inline unsigned long |
94 | find_first_bit(const unsigned long *addr, unsigned long size) | 96 | find_first_bit(const unsigned long *addr, unsigned long size) |
95 | { | 97 | { |
96 | const unsigned long *p = addr; | 98 | long_alias_t *p = (long_alias_t *) addr; |
97 | unsigned long result = 0; | 99 | unsigned long result = 0; |
98 | unsigned long tmp; | 100 | unsigned long tmp; |
99 | 101 | ||
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c index ac37d788b5cb..813e94e7cf29 100644 --- a/tools/perf/util/machine.c +++ b/tools/perf/util/machine.c | |||
@@ -1213,7 +1213,7 @@ static void ip__resolve_ams(struct machine *machine, struct thread *thread, | |||
1213 | */ | 1213 | */ |
1214 | thread__find_addr_location(thread, machine, m, MAP__FUNCTION, | 1214 | thread__find_addr_location(thread, machine, m, MAP__FUNCTION, |
1215 | ip, &al); | 1215 | ip, &al); |
1216 | if (al.sym) | 1216 | if (al.map) |
1217 | goto found; | 1217 | goto found; |
1218 | } | 1218 | } |
1219 | found: | 1219 | found: |
diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c index 8ac4a4fe2abd..3b7dbf51d4a9 100644 --- a/tools/perf/util/symbol-elf.c +++ b/tools/perf/util/symbol-elf.c | |||
@@ -151,15 +151,15 @@ Elf_Scn *elf_section_by_name(Elf *elf, GElf_Ehdr *ep, | |||
151 | 151 | ||
152 | gelf_getshdr(sec, shp); | 152 | gelf_getshdr(sec, shp); |
153 | str = elf_strptr(elf, ep->e_shstrndx, shp->sh_name); | 153 | str = elf_strptr(elf, ep->e_shstrndx, shp->sh_name); |
154 | if (!strcmp(name, str)) { | 154 | if (str && !strcmp(name, str)) { |
155 | if (idx) | 155 | if (idx) |
156 | *idx = cnt; | 156 | *idx = cnt; |
157 | break; | 157 | return sec; |
158 | } | 158 | } |
159 | ++cnt; | 159 | ++cnt; |
160 | } | 160 | } |
161 | 161 | ||
162 | return sec; | 162 | return NULL; |
163 | } | 163 | } |
164 | 164 | ||
165 | #define elf_section__for_each_rel(reldata, pos, pos_mem, idx, nr_entries) \ | 165 | #define elf_section__for_each_rel(reldata, pos, pos_mem, idx, nr_entries) \ |
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index 0ada68b3b096..95e249779931 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c | |||
@@ -1384,6 +1384,8 @@ int dso__load(struct dso *dso, struct map *map, symbol_filter_t filter) | |||
1384 | 1384 | ||
1385 | if (syms_ss && runtime_ss) | 1385 | if (syms_ss && runtime_ss) |
1386 | break; | 1386 | break; |
1387 | } else { | ||
1388 | symsrc__destroy(ss); | ||
1387 | } | 1389 | } |
1388 | 1390 | ||
1389 | } | 1391 | } |