Commit 729ff5e2 authored by Ingo Molnar's avatar Ingo Molnar

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: default avatarIngo Molnar <mingo@elte.hu>
parent df58ab24
...@@ -145,7 +145,7 @@ static void dsos__fprintf(FILE *fp) ...@@ -145,7 +145,7 @@ static void dsos__fprintf(FILE *fp)
dso__fprintf(pos, fp); dso__fprintf(pos, fp);
} }
static struct symbol *vdso__find_symbol(struct dso *dso, uint64_t ip) static struct symbol *vdso__find_symbol(struct dso *dso, __u64 ip)
{ {
return dso__find_symbol(kernel_dso, ip); return dso__find_symbol(kernel_dso, ip);
} }
...@@ -178,19 +178,19 @@ static int load_kernel(void) ...@@ -178,19 +178,19 @@ static int load_kernel(void)
struct map { struct map {
struct list_head node; struct list_head node;
uint64_t start; __u64 start;
uint64_t end; __u64 end;
uint64_t pgoff; __u64 pgoff;
uint64_t (*map_ip)(struct map *, uint64_t); __u64 (*map_ip)(struct map *, __u64);
struct dso *dso; struct dso *dso;
}; };
static uint64_t map__map_ip(struct map *map, uint64_t ip) static __u64 map__map_ip(struct map *map, __u64 ip)
{ {
return ip - map->start + map->pgoff; return ip - map->start + map->pgoff;
} }
static uint64_t vdso__map_ip(struct map *map, uint64_t ip) static __u64 vdso__map_ip(struct map *map, __u64 ip)
{ {
return ip; return ip;
} }
...@@ -249,7 +249,7 @@ static int map__overlap(struct map *l, struct map *r) ...@@ -249,7 +249,7 @@ static int map__overlap(struct map *l, struct map *r)
static size_t map__fprintf(struct map *self, FILE *fp) static size_t map__fprintf(struct map *self, FILE *fp)
{ {
return fprintf(fp, " %"PRIx64"-%"PRIx64" %"PRIx64" %s\n", return fprintf(fp, " %Lx-%Lx %Lx %s\n",
self->start, self->end, self->pgoff, self->dso->name); self->start, self->end, self->pgoff, self->dso->name);
} }
...@@ -373,7 +373,7 @@ static int thread__fork(struct thread *self, struct thread *parent) ...@@ -373,7 +373,7 @@ static int thread__fork(struct thread *self, struct thread *parent)
return 0; return 0;
} }
static struct map *thread__find_map(struct thread *self, uint64_t ip) static struct map *thread__find_map(struct thread *self, __u64 ip)
{ {
struct map *pos; struct map *pos;
...@@ -414,7 +414,7 @@ struct hist_entry { ...@@ -414,7 +414,7 @@ struct hist_entry {
struct map *map; struct map *map;
struct dso *dso; struct dso *dso;
struct symbol *sym; struct symbol *sym;
uint64_t ip; __u64 ip;
char level; char level;
uint32_t count; uint32_t count;
...@@ -533,7 +533,7 @@ static struct sort_entry sort_dso = { ...@@ -533,7 +533,7 @@ static struct sort_entry sort_dso = {
static int64_t static int64_t
sort__sym_cmp(struct hist_entry *left, struct hist_entry *right) sort__sym_cmp(struct hist_entry *left, struct hist_entry *right)
{ {
uint64_t ip_l, ip_r; __u64 ip_l, ip_r;
if (left->sym == right->sym) if (left->sym == right->sym)
return 0; return 0;
...@@ -647,7 +647,7 @@ hist_entry__collapse(struct hist_entry *left, struct hist_entry *right) ...@@ -647,7 +647,7 @@ hist_entry__collapse(struct hist_entry *left, struct hist_entry *right)
/* /*
* collect histogram counts * collect histogram counts
*/ */
static void hist_hit(struct hist_entry *he, uint64_t ip) static void hist_hit(struct hist_entry *he, __u64 ip)
{ {
unsigned int sym_size, offset; unsigned int sym_size, offset;
struct symbol *sym = he->sym; struct symbol *sym = he->sym;
...@@ -676,7 +676,7 @@ static void hist_hit(struct hist_entry *he, uint64_t ip) ...@@ -676,7 +676,7 @@ static void hist_hit(struct hist_entry *he, uint64_t ip)
static int static int
hist_entry__add(struct thread *thread, struct map *map, struct dso *dso, hist_entry__add(struct thread *thread, struct map *map, struct dso *dso,
struct symbol *sym, uint64_t ip, char level) struct symbol *sym, __u64 ip, char level)
{ {
struct rb_node **p = &hist.rb_node; struct rb_node **p = &hist.rb_node;
struct rb_node *parent = NULL; struct rb_node *parent = NULL;
...@@ -848,7 +848,7 @@ process_overflow_event(event_t *event, unsigned long offset, unsigned long head) ...@@ -848,7 +848,7 @@ process_overflow_event(event_t *event, unsigned long offset, unsigned long head)
int show = 0; int show = 0;
struct dso *dso = NULL; struct dso *dso = NULL;
struct thread *thread = threads__findnew(event->ip.pid); struct thread *thread = threads__findnew(event->ip.pid);
uint64_t ip = event->ip.ip; __u64 ip = event->ip.ip;
struct map *map = NULL; struct map *map = NULL;
dprintf("%p [%p]: PERF_EVENT (IP, %d): %d: %p\n", 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,7 +1031,7 @@ process_event(event_t *event, unsigned long offset, unsigned long head)
} }
static int static int
parse_line(FILE *file, struct symbol *sym, uint64_t start, uint64_t len) parse_line(FILE *file, struct symbol *sym, __u64 start, __u64 len)
{ {
char *line = NULL, *tmp, *tmp2; char *line = NULL, *tmp, *tmp2;
unsigned int offset; unsigned int offset;
...@@ -1112,7 +1112,7 @@ parse_line(FILE *file, struct symbol *sym, uint64_t start, uint64_t len) ...@@ -1112,7 +1112,7 @@ parse_line(FILE *file, struct symbol *sym, uint64_t start, uint64_t len)
static void annotate_sym(struct dso *dso, struct symbol *sym) static void annotate_sym(struct dso *dso, struct symbol *sym)
{ {
char *filename = dso->name; char *filename = dso->name;
uint64_t start, end, len; __u64 start, end, len;
char command[PATH_MAX*2]; char command[PATH_MAX*2];
FILE *file; FILE *file;
......
...@@ -223,7 +223,7 @@ static void pid_synthesize_comm_event(pid_t pid, int full) ...@@ -223,7 +223,7 @@ static void pid_synthesize_comm_event(pid_t pid, int full)
comm_ev.pid = pid; comm_ev.pid = pid;
comm_ev.header.type = PERF_EVENT_COMM; comm_ev.header.type = PERF_EVENT_COMM;
size = ALIGN(size, sizeof(uint64_t)); size = ALIGN(size, sizeof(__u64));
comm_ev.header.size = sizeof(comm_ev) - (sizeof(comm_ev.comm) - size); comm_ev.header.size = sizeof(comm_ev) - (sizeof(comm_ev.comm) - size);
if (!full) { if (!full) {
...@@ -304,7 +304,7 @@ static void pid_synthesize_mmap_samples(pid_t pid) ...@@ -304,7 +304,7 @@ static void pid_synthesize_mmap_samples(pid_t pid)
size = strlen(execname); size = strlen(execname);
execname[size - 1] = '\0'; /* Remove \n */ execname[size - 1] = '\0'; /* Remove \n */
memcpy(mmap_ev.filename, execname, size); memcpy(mmap_ev.filename, execname, size);
size = ALIGN(size, sizeof(uint64_t)); size = ALIGN(size, sizeof(__u64));
mmap_ev.len -= mmap_ev.start; mmap_ev.len -= mmap_ev.start;
mmap_ev.header.size = (sizeof(mmap_ev) - mmap_ev.header.size = (sizeof(mmap_ev) -
(sizeof(mmap_ev.filename) - size)); (sizeof(mmap_ev.filename) - size));
......
...@@ -146,7 +146,7 @@ static void dsos__fprintf(FILE *fp) ...@@ -146,7 +146,7 @@ static void dsos__fprintf(FILE *fp)
dso__fprintf(pos, fp); dso__fprintf(pos, fp);
} }
static struct symbol *vdso__find_symbol(struct dso *dso, uint64_t ip) static struct symbol *vdso__find_symbol(struct dso *dso, __u64 ip)
{ {
return dso__find_symbol(kernel_dso, ip); return dso__find_symbol(kernel_dso, ip);
} }
...@@ -193,19 +193,19 @@ static int strcommon(const char *pathname) ...@@ -193,19 +193,19 @@ static int strcommon(const char *pathname)
struct map { struct map {
struct list_head node; struct list_head node;
uint64_t start; __u64 start;
uint64_t end; __u64 end;
uint64_t pgoff; __u64 pgoff;
uint64_t (*map_ip)(struct map *, uint64_t); __u64 (*map_ip)(struct map *, __u64);
struct dso *dso; struct dso *dso;
}; };
static uint64_t map__map_ip(struct map *map, uint64_t ip) static __u64 map__map_ip(struct map *map, __u64 ip)
{ {
return ip - map->start + map->pgoff; return ip - map->start + map->pgoff;
} }
static uint64_t vdso__map_ip(struct map *map, uint64_t ip) static __u64 vdso__map_ip(struct map *map, __u64 ip)
{ {
return ip; return ip;
} }
...@@ -288,7 +288,7 @@ static int map__overlap(struct map *l, struct map *r) ...@@ -288,7 +288,7 @@ static int map__overlap(struct map *l, struct map *r)
static size_t map__fprintf(struct map *self, FILE *fp) static size_t map__fprintf(struct map *self, FILE *fp)
{ {
return fprintf(fp, " %"PRIx64"-%"PRIx64" %"PRIx64" %s\n", return fprintf(fp, " %Lx-%Lx %Lx %s\n",
self->start, self->end, self->pgoff, self->dso->name); self->start, self->end, self->pgoff, self->dso->name);
} }
...@@ -412,7 +412,7 @@ static int thread__fork(struct thread *self, struct thread *parent) ...@@ -412,7 +412,7 @@ static int thread__fork(struct thread *self, struct thread *parent)
return 0; return 0;
} }
static struct map *thread__find_map(struct thread *self, uint64_t ip) static struct map *thread__find_map(struct thread *self, __u64 ip)
{ {
struct map *pos; struct map *pos;
...@@ -453,10 +453,10 @@ struct hist_entry { ...@@ -453,10 +453,10 @@ struct hist_entry {
struct map *map; struct map *map;
struct dso *dso; struct dso *dso;
struct symbol *sym; struct symbol *sym;
uint64_t ip; __u64 ip;
char level; char level;
uint64_t count; __u64 count;
}; };
/* /*
...@@ -572,7 +572,7 @@ static struct sort_entry sort_dso = { ...@@ -572,7 +572,7 @@ static struct sort_entry sort_dso = {
static int64_t static int64_t
sort__sym_cmp(struct hist_entry *left, struct hist_entry *right) sort__sym_cmp(struct hist_entry *left, struct hist_entry *right)
{ {
uint64_t ip_l, ip_r; __u64 ip_l, ip_r;
if (left->sym == right->sym) if (left->sym == right->sym)
return 0; return 0;
...@@ -684,7 +684,7 @@ hist_entry__collapse(struct hist_entry *left, struct hist_entry *right) ...@@ -684,7 +684,7 @@ hist_entry__collapse(struct hist_entry *left, struct hist_entry *right)
} }
static size_t static size_t
hist_entry__fprintf(FILE *fp, struct hist_entry *self, uint64_t total_samples) hist_entry__fprintf(FILE *fp, struct hist_entry *self, __u64 total_samples)
{ {
struct sort_entry *se; struct sort_entry *se;
size_t ret; size_t ret;
...@@ -708,7 +708,7 @@ hist_entry__fprintf(FILE *fp, struct hist_entry *self, uint64_t total_samples) ...@@ -708,7 +708,7 @@ hist_entry__fprintf(FILE *fp, struct hist_entry *self, uint64_t total_samples)
ret = color_fprintf(fp, color, " %6.2f%%", ret = color_fprintf(fp, color, " %6.2f%%",
(self->count * 100.0) / total_samples); (self->count * 100.0) / total_samples);
} else } else
ret = fprintf(fp, "%12d ", self->count); ret = fprintf(fp, "%12Ld ", self->count);
list_for_each_entry(se, &hist_entry__sort_list, list) { list_for_each_entry(se, &hist_entry__sort_list, list) {
fprintf(fp, " "); fprintf(fp, " ");
...@@ -726,7 +726,7 @@ hist_entry__fprintf(FILE *fp, struct hist_entry *self, uint64_t total_samples) ...@@ -726,7 +726,7 @@ hist_entry__fprintf(FILE *fp, struct hist_entry *self, uint64_t total_samples)
static int static int
hist_entry__add(struct thread *thread, struct map *map, struct dso *dso, hist_entry__add(struct thread *thread, struct map *map, struct dso *dso,
struct symbol *sym, uint64_t ip, char level, uint64_t count) struct symbol *sym, __u64 ip, char level, __u64 count)
{ {
struct rb_node **p = &hist.rb_node; struct rb_node **p = &hist.rb_node;
struct rb_node *parent = NULL; struct rb_node *parent = NULL;
...@@ -873,7 +873,7 @@ static void output__resort(void) ...@@ -873,7 +873,7 @@ static void output__resort(void)
} }
} }
static size_t output__fprintf(FILE *fp, uint64_t total_samples) static size_t output__fprintf(FILE *fp, __u64 total_samples)
{ {
struct hist_entry *pos; struct hist_entry *pos;
struct sort_entry *se; struct sort_entry *se;
...@@ -941,8 +941,8 @@ process_overflow_event(event_t *event, unsigned long offset, unsigned long head) ...@@ -941,8 +941,8 @@ process_overflow_event(event_t *event, unsigned long offset, unsigned long head)
int show = 0; int show = 0;
struct dso *dso = NULL; struct dso *dso = NULL;
struct thread *thread = threads__findnew(event->ip.pid); struct thread *thread = threads__findnew(event->ip.pid);
uint64_t ip = event->ip.ip; __u64 ip = event->ip.ip;
uint64_t period = 1; __u64 period = 1;
struct map *map = NULL; struct map *map = NULL;
if (event->header.type & PERF_SAMPLE_PERIOD) if (event->header.type & PERF_SAMPLE_PERIOD)
......
...@@ -79,8 +79,8 @@ static int dump_symtab; ...@@ -79,8 +79,8 @@ static int dump_symtab;
* Symbols * Symbols
*/ */
static uint64_t min_ip; static __u64 min_ip;
static uint64_t max_ip = -1ll; static __u64 max_ip = -1ll;
struct sym_entry { struct sym_entry {
struct rb_node rb_node; struct rb_node rb_node;
...@@ -372,7 +372,7 @@ static int parse_symbols(void) ...@@ -372,7 +372,7 @@ static int parse_symbols(void)
/* /*
* Binary search in the histogram table and record the hit: * Binary search in the histogram table and record the hit:
*/ */
static void record_ip(uint64_t ip, int counter) static void record_ip(__u64 ip, int counter)
{ {
struct symbol *sym = dso__find_symbol(kernel_dso, ip); struct symbol *sym = dso__find_symbol(kernel_dso, ip);
...@@ -392,7 +392,7 @@ static void record_ip(uint64_t ip, int counter) ...@@ -392,7 +392,7 @@ static void record_ip(uint64_t ip, int counter)
samples--; samples--;
} }
static void process_event(uint64_t ip, int counter) static void process_event(__u64 ip, int counter)
{ {
samples++; samples++;
......
...@@ -9,9 +9,9 @@ ...@@ -9,9 +9,9 @@
const char *sym_hist_filter; const char *sym_hist_filter;
static struct symbol *symbol__new(uint64_t start, uint64_t len, static struct symbol *symbol__new(__u64 start, __u64 len,
const char *name, unsigned int priv_size, const char *name, unsigned int priv_size,
uint64_t obj_start, int verbose) __u64 obj_start, int verbose)
{ {
size_t namelen = strlen(name) + 1; size_t namelen = strlen(name) + 1;
struct symbol *self = calloc(1, priv_size + sizeof(*self) + namelen); 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,7 +89,7 @@ static void dso__insert_symbol(struct dso *self, struct symbol *sym)
{ {
struct rb_node **p = &self->syms.rb_node; struct rb_node **p = &self->syms.rb_node;
struct rb_node *parent = NULL; struct rb_node *parent = NULL;
const uint64_t ip = sym->start; const __u64 ip = sym->start;
struct symbol *s; struct symbol *s;
while (*p != NULL) { while (*p != NULL) {
...@@ -104,7 +104,7 @@ static void dso__insert_symbol(struct dso *self, struct symbol *sym) ...@@ -104,7 +104,7 @@ static void dso__insert_symbol(struct dso *self, struct symbol *sym)
rb_insert_color(&sym->rb_node, &self->syms); rb_insert_color(&sym->rb_node, &self->syms);
} }
struct symbol *dso__find_symbol(struct dso *self, uint64_t ip) struct symbol *dso__find_symbol(struct dso *self, __u64 ip)
{ {
struct rb_node *n; struct rb_node *n;
...@@ -523,7 +523,7 @@ static int dso__load_sym(struct dso *self, int fd, const char *name, ...@@ -523,7 +523,7 @@ static int dso__load_sym(struct dso *self, int fd, const char *name,
elf_symtab__for_each_symbol(syms, nr_syms, index, sym) { elf_symtab__for_each_symbol(syms, nr_syms, index, sym) {
struct symbol *f; struct symbol *f;
uint64_t obj_start; __u64 obj_start;
if (!elf_sym__is_function(&sym)) if (!elf_sym__is_function(&sym))
continue; continue;
......
...@@ -19,7 +19,7 @@ struct dso { ...@@ -19,7 +19,7 @@ struct dso {
struct list_head node; struct list_head node;
struct rb_root syms; struct rb_root syms;
unsigned int sym_priv_size; unsigned int sym_priv_size;
struct symbol *(*find_symbol)(struct dso *, uint64_t ip); struct symbol *(*find_symbol)(struct dso *, __u64 ip);
char name[0]; char name[0];
}; };
...@@ -35,7 +35,7 @@ static inline void *dso__sym_priv(struct dso *self, struct symbol *sym) ...@@ -35,7 +35,7 @@ static inline void *dso__sym_priv(struct dso *self, struct symbol *sym)
return ((void *)sym) - self->sym_priv_size; return ((void *)sym) - self->sym_priv_size;
} }
struct symbol *dso__find_symbol(struct dso *self, uint64_t ip); struct symbol *dso__find_symbol(struct dso *self, __u64 ip);
int dso__load_kernel(struct dso *self, const char *vmlinux, int dso__load_kernel(struct dso *self, const char *vmlinux,
symbol_filter_t filter, int verbose); symbol_filter_t filter, int verbose);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment