blob: 62f9945319b64956e8c454d8fea0944f43c60d00 [file] [log] [blame]
Jiri Olsa5f86b802014-08-01 13:02:58 -03001#ifndef __ORDERED_EVENTS_H
2#define __ORDERED_EVENTS_H
3
4#include <linux/types.h>
5#include "tool.h"
6
7struct perf_session;
8
9struct ordered_event {
10 u64 timestamp;
11 u64 file_offset;
12 union perf_event *event;
13 struct list_head list;
14};
15
16enum oe_flush {
17 OE_FLUSH__FINAL,
18 OE_FLUSH__ROUND,
19 OE_FLUSH__HALF,
20};
21
22struct ordered_events {
23 u64 last_flush;
24 u64 next_flush;
25 u64 max_timestamp;
26 u64 max_alloc_size;
27 u64 cur_alloc_size;
28 struct list_head events;
29 struct list_head cache;
30 struct list_head to_free;
31 struct ordered_event *buffer;
32 struct ordered_event *last;
33 int buffer_idx;
34 unsigned int nr_events;
35};
36
37struct ordered_event *ordered_events__new(struct ordered_events *oe, u64 timestamp);
38void ordered_events__delete(struct ordered_events *oe, struct ordered_event *event);
39int ordered_events__flush(struct perf_session *s, struct perf_tool *tool,
40 enum oe_flush how);
Jiri Olsa36522f52014-06-10 22:47:40 +020041void ordered_events__init(struct ordered_events *oe);
Jiri Olsa5f86b802014-08-01 13:02:58 -030042#endif /* __ORDERED_EVENTS_H */