Commit a4a6668a authored by Jiri Olsa's avatar Jiri Olsa Committed by Arnaldo Carvalho de Melo

perf ordered_events: Add private data member

We will need it in following patch, where we can't use the
container_of() trick to get the higher level object.
Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
Acked-by: default avatarDavid S. Miller <davem@davemloft.net>
Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/n/tip-vgs9aoek21v14o3obza586yy@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent b8494f1d
...@@ -326,7 +326,8 @@ int ordered_events__flush(struct ordered_events *oe, enum oe_flush how) ...@@ -326,7 +326,8 @@ int ordered_events__flush(struct ordered_events *oe, enum oe_flush how)
return err; return err;
} }
void ordered_events__init(struct ordered_events *oe, ordered_events__deliver_t deliver) void ordered_events__init(struct ordered_events *oe, ordered_events__deliver_t deliver,
void *data)
{ {
INIT_LIST_HEAD(&oe->events); INIT_LIST_HEAD(&oe->events);
INIT_LIST_HEAD(&oe->cache); INIT_LIST_HEAD(&oe->cache);
...@@ -334,6 +335,7 @@ void ordered_events__init(struct ordered_events *oe, ordered_events__deliver_t d ...@@ -334,6 +335,7 @@ void ordered_events__init(struct ordered_events *oe, ordered_events__deliver_t d
oe->max_alloc_size = (u64) -1; oe->max_alloc_size = (u64) -1;
oe->cur_alloc_size = 0; oe->cur_alloc_size = 0;
oe->deliver = deliver; oe->deliver = deliver;
oe->data = data;
} }
static void static void
...@@ -377,5 +379,5 @@ void ordered_events__reinit(struct ordered_events *oe) ...@@ -377,5 +379,5 @@ void ordered_events__reinit(struct ordered_events *oe)
ordered_events__free(oe); ordered_events__free(oe);
memset(oe, '\0', sizeof(*oe)); memset(oe, '\0', sizeof(*oe));
ordered_events__init(oe, old_deliver); ordered_events__init(oe, old_deliver, oe->data);
} }
...@@ -47,13 +47,15 @@ struct ordered_events { ...@@ -47,13 +47,15 @@ struct ordered_events {
enum oe_flush last_flush_type; enum oe_flush last_flush_type;
u32 nr_unordered_events; u32 nr_unordered_events;
bool copy_on_queue; bool copy_on_queue;
void *data;
}; };
int ordered_events__queue(struct ordered_events *oe, union perf_event *event, int ordered_events__queue(struct ordered_events *oe, union perf_event *event,
u64 timestamp, u64 file_offset); u64 timestamp, u64 file_offset);
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, enum oe_flush how); int ordered_events__flush(struct ordered_events *oe, enum oe_flush how);
void ordered_events__init(struct ordered_events *oe, ordered_events__deliver_t deliver); void ordered_events__init(struct ordered_events *oe, ordered_events__deliver_t deliver,
void *data);
void ordered_events__free(struct ordered_events *oe); void ordered_events__free(struct ordered_events *oe);
void ordered_events__reinit(struct ordered_events *oe); void ordered_events__reinit(struct ordered_events *oe);
......
...@@ -126,7 +126,8 @@ struct perf_session *perf_session__new(struct perf_data *data, ...@@ -126,7 +126,8 @@ struct perf_session *perf_session__new(struct perf_data *data,
session->tool = tool; session->tool = tool;
INIT_LIST_HEAD(&session->auxtrace_index); INIT_LIST_HEAD(&session->auxtrace_index);
machines__init(&session->machines); machines__init(&session->machines);
ordered_events__init(&session->ordered_events, ordered_events__deliver_event); ordered_events__init(&session->ordered_events,
ordered_events__deliver_event, NULL);
if (data) { if (data) {
if (perf_data__open(data)) if (perf_data__open(data))
......
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