1 #ifndef _BABELTRACE_CONTEXT_H
2 #define _BABELTRACE_CONTEXT_H
9 * Copyright 2012 EfficiOS Inc. and Linux Foundation
11 * Author: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
12 * Julien Desfossez <julien.desfossez@efficios.com>
14 * Permission is hereby granted, free of charge, to any person obtaining
15 * a copy of this software and associated documentation files (the
16 * "Software"), to deal in the Software without restriction, including
17 * without limitation the rights to use, copy, modify, merge, publish,
18 * distribute, sublicense, and/or sell copies of the Software, and to
19 * permit persons to whom the Software is furnished to do so, subject to
20 * the following conditions:
22 * The above copyright notice and this permission notice shall be
23 * included in all copies or substantial portions of the Software.
27 #include <babeltrace/format.h>
29 /* struct bt_context is opaque to the user */
34 * bt_context_create : create a Babeltrace context
36 * Allocate a new context. The creation of the context sets the refcount
39 * Returns an allocated context on success and NULL on error
41 struct bt_context
*bt_context_create(void);
44 * bt_context_add_trace : Add a trace by path to the context
48 * packet_seek can be NULL to use the default packet_seek handler
49 * provided by the trace format. If non-NULL, it is used as an override
50 * of the handler for seeks across packets. It takes as parameter a
51 * stream position, the packet index it needs to seek to (for SEEK_SET),
52 * and a "whence" parameter (either SEEK_CUR: seek to next packet, or
53 * SEEK_SET: seek to packet at packet index).
55 * If "path" is NULL, stream_list is used instread as a list of streams
56 * to open for the trace.
58 * The metadata parameter acts as a metadata override when not NULL.
60 * Return: the trace handle id (>= 0) on success, a negative
63 int bt_context_add_trace(struct bt_context
*ctx
, const char *path
,
65 void (*packet_seek
)(struct stream_pos
*pos
,
66 size_t index
, int whence
),
67 struct mmap_stream_list
*stream_list
,
71 * bt_context_remove_trace: Remove a trace from the context.
73 * Effectively closing the trace.
75 void bt_context_remove_trace(struct bt_context
*ctx
, int trace_id
);
78 * bt_context_get and bt_context_put : increments and decrement the
79 * refcount of the context
81 * These functions ensures that the context won't be destroyed when it
82 * is in use. The same number of get and put (plus one extra put to
83 * release the initial reference done at creation) has to be done to
86 * When the context refcount is decremented to 0 by a bt_context_put,
87 * the context is freed.
89 void bt_context_get(struct bt_context
*ctx
);
90 void bt_context_put(struct bt_context
*ctx
);
92 #endif /* _BABELTRACE_CONTEXT_H */
This page took 0.031634 seconds and 4 git commands to generate.