xref: /aosp_15_r20/external/libtraceevent/Documentation/libtraceevent-event_list.txt (revision 436bf2bcd5202612ffffe471bbcc1f277cc8d28e)
1*436bf2bcSAndroid Build Coastguard Workerlibtraceevent(3)
2*436bf2bcSAndroid Build Coastguard Worker================
3*436bf2bcSAndroid Build Coastguard Worker
4*436bf2bcSAndroid Build Coastguard WorkerNAME
5*436bf2bcSAndroid Build Coastguard Worker----
6*436bf2bcSAndroid Build Coastguard Workertep_list_events, tep_list_events_copy -
7*436bf2bcSAndroid Build Coastguard WorkerGet list of events, sorted by given criteria.
8*436bf2bcSAndroid Build Coastguard Worker
9*436bf2bcSAndroid Build Coastguard WorkerSYNOPSIS
10*436bf2bcSAndroid Build Coastguard Worker--------
11*436bf2bcSAndroid Build Coastguard Worker[verse]
12*436bf2bcSAndroid Build Coastguard Worker--
13*436bf2bcSAndroid Build Coastguard Worker*#include <event-parse.h>*
14*436bf2bcSAndroid Build Coastguard Worker
15*436bf2bcSAndroid Build Coastguard Workerenum *tep_event_sort_type* {
16*436bf2bcSAndroid Build Coastguard Worker	_TEP_EVENT_SORT_ID_,
17*436bf2bcSAndroid Build Coastguard Worker	_TEP_EVENT_SORT_NAME_,
18*436bf2bcSAndroid Build Coastguard Worker	_TEP_EVENT_SORT_SYSTEM_,
19*436bf2bcSAndroid Build Coastguard Worker};
20*436bf2bcSAndroid Build Coastguard Worker
21*436bf2bcSAndroid Build Coastguard Workerstruct tep_event pass:[*]pass:[*]*tep_list_events*(struct tep_handle pass:[*]_tep_, enum tep_event_sort_type _sort_type_);
22*436bf2bcSAndroid Build Coastguard Workerstruct tep_event pass:[*]pass:[*]*tep_list_events_copy*(struct tep_handle pass:[*]_tep_, enum tep_event_sort_type _sort_type_);
23*436bf2bcSAndroid Build Coastguard Worker--
24*436bf2bcSAndroid Build Coastguard Worker
25*436bf2bcSAndroid Build Coastguard WorkerDESCRIPTION
26*436bf2bcSAndroid Build Coastguard Worker-----------
27*436bf2bcSAndroid Build Coastguard WorkerThe *tep_list_events()* function returns an array of pointers to the events,
28*436bf2bcSAndroid Build Coastguard Workersorted by the _sort_type_ criteria. The last element of the array is NULL.
29*436bf2bcSAndroid Build Coastguard WorkerThe returned memory must not be freed, it is managed by the library.
30*436bf2bcSAndroid Build Coastguard WorkerThe function is not thread safe. The _tep_ argument is trace event parser
31*436bf2bcSAndroid Build Coastguard Workercontext. The _sort_type_ argument is the required sort criteria:
32*436bf2bcSAndroid Build Coastguard Worker[verse]
33*436bf2bcSAndroid Build Coastguard Worker--
34*436bf2bcSAndroid Build Coastguard Worker	_TEP_EVENT_SORT_ID_	- sort by the event ID.
35*436bf2bcSAndroid Build Coastguard Worker	_TEP_EVENT_SORT_NAME_	- sort by the event (name, system, id) triplet.
36*436bf2bcSAndroid Build Coastguard Worker	_TEP_EVENT_SORT_SYSTEM_	- sort by the event (system, name, id) triplet.
37*436bf2bcSAndroid Build Coastguard Worker--
38*436bf2bcSAndroid Build Coastguard Worker
39*436bf2bcSAndroid Build Coastguard WorkerThe *tep_list_events_copy()* is a thread safe version of _tep_list_events()_.
40*436bf2bcSAndroid Build Coastguard WorkerIt has the same behavior, but the returned array is allocated internally and
41*436bf2bcSAndroid Build Coastguard Workermust be freed by the caller. Note that the content of the array must not be
42*436bf2bcSAndroid Build Coastguard Workerfreed (see the EXAMPLE below).
43*436bf2bcSAndroid Build Coastguard Worker
44*436bf2bcSAndroid Build Coastguard WorkerRETURN VALUE
45*436bf2bcSAndroid Build Coastguard Worker------------
46*436bf2bcSAndroid Build Coastguard WorkerThe *tep_list_events()* function returns an array of pointers to events.
47*436bf2bcSAndroid Build Coastguard WorkerIn case of an error, NULL is returned. The returned array must not be freed,
48*436bf2bcSAndroid Build Coastguard Workerit is managed by the library.
49*436bf2bcSAndroid Build Coastguard Worker
50*436bf2bcSAndroid Build Coastguard WorkerThe *tep_list_events_copy()* function returns an array of pointers to events.
51*436bf2bcSAndroid Build Coastguard WorkerIn case of an error, NULL is returned. The returned array must be freed by
52*436bf2bcSAndroid Build Coastguard Workerthe caller.
53*436bf2bcSAndroid Build Coastguard Worker
54*436bf2bcSAndroid Build Coastguard WorkerEXAMPLE
55*436bf2bcSAndroid Build Coastguard Worker-------
56*436bf2bcSAndroid Build Coastguard Worker[source,c]
57*436bf2bcSAndroid Build Coastguard Worker--
58*436bf2bcSAndroid Build Coastguard Worker#include <event-parse.h>
59*436bf2bcSAndroid Build Coastguard Worker...
60*436bf2bcSAndroid Build Coastguard Workerstruct tep_handle *tep = tep_alloc();
61*436bf2bcSAndroid Build Coastguard Worker...
62*436bf2bcSAndroid Build Coastguard Workerint i;
63*436bf2bcSAndroid Build Coastguard Workerstruct tep_event_format **events;
64*436bf2bcSAndroid Build Coastguard Worker
65*436bf2bcSAndroid Build Coastguard Workeri=0;
66*436bf2bcSAndroid Build Coastguard Workerevents = tep_list_events(tep, TEP_EVENT_SORT_ID);
67*436bf2bcSAndroid Build Coastguard Workerif (events == NULL) {
68*436bf2bcSAndroid Build Coastguard Worker	/* Failed to get the events, sorted by ID */
69*436bf2bcSAndroid Build Coastguard Worker} else {
70*436bf2bcSAndroid Build Coastguard Worker	while(events[i]) {
71*436bf2bcSAndroid Build Coastguard Worker		/* walk through the list of the events, sorted by ID */
72*436bf2bcSAndroid Build Coastguard Worker		i++;
73*436bf2bcSAndroid Build Coastguard Worker	}
74*436bf2bcSAndroid Build Coastguard Worker}
75*436bf2bcSAndroid Build Coastguard Worker
76*436bf2bcSAndroid Build Coastguard Workeri=0;
77*436bf2bcSAndroid Build Coastguard Workerevents = tep_list_events_copy(tep, TEP_EVENT_SORT_NAME);
78*436bf2bcSAndroid Build Coastguard Workerif (events == NULL) {
79*436bf2bcSAndroid Build Coastguard Worker	/* Failed to get the events, sorted by name */
80*436bf2bcSAndroid Build Coastguard Worker} else {
81*436bf2bcSAndroid Build Coastguard Worker	while(events[i]) {
82*436bf2bcSAndroid Build Coastguard Worker		/* walk through the list of the events, sorted by name */
83*436bf2bcSAndroid Build Coastguard Worker		i++;
84*436bf2bcSAndroid Build Coastguard Worker	}
85*436bf2bcSAndroid Build Coastguard Worker	free(events);
86*436bf2bcSAndroid Build Coastguard Worker}
87*436bf2bcSAndroid Build Coastguard Worker
88*436bf2bcSAndroid Build Coastguard Worker...
89*436bf2bcSAndroid Build Coastguard Worker--
90*436bf2bcSAndroid Build Coastguard Worker
91*436bf2bcSAndroid Build Coastguard WorkerFILES
92*436bf2bcSAndroid Build Coastguard Worker-----
93*436bf2bcSAndroid Build Coastguard Worker[verse]
94*436bf2bcSAndroid Build Coastguard Worker--
95*436bf2bcSAndroid Build Coastguard Worker*event-parse.h*
96*436bf2bcSAndroid Build Coastguard Worker	Header file to include in order to have access to the library APIs.
97*436bf2bcSAndroid Build Coastguard Worker*-ltraceevent*
98*436bf2bcSAndroid Build Coastguard Worker	Linker switch to add when building a program that uses the library.
99*436bf2bcSAndroid Build Coastguard Worker--
100*436bf2bcSAndroid Build Coastguard Worker
101*436bf2bcSAndroid Build Coastguard WorkerSEE ALSO
102*436bf2bcSAndroid Build Coastguard Worker--------
103*436bf2bcSAndroid Build Coastguard Worker*libtraceevent*(3), *trace-cmd*(1)
104*436bf2bcSAndroid Build Coastguard Worker
105*436bf2bcSAndroid Build Coastguard WorkerAUTHOR
106*436bf2bcSAndroid Build Coastguard Worker------
107*436bf2bcSAndroid Build Coastguard Worker[verse]
108*436bf2bcSAndroid Build Coastguard Worker--
109*436bf2bcSAndroid Build Coastguard Worker*Steven Rostedt* <[email protected]>, author of *libtraceevent*.
110*436bf2bcSAndroid Build Coastguard Worker*Tzvetomir Stoyanov* <[email protected]>, author of this man page.
111*436bf2bcSAndroid Build Coastguard Worker--
112*436bf2bcSAndroid Build Coastguard WorkerREPORTING BUGS
113*436bf2bcSAndroid Build Coastguard Worker--------------
114*436bf2bcSAndroid Build Coastguard WorkerReport bugs to  <[email protected]>
115*436bf2bcSAndroid Build Coastguard Worker
116*436bf2bcSAndroid Build Coastguard WorkerLICENSE
117*436bf2bcSAndroid Build Coastguard Worker-------
118*436bf2bcSAndroid Build Coastguard Workerlibtraceevent is Free Software licensed under the GNU LGPL 2.1
119*436bf2bcSAndroid Build Coastguard Worker
120*436bf2bcSAndroid Build Coastguard WorkerRESOURCES
121*436bf2bcSAndroid Build Coastguard Worker---------
122*436bf2bcSAndroid Build Coastguard Workerhttps://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/
123