• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1libtraceevent(3)
2================
3
4NAME
5----
6tep_alloc, tep_free,tep_ref, tep_unref,tep_get_ref, tep_kbuffer - Create, destroy, manage
7references of trace event parser context.
8
9SYNOPSIS
10--------
11[verse]
12--
13*#include <event-parse.h>*
14
15struct tep_handle pass:[*]*tep_alloc*(void);
16void *tep_free*(struct tep_handle pass:[*]_tep_);
17void *tep_ref*(struct tep_handle pass:[*]_tep_);
18void *tep_unref*(struct tep_handle pass:[*]_tep_);
19int *tep_get_ref*(struct tep_handle pass:[*]_tep_);
20--
21
22DESCRIPTION
23-----------
24These are the main functions to create and destroy tep_handle - the main
25structure, representing the trace event parser context. This context is used as
26the input parameter of most library APIs.
27
28The *tep_alloc()* function allocates and initializes the tep context.
29
30The *tep_free()* function will decrement the reference of the _tep_ handler.
31When there is no more references, then it will free the handler, as well
32as clean up all its resources that it had used. The argument _tep_ is
33the pointer to the trace event parser context.
34
35The *tep_ref()* function adds a reference to the _tep_ handler.
36
37The *tep_unref()* function removes a reference from the _tep_ handler. When
38the last reference is removed, the _tep_ is destroyed, and all resources that
39it had used are cleaned up.
40
41The *tep_ref_get()* functions gets the current references of the _tep_ handler.
42
43The *tep_kbuffer()* function allocates a kbuffer descriptor that can be used to
44parse raw data that is represented by the _tep_ handle descriptor. It must be freed
45with *kbuf_free(3)*.
46
47RETURN VALUE
48------------
49*tep_alloc()* returns a pointer to a newly created tep_handle structure.
50NULL is returned in case there is not enough free memory to allocate it.
51
52*tep_ref_get()* returns the current references of _tep_.
53If _tep_ is NULL, 0 is returned.
54
55*tep_kbuffer()* returns a kbuffer descriptor that can parse the raw data that
56represents the tep handle. Must be freed with *kbuf_free(3)*.
57
58EXAMPLE
59-------
60[source,c]
61--
62#include <event-parse.h>
63
64...
65struct tep_handle *tep = tep_alloc();
66...
67int ref = tep_get_ref(tep);
68tep_ref(tep);
69if ( (ref+1) != tep_get_ref(tep)) {
70	/* Something wrong happened, the counter is not incremented by 1 */
71}
72tep_unref(tep);
73...
74tep_free(tep);
75...
76--
77FILES
78-----
79[verse]
80--
81*event-parse.h*
82	Header file to include in order to have access to the library APIs.
83*-ltraceevent*
84	Linker switch to add when building a program that uses the library.
85--
86
87SEE ALSO
88--------
89*libtraceevent*(3), *trace-cmd*(1)
90
91AUTHOR
92------
93[verse]
94--
95*Steven Rostedt* <rostedt@goodmis.org>, author of *libtraceevent*.
96*Tzvetomir Stoyanov* <tz.stoyanov@gmail.com>, author of this man page.
97--
98REPORTING BUGS
99--------------
100Report bugs to  <linux-trace-devel@vger.kernel.org>
101
102LICENSE
103-------
104libtraceevent is Free Software licensed under the GNU LGPL 2.1
105
106RESOURCES
107---------
108https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/
109