perf tools: Fix missing tool parameter

The 'inject' command expects to get a reference to 'struct perf_inject'
from its 'tool' member.  For that to work, 'tool' needs to be a
parameter of all tool callbacks.  Make it so.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1372944040-32690-3-git-send-email-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Adrian Hunter 2013-07-04 16:20:21 +03:00 committed by Arnaldo Carvalho de Melo
parent 63c2c9f8f2
commit 47c3d1091c
5 changed files with 30 additions and 28 deletions

View File

@ -73,22 +73,17 @@ static int perf_event__repipe_event_type_synth(struct perf_tool *tool,
return perf_event__repipe_synth(tool, event); return perf_event__repipe_synth(tool, event);
} }
static int perf_event__repipe_tracing_data_synth(union perf_event *event, static int perf_event__repipe_attr(struct perf_tool *tool,
struct perf_session *session union perf_event *event,
__maybe_unused) struct perf_evlist **pevlist)
{
return perf_event__repipe_synth(NULL, event);
}
static int perf_event__repipe_attr(union perf_event *event,
struct perf_evlist **pevlist __maybe_unused)
{ {
int ret; int ret;
ret = perf_event__process_attr(event, pevlist);
ret = perf_event__process_attr(tool, event, pevlist);
if (ret) if (ret)
return ret; return ret;
return perf_event__repipe_synth(NULL, event); return perf_event__repipe_synth(tool, event);
} }
static int perf_event__repipe(struct perf_tool *tool, static int perf_event__repipe(struct perf_tool *tool,
@ -147,13 +142,14 @@ static int perf_event__repipe_fork(struct perf_tool *tool,
return err; return err;
} }
static int perf_event__repipe_tracing_data(union perf_event *event, static int perf_event__repipe_tracing_data(struct perf_tool *tool,
union perf_event *event,
struct perf_session *session) struct perf_session *session)
{ {
int err; int err;
perf_event__repipe_synth(NULL, event); perf_event__repipe_synth(tool, event);
err = perf_event__process_tracing_data(event, session); err = perf_event__process_tracing_data(tool, event, session);
return err; return err;
} }
@ -407,7 +403,7 @@ int cmd_inject(int argc, const char **argv, const char *prefix __maybe_unused)
.unthrottle = perf_event__repipe, .unthrottle = perf_event__repipe,
.attr = perf_event__repipe_attr, .attr = perf_event__repipe_attr,
.event_type = perf_event__repipe_event_type_synth, .event_type = perf_event__repipe_event_type_synth,
.tracing_data = perf_event__repipe_tracing_data_synth, .tracing_data = perf_event__repipe_op2_synth,
.build_id = perf_event__repipe_op2_synth, .build_id = perf_event__repipe_op2_synth,
}, },
.input_name = "-", .input_name = "-",

View File

