diff options
author | Paul Mackerras <paulus@samba.org> | 2009-06-19 08:21:42 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-06-19 12:25:47 -0400 |
commit | 9cffa8d53335d891cc0ecb3824a67118b3ee4b2f (patch) | |
tree | 420e0f96198f0e78aedd006280826b8cf0839820 /tools/perf/builtin-top.c | |
parent | b49a9e7e72103ea91946453c19703a4dfa1994fe (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-top.c')
-rw-r--r-- | tools/perf/builtin-top.c | 24 |
1 files changed, 12 insertions, 12 deletions
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 | ||