aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-06-11 08:16:15 -0400
committerIngo Molnar <mingo@elte.hu>2009-06-11 10:48:38 -0400
commit729ff5e2aaf181f5d3ab849337fce406cd19b1d9 (patch)
tree49591d8103f05bd157c083b9392ed7f4a8b3ae17
parentdf58ab24bf26b166874bfb18b3b5a2e0a8e63179 (diff)
perf_counter tools: Clean up u64 usage
A build error slipped in: builtin-report.c: In function ‘hist_entry__fprintf’: builtin-report.c:711: error: format ‘%12d’ expects type ‘int’, but argument 3 has type ‘uint64_t’ Because we got a bit sloppy with those types. uint64_t really sucks, because there's no printf format for it. So standardize on __u64 instead - for all types that go to or come from the ABI (which is __u64), or for values that need to be large enough even on 32-bit. Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul Mackerras <paulus@samba.org> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> LKML-Reference: <new-submission> Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r--tools/perf/builtin-annotate.c32
-rw-r--r--tools/perf/builtin-record.c4
-rw-r--r--tools/perf/builtin-report.c36
-rw-r--r--tools/perf/builtin-top.c8
-rw-r--r--tools/perf/util/symbol.c10
-rw-r--r--tools/perf/util/symbol.h4
6 files changed, 47 insertions, 47 deletions
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index 3334a8bb1d51..b1ed5f766cb3 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -145,7 +145,7 @@ static void dsos__fprintf(FILE *fp)
145 dso__fprintf(pos, fp); 145 dso__fprintf(pos, fp);
146} 146}
147 147
148static struct symbol *vdso__find_symbol(struct dso *dso, uint64_t ip) 148static struct symbol *vdso__find_symbol(struct dso *dso, __u64 ip)
149{ 149{
150 return dso__find_symbol(kernel_dso, ip); 150 return dso__find_symbol(kernel_dso, ip);
151} 151}
@@ -178,19 +178,19 @@ static int load_kernel(void)
178 178
179struct map { 179struct map {
180 struct list_head node; 180 struct list_head node;
181 uint64_t start; 181 __u64 start;
182 uint64_t end; 182 __u64 end;
183 uint64_t pgoff; 183 __u64 pgoff;
184 uint64_t (*map_ip)(struct map *, uint64_t); 184 __u64 (*map_ip)(struct map *, __u64);
185 struct dso *dso; 185 struct dso *dso;
186}; 186};
187 187
188static uint64_t map__map_ip(struct map *map, uint64_t ip) 188static __u64 map__map_ip(struct map *map, __u64 ip)
189{ 189{
190 return ip - map->start + map->pgoff; 190 return ip - map->start + map->pgoff;
191} 191}
192 192
193static uint64_t vdso__map_ip(struct map *map, uint64_t ip) 193static __u64 vdso__map_ip(struct map *map, __u64 ip)
194{ 194{
195 return ip; 195 return ip;
196} 196}
@@ -249,7 +249,7 @@ static int map__overlap(struct map *l, struct map *r)
249 249
250static size_t map__fprintf(struct map *self, FILE *fp) 250static size_t map__fprintf(struct map *self, FILE *fp)
251{ 251{
252 return fprintf(fp, " %"PRIx64"-%"PRIx64" %"PRIx64" %s\n", 252 return fprintf(fp, " %Lx-%Lx %Lx %s\n",
253 self->start, self->end, self->pgoff, self->dso->name); 253 self->start, self->end, self->pgoff, self->dso->name);
254} 254}
255 255
@@ -373,7 +373,7 @@ static int thread__fork(struct thread *self, struct thread *parent)
373 return 0; 373 return 0;
374} 374}
375 375
376static struct map *thread__find_map(struct thread *self, uint64_t ip) 376static struct map *thread__find_map(struct thread *self, __u64 ip)
377{ 377{
378 struct map *pos; 378 struct map *pos;
379 379
@@ -414,7 +414,7 @@ struct hist_entry {
414 struct map *map; 414 struct map *map;
415 struct dso *dso; 415 struct dso *dso;
416 struct symbol *sym; 416 struct symbol *sym;
417 uint64_t ip; 417 __u64 ip;
418 char level; 418 char level;
419 419
420 uint32_t count; 420 uint32_t count;
@@ -533,7 +533,7 @@ static struct sort_entry sort_dso = {
533static int64_t 533static int64_t
534sort__sym_cmp(struct hist_entry *left, struct hist_entry *right) 534sort__sym_cmp(struct hist_entry *left, struct hist_entry *right)
535{ 535{
536 uint64_t ip_l, ip_r; 536 __u64 ip_l, ip_r;
537 537
538 if (left->sym == right->sym) 538 if (left->sym == right->sym)
539 return 0; 539 return 0;
@@ -647,7 +647,7 @@ hist_entry__collapse(struct hist_entry *left, struct hist_entry *right)
647/* 647/*
648 * collect histogram counts 648 * collect histogram counts
649 */ 649 */
650static void hist_hit(struct hist_entry *he, uint64_t ip) 650static void hist_hit(struct hist_entry *he, __u64 ip)
651{ 651{
652 unsigned int sym_size, offset; 652 unsigned int sym_size, offset;
653 struct symbol *sym = he->sym; 653 struct symbol *sym = he->sym;
@@ -676,7 +676,7 @@ static void hist_hit(struct hist_entry *he, uint64_t ip)
676 676
677static int 677static int
678hist_entry__add(struct thread *thread, struct map *map, struct dso *dso, 678hist_entry__add(struct thread *thread, struct map *map, struct dso *dso,
679 struct symbol *sym, uint64_t ip, char level) 679 struct symbol *sym, __u64 ip, char level)
680{ 680{
681 struct rb_node **p = &hist.rb_node; 681 struct rb_node **p = &hist.rb_node;
682 struct rb_node *parent = NULL; 682 struct rb_node *parent = NULL;
@@ -848,7 +848,7 @@ process_overflow_event(event_t *event, unsigned long offset, unsigned long head)
848 int show = 0; 848 int show = 0;
849 struct dso *dso = NULL; 849 struct dso *dso = NULL;
850 struct thread *thread = threads__findnew(event->ip.pid); 850 struct thread *thread = threads__findnew(event->ip.pid);
851 uint64_t ip = event->ip.ip; 851 __u64 ip = event->ip.ip;
852 struct map *map = NULL; 852 struct map *map = NULL;
853 853
854 dprintf("%p [%p]: PERF_EVENT (IP, %d): %d: %p\n", 854 dprintf("%p [%p]: PERF_EVENT (IP, %d): %d: %p\n",
@@ -1031,7 +1031,7 @@ process_event(event_t *event, unsigned long offset, unsigned long head)
1031} 1031}
1032 1032
1033static int 1033static int
1034parse_line(FILE *file, struct symbol *sym, uint64_t start, uint64_t len) 1034parse_line(FILE *file, struct symbol *sym, __u64 start, __u64 len)
1035{ 1035{
1036 char *line = NULL, *tmp, *tmp2; 1036 char *line = NULL, *tmp, *tmp2;
1037 unsigned int offset; 1037 unsigned int offset;
@@ -1112,7 +1112,7 @@ parse_line(FILE *file, struct symbol *sym, uint64_t start, uint64_t len)
1112static void annotate_sym(struct dso *dso, struct symbol *sym) 1112static void annotate_sym(struct dso *dso, struct symbol *sym)
1113{ 1113{
1114 char *filename = dso->name; 1114 char *filename = dso->name;
1115 uint64_t start, end, len; 1115 __u64 start, end, len;
1116 char command[PATH_MAX*2]; 1116 char command[PATH_MAX*2];
1117 FILE *file; 1117 FILE *file;
1118 1118
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 919f23ca4199..84cd336ae79b 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -223,7 +223,7 @@ static void pid_synthesize_comm_event(pid_t pid, int full)
223 223
224 comm_ev.pid = pid; 224 comm_ev.pid = pid;
225 comm_ev.header.type = PERF_EVENT_COMM; 225 comm_ev.header.type = PERF_EVENT_COMM;
226 size = ALIGN(size, sizeof(uint64_t)); 226 size = ALIGN(size, sizeof(__u64));
227 comm_ev.header.size = sizeof(comm_ev) - (sizeof(comm_ev.comm) - size); 227 comm_ev.header.size = sizeof(comm_ev) - (sizeof(comm_ev.comm) - size);
228 228
229 if (!full) { 229 if (!full) {
@@ -304,7 +304,7 @@ static void pid_synthesize_mmap_samples(pid_t pid)
304 size = strlen(execname); 304 size = strlen(execname);
305 execname[size - 1] = '\0'; /* Remove \n */ 305 execname[size - 1] = '\0'; /* Remove \n */
306 memcpy(mmap_ev.filename, execname, size); 306 memcpy(mmap_ev.filename, execname, size);
307 size = ALIGN(size, sizeof(uint64_t)); 307 size = ALIGN(size, sizeof(__u64));
308 mmap_ev.len -= mmap_ev.start; 308 mmap_ev.len -= mmap_ev.start;
309 mmap_ev.header.size = (sizeof(mmap_ev) - 309 mmap_ev.header.size = (sizeof(mmap_ev) -
310 (sizeof(mmap_ev.filename) - size)); 310 (sizeof(mmap_ev.filename) - size));
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index f57fd5c5531a..82fa93b4db99 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -146,7 +146,7 @@ static void dsos__fprintf(FILE *fp)
146 dso__fprintf(pos, fp); 146 dso__fprintf(pos, fp);
147} 147}
148 148
149static struct symbol *vdso__find_symbol(struct dso *dso, uint64_t ip) 149static struct symbol *vdso__find_symbol(struct dso *dso, __u64 ip)
150{ 150{
151 return dso__find_symbol(kernel_dso, ip); 151 return dso__find_symbol(kernel_dso, ip);
152} 152}
@@ -193,19 +193,19 @@ static int strcommon(const char *pathname)
193 193
194struct map { 194struct map {
195 struct list_head node; 195 struct list_head node;
196 uint64_t start; 196 __u64 start;
197 uint64_t end; 197 __u64 end;
198 uint64_t pgoff; 198 __u64 pgoff;
199 uint64_t (*map_ip)(struct map *, uint64_t); 199 __u64 (*map_ip)(struct map *, __u64);
200 struct dso *dso; 200 struct dso *dso;
201}; 201};
202 202
203static uint64_t map__map_ip(struct map *map, uint64_t ip) 203static __u64 map__map_ip(struct map *map, __u64 ip)
204{ 204{
205 return ip - map->start + map->pgoff; 205 return ip - map->start + map->pgoff;
206} 206}
207 207
208static uint64_t vdso__map_ip(struct map *map, uint64_t ip) 208static __u64 vdso__map_ip(struct map *map, __u64 ip)
209{ 209{
210 return ip; 210 return ip;
211} 211}
@@ -288,7 +288,7 @@ static int map__overlap(struct map *l, struct map *r)
288 288
289static size_t map__fprintf(struct map *self, FILE *fp) 289static size_t map__fprintf(struct map *self, FILE *fp)
290{ 290{
291 return fprintf(fp, " %"PRIx64"-%"PRIx64" %"PRIx64" %s\n", 291 return fprintf(fp, " %Lx-%Lx %Lx %s\n",
292 self->start, self->end, self->pgoff, self->dso->name); 292 self->start, self->end, self->pgoff, self->dso->name);
293} 293}
294 294
@@ -412,7 +412,7 @@ static int thread__fork(struct thread *self, struct thread *parent)
412 return 0; 412 return 0;
413} 413}
414 414
415static struct map *thread__find_map(struct thread *self, uint64_t ip) 415static struct map *thread__find_map(struct thread *self, __u64 ip)
416{ 416{
417 struct map *pos; 417 struct map *pos;
418 418
@@ -453,10 +453,10 @@ struct hist_entry {
453 struct map *map; 453 struct map *map;
454 struct dso *dso; 454 struct dso *dso;
455 struct symbol *sym; 455 struct symbol *sym;
456 uint64_t ip; 456 __u64 ip;
457 char level; 457 char level;
458 458
459 uint64_t count; 459 __u64 count;
460}; 460};
461 461
462/* 462/*
@@ -572,7 +572,7 @@ static struct sort_entry sort_dso = {
572static int64_t 572static int64_t
573sort__sym_cmp(struct hist_entry *left, struct hist_entry *right) 573sort__sym_cmp(struct hist_entry *left, struct hist_entry *right)
574{ 574{
575 uint64_t ip_l, ip_r; 575 __u64 ip_l, ip_r;
576 576
577 if (left->sym == right->sym) 577 if (left->sym == right->sym)
578 return 0; 578 return 0;
@@ -684,7 +684,7 @@ hist_entry__collapse(struct hist_entry *left, struct hist_entry *right)
684} 684}
685 685
686static size_t 686static size_t
687hist_entry__fprintf(FILE *fp, struct hist_entry *self, uint64_t total_samples) 687hist_entry__fprintf(FILE *fp, struct hist_entry *self, __u64 total_samples)
688{ 688{
689 struct sort_entry *se; 689 struct sort_entry *se;
690 size_t ret; 690 size_t ret;
@@ -708,7 +708,7 @@ hist_entry__fprintf(FILE *fp, struct hist_entry *self, uint64_t total_samples)
708 ret = color_fprintf(fp, color, " %6.2f%%", 708 ret = color_fprintf(fp, color, " %6.2f%%",
709 (self->count * 100.0) / total_samples); 709 (self->count * 100.0) / total_samples);
710 } else 710 } else
711 ret = fprintf(fp, "%12d ", self->count); 711 ret = fprintf(fp, "%12Ld ", self->count);
712 712
713 list_for_each_entry(se, &hist_entry__sort_list, list) { 713 list_for_each_entry(se, &hist_entry__sort_list, list) {
714 fprintf(fp, " "); 714 fprintf(fp, " ");
@@ -726,7 +726,7 @@ hist_entry__fprintf(FILE *fp, struct hist_entry *self, uint64_t total_samples)
726 726
727static int 727static int
728hist_entry__add(struct thread *thread, struct map *map, struct dso *dso, 728hist_entry__add(struct thread *thread, struct map *map, struct dso *dso,
729 struct symbol *sym, uint64_t ip, char level, uint64_t count) 729 struct symbol *sym, __u64 ip, char level, __u64 count)
730{ 730{
731 struct rb_node **p = &hist.rb_node; 731 struct rb_node **p = &hist.rb_node;
732 struct rb_node *parent = NULL; 732 struct rb_node *parent = NULL;
@@ -873,7 +873,7 @@ static void output__resort(void)
873 } 873 }
874} 874}
875 875
876static size_t output__fprintf(FILE *fp, uint64_t total_samples) 876static size_t output__fprintf(FILE *fp, __u64 total_samples)
877{ 877{
878 struct hist_entry *pos; 878 struct hist_entry *pos;
879 struct sort_entry *se; 879 struct sort_entry *se;
@@ -941,8 +941,8 @@ process_overflow_event(event_t *event, unsigned long offset, unsigned long head)
941 int show = 0; 941 int show = 0;
942 struct dso *dso = NULL; 942 struct dso *dso = NULL;
943 struct thread *thread = threads__findnew(event->ip.pid); 943 struct thread *thread = threads__findnew(event->ip.pid);
944 uint64_t ip = event->ip.ip; 944 __u64 ip = event->ip.ip;
945 uint64_t period = 1; 945 __u64 period = 1;
946 struct map *map = NULL; 946 struct map *map = NULL;
947 947
948 if (event->header.type & PERF_SAMPLE_PERIOD) 948 if (event->header.type & PERF_SAMPLE_PERIOD)
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 8ba24808a392..309dbc76ec88 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -79,8 +79,8 @@ static int dump_symtab;
79 * Symbols 79 * Symbols
80 */ 80 */
81 81
82static uint64_t min_ip; 82static __u64 min_ip;
83static uint64_t max_ip = -1ll; 83static __u64 max_ip = -1ll;
84 84
85struct sym_entry { 85struct sym_entry {
86 struct rb_node rb_node; 86 struct rb_node rb_node;
@@ -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 */
375static void record_ip(uint64_t ip, int counter) 375static 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(uint64_t ip, int counter)
392 samples--; 392 samples--;
393} 393}
394 394
395static void process_event(uint64_t ip, int counter) 395static void process_event(__u64 ip, int counter)
396{ 396{
397 samples++; 397 samples++;
398 398
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 32dd47d60d9c..49a55f813712 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -9,9 +9,9 @@
9 9
10const char *sym_hist_filter; 10const char *sym_hist_filter;
11 11
12static struct symbol *symbol__new(uint64_t start, uint64_t len, 12static 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 uint64_t 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);
@@ -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 uint64_t 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
107struct symbol *dso__find_symbol(struct dso *self, uint64_t ip) 107struct symbol *dso__find_symbol(struct dso *self, __u64 ip)
108{ 108{
109 struct rb_node *n; 109 struct rb_node *n;
110 110
@@ -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 uint64_t 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 4839d68f14f0..0d1292bd8270 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -19,7 +19,7 @@ struct dso {
19 struct list_head node; 19 struct list_head node;
20 struct rb_root syms; 20 struct rb_root syms;
21 unsigned int sym_priv_size; 21 unsigned int sym_priv_size;
22 struct symbol *(*find_symbol)(struct dso *, uint64_t ip); 22 struct symbol *(*find_symbol)(struct dso *, __u64 ip);
23 char name[0]; 23 char name[0];
24}; 24};
25 25
@@ -35,7 +35,7 @@ static inline void *dso__sym_priv(struct dso *self, struct symbol *sym)
35 return ((void *)sym) - self->sym_priv_size; 35 return ((void *)sym) - self->sym_priv_size;
36} 36}
37 37
38struct symbol *dso__find_symbol(struct dso *self, uint64_t ip); 38struct symbol *dso__find_symbol(struct dso *self, __u64 ip);
39 39
40int dso__load_kernel(struct dso *self, const char *vmlinux, 40int dso__load_kernel(struct dso *self, const char *vmlinux,
41 symbol_filter_t filter, int verbose); 41 symbol_filter_t filter, int verbose);