Merge tag 'clk-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux
[linux-2.6-block.git] / tools / perf / util / ordered-events.h
CommitLineData
5f86b80b
JO
1#ifndef __ORDERED_EVENTS_H
2#define __ORDERED_EVENTS_H
3
4#include <linux/types.h>
5f86b80b 5
d10eb1eb 6struct perf_sample;
5f86b80b
JO
7
8struct ordered_event {
9 u64 timestamp;
10 u64 file_offset;
11 union perf_event *event;
12 struct list_head list;
13};
14
15enum oe_flush {
b0a45203 16 OE_FLUSH__NONE,
5f86b80b
JO
17 OE_FLUSH__FINAL,
18 OE_FLUSH__ROUND,
19 OE_FLUSH__HALF,
20};
21
d10eb1eb
ACM
22struct ordered_events;
23
24typedef int (*ordered_events__deliver_t)(struct ordered_events *oe,
9870d780 25 struct ordered_event *event);
d10eb1eb 26
5f86b80b
JO
27struct ordered_events {
28 u64 last_flush;
29 u64 next_flush;
30 u64 max_timestamp;
31 u64 max_alloc_size;
32 u64 cur_alloc_size;
33 struct list_head events;
34 struct list_head cache;
35 struct list_head to_free;
36 struct ordered_event *buffer;
37 struct ordered_event *last;
d10eb1eb 38 ordered_events__deliver_t deliver;
5f86b80b
JO
39 int buffer_idx;
40 unsigned int nr_events;
b0a45203 41 enum oe_flush last_flush_type;
9870d780 42 u32 nr_unordered_events;
54bf53b1 43 bool copy_on_queue;
5f86b80b
JO
44};
45
4a6b362f
ACM
46int ordered_events__queue(struct ordered_events *oe, union perf_event *event,
47 struct perf_sample *sample, u64 file_offset);
5f86b80b 48void ordered_events__delete(struct ordered_events *oe, struct ordered_event *event);
b7b61cbe 49int ordered_events__flush(struct ordered_events *oe, enum oe_flush how);
9870d780 50void ordered_events__init(struct ordered_events *oe, ordered_events__deliver_t deliver);
adc56ed1 51void ordered_events__free(struct ordered_events *oe);
4532f642 52void ordered_events__reinit(struct ordered_events *oe);
94786b67
JO
53
54static inline
55void ordered_events__set_alloc_size(struct ordered_events *oe, u64 size)
56{
57 oe->max_alloc_size = size;
58}
54bf53b1
AY
59
60static inline
61void ordered_events__set_copy_on_queue(struct ordered_events *oe, bool copy)
62{
63 oe->copy_on_queue = copy;
64}
5f86b80b 65#endif /* __ORDERED_EVENTS_H */