libtraceevent-event_get.txt (2510B)
1libtraceevent(3) 2================ 3 4NAME 5---- 6tep_get_event, tep_get_first_event, tep_get_events_count - Access events. 7 8SYNOPSIS 9-------- 10[verse] 11-- 12*#include <event-parse.h>* 13 14struct tep_event pass:[*]*tep_get_event*(struct tep_handle pass:[*]_tep_, int _index_); 15struct tep_event pass:[*]*tep_get_first_event*(struct tep_handle pass:[*]_tep_); 16int *tep_get_events_count*(struct tep_handle pass:[*]_tep_); 17-- 18 19DESCRIPTION 20----------- 21The _tep_get_event()_ function returns a pointer to event at the given _index_. 22The _tep_ argument is trace event parser context, the _index_ is the index of 23the requested event. 24 25The _tep_get_first_event()_ function returns a pointer to the first event. 26As events are stored in an array, this function returns the pointer to the 27beginning of the array. The _tep_ argument is trace event parser context. 28 29The _tep_get_events_count()_ function returns the number of the events 30in the array. The _tep_ argument is trace event parser context. 31 32RETURN VALUE 33------------ 34The _tep_get_event()_ returns a pointer to the event located at _index_. 35NULL is returned in case of error, in case there are no events or _index_ is 36out of range. 37 38The _tep_get_first_event()_ returns a pointer to the first event. NULL is 39returned in case of error, or in case there are no events. 40 41The _tep_get_events_count()_ returns the number of the events. 0 is 42returned in case of error, or in case there are no events. 43 44EXAMPLE 45------- 46[source,c] 47-- 48#include <event-parse.h> 49... 50struct tep_handle *tep = tep_alloc(); 51... 52int i,count = tep_get_events_count(tep); 53struct tep_event *event, *events = tep_get_first_event(tep); 54 55if (events == NULL) { 56 /* There are no events */ 57} else { 58 for (i = 0; i < count; i++) { 59 event = (events+i); 60 /* process events[i] */ 61 } 62 63 /* Get the last event */ 64 event = tep_get_event(tep, count-1); 65} 66-- 67 68FILES 69----- 70[verse] 71-- 72*event-parse.h* 73 Header file to include in order to have access to the library APIs. 74*-ltraceevent* 75 Linker switch to add when building a program that uses the library. 76-- 77 78SEE ALSO 79-------- 80_libtraceevent(3)_, _trace-cmd(1)_ 81 82AUTHOR 83------ 84[verse] 85-- 86*Steven Rostedt* <rostedt@goodmis.org>, author of *libtraceevent*. 87*Tzvetomir Stoyanov* <tz.stoyanov@gmail.com>, author of this man page. 88-- 89REPORTING BUGS 90-------------- 91Report bugs to <linux-trace-devel@vger.kernel.org> 92 93LICENSE 94------- 95libtraceevent is Free Software licensed under the GNU LGPL 2.1 96 97RESOURCES 98--------- 99https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git