perf tools: Create ordered-events object
[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>
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);
41#endif /* __ORDERED_EVENTS_H */