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