7 * Copyright 2010-2011 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
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:
16 * The above copyright notice and this permission notice shall be included in
17 * all copies or substantial portions of the Software.
20 /* Forward declarations */
21 struct babeltrace_iter
;
22 struct trace_collection
;
23 struct ctf_stream_event
;
25 struct babeltrace_saved_pos
;
27 struct trace_collection_pos
{
29 BT_SEEK_TIME
, /* uses u.seek_time */
30 BT_SEEK_RESTORE
, /* uses u.restore */
37 struct babeltrace_saved_pos
*restore
;
42 * babeltrace_iter_create - Allocate a trace collection iterator.
44 * begin_pos and end_pos are optional parameters to specify the position
45 * at which the trace collection should be seeked upon iterator
46 * creation, and the position at which iteration will start returning
49 * By default, if begin_pos is NULL, a BT_SEEK_CUR is performed at
50 * creation. By default, if end_pos is NULL, a BT_SEEK_END (end of
51 * trace) is the EOF criterion.
53 struct babeltrace_iter
*babeltrace_iter_create(struct trace_collection
*tc
,
54 struct trace_collection_pos
*begin_pos
,
55 struct trace_collection_pos
*end_pos
);
58 * babeltrace_iter_destroy - Free a trace collection iterator.
60 void babeltrace_iter_destroy(struct babeltrace_iter
*iter
);
63 * babeltrace_iter_next: Move trace collection position to the next event.
65 * Returns 0 on success, a negative value on error
67 int babeltrace_iter_next(struct babeltrace_iter
*iter
);
70 * babeltrace_iter_save_pos - Save the current trace collection position.
72 * The position returned by this function needs to be freed by
73 * babeltrace_iter_free_pos after use.
75 struct trace_collection_pos
*
76 babeltrace_iter_save_pos(struct babeltrace_iter
*iter
);
79 * babeltrace_iter_free_pos - Free the position.
81 void babeltrace_iter_free_pos(struct trace_collection_pos
*pos
);
84 * babeltrace_iter_seek: seek iterator to given position.
86 * Return EOF if position is after the last event of the trace collection.
87 * Return other negative value for other errors.
88 * Return 0 for success.
90 int babeltrace_iter_seek(struct babeltrace_iter
*iter
,
91 const struct trace_collection_pos
*pos
);
94 * babeltrace_iter_read_event: Read the iterator's current event data.
96 * @iter: trace collection iterator (input)
97 * @stream: stream containing event at current position (output)
98 * @event: current event (output)
99 * Return 0 on success, negative error value on error.
101 int babeltrace_iter_read_event(struct babeltrace_iter
*iter
,
102 struct ctf_stream
**stream
,
103 struct ctf_stream_event
**event
);
105 #endif /* _BABELTRACE_H */
This page took 0.033351 seconds and 5 git commands to generate.