diff options
-rw-r--r-- | tools/perf/Makefile | 1 | ||||
-rw-r--r-- | tools/perf/builtin-annotate.c | 66 | ||||
-rw-r--r-- | tools/perf/builtin-record.c | 20 | ||||
-rw-r--r-- | tools/perf/builtin-report.c | 84 | ||||
-rw-r--r-- | tools/perf/builtin-stat.c | 62 | ||||
-rw-r--r-- | tools/perf/builtin-top.c | 24 | ||||
-rw-r--r-- | tools/perf/perf.h | 7 | ||||
-rw-r--r-- | tools/perf/types.h | 17 | ||||
-rw-r--r-- | tools/perf/util/parse-events.c | 10 | ||||
-rw-r--r-- | tools/perf/util/string.c | 2 | ||||
-rw-r--r-- | tools/perf/util/string.h | 4 | ||||
-rw-r--r-- | tools/perf/util/symbol.c | 20 | ||||
-rw-r--r-- | tools/perf/util/symbol.h | 15 |
13 files changed, 176 insertions, 156 deletions
diff --git a/tools/perf/Makefile b/tools/perf/Makefile index 672c5f069c6e..36d7eef49913 100644 --- a/tools/perf/Makefile +++ b/tools/perf/Makefile | |||
@@ -290,6 +290,7 @@ LIB_FILE=libperf.a | |||
290 | 290 | ||
291 | LIB_H += ../../include/linux/perf_counter.h | 291 | LIB_H += ../../include/linux/perf_counter.h |
292 | LIB_H += perf.h | 292 | LIB_H += perf.h |
293 | LIB_H += types.h | ||
293 | LIB_H += util/list.h | 294 | LIB_H += util/list.h |
294 | LIB_H += util/rbtree.h | 295 | LIB_H += util/rbtree.h |
295 | LIB_H += util/levenshtein.h | 296 | LIB_H += util/levenshtein.h |
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c index 94cea678fd7e..7e58e3ad1508 100644 --- a/tools/perf/builtin-annotate.c +++ b/tools/perf/builtin-annotate.c | |||
@@ -50,35 +50,35 @@ static unsigned long mmap_window = 32; | |||
50 | 50 | ||
51 | struct ip_event { | 51 | struct ip_event { |
52 | struct perf_event_header header; | 52 | struct perf_event_header header; |
53 | __u64 ip; | 53 | u64 ip; |
54 | __u32 pid, tid; | 54 | u32 pid, tid; |
55 | }; | 55 | }; |
56 | 56 | ||
57 | struct mmap_event { | 57 | struct mmap_event { |
58 | struct perf_event_header header; | 58 | struct perf_event_header header; |
59 | __u32 pid, tid; | 59 | u32 pid, tid; |
60 | __u64 start; | 60 | u64 start; |
61 | __u64 len; | 61 | u64 len; |
62 | __u64 pgoff; | 62 | u64 pgoff; |
63 | char filename[PATH_MAX]; | 63 | char filename[PATH_MAX]; |
64 | }; | 64 | }; |
65 | 65 | ||
66 | struct comm_event { | 66 | struct comm_event { |
67 | struct perf_event_header header; | 67 | struct perf_event_header header; |
68 | __u32 pid, tid; | 68 | u32 pid, tid; |
69 | char comm[16]; | 69 | char comm[16]; |
70 | }; | 70 | }; |
71 | 71 | ||
72 | struct fork_event { | 72 | struct fork_event { |
73 | struct perf_event_header header; | 73 | struct perf_event_header header; |
74 | __u32 pid, ppid; | 74 | u32 pid, ppid; |
75 | }; | 75 | }; |
76 | 76 | ||
77 | struct period_event { | 77 | struct period_event { |
78 | struct perf_event_header header; | 78 | struct perf_event_header header; |
79 | __u64 time; | 79 | u64 time; |
80 | __u64 id; | 80 | u64 id; |
81 | __u64 sample_period; | 81 | u64 sample_period; |
82 | }; | 82 | }; |
83 | 83 | ||
84 | typedef union event_union { | 84 | typedef union event_union { |
@@ -158,7 +158,7 @@ static void dsos__fprintf(FILE *fp) | |||
158 | dso__fprintf(pos, fp); | 158 | dso__fprintf(pos, fp); |
159 | } | 159 | } |
160 | 160 | ||
161 | static struct symbol *vdso__find_symbol(struct dso *dso, __u64 ip) | 161 | static struct symbol *vdso__find_symbol(struct dso *dso, u64 ip) |
162 | { | 162 | { |
163 | return dso__find_symbol(kernel_dso, ip); | 163 | return dso__find_symbol(kernel_dso, ip); |
164 | } | 164 | } |
@@ -191,19 +191,19 @@ static int load_kernel(void) | |||
191 | 191 | ||
192 | struct map { | 192 | struct map { |
193 | struct list_head node; | 193 | struct list_head node; |
194 | __u64 start; | 194 | u64 start; |
195 | __u64 end; | 195 | u64 end; |
196 | __u64 pgoff; | 196 | u64 pgoff; |
197 | __u64 (*map_ip)(struct map *, __u64); | 197 | u64 (*map_ip)(struct map *, u64); |
198 | struct dso *dso; | 198 | struct dso *dso; |
199 | }; | 199 | }; |
200 | 200 | ||
201 | static __u64 map__map_ip(struct map *map, __u64 ip) | 201 | static u64 map__map_ip(struct map *map, u64 ip) |
202 | { | 202 | { |
203 | return ip - map->start + map->pgoff; | 203 | return ip - map->start + map->pgoff; |
204 | } | 204 | } |
205 | 205 | ||
206 | static __u64 vdso__map_ip(struct map *map, __u64 ip) | 206 | static u64 vdso__map_ip(struct map *map, u64 ip) |
207 | { | 207 | { |
208 | return ip; | 208 | return ip; |
209 | } | 209 | } |
@@ -386,7 +386,7 @@ static int thread__fork(struct thread *self, struct thread *parent) | |||
386 | return 0; | 386 | return 0; |
387 | } | 387 | } |
388 | 388 | ||
389 | static struct map *thread__find_map(struct thread *self, __u64 ip) | 389 | static struct map *thread__find_map(struct thread *self, u64 ip) |
390 | { | 390 | { |
391 | struct map *pos; | 391 | struct map *pos; |
392 | 392 | ||
@@ -427,7 +427,7 @@ struct hist_entry { | |||
427 | struct map *map; | 427 | struct map *map; |
428 | struct dso *dso; | 428 | struct dso *dso; |
429 | struct symbol *sym; | 429 | struct symbol *sym; |
430 | __u64 ip; | 430 | u64 ip; |
431 | char level; | 431 | char level; |
432 | 432 | ||
433 | uint32_t count; | 433 | uint32_t count; |
@@ -532,7 +532,7 @@ sort__dso_print(FILE *fp, struct hist_entry *self) | |||
532 | if (self->dso) | 532 | if (self->dso) |
533 | return fprintf(fp, "%-25s", self->dso->name); | 533 | return fprintf(fp, "%-25s", self->dso->name); |
534 | 534 | ||
535 | return fprintf(fp, "%016llx ", (__u64)self->ip); | 535 | return fprintf(fp, "%016llx ", (u64)self->ip); |
536 | } | 536 | } |
537 | 537 | ||
538 | static struct sort_entry sort_dso = { | 538 | static struct sort_entry sort_dso = { |
@@ -546,7 +546,7 @@ static struct sort_entry sort_dso = { | |||
546 | static int64_t | 546 | static int64_t |
547 | sort__sym_cmp(struct hist_entry *left, struct hist_entry *right) | 547 | sort__sym_cmp(struct hist_entry *left, struct hist_entry *right) |
548 | { | 548 | { |
549 | __u64 ip_l, ip_r; | 549 | u64 ip_l, ip_r; |
550 | 550 | ||
551 | if (left->sym == right->sym) | 551 | if (left->sym == right->sym) |
552 | return 0; | 552 | return 0; |
@@ -563,13 +563,13 @@ sort__sym_print(FILE *fp, struct hist_entry *self) | |||
563 | size_t ret = 0; | 563 | size_t ret = 0; |
564 | 564 | ||
565 | if (verbose) | 565 | if (verbose) |
566 | ret += fprintf(fp, "%#018llx ", (__u64)self->ip); | 566 | ret += fprintf(fp, "%#018llx ", (u64)self->ip); |
567 | 567 | ||
568 | if (self->sym) { | 568 | if (self->sym) { |
569 | ret += fprintf(fp, "[%c] %s", | 569 | ret += fprintf(fp, "[%c] %s", |
570 | self->dso == kernel_dso ? 'k' : '.', self->sym->name); | 570 | self->dso == kernel_dso ? 'k' : '.', self->sym->name); |
571 | } else { | 571 | } else { |
572 | ret += fprintf(fp, "%#016llx", (__u64)self->ip); | 572 | ret += fprintf(fp, "%#016llx", (u64)self->ip); |
573 | } | 573 | } |
574 | 574 | ||
575 | return ret; | 575 | return ret; |
@@ -660,7 +660,7 @@ hist_entry__collapse(struct hist_entry *left, struct hist_entry *right) | |||
660 | /* | 660 | /* |
661 | * collect histogram counts | 661 | * collect histogram counts |
662 | */ | 662 | */ |
663 | static void hist_hit(struct hist_entry *he, __u64 ip) | 663 | static void hist_hit(struct hist_entry *he, u64 ip) |
664 | { | 664 | { |
665 | unsigned int sym_size, offset; | 665 | unsigned int sym_size, offset; |
666 | struct symbol *sym = he->sym; | 666 | struct symbol *sym = he->sym; |
@@ -689,7 +689,7 @@ static void hist_hit(struct hist_entry *he, __u64 ip) | |||
689 | 689 | ||
690 | static int | 690 | static int |
691 | hist_entry__add(struct thread *thread, struct map *map, struct dso *dso, | 691 | hist_entry__add(struct thread *thread, struct map *map, struct dso *dso, |
692 | struct symbol *sym, __u64 ip, char level) | 692 | struct symbol *sym, u64 ip, char level) |
693 | { | 693 | { |
694 | struct rb_node **p = &hist.rb_node; | 694 | struct rb_node **p = &hist.rb_node; |
695 | struct rb_node *parent = NULL; | 695 | struct rb_node *parent = NULL; |
@@ -861,7 +861,7 @@ process_overflow_event(event_t *event, unsigned long offset, unsigned long head) | |||
861 | int show = 0; | 861 | int show = 0; |
862 | struct dso *dso = NULL; | 862 | struct dso *dso = NULL; |
863 | struct thread *thread = threads__findnew(event->ip.pid); | 863 | struct thread *thread = threads__findnew(event->ip.pid); |
864 | __u64 ip = event->ip.ip; | 864 | u64 ip = event->ip.ip; |
865 | struct map *map = NULL; | 865 | struct map *map = NULL; |
866 | 866 | ||
867 | dprintf("%p [%p]: PERF_EVENT (IP, %d): %d: %p\n", | 867 | dprintf("%p [%p]: PERF_EVENT (IP, %d): %d: %p\n", |
@@ -1062,14 +1062,14 @@ static char *get_color(double percent) | |||
1062 | } | 1062 | } |
1063 | 1063 | ||
1064 | static int | 1064 | static int |
1065 | parse_line(FILE *file, struct symbol *sym, __u64 start, __u64 len) | 1065 | parse_line(FILE *file, struct symbol *sym, u64 start, u64 len) |
1066 | { | 1066 | { |
1067 | char *line = NULL, *tmp, *tmp2; | 1067 | char *line = NULL, *tmp, *tmp2; |
1068 | static const char *prev_line; | 1068 | static const char *prev_line; |
1069 | static const char *prev_color; | 1069 | static const char *prev_color; |
1070 | unsigned int offset; | 1070 | unsigned int offset; |
1071 | size_t line_len; | 1071 | size_t line_len; |
1072 | __u64 line_ip; | 1072 | u64 line_ip; |
1073 | int ret; | 1073 | int ret; |
1074 | char *c; | 1074 | char *c; |
1075 | 1075 | ||
@@ -1191,7 +1191,7 @@ static void free_source_line(struct symbol *sym, int len) | |||
1191 | 1191 | ||
1192 | /* Get the filename:line for the colored entries */ | 1192 | /* Get the filename:line for the colored entries */ |
1193 | static void | 1193 | static void |
1194 | get_source_line(struct symbol *sym, __u64 start, int len, char *filename) | 1194 | get_source_line(struct symbol *sym, u64 start, int len, char *filename) |
1195 | { | 1195 | { |
1196 | int i; | 1196 | int i; |
1197 | char cmd[PATH_MAX * 2]; | 1197 | char cmd[PATH_MAX * 2]; |
@@ -1209,7 +1209,7 @@ get_source_line(struct symbol *sym, __u64 start, int len, char *filename) | |||
1209 | for (i = 0; i < len; i++) { | 1209 | for (i = 0; i < len; i++) { |
1210 | char *path = NULL; | 1210 | char *path = NULL; |
1211 | size_t line_len; | 1211 | size_t line_len; |
1212 | __u64 offset; | 1212 | u64 offset; |
1213 | FILE *fp; | 1213 | FILE *fp; |
1214 | 1214 | ||
1215 | sym_ext[i].percent = 100.0 * sym->hist[i] / sym->hist_sum; | 1215 | sym_ext[i].percent = 100.0 * sym->hist[i] / sym->hist_sum; |
@@ -1269,7 +1269,7 @@ static void print_summary(char *filename) | |||
1269 | static void annotate_sym(struct dso *dso, struct symbol *sym) | 1269 | static void annotate_sym(struct dso *dso, struct symbol *sym) |
1270 | { | 1270 | { |
1271 | char *filename = dso->name; | 1271 | char *filename = dso->name; |
1272 | __u64 start, end, len; | 1272 | u64 start, end, len; |
1273 | char command[PATH_MAX*2]; | 1273 | char command[PATH_MAX*2]; |
1274 | FILE *file; | 1274 | FILE *file; |
1275 | 1275 | ||
@@ -1297,7 +1297,7 @@ static void annotate_sym(struct dso *dso, struct symbol *sym) | |||
1297 | if (verbose >= 2) | 1297 | if (verbose >= 2) |
1298 | printf("annotating [%p] %30s : [%p] %30s\n", dso, dso->name, sym, sym->name); | 1298 | printf("annotating [%p] %30s : [%p] %30s\n", dso, dso->name, sym, sym->name); |
1299 | 1299 | ||
1300 | sprintf(command, "objdump --start-address=0x%016Lx --stop-address=0x%016Lx -dS %s", (__u64)start, (__u64)end, filename); | 1300 | sprintf(command, "objdump --start-address=0x%016Lx --stop-address=0x%016Lx -dS %s", (u64)start, (u64)end, filename); |
1301 | 1301 | ||
1302 | if (verbose >= 3) | 1302 | if (verbose >= 3) |
1303 | printf("doing: %s\n", command); | 1303 | printf("doing: %s\n", command); |
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index 28304677c73e..e2cebc053bd7 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c | |||
@@ -44,7 +44,7 @@ static long samples; | |||
44 | static struct timeval last_read; | 44 | static struct timeval last_read; |
45 | static struct timeval this_read; | 45 | static struct timeval this_read; |
46 | 46 | ||
47 | static __u64 bytes_written; | 47 | static u64 bytes_written; |
48 | 48 | ||
49 | static struct pollfd event_array[MAX_NR_CPUS * MAX_COUNTERS]; | 49 | static struct pollfd event_array[MAX_NR_CPUS * MAX_COUNTERS]; |
50 | 50 | ||
@@ -56,18 +56,18 @@ static struct perf_file_header file_header; | |||
56 | 56 | ||
57 | struct mmap_event { | 57 | struct mmap_event { |
58 | struct perf_event_header header; | 58 | struct perf_event_header header; |
59 | __u32 pid; | 59 | u32 pid; |
60 | __u32 tid; | 60 | u32 tid; |
61 | __u64 start; | 61 | u64 start; |
62 | __u64 len; | 62 | u64 len; |
63 | __u64 pgoff; | 63 | u64 pgoff; |
64 | char filename[PATH_MAX]; | 64 | char filename[PATH_MAX]; |
65 | }; | 65 | }; |
66 | 66 | ||
67 | struct comm_event { | 67 | struct comm_event { |
68 | struct perf_event_header header; | 68 | struct perf_event_header header; |
69 | __u32 pid; | 69 | u32 pid; |
70 | __u32 tid; | 70 | u32 tid; |
71 | char comm[16]; | 71 | char comm[16]; |
72 | }; | 72 | }; |
73 | 73 | ||
@@ -238,7 +238,7 @@ static void pid_synthesize_comm_event(pid_t pid, int full) | |||
238 | 238 | ||
239 | comm_ev.pid = pid; | 239 | comm_ev.pid = pid; |
240 | comm_ev.header.type = PERF_EVENT_COMM; | 240 | comm_ev.header.type = PERF_EVENT_COMM; |
241 | size = ALIGN(size, sizeof(__u64)); | 241 | size = ALIGN(size, sizeof(u64)); |
242 | comm_ev.header.size = sizeof(comm_ev) - (sizeof(comm_ev.comm) - size); | 242 | comm_ev.header.size = sizeof(comm_ev) - (sizeof(comm_ev.comm) - size); |
243 | 243 | ||
244 | if (!full) { | 244 | if (!full) { |
@@ -315,7 +315,7 @@ static void pid_synthesize_mmap_samples(pid_t pid) | |||
315 | size = strlen(execname); | 315 | size = strlen(execname); |
316 | execname[size - 1] = '\0'; /* Remove \n */ | 316 | execname[size - 1] = '\0'; /* Remove \n */ |
317 | memcpy(mmap_ev.filename, execname, size); | 317 | memcpy(mmap_ev.filename, execname, size); |
318 | size = ALIGN(size, sizeof(__u64)); | 318 | size = ALIGN(size, sizeof(u64)); |
319 | mmap_ev.len -= mmap_ev.start; | 319 | mmap_ev.len -= mmap_ev.start; |
320 | mmap_ev.header.size = (sizeof(mmap_ev) - | 320 | mmap_ev.header.size = (sizeof(mmap_ev) - |
321 | (sizeof(mmap_ev.filename) - size)); | 321 | (sizeof(mmap_ev.filename) - size)); |
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index 37b26ecb0d0b..de1b97845e9e 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c | |||
@@ -54,47 +54,47 @@ static int exclude_other = 1; | |||
54 | 54 | ||
55 | struct ip_event { | 55 | struct ip_event { |
56 | struct perf_event_header header; | 56 | struct perf_event_header header; |
57 | __u64 ip; | 57 | u64 ip; |
58 | __u32 pid, tid; | 58 | u32 pid, tid; |
59 | unsigned char __more_data[]; | 59 | unsigned char __more_data[]; |
60 | }; | 60 | }; |
61 | 61 | ||
62 | struct ip_callchain { | 62 | struct ip_callchain { |
63 | __u64 nr; | 63 | u64 nr; |
64 | __u64 ips[0]; | 64 | u64 ips[0]; |
65 | }; | 65 | }; |
66 | 66 | ||
67 | struct mmap_event { | 67 | struct mmap_event { |
68 | struct perf_event_header header; | 68 | struct perf_event_header header; |
69 | __u32 pid, tid; | 69 | u32 pid, tid; |
70 | __u64 start; | 70 | u64 start; |
71 | __u64 len; | 71 | u64 len; |
72 | __u64 pgoff; | 72 | u64 pgoff; |
73 | char filename[PATH_MAX]; | 73 | char filename[PATH_MAX]; |
74 | }; | 74 | }; |
75 | 75 | ||
76 | struct comm_event { | 76 | struct comm_event { |
77 | struct perf_event_header header; | 77 | struct perf_event_header header; |
78 | __u32 pid, tid; | 78 | u32 pid, tid; |
79 | char comm[16]; | 79 | char comm[16]; |
80 | }; | 80 | }; |
81 | 81 | ||
82 | struct fork_event { | 82 | struct fork_event { |
83 | struct perf_event_header header; | 83 | struct perf_event_header header; |
84 | __u32 pid, ppid; | 84 | u32 pid, ppid; |
85 | }; | 85 | }; |
86 | 86 | ||
87 | struct period_event { | 87 | struct period_event { |
88 | struct perf_event_header header; | 88 | struct perf_event_header header; |
89 | __u64 time; | 89 | u64 time; |
90 | __u64 id; | 90 | u64 id; |
91 | __u64 sample_period; | 91 | u64 sample_period; |
92 | }; | 92 | }; |
93 | 93 | ||
94 | struct lost_event { | 94 | struct lost_event { |
95 | struct perf_event_header header; | 95 | struct perf_event_header header; |
96 | __u64 id; | 96 | u64 id; |
97 | __u64 lost; | 97 | u64 lost; |
98 | }; | 98 | }; |
99 | 99 | ||
100 | typedef union event_union { | 100 | typedef union event_union { |
@@ -163,7 +163,7 @@ static void dsos__fprintf(FILE *fp) | |||
163 | dso__fprintf(pos, fp); | 163 | dso__fprintf(pos, fp); |
164 | } | 164 | } |
165 | 165 | ||
166 | static struct symbol *vdso__find_symbol(struct dso *dso, __u64 ip) | 166 | static struct symbol *vdso__find_symbol(struct dso *dso, u64 ip) |
167 | { | 167 | { |
168 | return dso__find_symbol(kernel_dso, ip); | 168 | return dso__find_symbol(kernel_dso, ip); |
169 | } | 169 | } |
@@ -210,19 +210,19 @@ static int strcommon(const char *pathname) | |||
210 | 210 | ||
211 | struct map { | 211 | struct map { |
212 | struct list_head node; | 212 | struct list_head node; |
213 | __u64 start; | 213 | u64 start; |
214 | __u64 end; | 214 | u64 end; |
215 | __u64 pgoff; | 215 | u64 pgoff; |
216 | __u64 (*map_ip)(struct map *, __u64); | 216 | u64 (*map_ip)(struct map *, u64); |
217 | struct dso *dso; | 217 | struct dso *dso; |
218 | }; | 218 | }; |
219 | 219 | ||
220 | static __u64 map__map_ip(struct map *map, __u64 ip) | 220 | static u64 map__map_ip(struct map *map, u64 ip) |
221 | { | 221 | { |
222 | return ip - map->start + map->pgoff; | 222 | return ip - map->start + map->pgoff; |
223 | } | 223 | } |
224 | 224 | ||
225 | static __u64 vdso__map_ip(struct map *map, __u64 ip) | 225 | static u64 vdso__map_ip(struct map *map, u64 ip) |
226 | { | 226 | { |
227 | return ip; | 227 | return ip; |
228 | } | 228 | } |
@@ -429,7 +429,7 @@ static int thread__fork(struct thread *self, struct thread *parent) | |||
429 | return 0; | 429 | return 0; |
430 | } | 430 | } |
431 | 431 | ||
432 | static struct map *thread__find_map(struct thread *self, __u64 ip) | 432 | static struct map *thread__find_map(struct thread *self, u64 ip) |
433 | { | 433 | { |
434 | struct map *pos; | 434 | struct map *pos; |
435 | 435 | ||
@@ -471,10 +471,10 @@ struct hist_entry { | |||
471 | struct dso *dso; | 471 | struct dso *dso; |
472 | struct symbol *sym; | 472 | struct symbol *sym; |
473 | struct symbol *parent; | 473 | struct symbol *parent; |
474 | __u64 ip; | 474 | u64 ip; |
475 | char level; | 475 | char level; |
476 | 476 | ||
477 | __u64 count; | 477 | u64 count; |
478 | }; | 478 | }; |
479 | 479 | ||
480 | /* | 480 | /* |
@@ -574,7 +574,7 @@ sort__dso_print(FILE *fp, struct hist_entry *self) | |||
574 | if (self->dso) | 574 | if (self->dso) |
575 | return fprintf(fp, "%-25s", self->dso->name); | 575 | return fprintf(fp, "%-25s", self->dso->name); |
576 | 576 | ||
577 | return fprintf(fp, "%016llx ", (__u64)self->ip); | 577 | return fprintf(fp, "%016llx ", (u64)self->ip); |
578 | } | 578 | } |
579 | 579 | ||
580 | static struct sort_entry sort_dso = { | 580 | static struct sort_entry sort_dso = { |
@@ -588,7 +588,7 @@ static struct sort_entry sort_dso = { | |||
588 | static int64_t | 588 | static int64_t |
589 | sort__sym_cmp(struct hist_entry *left, struct hist_entry *right) | 589 | sort__sym_cmp(struct hist_entry *left, struct hist_entry *right) |
590 | { | 590 | { |
591 | __u64 ip_l, ip_r; | 591 | u64 ip_l, ip_r; |
592 | 592 | ||
593 | if (left->sym == right->sym) | 593 | if (left->sym == right->sym) |
594 | return 0; | 594 | return 0; |
@@ -605,13 +605,13 @@ sort__sym_print(FILE *fp, struct hist_entry *self) | |||
605 | size_t ret = 0; | 605 | size_t ret = 0; |
606 | 606 | ||
607 | if (verbose) | 607 | if (verbose) |
608 | ret += fprintf(fp, "%#018llx ", (__u64)self->ip); | 608 | ret += fprintf(fp, "%#018llx ", (u64)self->ip); |
609 | 609 | ||
610 | if (self->sym) { | 610 | if (self->sym) { |
611 | ret += fprintf(fp, "[%c] %s", | 611 | ret += fprintf(fp, "[%c] %s", |
612 | self->dso == kernel_dso ? 'k' : '.', self->sym->name); | 612 | self->dso == kernel_dso ? 'k' : '.', self->sym->name); |
613 | } else { | 613 | } else { |
614 | ret += fprintf(fp, "%#016llx", (__u64)self->ip); | 614 | ret += fprintf(fp, "%#016llx", (u64)self->ip); |
615 | } | 615 | } |
616 | 616 | ||
617 | return ret; | 617 | return ret; |
@@ -745,7 +745,7 @@ hist_entry__collapse(struct hist_entry *left, struct hist_entry *right) | |||
745 | } | 745 | } |
746 | 746 | ||
747 | static size_t | 747 | static size_t |
748 | hist_entry__fprintf(FILE *fp, struct hist_entry *self, __u64 total_samples) | 748 | hist_entry__fprintf(FILE *fp, struct hist_entry *self, u64 total_samples) |
749 | { | 749 | { |
750 | struct sort_entry *se; | 750 | struct sort_entry *se; |
751 | size_t ret; | 751 | size_t ret; |
@@ -793,7 +793,7 @@ hist_entry__fprintf(FILE *fp, struct hist_entry *self, __u64 total_samples) | |||
793 | 793 | ||
794 | static struct symbol * | 794 | static struct symbol * |
795 | resolve_symbol(struct thread *thread, struct map **mapp, | 795 | resolve_symbol(struct thread *thread, struct map **mapp, |
796 | struct dso **dsop, __u64 *ipp) | 796 | struct dso **dsop, u64 *ipp) |
797 | { | 797 | { |
798 | struct dso *dso = dsop ? *dsop : NULL; | 798 | struct dso *dso = dsop ? *dsop : NULL; |
799 | struct map *map = mapp ? *mapp : NULL; | 799 | struct map *map = mapp ? *mapp : NULL; |
@@ -852,8 +852,8 @@ static int call__match(struct symbol *sym) | |||
852 | 852 | ||
853 | static int | 853 | static int |
854 | hist_entry__add(struct thread *thread, struct map *map, struct dso *dso, | 854 | hist_entry__add(struct thread *thread, struct map *map, struct dso *dso, |
855 | struct symbol *sym, __u64 ip, struct ip_callchain *chain, | 855 | struct symbol *sym, u64 ip, struct ip_callchain *chain, |
856 | char level, __u64 count) | 856 | char level, u64 count) |
857 | { | 857 | { |
858 | struct rb_node **p = &hist.rb_node; | 858 | struct rb_node **p = &hist.rb_node; |
859 | struct rb_node *parent = NULL; | 859 | struct rb_node *parent = NULL; |
@@ -871,11 +871,11 @@ hist_entry__add(struct thread *thread, struct map *map, struct dso *dso, | |||
871 | int cmp; | 871 | int cmp; |
872 | 872 | ||
873 | if (sort__has_parent && chain) { | 873 | if (sort__has_parent && chain) { |
874 | __u64 context = PERF_CONTEXT_MAX; | 874 | u64 context = PERF_CONTEXT_MAX; |
875 | int i; | 875 | int i; |
876 | 876 | ||
877 | for (i = 0; i < chain->nr; i++) { | 877 | for (i = 0; i < chain->nr; i++) { |
878 | __u64 ip = chain->ips[i]; | 878 | u64 ip = chain->ips[i]; |
879 | struct dso *dso = NULL; | 879 | struct dso *dso = NULL; |
880 | struct symbol *sym; | 880 | struct symbol *sym; |
881 | 881 | ||
@@ -1032,7 +1032,7 @@ static void output__resort(void) | |||
1032 | } | 1032 | } |
1033 | } | 1033 | } |
1034 | 1034 | ||
1035 | static size_t output__fprintf(FILE *fp, __u64 total_samples) | 1035 | static size_t output__fprintf(FILE *fp, u64 total_samples) |
1036 | { | 1036 | { |
1037 | struct hist_entry *pos; | 1037 | struct hist_entry *pos; |
1038 | struct sort_entry *se; | 1038 | struct sort_entry *se; |
@@ -1041,7 +1041,7 @@ static size_t output__fprintf(FILE *fp, __u64 total_samples) | |||
1041 | 1041 | ||
1042 | fprintf(fp, "\n"); | 1042 | fprintf(fp, "\n"); |
1043 | fprintf(fp, "#\n"); | 1043 | fprintf(fp, "#\n"); |
1044 | fprintf(fp, "# (%Ld samples)\n", (__u64)total_samples); | 1044 | fprintf(fp, "# (%Ld samples)\n", (u64)total_samples); |
1045 | fprintf(fp, "#\n"); | 1045 | fprintf(fp, "#\n"); |
1046 | 1046 | ||
1047 | fprintf(fp, "# Overhead"); | 1047 | fprintf(fp, "# Overhead"); |
@@ -1108,7 +1108,7 @@ static int validate_chain(struct ip_callchain *chain, event_t *event) | |||
1108 | chain_size = event->header.size; | 1108 | chain_size = event->header.size; |
1109 | chain_size -= (unsigned long)&event->ip.__more_data - (unsigned long)event; | 1109 | chain_size -= (unsigned long)&event->ip.__more_data - (unsigned long)event; |
1110 | 1110 | ||
1111 | if (chain->nr*sizeof(__u64) > chain_size) | 1111 | if (chain->nr*sizeof(u64) > chain_size) |
1112 | return -1; | 1112 | return -1; |
1113 | 1113 | ||
1114 | return 0; | 1114 | return 0; |
@@ -1121,15 +1121,15 @@ process_overflow_event(event_t *event, unsigned long offset, unsigned long head) | |||
1121 | int show = 0; | 1121 | int show = 0; |
1122 | struct dso *dso = NULL; | 1122 | struct dso *dso = NULL; |
1123 | struct thread *thread = threads__findnew(event->ip.pid); | 1123 | struct thread *thread = threads__findnew(event->ip.pid); |
1124 | __u64 ip = event->ip.ip; | 1124 | u64 ip = event->ip.ip; |
1125 | __u64 period = 1; | 1125 | u64 period = 1; |
1126 | struct map *map = NULL; | 1126 | struct map *map = NULL; |
1127 | void *more_data = event->ip.__more_data; | 1127 | void *more_data = event->ip.__more_data; |
1128 | struct ip_callchain *chain = NULL; | 1128 | struct ip_callchain *chain = NULL; |
1129 | 1129 | ||
1130 | if (event->header.type & PERF_SAMPLE_PERIOD) { | 1130 | if (event->header.type & PERF_SAMPLE_PERIOD) { |
1131 | period = *(__u64 *)more_data; | 1131 | period = *(u64 *)more_data; |
1132 | more_data += sizeof(__u64); | 1132 | more_data += sizeof(u64); |
1133 | } | 1133 | } |
1134 | 1134 | ||
1135 | dprintf("%p [%p]: PERF_EVENT (IP, %d): %d: %p period: %Ld\n", | 1135 | dprintf("%p [%p]: PERF_EVENT (IP, %d): %d: %p period: %Ld\n", |
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index e5b3c0ff03a9..6d3eeac1ea25 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c | |||
@@ -85,29 +85,29 @@ static const unsigned int default_count[] = { | |||
85 | static int run_count = 1; | 85 | static int run_count = 1; |
86 | static int run_idx = 0; | 86 | static int run_idx = 0; |
87 | 87 | ||
88 | static __u64 event_res[MAX_RUN][MAX_COUNTERS][3]; | 88 | static u64 event_res[MAX_RUN][MAX_COUNTERS][3]; |
89 | static __u64 event_scaled[MAX_RUN][MAX_COUNTERS]; | 89 | static u64 event_scaled[MAX_RUN][MAX_COUNTERS]; |
90 | 90 | ||
91 | //static __u64 event_hist[MAX_RUN][MAX_COUNTERS][3]; | 91 | //static u64 event_hist[MAX_RUN][MAX_COUNTERS][3]; |
92 | 92 | ||
93 | 93 | ||
94 | static __u64 runtime_nsecs[MAX_RUN]; | 94 | static u64 runtime_nsecs[MAX_RUN]; |
95 | static __u64 walltime_nsecs[MAX_RUN]; | 95 | static u64 walltime_nsecs[MAX_RUN]; |
96 | static __u64 runtime_cycles[MAX_RUN]; | 96 | static u64 runtime_cycles[MAX_RUN]; |
97 | 97 | ||
98 | static __u64 event_res_avg[MAX_COUNTERS][3]; | 98 | static u64 event_res_avg[MAX_COUNTERS][3]; |
99 | static __u64 event_res_noise[MAX_COUNTERS][3]; | 99 | static u64 event_res_noise[MAX_COUNTERS][3]; |
100 | 100 | ||
101 | static __u64 event_scaled_avg[MAX_COUNTERS]; | 101 | static u64 event_scaled_avg[MAX_COUNTERS]; |
102 | 102 | ||
103 | static __u64 runtime_nsecs_avg; | 103 | static u64 runtime_nsecs_avg; |
104 | static __u64 runtime_nsecs_noise; | 104 | static u64 runtime_nsecs_noise; |
105 | 105 | ||
106 | static __u64 walltime_nsecs_avg; | 106 | static u64 walltime_nsecs_avg; |
107 | static __u64 walltime_nsecs_noise; | 107 | static u64 walltime_nsecs_noise; |
108 | 108 | ||
109 | static __u64 runtime_cycles_avg; | 109 | static u64 runtime_cycles_avg; |
110 | static __u64 runtime_cycles_noise; | 110 | static u64 runtime_cycles_noise; |
111 | 111 | ||
112 | static void create_perf_stat_counter(int counter) | 112 | static void create_perf_stat_counter(int counter) |
113 | { | 113 | { |
@@ -158,7 +158,7 @@ static inline int nsec_counter(int counter) | |||
158 | */ | 158 | */ |
159 | static void read_counter(int counter) | 159 | static void read_counter(int counter) |
160 | { | 160 | { |
161 | __u64 *count, single_count[3]; | 161 | u64 *count, single_count[3]; |
162 | ssize_t res; | 162 | ssize_t res; |
163 | int cpu, nv; | 163 | int cpu, nv; |
164 | int scaled; | 164 | int scaled; |
@@ -172,8 +172,8 @@ static void read_counter(int counter) | |||
172 | if (fd[cpu][counter] < 0) | 172 | if (fd[cpu][counter] < 0) |
173 | continue; | 173 | continue; |
174 | 174 | ||
175 | res = read(fd[cpu][counter], single_count, nv * sizeof(__u64)); | 175 | res = read(fd[cpu][counter], single_count, nv * sizeof(u64)); |
176 | assert(res == nv * sizeof(__u64)); | 176 | assert(res == nv * sizeof(u64)); |
177 | close(fd[cpu][counter]); | 177 | close(fd[cpu][counter]); |
178 | fd[cpu][counter] = -1; | 178 | fd[cpu][counter] = -1; |
179 | 179 | ||
@@ -251,14 +251,14 @@ static int run_perf_stat(int argc, const char **argv) | |||
251 | return WEXITSTATUS(status); | 251 | return WEXITSTATUS(status); |
252 | } | 252 | } |
253 | 253 | ||
254 | static void print_noise(__u64 *count, __u64 *noise) | 254 | static void print_noise(u64 *count, u64 *noise) |
255 | { | 255 | { |
256 | if (run_count > 1) | 256 | if (run_count > 1) |
257 | fprintf(stderr, " ( +- %7.3f%% )", | 257 | fprintf(stderr, " ( +- %7.3f%% )", |
258 | (double)noise[0]/(count[0]+1)*100.0); | 258 | (double)noise[0]/(count[0]+1)*100.0); |
259 | } | 259 | } |
260 | 260 | ||
261 | static void nsec_printout(int counter, __u64 *count, __u64 *noise) | 261 | static void nsec_printout(int counter, u64 *count, u64 *noise) |
262 | { | 262 | { |
263 | double msecs = (double)count[0] / 1000000; | 263 | double msecs = (double)count[0] / 1000000; |
264 | 264 | ||
@@ -274,7 +274,7 @@ static void nsec_printout(int counter, __u64 *count, __u64 *noise) | |||
274 | print_noise(count, noise); | 274 | print_noise(count, noise); |
275 | } | 275 | } |
276 | 276 | ||
277 | static void abs_printout(int counter, __u64 *count, __u64 *noise) | 277 | static void abs_printout(int counter, u64 *count, u64 *noise) |
278 | { | 278 | { |
279 | fprintf(stderr, " %14Ld %-20s", count[0], event_name(counter)); | 279 | fprintf(stderr, " %14Ld %-20s", count[0], event_name(counter)); |
280 | 280 | ||
@@ -298,7 +298,7 @@ static void abs_printout(int counter, __u64 *count, __u64 *noise) | |||
298 | */ | 298 | */ |
299 | static void print_counter(int counter) | 299 | static void print_counter(int counter) |
300 | { | 300 | { |
301 | __u64 *count, *noise; | 301 | u64 *count, *noise; |
302 | int scaled; | 302 | int scaled; |
303 | 303 | ||
304 | count = event_res_avg[counter]; | 304 | count = event_res_avg[counter]; |
@@ -326,16 +326,16 @@ static void print_counter(int counter) | |||
326 | /* | 326 | /* |
327 | * normalize_noise noise values down to stddev: | 327 | * normalize_noise noise values down to stddev: |
328 | */ | 328 | */ |
329 | static void normalize_noise(__u64 *val) | 329 | static void normalize_noise(u64 *val) |
330 | { | 330 | { |
331 | double res; | 331 | double res; |
332 | 332 | ||
333 | res = (double)*val / (run_count * sqrt((double)run_count)); | 333 | res = (double)*val / (run_count * sqrt((double)run_count)); |
334 | 334 | ||
335 | *val = (__u64)res; | 335 | *val = (u64)res; |
336 | } | 336 | } |
337 | 337 | ||
338 | static void update_avg(const char *name, int idx, __u64 *avg, __u64 *val) | 338 | static void update_avg(const char *name, int idx, u64 *avg, u64 *val) |
339 | { | 339 | { |
340 | *avg += *val; | 340 | *avg += *val; |
341 | 341 | ||
@@ -380,19 +380,19 @@ static void calc_avg(void) | |||
380 | 380 | ||
381 | for (i = 0; i < run_count; i++) { | 381 | for (i = 0; i < run_count; i++) { |
382 | runtime_nsecs_noise += | 382 | runtime_nsecs_noise += |
383 | abs((__s64)(runtime_nsecs[i] - runtime_nsecs_avg)); | 383 | abs((s64)(runtime_nsecs[i] - runtime_nsecs_avg)); |
384 | walltime_nsecs_noise += | 384 | walltime_nsecs_noise += |
385 | abs((__s64)(walltime_nsecs[i] - walltime_nsecs_avg)); | 385 | abs((s64)(walltime_nsecs[i] - walltime_nsecs_avg)); |
386 | runtime_cycles_noise += | 386 | runtime_cycles_noise += |
387 | abs((__s64)(runtime_cycles[i] - runtime_cycles_avg)); | 387 | abs((s64)(runtime_cycles[i] - runtime_cycles_avg)); |
388 | 388 | ||
389 | for (j = 0; j < nr_counters; j++) { | 389 | for (j = 0; j < nr_counters; j++) { |
390 | event_res_noise[j][0] += | 390 | event_res_noise[j][0] += |
391 | abs((__s64)(event_res[i][j][0] - event_res_avg[j][0])); | 391 | abs((s64)(event_res[i][j][0] - event_res_avg[j][0])); |
392 | event_res_noise[j][1] += | 392 | event_res_noise[j][1] += |
393 | abs((__s64)(event_res[i][j][1] - event_res_avg[j][1])); | 393 | abs((s64)(event_res[i][j][1] - event_res_avg[j][1])); |
394 | event_res_noise[j][2] += | 394 | event_res_noise[j][2] += |
395 | abs((__s64)(event_res[i][j][2] - event_res_avg[j][2])); | 395 | abs((s64)(event_res[i][j][2] - event_res_avg[j][2])); |
396 | } | 396 | } |
397 | } | 397 | } |
398 | 398 | ||
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index fe338d3c5d7e..5352b5e352ed 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c | |||
@@ -54,7 +54,7 @@ static int system_wide = 0; | |||
54 | 54 | ||
55 | static int default_interval = 100000; | 55 | static int default_interval = 100000; |
56 | 56 | ||
57 | static __u64 count_filter = 5; | 57 | static u64 count_filter = 5; |
58 | static int print_entries = 15; | 58 | static int print_entries = 15; |
59 | 59 | ||
60 | static int target_pid = -1; | 60 | static int target_pid = -1; |
@@ -79,8 +79,8 @@ static int dump_symtab; | |||
79 | * Symbols | 79 | * Symbols |
80 | */ | 80 | */ |
81 | 81 | ||
82 | static __u64 min_ip; | 82 | static u64 min_ip; |
83 | static __u64 max_ip = -1ll; | 83 | static u64 max_ip = -1ll; |
84 | 84 | ||
85 | struct sym_entry { | 85 | struct sym_entry { |
86 | struct rb_node rb_node; | 86 | struct rb_node rb_node; |
@@ -194,7 +194,7 @@ static void print_sym_table(void) | |||
194 | 100.0 - (100.0*((samples_per_sec-ksamples_per_sec)/samples_per_sec))); | 194 | 100.0 - (100.0*((samples_per_sec-ksamples_per_sec)/samples_per_sec))); |
195 | 195 | ||
196 | if (nr_counters == 1) { | 196 | if (nr_counters == 1) { |
197 | printf("%Ld", attrs[0].sample_period); | 197 | printf("%Ld", (u64)attrs[0].sample_period); |
198 | if (freq) | 198 | if (freq) |
199 | printf("Hz "); | 199 | printf("Hz "); |
200 | else | 200 | else |
@@ -372,7 +372,7 @@ out_delete_dso: | |||
372 | /* | 372 | /* |
373 | * Binary search in the histogram table and record the hit: | 373 | * Binary search in the histogram table and record the hit: |
374 | */ | 374 | */ |
375 | static void record_ip(__u64 ip, int counter) | 375 | static void record_ip(u64 ip, int counter) |
376 | { | 376 | { |
377 | struct symbol *sym = dso__find_symbol(kernel_dso, ip); | 377 | struct symbol *sym = dso__find_symbol(kernel_dso, ip); |
378 | 378 | ||
@@ -392,7 +392,7 @@ static void record_ip(__u64 ip, int counter) | |||
392 | samples--; | 392 | samples--; |
393 | } | 393 | } |
394 | 394 | ||
395 | static void process_event(__u64 ip, int counter) | 395 | static void process_event(u64 ip, int counter) |
396 | { | 396 | { |
397 | samples++; | 397 | samples++; |
398 | 398 | ||
@@ -463,15 +463,15 @@ static void mmap_read_counter(struct mmap_data *md) | |||
463 | for (; old != head;) { | 463 | for (; old != head;) { |
464 | struct ip_event { | 464 | struct ip_event { |
465 | struct perf_event_header header; | 465 | struct perf_event_header header; |
466 | __u64 ip; | 466 | u64 ip; |
467 | __u32 pid, target_pid; | 467 | u32 pid, target_pid; |
468 | }; | 468 | }; |
469 | struct mmap_event { | 469 | struct mmap_event { |
470 | struct perf_event_header header; | 470 | struct perf_event_header header; |
471 | __u32 pid, target_pid; | 471 | u32 pid, target_pid; |
472 | __u64 start; | 472 | u64 start; |
473 | __u64 len; | 473 | u64 len; |
474 | __u64 pgoff; | 474 | u64 pgoff; |
475 | char filename[PATH_MAX]; | 475 | char filename[PATH_MAX]; |
476 | }; | 476 | }; |
477 | 477 | ||
diff --git a/tools/perf/perf.h b/tools/perf/perf.h index 55c62f4b990b..bccb529dac08 100644 --- a/tools/perf/perf.h +++ b/tools/perf/perf.h | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <sys/syscall.h> | 19 | #include <sys/syscall.h> |
20 | 20 | ||
21 | #include "../../include/linux/perf_counter.h" | 21 | #include "../../include/linux/perf_counter.h" |
22 | #include "types.h" | ||
22 | 23 | ||
23 | /* | 24 | /* |
24 | * prctl(PR_TASK_PERF_COUNTERS_DISABLE) will (cheaply) disable all | 25 | * prctl(PR_TASK_PERF_COUNTERS_DISABLE) will (cheaply) disable all |
@@ -66,9 +67,9 @@ sys_perf_counter_open(struct perf_counter_attr *attr, | |||
66 | #define MAX_NR_CPUS 256 | 67 | #define MAX_NR_CPUS 256 |
67 | 68 | ||
68 | struct perf_file_header { | 69 | struct perf_file_header { |
69 | __u64 version; | 70 | u64 version; |
70 | __u64 sample_type; | 71 | u64 sample_type; |
71 | __u64 data_size; | 72 | u64 data_size; |
72 | }; | 73 | }; |
73 | 74 | ||
74 | #endif | 75 | #endif |
diff --git a/tools/perf/types.h b/tools/perf/types.h new file mode 100644 index 000000000000..5e75f9005940 --- /dev/null +++ b/tools/perf/types.h | |||
@@ -0,0 +1,17 @@ | |||
1 | #ifndef _PERF_TYPES_H | ||
2 | #define _PERF_TYPES_H | ||
3 | |||
4 | /* | ||
5 | * We define u64 as unsigned long long for every architecture | ||
6 | * so that we can print it with %Lx without getting warnings. | ||
7 | */ | ||
8 | typedef unsigned long long u64; | ||
9 | typedef signed long long s64; | ||
10 | typedef unsigned int u32; | ||
11 | typedef signed int s32; | ||
12 | typedef unsigned short u16; | ||
13 | typedef signed short s16; | ||
14 | typedef unsigned char u8; | ||
15 | typedef signed char s8; | ||
16 | |||
17 | #endif /* _PERF_TYPES_H */ | ||
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index f0c9f2627fe1..35d04da38d6a 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c | |||
@@ -13,8 +13,8 @@ int nr_counters; | |||
13 | struct perf_counter_attr attrs[MAX_COUNTERS]; | 13 | struct perf_counter_attr attrs[MAX_COUNTERS]; |
14 | 14 | ||
15 | struct event_symbol { | 15 | struct event_symbol { |
16 | __u8 type; | 16 | u8 type; |
17 | __u64 config; | 17 | u64 config; |
18 | char *symbol; | 18 | char *symbol; |
19 | }; | 19 | }; |
20 | 20 | ||
@@ -96,7 +96,7 @@ static char *hw_cache_result [][MAX_ALIASES] = { | |||
96 | 96 | ||
97 | char *event_name(int counter) | 97 | char *event_name(int counter) |
98 | { | 98 | { |
99 | __u64 config = attrs[counter].config; | 99 | u64 config = attrs[counter].config; |
100 | int type = attrs[counter].type; | 100 | int type = attrs[counter].type; |
101 | static char buf[32]; | 101 | static char buf[32]; |
102 | 102 | ||
@@ -112,7 +112,7 @@ char *event_name(int counter) | |||
112 | return "unknown-hardware"; | 112 | return "unknown-hardware"; |
113 | 113 | ||
114 | case PERF_TYPE_HW_CACHE: { | 114 | case PERF_TYPE_HW_CACHE: { |
115 | __u8 cache_type, cache_op, cache_result; | 115 | u8 cache_type, cache_op, cache_result; |
116 | static char name[100]; | 116 | static char name[100]; |
117 | 117 | ||
118 | cache_type = (config >> 0) & 0xff; | 118 | cache_type = (config >> 0) & 0xff; |
@@ -202,7 +202,7 @@ static int parse_generic_hw_symbols(const char *str, struct perf_counter_attr *a | |||
202 | */ | 202 | */ |
203 | static int parse_event_symbols(const char *str, struct perf_counter_attr *attr) | 203 | static int parse_event_symbols(const char *str, struct perf_counter_attr *attr) |
204 | { | 204 | { |
205 | __u64 config, id; | 205 | u64 config, id; |
206 | int type; | 206 | int type; |
207 | unsigned int i; | 207 | unsigned int i; |
208 | const char *sep, *pstr; | 208 | const char *sep, *pstr; |
diff --git a/tools/perf/util/string.c b/tools/perf/util/string.c index ec33c0c7f4e2..c93eca9a7be3 100644 --- a/tools/perf/util/string.c +++ b/tools/perf/util/string.c | |||
@@ -15,7 +15,7 @@ static int hex(char ch) | |||
15 | * While we find nice hex chars, build a long_val. | 15 | * While we find nice hex chars, build a long_val. |
16 | * Return number of chars processed. | 16 | * Return number of chars processed. |
17 | */ | 17 | */ |
18 | int hex2u64(const char *ptr, __u64 *long_val) | 18 | int hex2u64(const char *ptr, u64 *long_val) |
19 | { | 19 | { |
20 | const char *p = ptr; | 20 | const char *p = ptr; |
21 | *long_val = 0; | 21 | *long_val = 0; |
diff --git a/tools/perf/util/string.h b/tools/perf/util/string.h index 72812c1c9a7a..37b03255b425 100644 --- a/tools/perf/util/string.h +++ b/tools/perf/util/string.h | |||
@@ -1,8 +1,8 @@ | |||
1 | #ifndef _PERF_STRING_H_ | 1 | #ifndef _PERF_STRING_H_ |
2 | #define _PERF_STRING_H_ | 2 | #define _PERF_STRING_H_ |
3 | 3 | ||
4 | #include <linux/types.h> | 4 | #include "../types.h" |
5 | 5 | ||
6 | int hex2u64(const char *ptr, __u64 *val); | 6 | int hex2u64(const char *ptr, u64 *val); |
7 | 7 | ||
8 | #endif | 8 | #endif |
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index 49a55f813712..86e14375e74e 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c | |||
@@ -9,9 +9,9 @@ | |||
9 | 9 | ||
10 | const char *sym_hist_filter; | 10 | const char *sym_hist_filter; |
11 | 11 | ||
12 | static struct symbol *symbol__new(__u64 start, __u64 len, | 12 | static struct symbol *symbol__new(u64 start, u64 len, |
13 | const char *name, unsigned int priv_size, | 13 | const char *name, unsigned int priv_size, |
14 | __u64 obj_start, int verbose) | 14 | u64 obj_start, int verbose) |
15 | { | 15 | { |
16 | size_t namelen = strlen(name) + 1; | 16 | size_t namelen = strlen(name) + 1; |
17 | struct symbol *self = calloc(1, priv_size + sizeof(*self) + namelen); | 17 | struct symbol *self = calloc(1, priv_size + sizeof(*self) + namelen); |
@@ -21,14 +21,14 @@ static struct symbol *symbol__new(__u64 start, __u64 len, | |||
21 | 21 | ||
22 | if (verbose >= 2) | 22 | if (verbose >= 2) |
23 | printf("new symbol: %016Lx [%08lx]: %s, hist: %p, obj_start: %p\n", | 23 | printf("new symbol: %016Lx [%08lx]: %s, hist: %p, obj_start: %p\n", |
24 | (__u64)start, (unsigned long)len, name, self->hist, (void *)(unsigned long)obj_start); | 24 | (u64)start, (unsigned long)len, name, self->hist, (void *)(unsigned long)obj_start); |
25 | 25 | ||
26 | self->obj_start= obj_start; | 26 | self->obj_start= obj_start; |
27 | self->hist = NULL; | 27 | self->hist = NULL; |
28 | self->hist_sum = 0; | 28 | self->hist_sum = 0; |
29 | 29 | ||
30 | if (sym_hist_filter && !strcmp(name, sym_hist_filter)) | 30 | if (sym_hist_filter && !strcmp(name, sym_hist_filter)) |
31 | self->hist = calloc(sizeof(__u64), len); | 31 | self->hist = calloc(sizeof(u64), len); |
32 | 32 | ||
33 | if (priv_size) { | 33 | if (priv_size) { |
34 | memset(self, 0, priv_size); | 34 | memset(self, 0, priv_size); |
@@ -89,7 +89,7 @@ static void dso__insert_symbol(struct dso *self, struct symbol *sym) | |||
89 | { | 89 | { |
90 | struct rb_node **p = &self->syms.rb_node; | 90 | struct rb_node **p = &self->syms.rb_node; |
91 | struct rb_node *parent = NULL; | 91 | struct rb_node *parent = NULL; |
92 | const __u64 ip = sym->start; | 92 | const u64 ip = sym->start; |
93 | struct symbol *s; | 93 | struct symbol *s; |
94 | 94 | ||
95 | while (*p != NULL) { | 95 | while (*p != NULL) { |
@@ -104,7 +104,7 @@ static void dso__insert_symbol(struct dso *self, struct symbol *sym) | |||
104 | rb_insert_color(&sym->rb_node, &self->syms); | 104 | rb_insert_color(&sym->rb_node, &self->syms); |
105 | } | 105 | } |
106 | 106 | ||
107 | struct symbol *dso__find_symbol(struct dso *self, __u64 ip) | 107 | struct symbol *dso__find_symbol(struct dso *self, u64 ip) |
108 | { | 108 | { |
109 | struct rb_node *n; | 109 | struct rb_node *n; |
110 | 110 | ||
@@ -151,7 +151,7 @@ static int dso__load_kallsyms(struct dso *self, symbol_filter_t filter, int verb | |||
151 | goto out_failure; | 151 | goto out_failure; |
152 | 152 | ||
153 | while (!feof(file)) { | 153 | while (!feof(file)) { |
154 | __u64 start; | 154 | u64 start; |
155 | struct symbol *sym; | 155 | struct symbol *sym; |
156 | int line_len, len; | 156 | int line_len, len; |
157 | char symbol_type; | 157 | char symbol_type; |
@@ -232,7 +232,7 @@ static int dso__load_perf_map(struct dso *self, symbol_filter_t filter, int verb | |||
232 | goto out_failure; | 232 | goto out_failure; |
233 | 233 | ||
234 | while (!feof(file)) { | 234 | while (!feof(file)) { |
235 | __u64 start, size; | 235 | u64 start, size; |
236 | struct symbol *sym; | 236 | struct symbol *sym; |
237 | int line_len, len; | 237 | int line_len, len; |
238 | 238 | ||
@@ -353,7 +353,7 @@ static int dso__synthesize_plt_symbols(struct dso *self, Elf *elf, | |||
353 | { | 353 | { |
354 | uint32_t nr_rel_entries, idx; | 354 | uint32_t nr_rel_entries, idx; |
355 | GElf_Sym sym; | 355 | GElf_Sym sym; |
356 | __u64 plt_offset; | 356 | u64 plt_offset; |
357 | GElf_Shdr shdr_plt; | 357 | GElf_Shdr shdr_plt; |
358 | struct symbol *f; | 358 | struct symbol *f; |
359 | GElf_Shdr shdr_rel_plt; | 359 | GElf_Shdr shdr_rel_plt; |
@@ -523,7 +523,7 @@ static int dso__load_sym(struct dso *self, int fd, const char *name, | |||
523 | 523 | ||
524 | elf_symtab__for_each_symbol(syms, nr_syms, index, sym) { | 524 | elf_symtab__for_each_symbol(syms, nr_syms, index, sym) { |
525 | struct symbol *f; | 525 | struct symbol *f; |
526 | __u64 obj_start; | 526 | u64 obj_start; |
527 | 527 | ||
528 | if (!elf_sym__is_function(&sym)) | 528 | if (!elf_sym__is_function(&sym)) |
529 | continue; | 529 | continue; |
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h index 5ad9b06c3f6f..ea332e56e458 100644 --- a/tools/perf/util/symbol.h +++ b/tools/perf/util/symbol.h | |||
@@ -2,16 +2,17 @@ | |||
2 | #define _PERF_SYMBOL_ 1 | 2 | #define _PERF_SYMBOL_ 1 |
3 | 3 | ||
4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
5 | #include "../types.h" | ||
5 | #include "list.h" | 6 | #include "list.h" |
6 | #include "rbtree.h" | 7 | #include "rbtree.h" |
7 | 8 | ||
8 | struct symbol { | 9 | struct symbol { |
9 | struct rb_node rb_node; | 10 | struct rb_node rb_node; |
10 | __u64 start; | 11 | u64 start; |
11 | __u64 end; | 12 | u64 end; |
12 | __u64 obj_start; | 13 | u64 obj_start; |
13 | __u64 hist_sum; | 14 | u64 hist_sum; |
14 | __u64 *hist; | 15 | u64 *hist; |
15 | void *priv; | 16 | void *priv; |
16 | char name[0]; | 17 | char name[0]; |
17 | }; | 18 | }; |
@@ -20,7 +21,7 @@ struct dso { | |||
20 | struct list_head node; | 21 | struct list_head node; |
21 | struct rb_root syms; | 22 | struct rb_root syms; |
22 | unsigned int sym_priv_size; | 23 | unsigned int sym_priv_size; |
23 | struct symbol *(*find_symbol)(struct dso *, __u64 ip); | 24 | struct symbol *(*find_symbol)(struct dso *, u64 ip); |
24 | char name[0]; | 25 | char name[0]; |
25 | }; | 26 | }; |
26 | 27 | ||
@@ -36,7 +37,7 @@ static inline void *dso__sym_priv(struct dso *self, struct symbol *sym) | |||
36 | return ((void *)sym) - self->sym_priv_size; | 37 | return ((void *)sym) - self->sym_priv_size; |
37 | } | 38 | } |
38 | 39 | ||
39 | struct symbol *dso__find_symbol(struct dso *self, __u64 ip); | 40 | struct symbol *dso__find_symbol(struct dso *self, u64 ip); |
40 | 41 | ||
41 | int dso__load_kernel(struct dso *self, const char *vmlinux, | 42 | int dso__load_kernel(struct dso *self, const char *vmlinux, |
42 | symbol_filter_t filter, int verbose); | 43 | symbol_filter_t filter, int verbose); |