perf ordered_events: Shorten function signatures

By keeping pointers to machines, evlist and tool in ordered_events.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: David Ahern <dsahern@gmail.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-0c6huyaf59mqtm2ek9pmposl@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent fa713a4e
...@@ -208,7 +208,7 @@ static int __cmd_annotate(struct perf_annotate *ann) ...@@ -208,7 +208,7 @@ static int __cmd_annotate(struct perf_annotate *ann)
goto out; goto out;
} }
ret = perf_session__process_events(session, &ann->tool); ret = perf_session__process_events(session);
if (ret) if (ret)
goto out; goto out;
......
...@@ -74,7 +74,7 @@ static int perf_session__list_build_ids(bool force, bool with_hits) ...@@ -74,7 +74,7 @@ static int perf_session__list_build_ids(bool force, bool with_hits)
* the record stream. Buildids are stored as RECORD_HEADER_BUILD_ID * the record stream. Buildids are stored as RECORD_HEADER_BUILD_ID
*/ */
if (with_hits || perf_data_file__is_pipe(&file)) if (with_hits || perf_data_file__is_pipe(&file))
perf_session__process_events(session, &build_id__mark_dso_hit_ops); perf_session__process_events(session);
perf_session__fprintf_dsos_buildid(session, stdout, dso__skip_buildid, with_hits); perf_session__fprintf_dsos_buildid(session, stdout, dso__skip_buildid, with_hits);
perf_session__delete(session); perf_session__delete(session);
......
...@@ -747,7 +747,7 @@ static int __cmd_diff(void) ...@@ -747,7 +747,7 @@ static int __cmd_diff(void)
goto out_delete; goto out_delete;
} }
ret = perf_session__process_events(d->session, &tool); ret = perf_session__process_events(d->session);
if (ret) { if (ret) {
pr_err("Failed to process %s\n", d->file.path); pr_err("Failed to process %s\n", d->file.path);
goto out_delete; goto out_delete;
......
...@@ -359,8 +359,6 @@ static int __cmd_inject(struct perf_inject *inject) ...@@ -359,8 +359,6 @@ static int __cmd_inject(struct perf_inject *inject)
} else if (inject->sched_stat) { } else if (inject->sched_stat) {
struct perf_evsel *evsel; struct perf_evsel *evsel;
inject->tool.ordered_events = true;
evlist__for_each(session->evlist, evsel) { evlist__for_each(session->evlist, evsel) {
const char *name = perf_evsel__name(evsel); const char *name = perf_evsel__name(evsel);
...@@ -379,7 +377,7 @@ static int __cmd_inject(struct perf_inject *inject) ...@@ -379,7 +377,7 @@ static int __cmd_inject(struct perf_inject *inject)
if (!file_out->is_pipe) if (!file_out->is_pipe)
lseek(fd, session->header.data_offset, SEEK_SET); lseek(fd, session->header.data_offset, SEEK_SET);
ret = perf_session__process_events(session, &inject->tool); ret = perf_session__process_events(session);
if (!file_out->is_pipe) { if (!file_out->is_pipe) {
if (inject->build_ids) if (inject->build_ids)
...@@ -458,6 +456,8 @@ int cmd_inject(int argc, const char **argv, const char *prefix __maybe_unused) ...@@ -458,6 +456,8 @@ int cmd_inject(int argc, const char **argv, const char *prefix __maybe_unused)
return -1; return -1;
} }
inject.tool.ordered_events = inject.sched_stat;
file.path = inject.input_name; file.path = inject.input_name;
inject.session = perf_session__new(&file, true, &inject.tool); inject.session = perf_session__new(&file, true, &inject.tool);
if (inject.session == NULL) if (inject.session == NULL)
......
...@@ -426,7 +426,7 @@ static int __cmd_kmem(struct perf_session *session) ...@@ -426,7 +426,7 @@ static int __cmd_kmem(struct perf_session *session)
} }
setup_pager(); setup_pager();
err = perf_session__process_events(session, &perf_kmem); err = perf_session__process_events(session);
if (err != 0) if (err != 0)
goto out; goto out;
sort_result(); sort_result();
......
...@@ -730,9 +730,9 @@ static s64 perf_kvm__mmap_read_idx(struct perf_kvm_stat *kvm, int idx, ...@@ -730,9 +730,9 @@ static s64 perf_kvm__mmap_read_idx(struct perf_kvm_stat *kvm, int idx,
return -1; return -1;
} }
err = perf_session_queue_event(kvm->session, event, &kvm->tool, &sample, 0); err = perf_session__queue_event(kvm->session, event, &sample, 0);
/* /*
* FIXME: Here we can't consume the event, as perf_session_queue_event will * FIXME: Here we can't consume the event, as perf_session__queue_event will
* point to it, and it'll get possibly overwritten by the kernel. * point to it, and it'll get possibly overwritten by the kernel.
*/ */
perf_evlist__mmap_consume(kvm->evlist, idx); perf_evlist__mmap_consume(kvm->evlist, idx);
...@@ -1066,7 +1066,7 @@ static int read_events(struct perf_kvm_stat *kvm) ...@@ -1066,7 +1066,7 @@ static int read_events(struct perf_kvm_stat *kvm)
if (ret < 0) if (ret < 0)
return ret; return ret;
return perf_session__process_events(kvm->session, &kvm->tool); return perf_session__process_events(kvm->session);
} }
static int parse_target_str(struct perf_kvm_stat *kvm) static int parse_target_str(struct perf_kvm_stat *kvm)
......
...@@ -878,7 +878,7 @@ static int __cmd_report(bool display_info) ...@@ -878,7 +878,7 @@ static int __cmd_report(bool display_info)
if (select_key()) if (select_key())
goto out_delete; goto out_delete;
err = perf_session__process_events(session, &eops); err = perf_session__process_events(session);
if (err) if (err)
goto out_delete; goto out_delete;
......
...@@ -141,7 +141,7 @@ static int report_raw_events(struct perf_mem *mem) ...@@ -141,7 +141,7 @@ static int report_raw_events(struct perf_mem *mem)
printf("# PID, TID, IP, ADDR, LOCAL WEIGHT, DSRC, SYMBOL\n"); printf("# PID, TID, IP, ADDR, LOCAL WEIGHT, DSRC, SYMBOL\n");
err = perf_session__process_events(session, &mem->tool); err = perf_session__process_events(session);
if (err) if (err)
return err; return err;
......
...@@ -225,7 +225,7 @@ static int process_buildids(struct record *rec) ...@@ -225,7 +225,7 @@ static int process_buildids(struct record *rec)
*/ */
symbol_conf.ignore_vmlinux_buildid = true; symbol_conf.ignore_vmlinux_buildid = true;
return perf_session__process_events(session, &rec->tool); return perf_session__process_events(session);
} }
static void perf_event__synthesize_guest_os(struct machine *machine, void *data) static void perf_event__synthesize_guest_os(struct machine *machine, void *data)
...@@ -343,7 +343,7 @@ static int __cmd_record(struct record *rec, int argc, const char **argv) ...@@ -343,7 +343,7 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
signal(SIGINT, sig_handler); signal(SIGINT, sig_handler);
signal(SIGTERM, sig_handler); signal(SIGTERM, sig_handler);
session = perf_session__new(file, false, NULL); session = perf_session__new(file, false, tool);
if (session == NULL) { if (session == NULL) {
pr_err("Perf session creation failed.\n"); pr_err("Perf session creation failed.\n");
return -1; return -1;
......
...@@ -482,7 +482,7 @@ static int __cmd_report(struct report *rep) ...@@ -482,7 +482,7 @@ static int __cmd_report(struct report *rep)
if (ret) if (ret)
return ret; return ret;
ret = perf_session__process_events(session, &rep->tool); ret = perf_session__process_events(session);
if (ret) if (ret)
return ret; return ret;
......
...@@ -1467,7 +1467,7 @@ static int perf_sched__read_events(struct perf_sched *sched) ...@@ -1467,7 +1467,7 @@ static int perf_sched__read_events(struct perf_sched *sched)
goto out_delete; goto out_delete;
if (perf_session__has_traces(session, "record -R")) { if (perf_session__has_traces(session, "record -R")) {
int err = perf_session__process_events(session, &sched->tool); int err = perf_session__process_events(session);
if (err) { if (err) {
pr_err("Failed to process events, error %d", err); pr_err("Failed to process events, error %d", err);
goto out_delete; goto out_delete;
......
...@@ -800,7 +800,7 @@ static int __cmd_script(struct perf_script *script) ...@@ -800,7 +800,7 @@ static int __cmd_script(struct perf_script *script)
script->tool.mmap2 = process_mmap2_event; script->tool.mmap2 = process_mmap2_event;
} }
ret = perf_session__process_events(script->session, &script->tool); ret = perf_session__process_events(script->session);
if (debug_mode) if (debug_mode)
pr_err("Misordered timestamps: %" PRIu64 "\n", nr_unordered); pr_err("Misordered timestamps: %" PRIu64 "\n", nr_unordered);
......
...@@ -1623,7 +1623,7 @@ static int __cmd_timechart(struct timechart *tchart, const char *output_name) ...@@ -1623,7 +1623,7 @@ static int __cmd_timechart(struct timechart *tchart, const char *output_name)
goto out_delete; goto out_delete;
} }
ret = perf_session__process_events(session, &tchart->tool); ret = perf_session__process_events(session);
if (ret) if (ret)
goto out_delete; goto out_delete;
......
...@@ -2408,7 +2408,7 @@ static int trace__replay(struct trace *trace) ...@@ -2408,7 +2408,7 @@ static int trace__replay(struct trace *trace)
setup_pager(); setup_pager();
err = perf_session__process_events(session, &trace->tool); err = perf_session__process_events(session);
if (err) if (err)
pr_err("Failed to process events, error %d", err); pr_err("Failed to process events, error %d", err);
......
...@@ -579,7 +579,7 @@ int bt_convert__perf2ctf(const char *input, const char *path) ...@@ -579,7 +579,7 @@ int bt_convert__perf2ctf(const char *input, const char *path)
return -1; return -1;
/* perf.data session */ /* perf.data session */
session = perf_session__new(&file, 0, NULL); session = perf_session__new(&file, 0, &c.tool);
if (!session) if (!session)
goto free_writer; goto free_writer;
...@@ -591,7 +591,7 @@ int bt_convert__perf2ctf(const char *input, const char *path) ...@@ -591,7 +591,7 @@ int bt_convert__perf2ctf(const char *input, const char *path)
if (setup_events(cw, session)) if (setup_events(cw, session))
goto free_session; goto free_session;
err = perf_session__process_events(session, &c.tool); err = perf_session__process_events(session);
if (!err) if (!err)
err = bt_ctf_stream_flush(cw->stream); err = bt_ctf_stream_flush(cw->stream);
......
...@@ -153,10 +153,7 @@ void ordered_events__delete(struct ordered_events *oe, struct ordered_event *eve ...@@ -153,10 +153,7 @@ void ordered_events__delete(struct ordered_events *oe, struct ordered_event *eve
free_dup_event(oe, event->event); free_dup_event(oe, event->event);
} }
static int __ordered_events__flush(struct ordered_events *oe, static int __ordered_events__flush(struct ordered_events *oe)
struct machines *machines,
struct perf_evlist *evlist,
struct perf_tool *tool)
{ {
struct list_head *head = &oe->events; struct list_head *head = &oe->events;
struct ordered_event *tmp, *iter; struct ordered_event *tmp, *iter;
...@@ -180,12 +177,12 @@ static int __ordered_events__flush(struct ordered_events *oe, ...@@ -180,12 +177,12 @@ static int __ordered_events__flush(struct ordered_events *oe,
if (iter->timestamp > limit) if (iter->timestamp > limit)
break; break;
ret = perf_evlist__parse_sample(evlist, iter->event, &sample); ret = perf_evlist__parse_sample(oe->evlist, iter->event, &sample);
if (ret) if (ret)
pr_err("Can't parse sample, err = %d\n", ret); pr_err("Can't parse sample, err = %d\n", ret);
else { else {
ret = machines__deliver_event(machines, evlist, iter->event, ret = machines__deliver_event(oe->machines, oe->evlist, iter->event,
&sample, tool, iter->file_offset); &sample, oe->tool, iter->file_offset);
if (ret) if (ret)
return ret; return ret;
} }
...@@ -205,9 +202,7 @@ static int __ordered_events__flush(struct ordered_events *oe, ...@@ -205,9 +202,7 @@ static int __ordered_events__flush(struct ordered_events *oe,
return 0; return 0;
} }
int ordered_events__flush(struct ordered_events *oe, struct machines *machines, int ordered_events__flush(struct ordered_events *oe, enum oe_flush how)
struct perf_evlist *evlist, struct perf_tool *tool,
enum oe_flush how)
{ {
static const char * const str[] = { static const char * const str[] = {
"NONE", "NONE",
...@@ -252,7 +247,7 @@ int ordered_events__flush(struct ordered_events *oe, struct machines *machines, ...@@ -252,7 +247,7 @@ int ordered_events__flush(struct ordered_events *oe, struct machines *machines,
str[how], oe->nr_events); str[how], oe->nr_events);
pr_oe_time(oe->max_timestamp, "max_timestamp\n"); pr_oe_time(oe->max_timestamp, "max_timestamp\n");
err = __ordered_events__flush(oe, machines, evlist, tool); err = __ordered_events__flush(oe);
if (!err) { if (!err) {
if (how == OE_FLUSH__ROUND) if (how == OE_FLUSH__ROUND)
...@@ -268,13 +263,17 @@ int ordered_events__flush(struct ordered_events *oe, struct machines *machines, ...@@ -268,13 +263,17 @@ int ordered_events__flush(struct ordered_events *oe, struct machines *machines,
return err; return err;
} }
void ordered_events__init(struct ordered_events *oe) void ordered_events__init(struct ordered_events *oe, struct machines *machines,
struct perf_evlist *evlist, struct perf_tool *tool)
{ {
INIT_LIST_HEAD(&oe->events); INIT_LIST_HEAD(&oe->events);
INIT_LIST_HEAD(&oe->cache); INIT_LIST_HEAD(&oe->cache);
INIT_LIST_HEAD(&oe->to_free); INIT_LIST_HEAD(&oe->to_free);
oe->max_alloc_size = (u64) -1; oe->max_alloc_size = (u64) -1;
oe->cur_alloc_size = 0; oe->cur_alloc_size = 0;
oe->evlist = evlist;
oe->machines = machines;
oe->tool = tool;
} }
void ordered_events__free(struct ordered_events *oe) void ordered_events__free(struct ordered_events *oe)
......
...@@ -32,6 +32,9 @@ struct ordered_events { ...@@ -32,6 +32,9 @@ struct ordered_events {
struct list_head to_free; struct list_head to_free;
struct ordered_event *buffer; struct ordered_event *buffer;
struct ordered_event *last; struct ordered_event *last;
struct machines *machines;
struct perf_evlist *evlist;
struct perf_tool *tool;
int buffer_idx; int buffer_idx;
unsigned int nr_events; unsigned int nr_events;
enum oe_flush last_flush_type; enum oe_flush last_flush_type;
...@@ -41,10 +44,9 @@ struct ordered_events { ...@@ -41,10 +44,9 @@ struct ordered_events {
struct ordered_event *ordered_events__new(struct ordered_events *oe, u64 timestamp, struct ordered_event *ordered_events__new(struct ordered_events *oe, u64 timestamp,
union perf_event *event); union perf_event *event);
void ordered_events__delete(struct ordered_events *oe, struct ordered_event *event); void ordered_events__delete(struct ordered_events *oe, struct ordered_event *event);
int ordered_events__flush(struct ordered_events *oe, struct machines *machines, int ordered_events__flush(struct ordered_events *oe, enum oe_flush how);
struct perf_evlist *evlist, struct perf_tool *tool, void ordered_events__init(struct ordered_events *oe, struct machines *machines,
enum oe_flush how); struct perf_evlist *evlsit, struct perf_tool *tool);
void ordered_events__init(struct ordered_events *oe);
void ordered_events__free(struct ordered_events *oe); void ordered_events__free(struct ordered_events *oe);
static inline static inline
......
...@@ -95,7 +95,6 @@ struct perf_session *perf_session__new(struct perf_data_file *file, ...@@ -95,7 +95,6 @@ struct perf_session *perf_session__new(struct perf_data_file *file,
goto out; goto out;
session->repipe = repipe; session->repipe = repipe;
ordered_events__init(&session->ordered_events);
machines__init(&session->machines); machines__init(&session->machines);
if (file) { if (file) {
...@@ -126,7 +125,8 @@ struct perf_session *perf_session__new(struct perf_data_file *file, ...@@ -126,7 +125,8 @@ struct perf_session *perf_session__new(struct perf_data_file *file,
tool->ordered_events && !perf_evlist__sample_id_all(session->evlist)) { tool->ordered_events && !perf_evlist__sample_id_all(session->evlist)) {
dump_printf("WARNING: No sample_id_all support, falling back to unordered processing\n"); dump_printf("WARNING: No sample_id_all support, falling back to unordered processing\n");
tool->ordered_events = false; tool->ordered_events = false;
} } else
ordered_events__init(&session->ordered_events, &session->machines, session->evlist, tool);
return session; return session;
...@@ -508,24 +508,19 @@ static perf_event__swap_op perf_event__swap_ops[] = { ...@@ -508,24 +508,19 @@ static perf_event__swap_op perf_event__swap_ops[] = {
* Flush every events below timestamp 7 * Flush every events below timestamp 7
* etc... * etc...
*/ */
static int process_finished_round(struct perf_tool *tool, static int process_finished_round(struct perf_tool *tool __maybe_unused,
union perf_event *event __maybe_unused, union perf_event *event __maybe_unused,
struct perf_session *session) struct perf_session *session)
{ {
struct ordered_events *oe = &session->ordered_events; struct ordered_events *oe = &session->ordered_events;
struct perf_evlist *evlist = session->evlist;
struct machines *machines = &session->machines;
return ordered_events__flush(oe, machines, evlist, tool, OE_FLUSH__ROUND); return ordered_events__flush(oe, OE_FLUSH__ROUND);
} }
int perf_session_queue_event(struct perf_session *s, union perf_event *event, int perf_session__queue_event(struct perf_session *s, union perf_event *event,
struct perf_tool *tool, struct perf_sample *sample, struct perf_sample *sample, u64 file_offset)
u64 file_offset)
{ {
struct ordered_events *oe = &s->ordered_events; struct ordered_events *oe = &s->ordered_events;
struct perf_evlist *evlist = s->evlist;
struct machines *machines = &s->machines;
u64 timestamp = sample->time; u64 timestamp = sample->time;
struct ordered_event *new; struct ordered_event *new;
...@@ -543,7 +538,7 @@ int perf_session_queue_event(struct perf_session *s, union perf_event *event, ...@@ -543,7 +538,7 @@ int perf_session_queue_event(struct perf_session *s, union perf_event *event,
new = ordered_events__new(oe, timestamp, event); new = ordered_events__new(oe, timestamp, event);
if (!new) { if (!new) {
ordered_events__flush(oe, machines, evlist, tool, OE_FLUSH__HALF); ordered_events__flush(oe, OE_FLUSH__HALF);
new = ordered_events__new(oe, timestamp, event); new = ordered_events__new(oe, timestamp, event);
} }
...@@ -948,9 +943,9 @@ int machines__deliver_event(struct machines *machines, ...@@ -948,9 +943,9 @@ int machines__deliver_event(struct machines *machines,
static s64 perf_session__process_user_event(struct perf_session *session, static s64 perf_session__process_user_event(struct perf_session *session,
union perf_event *event, union perf_event *event,
struct perf_tool *tool,
u64 file_offset) u64 file_offset)
{ {
struct perf_tool *tool = session->ordered_events.tool;
int fd = perf_data_file__fd(session->file); int fd = perf_data_file__fd(session->file);
int err; int err;
...@@ -988,15 +983,15 @@ static s64 perf_session__process_user_event(struct perf_session *session, ...@@ -988,15 +983,15 @@ static s64 perf_session__process_user_event(struct perf_session *session,
int perf_session__deliver_synth_event(struct perf_session *session, int perf_session__deliver_synth_event(struct perf_session *session,
union perf_event *event, union perf_event *event,
struct perf_sample *sample, struct perf_sample *sample)
struct perf_tool *tool)
{ {
struct perf_evlist *evlist = session->evlist; struct perf_evlist *evlist = session->evlist;
struct perf_tool *tool = session->ordered_events.tool;
events_stats__inc(&evlist->stats, event->header.type); events_stats__inc(&evlist->stats, event->header.type);
if (event->header.type >= PERF_RECORD_USER_TYPE_START) if (event->header.type >= PERF_RECORD_USER_TYPE_START)
return perf_session__process_user_event(session, event, tool, 0); return perf_session__process_user_event(session, event, 0);
return machines__deliver_event(&session->machines, evlist, event, sample, tool, 0); return machines__deliver_event(&session->machines, evlist, event, sample, tool, 0);
} }
...@@ -1066,11 +1061,10 @@ int perf_session__peek_event(struct perf_session *session, off_t file_offset, ...@@ -1066,11 +1061,10 @@ int perf_session__peek_event(struct perf_session *session, off_t file_offset,
} }
static s64 perf_session__process_event(struct perf_session *session, static s64 perf_session__process_event(struct perf_session *session,
union perf_event *event, union perf_event *event, u64 file_offset)
struct perf_tool *tool,
u64 file_offset)
{ {
struct perf_evlist *evlist = session->evlist; struct perf_evlist *evlist = session->evlist;
struct perf_tool *tool = session->ordered_events.tool;
struct perf_sample sample; struct perf_sample sample;
int ret; int ret;
...@@ -1083,7 +1077,7 @@ static s64 perf_session__process_event(struct perf_session *session, ...@@ -1083,7 +1077,7 @@ static s64 perf_session__process_event(struct perf_session *session,
events_stats__inc(&evlist->stats, event->header.type); events_stats__inc(&evlist->stats, event->header.type);
if (event->header.type >= PERF_RECORD_USER_TYPE_START) if (event->header.type >= PERF_RECORD_USER_TYPE_START)
return perf_session__process_user_event(session, event, tool, file_offset); return perf_session__process_user_event(session, event, file_offset);
/* /*
* For all kernel events we get the sample data * For all kernel events we get the sample data
...@@ -1093,8 +1087,7 @@ static s64 perf_session__process_event(struct perf_session *session, ...@@ -1093,8 +1087,7 @@ static s64 perf_session__process_event(struct perf_session *session,
return ret; return ret;
if (tool->ordered_events) { if (tool->ordered_events) {
ret = perf_session_queue_event(session, event, tool, &sample, ret = perf_session__queue_event(session, event, &sample, file_offset);
file_offset);
if (ret != -ETIME) if (ret != -ETIME)
return ret; return ret;
} }
...@@ -1173,12 +1166,10 @@ static void perf_tool__warn_about_errors(const struct perf_tool *tool, ...@@ -1173,12 +1166,10 @@ static void perf_tool__warn_about_errors(const struct perf_tool *tool,
volatile int session_done; volatile int session_done;
static int __perf_session__process_pipe_events(struct perf_session *session, static int __perf_session__process_pipe_events(struct perf_session *session)
struct perf_tool *tool)
{ {
struct ordered_events *oe = &session->ordered_events; struct ordered_events *oe = &session->ordered_events;
struct perf_evlist *evlist = session->evlist; struct perf_tool *tool = oe->tool;
struct machines *machines = &session->machines;
int fd = perf_data_file__fd(session->file); int fd = perf_data_file__fd(session->file);
union perf_event *event; union perf_event *event;
uint32_t size, cur_size = 0; uint32_t size, cur_size = 0;
...@@ -1242,7 +1233,7 @@ static int __perf_session__process_pipe_events(struct perf_session *session, ...@@ -1242,7 +1233,7 @@ static int __perf_session__process_pipe_events(struct perf_session *session,
} }
} }
if ((skip = perf_session__process_event(session, event, tool, head)) < 0) { if ((skip = perf_session__process_event(session, event, head)) < 0) {
pr_err("%#" PRIx64 " [%#x]: failed to process type: %d\n", pr_err("%#" PRIx64 " [%#x]: failed to process type: %d\n",
head, event->header.size, event->header.type); head, event->header.size, event->header.type);
err = -EINVAL; err = -EINVAL;
...@@ -1258,7 +1249,7 @@ static int __perf_session__process_pipe_events(struct perf_session *session, ...@@ -1258,7 +1249,7 @@ static int __perf_session__process_pipe_events(struct perf_session *session,
goto more; goto more;
done: done:
/* do the final flush for ordered samples */ /* do the final flush for ordered samples */
err = ordered_events__flush(oe, machines, evlist, tool, OE_FLUSH__FINAL); err = ordered_events__flush(oe, OE_FLUSH__FINAL);
out_err: out_err:
free(buf); free(buf);
perf_tool__warn_about_errors(tool, &session->evlist->stats); perf_tool__warn_about_errors(tool, &session->evlist->stats);
...@@ -1308,11 +1299,10 @@ fetch_mmaped_event(struct perf_session *session, ...@@ -1308,11 +1299,10 @@ fetch_mmaped_event(struct perf_session *session,
static int __perf_session__process_events(struct perf_session *session, static int __perf_session__process_events(struct perf_session *session,
u64 data_offset, u64 data_size, u64 data_offset, u64 data_size,
u64 file_size, struct perf_tool *tool) u64 file_size)
{ {
struct ordered_events *oe = &session->ordered_events; struct ordered_events *oe = &session->ordered_events;
struct perf_evlist *evlist = session->evlist; struct perf_tool *tool = oe->tool;
struct machines *machines = &session->machines;
int fd = perf_data_file__fd(session->file); int fd = perf_data_file__fd(session->file);
u64 head, page_offset, file_offset, file_pos, size; u64 head, page_offset, file_offset, file_pos, size;
int err, mmap_prot, mmap_flags, map_idx = 0; int err, mmap_prot, mmap_flags, map_idx = 0;
...@@ -1381,8 +1371,7 @@ static int __perf_session__process_events(struct perf_session *session, ...@@ -1381,8 +1371,7 @@ static int __perf_session__process_events(struct perf_session *session,
size = event->header.size; size = event->header.size;
if (size < sizeof(struct perf_event_header) || if (size < sizeof(struct perf_event_header) ||
(skip = perf_session__process_event(session, event, tool, file_pos)) (skip = perf_session__process_event(session, event, file_pos)) < 0) {
< 0) {
pr_err("%#" PRIx64 " [%#x]: failed to process type: %d\n", pr_err("%#" PRIx64 " [%#x]: failed to process type: %d\n",
file_offset + head, event->header.size, file_offset + head, event->header.size,
event->header.type); event->header.type);
...@@ -1406,7 +1395,7 @@ static int __perf_session__process_events(struct perf_session *session, ...@@ -1406,7 +1395,7 @@ static int __perf_session__process_events(struct perf_session *session,
out: out:
/* do the final flush for ordered samples */ /* do the final flush for ordered samples */
err = ordered_events__flush(oe, machines, evlist, tool, OE_FLUSH__FINAL); err = ordered_events__flush(oe, OE_FLUSH__FINAL);
out_err: out_err:
ui_progress__finish(); ui_progress__finish();
perf_tool__warn_about_errors(tool, &session->evlist->stats); perf_tool__warn_about_errors(tool, &session->evlist->stats);
...@@ -1415,8 +1404,7 @@ static int __perf_session__process_events(struct perf_session *session, ...@@ -1415,8 +1404,7 @@ static int __perf_session__process_events(struct perf_session *session,
return err; return err;
} }
int perf_session__process_events(struct perf_session *session, int perf_session__process_events(struct perf_session *session)
struct perf_tool *tool)
{ {
u64 size = perf_data_file__size(session->file); u64 size = perf_data_file__size(session->file);
int err; int err;
...@@ -1427,10 +1415,9 @@ int perf_session__process_events(struct perf_session *session, ...@@ -1427,10 +1415,9 @@ int perf_session__process_events(struct perf_session *session,
if (!perf_data_file__is_pipe(session->file)) if (!perf_data_file__is_pipe(session->file))
err = __perf_session__process_events(session, err = __perf_session__process_events(session,
session->header.data_offset, session->header.data_offset,
session->header.data_size, session->header.data_size, size);
size, tool);
else else
err = __perf_session__process_pipe_events(session, tool); err = __perf_session__process_pipe_events(session);
return err; return err;
} }
......
...@@ -48,12 +48,10 @@ int perf_session__peek_event(struct perf_session *session, off_t file_offset, ...@@ -48,12 +48,10 @@ int perf_session__peek_event(struct perf_session *session, off_t file_offset,
union perf_event **event_ptr, union perf_event **event_ptr,
struct perf_sample *sample); struct perf_sample *sample);
int perf_session__process_events(struct perf_session *session, int perf_session__process_events(struct perf_session *session);
struct perf_tool *tool);
int perf_session_queue_event(struct perf_session *s, union perf_event *event, int perf_session__queue_event(struct perf_session *s, union perf_event *event,
struct perf_tool *tool, struct perf_sample *sample, struct perf_sample *sample, u64 file_offset);
u64 file_offset);
void perf_tool__fill_defaults(struct perf_tool *tool); void perf_tool__fill_defaults(struct perf_tool *tool);
...@@ -126,8 +124,7 @@ extern volatile int session_done; ...@@ -126,8 +124,7 @@ extern volatile int session_done;
int perf_session__deliver_synth_event(struct perf_session *session, int perf_session__deliver_synth_event(struct perf_session *session,
union perf_event *event, union perf_event *event,
struct perf_sample *sample, struct perf_sample *sample);
struct perf_tool *tool);
int perf_event__process_id_index(struct perf_tool *tool, int perf_event__process_id_index(struct perf_tool *tool,
union perf_event *event, union perf_event *event,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment