aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-report.c
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2009-06-19 08:21:42 -0400
committerIngo Molnar <mingo@elte.hu>2009-06-19 12:25:47 -0400
commit9cffa8d53335d891cc0ecb3824a67118b3ee4b2f (patch)
tree420e0f96198f0e78aedd006280826b8cf0839820 /tools/perf/builtin-report.c
parentb49a9e7e72103ea91946453c19703a4dfa1994fe (diff)
perf_counter tools: Define and use our own u64, s64 etc. definitions
On 64-bit powerpc, __u64 is defined to be unsigned long rather than unsigned long long. This causes compiler warnings every time we print a __u64 value with %Lx. Rather than changing __u64, we define our own u64 to be unsigned long long on all architectures, and similarly s64 as signed long long. For consistency we also define u32, s32, u16, s16, u8 and s8. These definitions are put in a new header, types.h, because these definitions are needed in util/string.h and util/symbol.h. The main change here is the mechanical change of __[us]{64,32,16,8} to remove the "__". The other changes are: * Create types.h * Include types.h in perf.h, util/string.h and util/symbol.h * Add types.h to the LIB_H definition in Makefile * Added (u64) casts in process_overflow_event() and print_sym_table() to kill two remaining warnings. Signed-off-by: Paul Mackerras <paulus@samba.org> Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: benh@kernel.crashing.org LKML-Reference: <19003.33494.495844.956580@cargo.ozlabs.ibm.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/builtin-report.c')
-rw-r--r--tools/perf/builtin-report.c84
1 files changed, 42 insertions, 42 deletions
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
55struct ip_event { 55struct 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
62struct ip_callchain { 62struct ip_callchain {
63 __u64 nr; 63 u64 nr;
64 __u64 ips[0]; 64 u64 ips[0];
65}; 65};
66 66
67struct mmap_event { 67struct 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
76struct comm_event { 76struct 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
82struct fork_event { 82struct 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
87struct period_event { 87struct 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
94struct lost_event { 94struct 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
100typedef union event_union { 100typedef 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
166static struct symbol *vdso__find_symbol(struct dso *dso, __u64 ip) 166static 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
211struct map { 211struct 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
220static __u64 map__map_ip(struct map *map, __u64 ip) 220static 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
225static __u64 vdso__map_ip(struct map *map, __u64 ip) 225static 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
432static struct map *thread__find_map(struct thread *self, __u64 ip) 432static 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
580static struct sort_entry sort_dso = { 580static struct sort_entry sort_dso = {
@@ -588,7 +588,7 @@ static struct sort_entry sort_dso = {
588static int64_t 588static int64_t
589sort__sym_cmp(struct hist_entry *left, struct hist_entry *right) 589sort__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
747static size_t 747static size_t
748hist_entry__fprintf(FILE *fp, struct hist_entry *self, __u64 total_samples) 748hist_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
794static struct symbol * 794static struct symbol *
795resolve_symbol(struct thread *thread, struct map **mapp, 795resolve_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
853static int 853static int
854hist_entry__add(struct thread *thread, struct map *map, struct dso *dso, 854hist_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
1035static size_t output__fprintf(FILE *fp, __u64 total_samples) 1035static 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",