@ -2922,7 +2922,8 @@ int perf_event__synthesize_attrs(struct perf_tool *tool,
return err; return err;
} }
int perf_event__process_attr(union perf_event *event, int perf_event__process_attr(struct perf_tool *tool __maybe_unused,
union perf_event *event,
struct perf_evlist **pevlist) struct perf_evlist **pevlist)
{ {
u32 i, ids, n_ids; u32 i, ids, n_ids;
@ -3065,7 +3066,8 @@ int perf_event__synthesize_tracing_data(struct perf_tool *tool, int fd,
return aligned_size; return aligned_size;
} }
int perf_event__process_tracing_data(union perf_event *event, int perf_event__process_tracing_data(struct perf_tool *tool __maybe_unused,
union perf_event *event,
struct perf_session *session) struct perf_session *session)
{ {
ssize_t size_read, padding, size = event->tracing_data.size; ssize_t size_read, padding, size = event->tracing_data.size;

View File

@ -130,7 +130,8 @@ int perf_event__synthesize_attr(struct perf_tool *tool,
int perf_event__synthesize_attrs(struct perf_tool *tool, int perf_event__synthesize_attrs(struct perf_tool *tool,
struct perf_session *session, struct perf_session *session,
perf_event__handler_t process); perf_event__handler_t process);
int perf_event__process_attr(union perf_event *event, struct perf_evlist **pevlist); int perf_event__process_attr(struct perf_tool *tool, union perf_event *event,
struct perf_evlist **pevlist);
int perf_event__synthesize_event_type(struct perf_tool *tool, int perf_event__synthesize_event_type(struct perf_tool *tool,
u64 event_id, char *name, u64 event_id, char *name,
@ -145,7 +146,8 @@ int perf_event__process_event_type(struct perf_tool *tool,
int perf_event__synthesize_tracing_data(struct perf_tool *tool, int perf_event__synthesize_tracing_data(struct perf_tool *tool,
int fd, struct perf_evlist *evlist, int fd, struct perf_evlist *evlist,
perf_event__handler_t process); perf_event__handler_t process);
int perf_event__process_tracing_data(union perf_event *event, int perf_event__process_tracing_data(struct perf_tool *tool,
union perf_event *event,
struct perf_session *session); struct perf_session *session);
int perf_event__synthesize_build_id(struct perf_tool *tool, int perf_event__synthesize_build_id(struct perf_tool *tool,

View File

@ -193,7 +193,9 @@ void perf_session__delete(struct perf_session *self)
vdso__exit(); vdso__exit();
} }
static int process_event_synth_tracing_data_stub(union perf_event *event static int process_event_synth_tracing_data_stub(struct perf_tool *tool
__maybe_unused,
union perf_event *event
__maybe_unused, __maybe_unused,
struct perf_session *session struct perf_session *session
__maybe_unused) __maybe_unused)
@ -202,7 +204,8 @@ static int process_event_synth_tracing_data_stub(union perf_event *event
return 0; return 0;
} }
static int process_event_synth_attr_stub(union perf_event *event __maybe_unused, static int process_event_synth_attr_stub(struct perf_tool *tool __maybe_unused,
union perf_event *event __maybe_unused,
struct perf_evlist **pevlist struct perf_evlist **pevlist
__maybe_unused) __maybe_unused)
{ {
@ -921,7 +924,7 @@ static int perf_session__process_user_event(struct perf_session *session, union
/* These events are processed right away */ /* These events are processed right away */
switch (event->header.type) { switch (event->header.type) {
case PERF_RECORD_HEADER_ATTR: case PERF_RECORD_HEADER_ATTR:
err = tool->attr(event, &session->evlist); err = tool->attr(tool, event, &session->evlist);
if (err == 0) if (err == 0)
perf_session__set_id_hdr_size(session); perf_session__set_id_hdr_size(session);
return err; return err;
@ -930,7 +933,7 @@ static int perf_session__process_user_event(struct perf_session *session, union
case PERF_RECORD_HEADER_TRACING_DATA: case PERF_RECORD_HEADER_TRACING_DATA:
/* setup for reading amidst mmap */ /* setup for reading amidst mmap */
lseek(session->fd, file_offset, SEEK_SET); lseek(session->fd, file_offset, SEEK_SET);
return tool->tracing_data(event, session); return tool->tracing_data(tool, event, session);
case PERF_RECORD_HEADER_BUILD_ID: case PERF_RECORD_HEADER_BUILD_ID:
return tool->build_id(tool, event, session); return tool->build_id(tool, event, session);
case PERF_RECORD_FINISHED_ROUND: case PERF_RECORD_FINISHED_ROUND:

View File

@ -18,12 +18,11 @@ typedef int (*event_sample)(struct perf_tool *tool, union perf_event *event,
typedef int (*event_op)(struct perf_tool *tool, union perf_event *event, typedef int (*event_op)(struct perf_tool *tool, union perf_event *event,
struct perf_sample *sample, struct machine *machine); struct perf_sample *sample, struct machine *machine);
typedef int (*event_attr_op)(union perf_event *event, typedef int (*event_attr_op)(struct perf_tool *tool,
union perf_event *event,
struct perf_evlist **pevlist); struct perf_evlist **pevlist);
typedef int (*event_simple_op)(struct perf_tool *tool, union perf_event *event);
typedef int (*event_synth_op)(union perf_event *event, typedef int (*event_simple_op)(struct perf_tool *tool, union perf_event *event);
struct perf_session *session);
typedef int (*event_op2)(struct perf_tool *tool, union perf_event *event, typedef int (*event_op2)(struct perf_tool *tool, union perf_event *event,
struct perf_session *session); struct perf_session *session);
@ -39,7 +38,7 @@ struct perf_tool {
throttle, throttle,
unthrottle; unthrottle;
event_attr_op attr; event_attr_op attr;
event_synth_op tracing_data; event_op2 tracing_data;
event_simple_op event_type; event_simple_op event_type;
event_op2 finished_round, event_op2 finished_round,
build_id; build_id;