Commit | Line | Data |
---|---|---|
34ac0e6c MD |
1 | #ifndef _BABELTRACE_H |
2 | #define _BABELTRACE_H | |
3 | ||
70bd0a12 JD |
4 | /* |
5 | * BabelTrace API | |
6 | * | |
7 | * Copyright 2010-2011 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com> | |
8 | * | |
9 | * Permission is hereby granted, free of charge, to any person obtaining a copy | |
10 | * of this software and associated documentation files (the "Software"), to deal | |
11 | * in the Software without restriction, including without limitation the rights | |
12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
13 | * copies of the Software, and to permit persons to whom the Software is | |
14 | * furnished to do so, subject to the following conditions: | |
15 | * | |
16 | * The above copyright notice and this permission notice shall be included in | |
17 | * all copies or substantial portions of the Software. | |
18 | */ | |
847bf71a | 19 | |
70bd0a12 JD |
20 | /* Forward declarations */ |
21 | struct babeltrace_iter; | |
70bd0a12 JD |
22 | struct trace_collection; |
23 | struct ctf_stream_event; | |
24 | struct ctf_stream; | |
34ac0e6c | 25 | |
70bd0a12 JD |
26 | /* |
27 | * babeltrace_iter_create - Allocate a trace collection iterator. | |
28 | */ | |
29 | struct babeltrace_iter *babeltrace_iter_create(struct trace_collection *tc); | |
34ac0e6c | 30 | |
70bd0a12 JD |
31 | /* |
32 | * babeltrace_iter_destroy - Free a trace collection iterator. | |
33 | */ | |
34 | void babeltrace_iter_destroy(struct babeltrace_iter *iter); | |
34ac0e6c | 35 | |
70bd0a12 JD |
36 | /* |
37 | * babeltrace_iter_next: Move trace collection position to the next event. | |
38 | * | |
39 | * Returns 0 on success, a negative value on error | |
40 | */ | |
41 | int babeltrace_iter_next(struct babeltrace_iter *iter); | |
46322b33 | 42 | |
70bd0a12 JD |
43 | /* |
44 | * babeltrace_iter_get_pos - Get the current trace collection position. | |
45 | * | |
46 | * The position returned by this function needs to be freed by | |
47 | * babeltrace_iter_free_pos after use. | |
48 | */ | |
49 | struct babeltrace_iter_pos * | |
50 | babeltrace_iter_get_pos(struct babeltrace_iter *iter); | |
46322b33 | 51 | |
70bd0a12 JD |
52 | /* |
53 | * babeltrace_iter_free_pos - Free the position. | |
54 | */ | |
55 | void babeltrace_iter_free_pos(struct babeltrace_iter_pos *pos); | |
d63ca2cd | 56 | |
70bd0a12 JD |
57 | /* |
58 | * babeltrace_iter_seek_pos - Seek the trace collection to the position. | |
59 | */ | |
60 | int babeltrace_iter_seek_pos(struct babeltrace_iter *iter, | |
61 | struct babeltrace_iter_pos *pos); | |
62 | ||
63 | /* | |
64 | * babeltrace_iter_seek_time: Seek the trace collection to the given timestamp. | |
65 | * | |
66 | * Return EOF if timestamp is after the last event of the trace collection. | |
67 | * Return other negative value for other errors. | |
68 | * Return 0 for success. | |
69 | */ | |
70 | int babeltrace_iter_seek_time(struct babeltrace_iter *iter, | |
71 | uint64_t timestamp); | |
72 | ||
73 | /* | |
74 | * babeltrace_iter_read_event: Read the iterator's current event data. | |
75 | * | |
76 | * @iter: trace collection iterator (input) | |
77 | * @stream: stream containing event at current position (output) | |
78 | * @event: current event (output) | |
79 | * Return 0 on success, negative error value on error. | |
80 | */ | |
81 | int babeltrace_iter_read_event(struct babeltrace_iter *iter, | |
82 | struct ctf_stream **stream, | |
83 | struct ctf_stream_event **event); | |
84 | ||
85 | #endif /* _BABELTRACE_H */ |