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

NAME

6       tep_alloc, tep_free, tep_ref, tep_unref, tep_get_ref - Create, destroy,
7       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

RETURN VALUE

40       tep_alloc() returns a pointer to a newly created tep_handle structure.
41       NULL is returned in case there is not enough free memory to allocate
42       it.
43
44       tep_ref_get() returns the current references of tep. If tep is NULL, 0
45       is returned.
46

EXAMPLE

48           #include <event-parse.h>
49
50           ...
51           struct tep_handle *tep = tep_alloc();
52           ...
53           int ref = tep_get_ref(tep);
54           tep_ref(tep);
55           if ( (ref+1) != tep_get_ref(tep)) {
56                   /* Something wrong happened, the counter is not incremented by 1 */
57           }
58           tep_unref(tep);
59           ...
60           tep_free(tep);
61           ...
62

FILES

64           event-parse.h
65                   Header file to include in order to have access to the library APIs.
66           -ltraceevent
67                   Linker switch to add when building a program that uses the library.
68

SEE ALSO

70       libtraceevent(3), trace-cmd(1)
71

AUTHOR

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

REPORTING BUGS

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

LICENSE

80       libtraceevent is Free Software licensed under the GNU LGPL 2.1
81

RESOURCES

83       https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/
84

NOTES

86        1. rostedt@goodmis.org
87           mailto:rostedt@goodmis.org
88
89        2. tz.stoyanov@gmail.com
90           mailto:tz.stoyanov@gmail.com
91
92        3. linux-trace-devel@vger.kernel.org
93           mailto:linux-trace-devel@vger.kernel.org
94
95
96
97libtraceevent 1.5.3               04/15/2022                  LIBTRACEEVENT(3)
Impressum