diff options
Diffstat (limited to 'tools/perf/builtin-stat.c')
-rw-r--r-- | tools/perf/builtin-stat.c | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index e5b3c0ff03a9..6d3eeac1ea25 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c | |||
@@ -85,29 +85,29 @@ static const unsigned int default_count[] = { | |||
85 | static int run_count = 1; | 85 | static int run_count = 1; |
86 | static int run_idx = 0; | 86 | static int run_idx = 0; |
87 | 87 | ||
88 | static __u64 event_res[MAX_RUN][MAX_COUNTERS][3]; | 88 | static u64 event_res[MAX_RUN][MAX_COUNTERS][3]; |
89 | static __u64 event_scaled[MAX_RUN][MAX_COUNTERS]; | 89 | static u64 event_scaled[MAX_RUN][MAX_COUNTERS]; |
90 | 90 | ||
91 | //static __u64 event_hist[MAX_RUN][MAX_COUNTERS][3]; | 91 | //static u64 event_hist[MAX_RUN][MAX_COUNTERS][3]; |
92 | 92 | ||
93 | 93 | ||
94 | static __u64 runtime_nsecs[MAX_RUN]; | 94 | static u64 runtime_nsecs[MAX_RUN]; |
95 | static __u64 walltime_nsecs[MAX_RUN]; | 95 | static u64 walltime_nsecs[MAX_RUN]; |
96 | static __u64 runtime_cycles[MAX_RUN]; | 96 | static u64 runtime_cycles[MAX_RUN]; |
97 | 97 | ||
98 | static __u64 event_res_avg[MAX_COUNTERS][3]; | 98 | static u64 event_res_avg[MAX_COUNTERS][3]; |
99 | static __u64 event_res_noise[MAX_COUNTERS][3]; | 99 | static u64 event_res_noise[MAX_COUNTERS][3]; |
100 | 100 | ||
101 | static __u64 event_scaled_avg[MAX_COUNTERS]; | 101 | static u64 event_scaled_avg[MAX_COUNTERS]; |
102 | 102 | ||
103 | static __u64 runtime_nsecs_avg; | 103 | static u64 runtime_nsecs_avg; |
104 | static __u64 runtime_nsecs_noise; | 104 | static u64 runtime_nsecs_noise; |
105 | 105 | ||
106 | static __u64 walltime_nsecs_avg; | 106 | static u64 walltime_nsecs_avg; |
107 | static __u64 walltime_nsecs_noise; | 107 | static u64 walltime_nsecs_noise; |
108 | 108 | ||
109 | static __u64 runtime_cycles_avg; | 109 | static u64 runtime_cycles_avg; |
110 | static __u64 runtime_cycles_noise; | 110 | static u64 runtime_cycles_noise; |
111 | 111 | ||
112 | static void create_perf_stat_counter(int counter) | 112 | static void create_perf_stat_counter(int counter) |
113 | { | 113 | { |
@@ -158,7 +158,7 @@ static inline int nsec_counter(int counter) | |||
158 | */ | 158 | */ |
159 | static void read_counter(int counter) | 159 | static void read_counter(int counter) |
160 | { | 160 | { |
161 | __u64 *count, single_count[3]; | 161 | u64 *count, single_count[3]; |
162 | ssize_t res; | 162 | ssize_t res; |
163 | int cpu, nv; | 163 | int cpu, nv; |
164 | int scaled; | 164 | int scaled; |
@@ -172,8 +172,8 @@ static void read_counter(int counter) | |||
172 | if (fd[cpu][counter] < 0) | 172 | if (fd[cpu][counter] < 0) |
173 | continue; | 173 | continue; |
174 | 174 | ||
175 | res = read(fd[cpu][counter], single_count, nv * sizeof(__u64)); | 175 | res = read(fd[cpu][counter], single_count, nv * sizeof(u64)); |
176 | assert(res == nv * sizeof(__u64)); | 176 | assert(res == nv * sizeof(u64)); |
177 | close(fd[cpu][counter]); | 177 | close(fd[cpu][counter]); |
178 | fd[cpu][counter] = -1; | 178 | fd[cpu][counter] = -1; |
179 | 179 | ||
@@ -251,14 +251,14 @@ static int run_perf_stat(int argc, const char **argv) | |||
251 | return WEXITSTATUS(status); | 251 | return WEXITSTATUS(status); |
252 | } | 252 | } |
253 | 253 | ||
254 | static void print_noise(__u64 *count, __u64 *noise) | 254 | static void print_noise(u64 *count, u64 *noise) |
255 | { | 255 | { |
256 | if (run_count > 1) | 256 | if (run_count > 1) |
257 | fprintf(stderr, " ( +- %7.3f%% )", | 257 | fprintf(stderr, " ( +- %7.3f%% )", |
258 | (double)noise[0]/(count[0]+1)*100.0); | 258 | (double)noise[0]/(count[0]+1)*100.0); |
259 | } | 259 | } |
260 | 260 | ||
261 | static void nsec_printout(int counter, __u64 *count, __u64 *noise) | 261 | static void nsec_printout(int counter, u64 *count, u64 *noise) |
262 | { | 262 | { |
263 | double msecs = (double)count[0] / 1000000; | 263 | double msecs = (double)count[0] / 1000000; |
264 | 264 | ||
@@ -274,7 +274,7 @@ static void nsec_printout(int counter, __u64 *count, __u64 *noise) | |||
274 | print_noise(count, noise); | 274 | print_noise(count, noise); |
275 | } | 275 | } |
276 | 276 | ||
277 | static void abs_printout(int counter, __u64 *count, __u64 *noise) | 277 | static void abs_printout(int counter, u64 *count, u64 *noise) |
278 | { | 278 | { |
279 | fprintf(stderr, " %14Ld %-20s", count[0], event_name(counter)); | 279 | fprintf(stderr, " %14Ld %-20s", count[0], event_name(counter)); |
280 | 280 | ||
@@ -298,7 +298,7 @@ static void abs_printout(int counter, __u64 *count, __u64 *noise) | |||
298 | */ | 298 | */ |
299 | static void print_counter(int counter) | 299 | static void print_counter(int counter) |
300 | { | 300 | { |
301 | __u64 *count, *noise; | 301 | u64 *count, *noise; |
302 | int scaled; | 302 | int scaled; |
303 | 303 | ||
304 | count = event_res_avg[counter]; | 304 | count = event_res_avg[counter]; |
@@ -326,16 +326,16 @@ static void print_counter(int counter) | |||
326 | /* | 326 | /* |
327 | * normalize_noise noise values down to stddev: | 327 | * normalize_noise noise values down to stddev: |
328 | */ | 328 | */ |
329 | static void normalize_noise(__u64 *val) | 329 | static void normalize_noise(u64 *val) |
330 | { | 330 | { |
331 | double res; | 331 | double res; |
332 | 332 | ||
333 | res = (double)*val / (run_count * sqrt((double)run_count)); | 333 | res = (double)*val / (run_count * sqrt((double)run_count)); |
334 | 334 | ||
335 | *val = (__u64)res; | 335 | *val = (u64)res; |
336 | } | 336 | } |
337 | 337 | ||
338 | static void update_avg(const char *name, int idx, __u64 *avg, __u64 *val) | 338 | static void update_avg(const char *name, int idx, u64 *avg, u64 *val) |
339 | { | 339 | { |
340 | *avg += *val; | 340 | *avg += *val; |
341 | 341 | ||
@@ -380,19 +380,19 @@ static void calc_avg(void) | |||
380 | 380 | ||
381 | for (i = 0; i < run_count; i++) { | 381 | for (i = 0; i < run_count; i++) { |
382 | runtime_nsecs_noise += | 382 | runtime_nsecs_noise += |
383 | abs((__s64)(runtime_nsecs[i] - runtime_nsecs_avg)); | 383 | abs((s64)(runtime_nsecs[i] - runtime_nsecs_avg)); |
384 | walltime_nsecs_noise += | 384 | walltime_nsecs_noise += |
385 | abs((__s64)(walltime_nsecs[i] - walltime_nsecs_avg)); | 385 | abs((s64)(walltime_nsecs[i] - walltime_nsecs_avg)); |
386 | runtime_cycles_noise += | 386 | runtime_cycles_noise += |
387 | abs((__s64)(runtime_cycles[i] - runtime_cycles_avg)); | 387 | abs((s64)(runtime_cycles[i] - runtime_cycles_avg)); |
388 | 388 | ||
389 | for (j = 0; j < nr_counters; j++) { | 389 | for (j = 0; j < nr_counters; j++) { |
390 | event_res_noise[j][0] += | 390 | event_res_noise[j][0] += |
391 | abs((__s64)(event_res[i][j][0] - event_res_avg[j][0])); | 391 | abs((s64)(event_res[i][j][0] - event_res_avg[j][0])); |
392 | event_res_noise[j][1] += | 392 | event_res_noise[j][1] += |
393 | abs((__s64)(event_res[i][j][1] - event_res_avg[j][1])); | 393 | abs((s64)(event_res[i][j][1] - event_res_avg[j][1])); |
394 | event_res_noise[j][2] += | 394 | event_res_noise[j][2] += |
395 | abs((__s64)(event_res[i][j][2] - event_res_avg[j][2])); | 395 | abs((s64)(event_res[i][j][2] - event_res_avg[j][2])); |
396 | } | 396 | } |
397 | } | 397 | } |
398 | 398 | ||