perf tools: Pass tool context in the the perf_event_ops functions

So that we don't need to have that many globals.

Next steps will remove the 'session' pointer, that in most cases is
not needed.

Then we can rename perf_event_ops to 'perf_tool' that better describes
this class hierarchy.

Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-wp4djox7x6w1i2bab1pt4xxp@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Arnaldo Carvalho de Melo
2011-11-25 08:19:45 -02:00
parent 7009cc34b9
commit d20deb64e0
20 changed files with 519 additions and 372 deletions

View File

@@ -824,7 +824,7 @@ static void perf_session__mmap_read_idx(struct perf_session *self, int idx)
perf_event__process_sample(event, evsel, &sample, self);
else if (event->header.type < PERF_RECORD_MAX) {
hists__inc_nr_events(&evsel->hists, event->header.type);
perf_event__process(event, &sample, self);
perf_event__process(&top.ops, event, &sample, self);
} else
++self->hists.stats.nr_unknown_events;
}
@@ -966,10 +966,10 @@ static int __cmd_top(void)
goto out_delete;
if (top.target_tid != -1)
perf_event__synthesize_thread_map(top.evlist->threads,
perf_event__synthesize_thread_map(&top.ops, top.evlist->threads,
perf_event__process, top.session);
else
perf_event__synthesize_threads(perf_event__process, top.session);
perf_event__synthesize_threads(&top.ops, perf_event__process, top.session);
start_counters(top.evlist);
top.session->evlist = top.evlist;