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_parse_event, tep_parse_format - Parse the event format information 7*436bf2bcSAndroid Build Coastguard Worker 8*436bf2bcSAndroid Build Coastguard WorkerSYNOPSIS 9*436bf2bcSAndroid Build Coastguard Worker-------- 10*436bf2bcSAndroid Build Coastguard Worker[verse] 11*436bf2bcSAndroid Build Coastguard Worker-- 12*436bf2bcSAndroid Build Coastguard Worker*#include <event-parse.h>* 13*436bf2bcSAndroid Build Coastguard Worker 14*436bf2bcSAndroid Build Coastguard Workerenum tep_errno *tep_parse_event*(struct tep_handle pass:[*]_tep_, const char pass:[*]_buf_, unsigned long _size_, const char pass:[*]_sys_); 15*436bf2bcSAndroid Build Coastguard Workerenum tep_errno *tep_parse_format*(struct tep_handle pass:[*]_tep_, struct tep_event pass:[*]pass:[*]_eventp_, const char pass:[*]_buf_, unsigned long _size_, const char pass:[*]_sys_); 16*436bf2bcSAndroid Build Coastguard Worker-- 17*436bf2bcSAndroid Build Coastguard Worker 18*436bf2bcSAndroid Build Coastguard WorkerDESCRIPTION 19*436bf2bcSAndroid Build Coastguard Worker----------- 20*436bf2bcSAndroid Build Coastguard WorkerThe *tep_parse_event()* function parses the event format and creates an event 21*436bf2bcSAndroid Build Coastguard Workerstructure to quickly parse raw data for a given event. The _tep_ argument is 22*436bf2bcSAndroid Build Coastguard Workerthe trace event parser context. The created event structure is stored in the 23*436bf2bcSAndroid Build Coastguard Worker_tep_ context. The _buf_ argument is a buffer with _size_, where the event 24*436bf2bcSAndroid Build Coastguard Workerformat data is. The event format data can be taken from 25*436bf2bcSAndroid Build Coastguard Workertracefs/events/.../.../format files. The _sys_ argument is the system of 26*436bf2bcSAndroid Build Coastguard Workerthe event. 27*436bf2bcSAndroid Build Coastguard Worker 28*436bf2bcSAndroid Build Coastguard WorkerThe *tep_parse_format()* function does the same as *tep_parse_event()*. The only 29*436bf2bcSAndroid Build Coastguard Workerdifference is in the extra _eventp_ argument, where the newly created event 30*436bf2bcSAndroid Build Coastguard Workerstructure is returned. 31*436bf2bcSAndroid Build Coastguard Worker 32*436bf2bcSAndroid Build Coastguard WorkerRETURN VALUE 33*436bf2bcSAndroid Build Coastguard Worker------------ 34*436bf2bcSAndroid Build Coastguard WorkerBoth *tep_parse_event()* and *tep_parse_format()* functions return 0 on success, 35*436bf2bcSAndroid Build Coastguard Workeror TEP_ERRNO__... in case of an error. 36*436bf2bcSAndroid Build Coastguard Worker 37*436bf2bcSAndroid Build Coastguard WorkerEXAMPLE 38*436bf2bcSAndroid Build Coastguard Worker------- 39*436bf2bcSAndroid Build Coastguard Worker[source,c] 40*436bf2bcSAndroid Build Coastguard Worker-- 41*436bf2bcSAndroid Build Coastguard Worker#include <event-parse.h> 42*436bf2bcSAndroid Build Coastguard Worker... 43*436bf2bcSAndroid Build Coastguard Workerstruct tep_handle *tep = tep_alloc(); 44*436bf2bcSAndroid Build Coastguard Worker... 45*436bf2bcSAndroid Build Coastguard Workerchar *buf; 46*436bf2bcSAndroid Build Coastguard Workerint size; 47*436bf2bcSAndroid Build Coastguard Workerstruct tep_event *event = NULL; 48*436bf2bcSAndroid Build Coastguard Workerbuf = read_file("/sys/kernel/tracing/events/ftrace/print/format", &size); 49*436bf2bcSAndroid Build Coastguard Workerif (tep_parse_event(tep, buf, size, "ftrace") != 0) { 50*436bf2bcSAndroid Build Coastguard Worker /* Failed to parse the ftrace print format */ 51*436bf2bcSAndroid Build Coastguard Worker} 52*436bf2bcSAndroid Build Coastguard Worker 53*436bf2bcSAndroid Build Coastguard Workerif (tep_parse_format(tep, &event, buf, size, "ftrace") != 0) { 54*436bf2bcSAndroid Build Coastguard Worker /* Failed to parse the ftrace print format */ 55*436bf2bcSAndroid Build Coastguard Worker} 56*436bf2bcSAndroid Build Coastguard Worker... 57*436bf2bcSAndroid Build Coastguard Worker-- 58*436bf2bcSAndroid Build Coastguard Worker 59*436bf2bcSAndroid Build Coastguard WorkerFILES 60*436bf2bcSAndroid Build Coastguard Worker----- 61*436bf2bcSAndroid Build Coastguard Worker[verse] 62*436bf2bcSAndroid Build Coastguard Worker-- 63*436bf2bcSAndroid Build Coastguard Worker*event-parse.h* 64*436bf2bcSAndroid Build Coastguard Worker Header file to include in order to have access to the library APIs. 65*436bf2bcSAndroid Build Coastguard Worker*-ltraceevent* 66*436bf2bcSAndroid Build Coastguard Worker Linker switch to add when building a program that uses the library. 67*436bf2bcSAndroid Build Coastguard Worker-- 68*436bf2bcSAndroid Build Coastguard Worker 69*436bf2bcSAndroid Build Coastguard WorkerSEE ALSO 70*436bf2bcSAndroid Build Coastguard Worker-------- 71*436bf2bcSAndroid Build Coastguard Worker*libtraceevent*(3), *trace-cmd*(1) 72*436bf2bcSAndroid Build Coastguard Worker 73*436bf2bcSAndroid Build Coastguard WorkerAUTHOR 74*436bf2bcSAndroid Build Coastguard Worker------ 75*436bf2bcSAndroid Build Coastguard Worker[verse] 76*436bf2bcSAndroid Build Coastguard Worker-- 77*436bf2bcSAndroid Build Coastguard Worker*Steven Rostedt* <[email protected]>, author of *libtraceevent*. 78*436bf2bcSAndroid Build Coastguard Worker*Tzvetomir Stoyanov* <[email protected]>, author of this man page. 79*436bf2bcSAndroid Build Coastguard Worker-- 80*436bf2bcSAndroid Build Coastguard WorkerREPORTING BUGS 81*436bf2bcSAndroid Build Coastguard Worker-------------- 82*436bf2bcSAndroid Build Coastguard WorkerReport bugs to <[email protected]> 83*436bf2bcSAndroid Build Coastguard Worker 84*436bf2bcSAndroid Build Coastguard WorkerLICENSE 85*436bf2bcSAndroid Build Coastguard Worker------- 86*436bf2bcSAndroid Build Coastguard Workerlibtraceevent is Free Software licensed under the GNU LGPL 2.1 87*436bf2bcSAndroid Build Coastguard Worker 88*436bf2bcSAndroid Build Coastguard WorkerRESOURCES 89*436bf2bcSAndroid Build Coastguard Worker--------- 90*436bf2bcSAndroid Build Coastguard Workerhttps://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/ 91