diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2011-03-11 08:11:48 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2011-03-11 11:28:45 -0500 |
commit | ec52d9765a0f3603c62b4238482bf38897e4d42f (patch) | |
tree | a836047186077efda945d63bdd11aabccfd941b5 /tools | |
parent | 137ee20ddd10fdc20600c389fe63edab0c39cb1a (diff) |
perf top: Remove redundant perf_top->sym_counter
We can get that counter index from perf_top->sym_evsel->idx instead.
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/builtin-top.c | 11 | ||||
-rw-r--r-- | tools/perf/util/top.c | 2 | ||||
-rw-r--r-- | tools/perf/util/top.h | 2 |
3 files changed, 8 insertions, 7 deletions
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index 80c9e062bd5b..4bf6e02c2b2a 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c | |||
@@ -515,24 +515,25 @@ static void handle_keypress(struct perf_session *session, int c) | |||
515 | break; | 515 | break; |
516 | case 'E': | 516 | case 'E': |
517 | if (top.evlist->nr_entries > 1) { | 517 | if (top.evlist->nr_entries > 1) { |
518 | int counter; | ||
518 | fprintf(stderr, "\nAvailable events:"); | 519 | fprintf(stderr, "\nAvailable events:"); |
519 | 520 | ||
520 | list_for_each_entry(top.sym_evsel, &top.evlist->entries, node) | 521 | list_for_each_entry(top.sym_evsel, &top.evlist->entries, node) |
521 | fprintf(stderr, "\n\t%d %s", top.sym_evsel->idx, event_name(top.sym_evsel)); | 522 | fprintf(stderr, "\n\t%d %s", top.sym_evsel->idx, event_name(top.sym_evsel)); |
522 | 523 | ||
523 | prompt_integer(&top.sym_counter, "Enter details event counter"); | 524 | prompt_integer(&counter, "Enter details event counter"); |
524 | 525 | ||
525 | if (top.sym_counter >= top.evlist->nr_entries) { | 526 | if (counter >= top.evlist->nr_entries) { |
526 | top.sym_evsel = list_entry(top.evlist->entries.next, struct perf_evsel, node); | 527 | top.sym_evsel = list_entry(top.evlist->entries.next, struct perf_evsel, node); |
527 | top.sym_counter = 0; | ||
528 | fprintf(stderr, "Sorry, no such event, using %s.\n", event_name(top.sym_evsel)); | 528 | fprintf(stderr, "Sorry, no such event, using %s.\n", event_name(top.sym_evsel)); |
529 | sleep(1); | 529 | sleep(1); |
530 | break; | 530 | break; |
531 | } | 531 | } |
532 | list_for_each_entry(top.sym_evsel, &top.evlist->entries, node) | 532 | list_for_each_entry(top.sym_evsel, &top.evlist->entries, node) |
533 | if (top.sym_evsel->idx == top.sym_counter) | 533 | if (top.sym_evsel->idx == counter) |
534 | break; | 534 | break; |
535 | } else top.sym_counter = 0; | 535 | } else |
536 | top.sym_evsel = list_entry(top.evlist->entries.next, struct perf_evsel, node); | ||
536 | break; | 537 | break; |
537 | case 'f': | 538 | case 'f': |
538 | prompt_integer(&top.count_filter, "Enter display event count filter"); | 539 | prompt_integer(&top.count_filter, "Enter display event count filter"); |
diff --git a/tools/perf/util/top.c b/tools/perf/util/top.c index 75cfe4d45119..fcfb77762819 100644 --- a/tools/perf/util/top.c +++ b/tools/perf/util/top.c | |||
@@ -171,7 +171,7 @@ float perf_top__decay_samples(struct perf_top *top, struct rb_root *root) | |||
171 | { | 171 | { |
172 | struct sym_entry *syme, *n; | 172 | struct sym_entry *syme, *n; |
173 | float sum_ksamples = 0.0; | 173 | float sum_ksamples = 0.0; |
174 | int snap = !top->display_weighted ? top->sym_counter : 0, j; | 174 | int snap = !top->display_weighted ? top->sym_evsel->idx : 0, j; |
175 | 175 | ||
176 | /* Sort the active symbols */ | 176 | /* Sort the active symbols */ |
177 | pthread_mutex_lock(&top->active_symbols_lock); | 177 | pthread_mutex_lock(&top->active_symbols_lock); |
diff --git a/tools/perf/util/top.h b/tools/perf/util/top.h index 96d1cb78af01..96a78312c719 100644 --- a/tools/perf/util/top.h +++ b/tools/perf/util/top.h | |||
@@ -41,7 +41,7 @@ struct perf_top { | |||
41 | u64 exact_samples; | 41 | u64 exact_samples; |
42 | u64 guest_us_samples, guest_kernel_samples; | 42 | u64 guest_us_samples, guest_kernel_samples; |
43 | int print_entries, count_filter, delay_secs; | 43 | int print_entries, count_filter, delay_secs; |
44 | int display_weighted, freq, rb_entries, sym_counter; | 44 | int display_weighted, freq, rb_entries; |
45 | pid_t target_pid, target_tid; | 45 | pid_t target_pid, target_tid; |
46 | bool hide_kernel_symbols, hide_user_symbols, zero; | 46 | bool hide_kernel_symbols, hide_user_symbols, zero; |
47 | const char *cpu_list; | 47 | const char *cpu_list; |