summaryrefslogtreecommitdiff
path: root/tools/perf/builtin-top.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2011-03-11 16:11:48 +0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2011-03-11 19:28:45 +0300
commitec52d9765a0f3603c62b4238482bf38897e4d42f (patch)
treea836047186077efda945d63bdd11aabccfd941b5 /tools/perf/builtin-top.c
parent137ee20ddd10fdc20600c389fe63edab0c39cb1a (diff)
downloadlinux-ec52d9765a0f3603c62b4238482bf38897e4d42f.tar.xz
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/perf/builtin-top.c')
-rw-r--r--tools/perf/builtin-top.c11
1 files changed, 6 insertions, 5 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)
break;
case 'E':
if (top.evlist->nr_entries > 1) {
+ int counter;
fprintf(stderr, "\nAvailable events:");
list_for_each_entry(top.sym_evsel, &top.evlist->entries, node)
fprintf(stderr, "\n\t%d %s", top.sym_evsel->idx, event_name(top.sym_evsel));
- prompt_integer(&top.sym_counter, "Enter details event counter");
+ prompt_integer(&counter, "Enter details event counter");
- if (top.sym_counter >= top.evlist->nr_entries) {
+ if (counter >= top.evlist->nr_entries) {
top.sym_evsel = list_entry(top.evlist->entries.next, struct perf_evsel, node);
- top.sym_counter = 0;
fprintf(stderr, "Sorry, no such event, using %s.\n", event_name(top.sym_evsel));
sleep(1);
break;
}
list_for_each_entry(top.sym_evsel, &top.evlist->entries, node)
- if (top.sym_evsel->idx == top.sym_counter)
+ if (top.sym_evsel->idx == counter)
break;
- } else top.sym_counter = 0;
+ } else
+ top.sym_evsel = list_entry(top.evlist->entries.next, struct perf_evsel, node);
break;
case 'f':
prompt_integer(&top.count_filter, "Enter display event count filter");