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

NAME

6       tep_list_events, tep_list_events_copy - Get list of events, sorted by
7       given criteria.
8

SYNOPSIS

10       #include <event-parse.h>
11
12       enum tep_event_sort_type {
13               TEP_EVENT_SORT_ID,
14               TEP_EVENT_SORT_NAME,
15               TEP_EVENT_SORT_SYSTEM,
16       };
17
18       struct tep_event **tep_list_events(struct tep_handle *tep, enum tep_event_sort_type sort_type);
19       struct tep_event **tep_list_events_copy(struct tep_handle *tep, enum tep_event_sort_type sort_type);
20

DESCRIPTION

22       The tep_list_events() function returns an array of pointers to the
23       events, sorted by the sort_type criteria. The last element of the array
24       is NULL. The returned memory must not be freed, it is managed by the
25       library. The function is not thread safe. The tep argument is trace
26       event parser context. The sort_type argument is the required sort
27       criteria:
28
29                   TEP_EVENT_SORT_ID     - sort by the event ID.
30                   TEP_EVENT_SORT_NAME   - sort by the event (name, system, id) triplet.
31                   TEP_EVENT_SORT_SYSTEM - sort by the event (system, name, id) triplet.
32
33       The tep_list_events_copy() is a thread safe version of
34       tep_list_events(). It has the same behavior, but the returned array is
35       allocated internally and must be freed by the caller. Note that the
36       content of the array must not be freed (see the EXAMPLE below).
37

RETURN VALUE

39       The tep_list_events() function returns an array of pointers to events.
40       In case of an error, NULL is returned. The returned array must not be
41       freed, it is managed by the library.
42
43       The tep_list_events_copy() function returns an array of pointers to
44       events. In case of an error, NULL is returned. The returned array must
45       be freed by the caller.
46

EXAMPLE

48           #include <event-parse.h>
49           ...
50           struct tep_handle *tep = tep_alloc();
51           ...
52           int i;
53           struct tep_event_format **events;
54
55           i=0;
56           events = tep_list_events(tep, TEP_EVENT_SORT_ID);
57           if (events == NULL) {
58                   /* Failed to get the events, sorted by ID */
59           } else {
60                   while(events[i]) {
61                           /* walk through the list of the events, sorted by ID */
62                           i++;
63                   }
64           }
65
66           i=0;
67           events = tep_list_events_copy(tep, TEP_EVENT_SORT_NAME);
68           if (events == NULL) {
69                   /* Failed to get the events, sorted by name */
70           } else {
71                   while(events[i]) {
72                           /* walk through the list of the events, sorted by name */
73                           i++;
74                   }
75                   free(events);
76           }
77
78           ...
79

FILES

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

SEE ALSO

87       libtraceevent(3), trace-cmd(1)
88

AUTHOR

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

REPORTING BUGS

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

LICENSE

97       libtraceevent is Free Software licensed under the GNU LGPL 2.1
98

RESOURCES

100       https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/
101

NOTES

103        1. rostedt@goodmis.org
104           mailto:rostedt@goodmis.org
105
106        2. tz.stoyanov@gmail.com
107           mailto:tz.stoyanov@gmail.com
108
109        3. linux-trace-devel@vger.kernel.org
110           mailto:linux-trace-devel@vger.kernel.org
111
112
113
114libtraceevent 1.1.1               02/08/2021                  LIBTRACEEVENT(3)
Impressum