Back to home page

OSCL-LXR

 
 

    


0001 libtraceevent(3)
0002 ================
0003 
0004 NAME
0005 ----
0006 tep_list_events, tep_list_events_copy -
0007 Get list of events, sorted by given criteria.
0008 
0009 SYNOPSIS
0010 --------
0011 [verse]
0012 --
0013 *#include <event-parse.h>*
0014 
0015 enum *tep_event_sort_type* {
0016         _TEP_EVENT_SORT_ID_,
0017         _TEP_EVENT_SORT_NAME_,
0018         _TEP_EVENT_SORT_SYSTEM_,
0019 };
0020 
0021 struct tep_event pass:[*]pass:[*]*tep_list_events*(struct tep_handle pass:[*]_tep_, enum tep_event_sort_type _sort_type_);
0022 struct tep_event pass:[*]pass:[*]*tep_list_events_copy*(struct tep_handle pass:[*]_tep_, enum tep_event_sort_type _sort_type_);
0023 --
0024 
0025 DESCRIPTION
0026 -----------
0027 The _tep_list_events()_ function returns an array of pointers to the events,
0028 sorted by the _sort_type_ criteria. The last element of the array is NULL.
0029 The returned memory must not be freed, it is managed by the library.
0030 The function is not thread safe. The _tep_ argument is trace event parser
0031 context. The _sort_type_ argument is the required sort criteria:
0032 [verse]
0033 --
0034         _TEP_EVENT_SORT_ID_     - sort by the event ID.
0035         _TEP_EVENT_SORT_NAME_   - sort by the event (name, system, id) triplet.
0036         _TEP_EVENT_SORT_SYSTEM_ - sort by the event (system, name, id) triplet.
0037 --
0038 
0039 The _tep_list_events_copy()_ is a thread safe version of _tep_list_events()_.
0040 It has the same behavior, but the returned array is allocated internally and
0041 must be freed by the caller. Note that the content of the array must not be
0042 freed (see the EXAMPLE below).
0043 
0044 RETURN VALUE
0045 ------------
0046 The _tep_list_events()_ function returns an array of pointers to events.
0047 In case of an error, NULL is returned. The returned array must not be freed,
0048 it is managed by the library.
0049 
0050 The _tep_list_events_copy()_ function returns an array of pointers to events.
0051 In case of an error, NULL is returned. The returned array must be freed by
0052 the caller.
0053 
0054 EXAMPLE
0055 -------
0056 [source,c]
0057 --
0058 #include <event-parse.h>
0059 ...
0060 struct tep_handle *tep = tep_alloc();
0061 ...
0062 int i;
0063 struct tep_event_format **events;
0064 
0065 i=0;
0066 events = tep_list_events(tep, TEP_EVENT_SORT_ID);
0067 if (events == NULL) {
0068         /* Failed to get the events, sorted by ID */
0069 } else {
0070         while(events[i]) {
0071                 /* walk through the list of the events, sorted by ID */
0072                 i++;
0073         }
0074 }
0075 
0076 i=0;
0077 events = tep_list_events_copy(tep, TEP_EVENT_SORT_NAME);
0078 if (events == NULL) {
0079         /* Failed to get the events, sorted by name */
0080 } else {
0081         while(events[i]) {
0082                 /* walk through the list of the events, sorted by name */
0083                 i++;
0084         }
0085         free(events);
0086 }
0087 
0088 ...
0089 --
0090 
0091 FILES
0092 -----
0093 [verse]
0094 --
0095 *event-parse.h*
0096         Header file to include in order to have access to the library APIs.
0097 *-ltraceevent*
0098         Linker switch to add when building a program that uses the library.
0099 --
0100 
0101 SEE ALSO
0102 --------
0103 _libtraceevent(3)_, _trace-cmd(1)_
0104 
0105 AUTHOR
0106 ------
0107 [verse]
0108 --
0109 *Steven Rostedt* <rostedt@goodmis.org>, author of *libtraceevent*.
0110 *Tzvetomir Stoyanov* <tz.stoyanov@gmail.com>, author of this man page.
0111 --
0112 REPORTING BUGS
0113 --------------
0114 Report bugs to  <linux-trace-devel@vger.kernel.org>
0115 
0116 LICENSE
0117 -------
0118 libtraceevent is Free Software licensed under the GNU LGPL 2.1
0119 
0120 RESOURCES
0121 ---------
0122 https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git