Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Jaswinder Singh Rajput and committed by
Ingo Molnar
3d632595 c14dab5c

+15 -33
+15 -33
tools/perf/builtin-stat.c
··· 59 59 60 60 }; 61 61 62 + #define MAX_RUN 100 63 + 62 64 static int system_wide = 0; 63 - static int inherit = 1; 64 65 static int verbose = 0; 66 + static int nr_cpus = 0; 67 + static int run_idx = 0; 68 + 69 + static int run_count = 1; 70 + static int inherit = 1; 71 + static int scale = 1; 72 + static int target_pid = -1; 65 73 66 74 static int fd[MAX_NR_CPUS][MAX_COUNTERS]; 67 - 68 - static int target_pid = -1; 69 - static int nr_cpus = 0; 70 - static unsigned int page_size; 71 - 72 - static int scale = 1; 73 - 74 - static const unsigned int default_count[] = { 75 - 1000000, 76 - 1000000, 77 - 10000, 78 - 10000, 79 - 1000000, 80 - 10000, 81 - }; 82 - 83 - #define MAX_RUN 100 84 - 85 - static int run_count = 1; 86 - static int run_idx = 0; 87 - 88 - static u64 event_res[MAX_RUN][MAX_COUNTERS][3]; 89 - static u64 event_scaled[MAX_RUN][MAX_COUNTERS]; 90 - 91 - //static u64 event_hist[MAX_RUN][MAX_COUNTERS][3]; 92 - 93 75 94 76 static u64 runtime_nsecs[MAX_RUN]; 95 77 static u64 walltime_nsecs[MAX_RUN]; 96 78 static u64 runtime_cycles[MAX_RUN]; 79 + 80 + static u64 event_res[MAX_RUN][MAX_COUNTERS][3]; 81 + static u64 event_scaled[MAX_RUN][MAX_COUNTERS]; 97 82 98 83 static u64 event_res_avg[MAX_COUNTERS][3]; 99 84 static u64 event_res_noise[MAX_COUNTERS][3]; ··· 93 108 94 109 static u64 runtime_cycles_avg; 95 110 static u64 runtime_cycles_noise; 96 - 97 111 98 112 #define ERR_PERF_OPEN \ 99 113 "Error: counter %d, sys_perf_counter_open() syscall returned with %d (%s)\n" ··· 454 470 OPT_INTEGER('p', "pid", &target_pid, 455 471 "stat events on existing pid"), 456 472 OPT_BOOLEAN('a', "all-cpus", &system_wide, 457 - "system-wide collection from all CPUs"), 473 + "system-wide collection from all CPUs"), 458 474 OPT_BOOLEAN('S', "scale", &scale, 459 - "scale/normalize counters"), 475 + "scale/normalize counters"), 460 476 OPT_BOOLEAN('v', "verbose", &verbose, 461 477 "be more verbose (show counter open errors, etc)"), 462 478 OPT_INTEGER('r', "repeat", &run_count, ··· 467 483 int cmd_stat(int argc, const char **argv, const char *prefix) 468 484 { 469 485 int status; 470 - 471 - page_size = sysconf(_SC_PAGE_SIZE); 472 486 473 487 memcpy(attrs, default_attrs, sizeof(attrs)); 474 488 ··· 497 515 status = 0; 498 516 for (run_idx = 0; run_idx < run_count; run_idx++) { 499 517 if (run_count != 1 && verbose) 500 - fprintf(stderr, "[ perf stat: executing run #%d ... ]\n", run_idx+1); 518 + fprintf(stderr, "[ perf stat: executing run #%d ... ]\n", run_idx + 1); 501 519 status = run_perf_stat(argc, argv); 502 520 } 503 521