1LIBTRACEEVENT(3)             libtraceevent Manual             LIBTRACEEVENT(3)
2
3
4

NAME

6       tep_alloc, tep_free, tep_ref, tep_unref, tep_get_ref, tep_kbuffer -
7       Create, destroy, manage references of trace event parser context.
8

SYNOPSIS

10       #include <event-parse.h>
11
12       struct tep_handle *tep_alloc(void);
13       void tep_free(struct tep_handle *tep);
14       void tep_ref(struct tep_handle *tep);
15       void tep_unref(struct tep_handle *tep);
16       int tep_get_ref(struct tep_handle *tep);
17

DESCRIPTION

19       These are the main functions to create and destroy tep_handle - the
20       main structure, representing the trace event parser context. This
21       context is used as the input parameter of most library APIs.
22
23       The tep_alloc() function allocates and initializes the tep context.
24
25       The tep_free() function will decrement the reference of the tep
26       handler. When there is no more references, then it will free the
27       handler, as well as clean up all its resources that it had used. The
28       argument tep is the pointer to the trace event parser context.
29
30       The tep_ref() function adds a reference to the tep handler.
31
32       The tep_unref() function removes a reference from the tep handler. When
33       the last reference is removed, the tep is destroyed, and all resources
34       that it had used are cleaned up.
35
36       The tep_ref_get() functions gets the current references of the tep
37       handler.
38
39       The tep_kbuffer() function allocates a kbuffer descriptor that can be
40       used to parse raw data that is represented by the tep handle
41       descriptor. It must be freed with kbuf_free(3).
42

RETURN VALUE

44       tep_alloc() returns a pointer to a newly created tep_handle structure.
45       NULL is returned in case there is not enough free memory to allocate
46       it.
47
48       tep_ref_get() returns the current references of tep. If tep is NULL, 0
49       is returned.
50
51       tep_kbuffer() returns a kbuffer descriptor that can parse the raw data
52       that represents the tep handle. Must be freed with kbuf_free(3).
53

EXAMPLE

55           #include <event-parse.h>
56
57           ...
58           struct tep_handle *tep = tep_alloc();
59           ...
60           int ref = tep_get_ref(tep);
61           tep_ref(tep);
62           if ( (ref+1) != tep_get_ref(tep)) {
63                   /* Something wrong happened, the counter is not incremented by 1 */
64           }
65           tep_unref(tep);
66           ...
67           tep_free(tep);
68           ...
69

FILES

71           event-parse.h
72                   Header file to include in order to have access to the library APIs.
73           -ltraceevent
74                   Linker switch to add when building a program that uses the library.
75

SEE ALSO

77       libtraceevent(3), trace-cmd(1)
78

AUTHOR

80           Steven Rostedt <rostedt@goodmis.org[1]>, author of libtraceevent.
81           Tzvetomir Stoyanov <tz.stoyanov@gmail.com[2]>, author of this man page.
82

REPORTING BUGS

84       Report bugs to <linux-trace-devel@vger.kernel.org[3]>
85

LICENSE

87       libtraceevent is Free Software licensed under the GNU LGPL 2.1
88

RESOURCES

90       https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/
91

NOTES

93        1. rostedt@goodmis.org
94           mailto:rostedt@goodmis.org
95
96        2. tz.stoyanov@gmail.com
97           mailto:tz.stoyanov@gmail.com
98
99        3. linux-trace-devel@vger.kernel.org
100           mailto:linux-trace-devel@vger.kernel.org
101
102
103
104libtraceevent 1.7.2               04/05/2023                  LIBTRACEEVENT(3)
Impressum