Skip to content

Commit

Permalink
perf evsel: Ditch evsel->handler.data field
Browse files Browse the repository at this point in the history
Not needed since this cset:

  fcf65bf: perf evsel: Cache associated event_format

So lets trim this struct a bit.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.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-j8setslokt0goiwxq9dogzqm@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
  • Loading branch information
Arnaldo Carvalho de Melo committed Nov 7, 2013
1 parent 8a4d0b5 commit 744a971
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 23 deletions.
10 changes: 5 additions & 5 deletions tools/perf/builtin-inject.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ static int perf_event__repipe_sample(struct perf_tool *tool,
struct perf_evsel *evsel,
struct machine *machine)
{
if (evsel->handler.func) {
inject_handler f = evsel->handler.func;
if (evsel->handler) {
inject_handler f = evsel->handler;
return f(tool, event, sample, evsel, machine);
}

Expand Down Expand Up @@ -383,11 +383,11 @@ static int __cmd_inject(struct perf_inject *inject)
if (perf_evsel__check_stype(evsel, PERF_SAMPLE_TID, "TID"))
return -EINVAL;

evsel->handler.func = perf_inject__sched_switch;
evsel->handler = perf_inject__sched_switch;
} else if (!strcmp(name, "sched:sched_process_exit"))
evsel->handler.func = perf_inject__sched_process_exit;
evsel->handler = perf_inject__sched_process_exit;
else if (!strncmp(name, "sched:sched_stat_", 17))
evsel->handler.func = perf_inject__sched_stat;
evsel->handler = perf_inject__sched_stat;
}
}

Expand Down
4 changes: 2 additions & 2 deletions tools/perf/builtin-kmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,8 @@ static int process_sample_event(struct perf_tool *tool __maybe_unused,

dump_printf(" ... thread: %s:%d\n", thread__comm_str(thread), thread->tid);

if (evsel->handler.func != NULL) {
tracepoint_handler f = evsel->handler.func;
if (evsel->handler != NULL) {
tracepoint_handler f = evsel->handler;
return f(evsel, sample);
}

Expand Down
4 changes: 2 additions & 2 deletions tools/perf/builtin-lock.c
Original file line number Diff line number Diff line change
Expand Up @@ -819,8 +819,8 @@ static int process_sample_event(struct perf_tool *tool __maybe_unused,
return -1;
}

if (evsel->handler.func != NULL) {
tracepoint_handler f = evsel->handler.func;
if (evsel->handler != NULL) {
tracepoint_handler f = evsel->handler;
return f(evsel, sample);
}

Expand Down
4 changes: 2 additions & 2 deletions tools/perf/builtin-sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -1427,8 +1427,8 @@ static int perf_sched__process_tracepoint_sample(struct perf_tool *tool __maybe_
evsel->hists.stats.total_period += sample->period;
hists__inc_nr_events(&evsel->hists, PERF_RECORD_SAMPLE);

if (evsel->handler.func != NULL) {
tracepoint_handler f = evsel->handler.func;
if (evsel->handler != NULL) {
tracepoint_handler f = evsel->handler;
err = f(tool, evsel, sample, machine);
}

Expand Down
4 changes: 2 additions & 2 deletions tools/perf/builtin-timechart.c
Original file line number Diff line number Diff line change
Expand Up @@ -483,8 +483,8 @@ static int process_sample_event(struct perf_tool *tool __maybe_unused,
if (sample->cpu > numcpus)
numcpus = sample->cpu;

if (evsel->handler.func != NULL) {
tracepoint_handler f = evsel->handler.func;
if (evsel->handler != NULL) {
tracepoint_handler f = evsel->handler;
return f(evsel, sample);
}

Expand Down
6 changes: 3 additions & 3 deletions tools/perf/builtin-trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -1570,7 +1570,7 @@ static int trace__process_sample(struct perf_tool *tool,
struct trace *trace = container_of(tool, struct trace, tool);
int err = 0;

tracepoint_handler handler = evsel->handler.func;
tracepoint_handler handler = evsel->handler;

if (skip_sample(trace, sample))
return 0;
Expand Down Expand Up @@ -1656,7 +1656,7 @@ static void perf_evlist__add_vfs_getname(struct perf_evlist *evlist)
return;
}

evsel->handler.func = trace__vfs_getname;
evsel->handler = trace__vfs_getname;
perf_evlist__add(evlist, evsel);
}

Expand Down Expand Up @@ -1768,7 +1768,7 @@ static int trace__run(struct trace *trace, int argc, const char **argv)
goto next_event;
}

handler = evsel->handler.func;
handler = evsel->handler;
handler(trace, evsel, &sample);
next_event:
perf_evlist__mmap_consume(evlist, i);
Expand Down
2 changes: 1 addition & 1 deletion tools/perf/util/evlist.c
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ int perf_evlist__add_newtp(struct perf_evlist *evlist,
if (evsel == NULL)
return -1;

evsel->handler.func = handler;
evsel->handler = handler;
perf_evlist__add(evlist, evsel);
return 0;
}
Expand Down
5 changes: 1 addition & 4 deletions tools/perf/util/evsel.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,7 @@ struct perf_evsel {
off_t id_offset;
};
struct cgroup_sel *cgrp;
struct {
void *func;
void *data;
} handler;
void *handler;
struct cpu_map *cpus;
unsigned int sample_size;
int id_pos;
Expand Down
4 changes: 2 additions & 2 deletions tools/perf/util/session.c
Original file line number Diff line number Diff line change
Expand Up @@ -1650,9 +1650,9 @@ int __perf_session__set_tracepoints_handlers(struct perf_session *session,
continue;

err = -EEXIST;
if (evsel->handler.func != NULL)
if (evsel->handler != NULL)
goto out;
evsel->handler.func = assocs[i].handler;
evsel->handler = assocs[i].handler;
}

err = 0;
Expand Down

0 comments on commit 744a971

Please sign in to comment.