perf session: Pass evsel in event_ops->sample()
Resolving the sample->id to an evsel since the most advanced tools, report and annotate, and the others will too when they evolve to properly support multi-event perf.data files. Good also because it does an extra validation, checking that the ID is valid when present. When that is not the case, the overhead is just a branch + function call (perf_evlist__id2evsel). 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>
This commit is contained in:
@@ -488,6 +488,7 @@ static void sched_switch(int cpu, u64 timestamp, struct trace_entry *te)
|
||||
|
||||
static int process_sample_event(union perf_event *event __used,
|
||||
struct perf_sample *sample,
|
||||
struct perf_evsel *evsel __used,
|
||||
struct perf_session *session)
|
||||
{
|
||||
struct trace_entry *te;
|
||||
@@ -506,6 +507,16 @@ static int process_sample_event(union perf_event *event __used,
|
||||
struct power_entry_old *peo;
|
||||
peo = (void *)te;
|
||||
#endif
|
||||
/*
|
||||
* FIXME: use evsel, its already mapped from id to perf_evsel,
|
||||
* remove perf_header__find_event infrastructure bits.
|
||||
* Mapping all these "power:cpu_idle" strings to the tracepoint
|
||||
* ID and then just comparing against evsel->attr.config.
|
||||
*
|
||||
* e.g.:
|
||||
*
|
||||
* if (evsel->attr.config == power_cpu_idle_id)
|
||||
*/
|
||||
event_str = perf_header__find_event(te->type);
|
||||
|
||||
if (!event_str)
|
||||
|
Reference in New Issue
Block a user