if (ret)
pr_err("Can't parse sample, err = %d\n", ret);
else {
- ret = machines__deliver_event(oe->machines, oe->evlist, iter->event,
- &sample, oe->tool, iter->file_offset);
+ ret = oe->deliver(oe, iter, &sample);
if (ret)
return ret;
}
}
void ordered_events__init(struct ordered_events *oe, struct machines *machines,
- struct perf_evlist *evlist, struct perf_tool *tool)
+ struct perf_evlist *evlist, struct perf_tool *tool,
+ ordered_events__deliver_t deliver)
{
INIT_LIST_HEAD(&oe->events);
INIT_LIST_HEAD(&oe->cache);
oe->evlist = evlist;
oe->machines = machines;
oe->tool = tool;
+ oe->deliver = deliver;
}
void ordered_events__free(struct ordered_events *oe)
struct perf_tool;
struct perf_evlist;
+struct perf_sample;
struct machines;
struct ordered_event {
OE_FLUSH__HALF,
};
+struct ordered_events;
+
+typedef int (*ordered_events__deliver_t)(struct ordered_events *oe,
+ struct ordered_event *event,
+ struct perf_sample *sample);
+
struct ordered_events {
u64 last_flush;
u64 next_flush;
struct machines *machines;
struct perf_evlist *evlist;
struct perf_tool *tool;
+ ordered_events__deliver_t deliver;
int buffer_idx;
unsigned int nr_events;
enum oe_flush last_flush_type;
void ordered_events__delete(struct ordered_events *oe, struct ordered_event *event);
int ordered_events__flush(struct ordered_events *oe, enum oe_flush how);
void ordered_events__init(struct ordered_events *oe, struct machines *machines,
- struct perf_evlist *evlsit, struct perf_tool *tool);
+ struct perf_evlist *evlsit, struct perf_tool *tool,
+ ordered_events__deliver_t deliver);
void ordered_events__free(struct ordered_events *oe);
static inline
#include "perf_regs.h"
#include "asm/bug.h"
+static int machines__deliver_event(struct machines *machines,
+ struct perf_evlist *evlist,
+ union perf_event *event,
+ struct perf_sample *sample,
+ struct perf_tool *tool, u64 file_offset);
+
static int perf_session__open(struct perf_session *session)
{
struct perf_data_file *file = session->file;
machines__set_comm_exec(&session->machines, comm_exec);
}
+static int ordered_events__deliver_event(struct ordered_events *oe,
+ struct ordered_event *event,
+ struct perf_sample *sample)
+{
+ return machines__deliver_event(oe->machines, oe->evlist, event->event,
+ sample, oe->tool, event->file_offset);
+}
+
struct perf_session *perf_session__new(struct perf_data_file *file,
bool repipe, struct perf_tool *tool)
{
tool->ordered_events && !perf_evlist__sample_id_all(session->evlist)) {
dump_printf("WARNING: No sample_id_all support, falling back to unordered processing\n");
tool->ordered_events = false;
- } else
- ordered_events__init(&session->ordered_events, &session->machines, session->evlist, tool);
+ } else {
+ ordered_events__init(&session->ordered_events, &session->machines,
+ session->evlist, tool, ordered_events__deliver_event);
+ }
return session;
&sample->read.one, machine);
}
-int machines__deliver_event(struct machines *machines,
- struct perf_evlist *evlist,
- union perf_event *event,
- struct perf_sample *sample,
- struct perf_tool *tool, u64 file_offset)
+static int machines__deliver_event(struct machines *machines,
+ struct perf_evlist *evlist,
+ union perf_event *event,
+ struct perf_sample *sample,
+ struct perf_tool *tool, u64 file_offset)
{
struct perf_evsel *evsel;
struct machine *machine;
void perf_tool__fill_defaults(struct perf_tool *tool);
-int machines__deliver_event(struct machines *machines,
- struct perf_evlist *evlist,
- union perf_event *event,
- struct perf_sample *sample,
- struct perf_tool *tool, u64 file_offset);
-
int perf_session__resolve_callchain(struct perf_session *session,
struct perf_evsel *evsel,
struct thread *thread,