aboutsummaryrefslogtreecommitdiff
path: root/tools/perf/builtin-stat.c
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2009-06-19 22:21:42 +1000
committerIngo Molnar <mingo@elte.hu>2009-06-19 18:25:47 +0200
commit9cffa8d53335d891cc0ecb3824a67118b3ee4b2f (patch)
tree420e0f96198f0e78aedd006280826b8cf0839820 /tools/perf/builtin-stat.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-stat.c')
-rw-r--r--tools/perf/builtin-stat.c62
1 files changed, 31 insertions, 31 deletions
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index e5b3c0ff03a..6d3eeac1ea2 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -85,29 +85,29 @@ static const unsigned int default_count[] = {
static int run_count = 1;
static int run_idx = 0;
-static __u64 event_res[MAX_RUN][MAX_COUNTERS][3];
-static __u64 event_scaled[MAX_RUN][MAX_COUNTERS];
+static u64 event_res[MAX_RUN][MAX_COUNTERS][3];
+static u64 event_scaled[MAX_RUN][MAX_COUNTERS];
-//static __u64 event_hist[MAX_RUN][MAX_COUNTERS][3];
+//static u64 event_hist[MAX_RUN][MAX_COUNTERS][3];
-static __u64 runtime_nsecs[MAX_RUN];
-static __u64 walltime_nsecs[MAX_RUN];
-static __u64 runtime_cycles[MAX_RUN];
+static u64 runtime_nsecs[MAX_RUN];
+static u64 walltime_nsecs[MAX_RUN];
+static u64 runtime_cycles[MAX_RUN];
-static __u64 event_res_avg[MAX_COUNTERS][3];
-static __u64 event_res_noise[MAX_COUNTERS][3];
+static u64 event_res_avg[MAX_COUNTERS][3];
+static u64 event_res_noise[MAX_COUNTERS][3];
-static __u64 event_scaled_avg[MAX_COUNTERS];
+static u64 event_scaled_avg[MAX_COUNTERS];
-static __u64 runtime_nsecs_avg;
-static __u64 runtime_nsecs_noise;
+static u64 runtime_nsecs_avg;
+static u64 runtime_nsecs_noise;
-static __u64 walltime_nsecs_avg;
-static __u64 walltime_nsecs_noise;
+static u64 walltime_nsecs_avg;
+static u64 walltime_nsecs_noise;
-static __u64 runtime_cycles_avg;
-static __u64 runtime_cycles_noise;
+static u64 runtime_cycles_avg;
+static u64 runtime_cycles_noise;
static void create_perf_stat_counter(int counter)
{
@@ -158,7 +158,7 @@ static inline int nsec_counter(int counter)
*/
static void read_counter(int counter)
{
- __u64 *count, single_count[3];
+ u64 *count, single_count[3];
ssize_t res;
int cpu, nv;
int scaled;
@@ -172,8 +172,8 @@ static void read_counter(int counter)
if (fd[cpu][counter] < 0)
continue;
- res = read(fd[cpu][counter], single_count, nv * sizeof(__u64));
- assert(res == nv * sizeof(__u64));
+ res = read(fd[cpu][counter], single_count, nv * sizeof(u64));
+ assert(res == nv * sizeof(u64));
close(fd[cpu][counter]);
fd[cpu][counter] = -1;
@@ -251,14 +251,14 @@ static int run_perf_stat(int argc, const char **argv)
return WEXITSTATUS(status);
}
-static void print_noise(__u64 *count, __u64 *noise)
+static void print_noise(u64 *count, u64 *noise)
{
if (run_count > 1)
fprintf(stderr, " ( +- %7.3f%% )",
(double)noise[0]/(count[0]+1)*100.0);
}
-static void nsec_printout(int counter, __u64 *count, __u64 *noise)
+static void nsec_printout(int counter, u64 *count, u64 *noise)
{
double msecs = (double)count[0] / 1000000;
@@ -274,7 +274,7 @@ static void nsec_printout(int counter, __u64 *count, __u64 *noise)
print_noise(count, noise);
}
-static void abs_printout(int counter, __u64 *count, __u64 *noise)
+static void abs_printout(int counter, u64 *count, u64 *noise)
{
fprintf(stderr, " %14Ld %-20s", count[0], event_name(counter));
@@ -298,7 +298,7 @@ static void abs_printout(int counter, __u64 *count, __u64 *noise)
*/
static void print_counter(int counter)
{
- __u64 *count, *noise;
+ u64 *count, *noise;
int scaled;
count = event_res_avg[counter];
@@ -326,16 +326,16 @@ static void print_counter(int counter)
/*
* normalize_noise noise values down to stddev:
*/
-static void normalize_noise(__u64 *val)
+static void normalize_noise(u64 *val)
{
double res;
res = (double)*val / (run_count * sqrt((double)run_count));
- *val = (__u64)res;
+ *val = (u64)res;
}
-static void update_avg(const char *name, int idx, __u64 *avg, __u64 *val)
+static void update_avg(const char *name, int idx, u64 *avg, u64 *val)
{
*avg += *val;
@@ -380,19 +380,19 @@ static void calc_avg(void)
for (i = 0; i < run_count; i++) {
runtime_nsecs_noise +=
- abs((__s64)(runtime_nsecs[i] - runtime_nsecs_avg));
+ abs((s64)(runtime_nsecs[i] - runtime_nsecs_avg));
walltime_nsecs_noise +=
- abs((__s64)(walltime_nsecs[i] - walltime_nsecs_avg));
+ abs((s64)(walltime_nsecs[i] - walltime_nsecs_avg));
runtime_cycles_noise +=
- abs((__s64)(runtime_cycles[i] - runtime_cycles_avg));
+ abs((s64)(runtime_cycles[i] - runtime_cycles_avg));
for (j = 0; j < nr_counters; j++) {
event_res_noise[j][0] +=
- abs((__s64)(event_res[i][j][0] - event_res_avg[j][0]));
+ abs((s64)(event_res[i][j][0] - event_res_avg[j][0]));
event_res_noise[j][1] +=
- abs((__s64)(event_res[i][j][1] - event_res_avg[j][1]));
+ abs((s64)(event_res[i][j][1] - event_res_avg[j][1]));
event_res_noise[j][2] +=
- abs((__s64)(event_res[i][j][2] - event_res_avg[j][2]));
+ abs((s64)(event_res[i][j][2] - event_res_avg[j][2]));
}
}