1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __ORDERED_EVENTS_H
3 #define __ORDERED_EVENTS_H
5 #include <linux/types.h>
12 union perf_event *event;
13 struct list_head list;
25 struct ordered_events;
27 typedef int (*ordered_events__deliver_t)(struct ordered_events *oe,
28 struct ordered_event *event);
30 struct ordered_events_buffer {
31 struct list_head list;
32 struct ordered_event event[];
35 struct ordered_events {
41 struct list_head events;
42 struct list_head cache;
43 struct list_head to_free;
44 struct ordered_events_buffer *buffer;
45 struct ordered_event *last;
46 ordered_events__deliver_t deliver;
48 unsigned int nr_events;
49 enum oe_flush last_flush_type;
50 u32 nr_unordered_events;
55 int ordered_events__queue(struct ordered_events *oe, union perf_event *event,
56 u64 timestamp, u64 file_offset);
57 void ordered_events__delete(struct ordered_events *oe, struct ordered_event *event);
58 int ordered_events__flush(struct ordered_events *oe, enum oe_flush how);
59 int ordered_events__flush_time(struct ordered_events *oe, u64 timestamp);
60 void ordered_events__init(struct ordered_events *oe, ordered_events__deliver_t deliver,
62 void ordered_events__free(struct ordered_events *oe);
63 void ordered_events__reinit(struct ordered_events *oe);
64 u64 ordered_events__first_time(struct ordered_events *oe);
67 void ordered_events__set_alloc_size(struct ordered_events *oe, u64 size)
69 oe->max_alloc_size = size;
73 void ordered_events__set_copy_on_queue(struct ordered_events *oe, bool copy)
75 oe->copy_on_queue = copy;
77 #endif /* __ORDERED_EVENTS_H */