aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf
diff options
context:
space:
mode:
authorJaswinder Singh Rajput <jaswinder@kernel.org>2009-06-24 08:49:34 -0400
committerIngo Molnar <mingo@elte.hu>2009-06-24 08:55:45 -0400
commit3d63259583278262d9153316094e315f73ebfcb5 (patch)
tree48f8fefd44f744c4ac35313cc2502ca68c18db9f /tools/perf
parentc14dab5c0782ef632742963a66276a195418a63c (diff)
perf stat: Remove dead code
Remove dead code and do some code alignment. Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@gmail.com> Cc: Peter Zijlstra <peterz@infradead.org> LKML-Reference: <1245847774.2681.2.camel@ht.satnam> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf')
-rw-r--r--tools/perf/builtin-stat.c44
1 files changed, 13 insertions, 31 deletions
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 5e04fcc8d077..8420ec589506 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -59,42 +59,27 @@ static struct perf_counter_attr default_attrs[MAX_COUNTERS] = {
59 59
60}; 60};
61 61
62#define MAX_RUN 100
63
62static int system_wide = 0; 64static int system_wide = 0;
63static int inherit = 1;
64static int verbose = 0; 65static int verbose = 0;
65
66static int fd[MAX_NR_CPUS][MAX_COUNTERS];
67
68static int target_pid = -1;
69static int nr_cpus = 0; 66static int nr_cpus = 0;
70static unsigned int page_size; 67static int run_idx = 0;
71 68
69static int run_count = 1;
70static int inherit = 1;
72static int scale = 1; 71static int scale = 1;
72static int target_pid = -1;
73 73
74static const unsigned int default_count[] = { 74static int fd[MAX_NR_CPUS][MAX_COUNTERS];
75 1000000,
76 1000000,
77 10000,
78 10000,
79 1000000,
80 10000,
81};
82
83#define MAX_RUN 100
84
85static int run_count = 1;
86static int run_idx = 0;
87
88static u64 event_res[MAX_RUN][MAX_COUNTERS][3];
89static u64 event_scaled[MAX_RUN][MAX_COUNTERS];
90
91//static u64 event_hist[MAX_RUN][MAX_COUNTERS][3];
92
93 75
94static u64 runtime_nsecs[MAX_RUN]; 76static u64 runtime_nsecs[MAX_RUN];
95static u64 walltime_nsecs[MAX_RUN]; 77static u64 walltime_nsecs[MAX_RUN];
96static u64 runtime_cycles[MAX_RUN]; 78static u64 runtime_cycles[MAX_RUN];
97 79
80static u64 event_res[MAX_RUN][MAX_COUNTERS][3];
81static u64 event_scaled[MAX_RUN][MAX_COUNTERS];
82
98static u64 event_res_avg[MAX_COUNTERS][3]; 83static u64 event_res_avg[MAX_COUNTERS][3];
99static u64 event_res_noise[MAX_COUNTERS][3]; 84static u64 event_res_noise[MAX_COUNTERS][3];
100 85
@@ -109,7 +94,6 @@ static u64 walltime_nsecs_noise;
109static u64 runtime_cycles_avg; 94static u64 runtime_cycles_avg;
110static u64 runtime_cycles_noise; 95static u64 runtime_cycles_noise;
111 96
112
113#define ERR_PERF_OPEN \ 97#define ERR_PERF_OPEN \
114"Error: counter %d, sys_perf_counter_open() syscall returned with %d (%s)\n" 98"Error: counter %d, sys_perf_counter_open() syscall returned with %d (%s)\n"
115 99
@@ -470,9 +454,9 @@ static const struct option options[] = {
470 OPT_INTEGER('p', "pid", &target_pid, 454 OPT_INTEGER('p', "pid", &target_pid,
471 "stat events on existing pid"), 455 "stat events on existing pid"),
472 OPT_BOOLEAN('a', "all-cpus", &system_wide, 456 OPT_BOOLEAN('a', "all-cpus", &system_wide,
473 "system-wide collection from all CPUs"), 457 "system-wide collection from all CPUs"),
474 OPT_BOOLEAN('S', "scale", &scale, 458 OPT_BOOLEAN('S', "scale", &scale,
475 "scale/normalize counters"), 459 "scale/normalize counters"),
476 OPT_BOOLEAN('v', "verbose", &verbose, 460 OPT_BOOLEAN('v', "verbose", &verbose,
477 "be more verbose (show counter open errors, etc)"), 461 "be more verbose (show counter open errors, etc)"),
478 OPT_INTEGER('r', "repeat", &run_count, 462 OPT_INTEGER('r', "repeat", &run_count,
@@ -484,8 +468,6 @@ int cmd_stat(int argc, const char **argv, const char *prefix)
484{ 468{
485 int status; 469 int status;
486 470
487 page_size = sysconf(_SC_PAGE_SIZE);
488
489 memcpy(attrs, default_attrs, sizeof(attrs)); 471 memcpy(attrs, default_attrs, sizeof(attrs));
490 472
491 argc = parse_options(argc, argv, options, stat_usage, 0); 473 argc = parse_options(argc, argv, options, stat_usage, 0);
@@ -515,7 +497,7 @@ int cmd_stat(int argc, const char **argv, const char *prefix)
515 status = 0; 497 status = 0;
516 for (run_idx = 0; run_idx < run_count; run_idx++) { 498 for (run_idx = 0; run_idx < run_count; run_idx++) {
517 if (run_count != 1 && verbose) 499 if (run_count != 1 && verbose)
518 fprintf(stderr, "[ perf stat: executing run #%d ... ]\n", run_idx+1); 500 fprintf(stderr, "[ perf stat: executing run #%d ... ]\n", run_idx + 1);
519 status = run_perf_stat(argc, argv); 501 status = run_perf_stat(argc, argv);
520 } 502 }
521 503