Back to home page

OSCL-LXR

 
 

    


0001 libtraceevent(3)
0002 ================
0003 
0004 NAME
0005 ----
0006 tep_parse_event, tep_parse_format - Parse the event format information
0007 
0008 SYNOPSIS
0009 --------
0010 [verse]
0011 --
0012 *#include <event-parse.h>*
0013 
0014 enum tep_errno *tep_parse_event*(struct tep_handle pass:[*]_tep_, const char pass:[*]_buf_, unsigned long _size_, const char pass:[*]_sys_);
0015 enum 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_);
0016 --
0017 
0018 DESCRIPTION
0019 -----------
0020 The _tep_parse_event()_ function parses the event format and creates an event
0021 structure to quickly parse raw data for a given event. The _tep_ argument is
0022 the trace event parser context. The created event structure is stored in the
0023 _tep_ context. The _buf_ argument is a buffer with _size_, where the event
0024 format data is. The event format data can be taken from
0025 tracefs/events/.../.../format files. The _sys_ argument is the system of
0026 the event.
0027 
0028 The _tep_parse_format()_ function does the same as _tep_parse_event()_. The only
0029 difference is in the extra _eventp_ argument, where the newly created event
0030 structure is returned.
0031 
0032 RETURN VALUE
0033 ------------
0034 Both _tep_parse_event()_ and _tep_parse_format()_ functions return 0 on success,
0035 or TEP_ERRNO__... in case of an error.
0036 
0037 EXAMPLE
0038 -------
0039 [source,c]
0040 --
0041 #include <event-parse.h>
0042 ...
0043 struct tep_handle *tep = tep_alloc();
0044 ...
0045 char *buf;
0046 int size;
0047 struct tep_event *event = NULL;
0048 buf = read_file("/sys/kernel/tracing/events/ftrace/print/format", &size);
0049 if (tep_parse_event(tep, buf, size, "ftrace") != 0) {
0050         /* Failed to parse the ftrace print format */
0051 }
0052 
0053 if (tep_parse_format(tep, &event, buf, size, "ftrace") != 0) {
0054         /* Failed to parse the ftrace print format */
0055 }
0056 ...
0057 --
0058 
0059 FILES
0060 -----
0061 [verse]
0062 --
0063 *event-parse.h*
0064         Header file to include in order to have access to the library APIs.
0065 *-ltraceevent*
0066         Linker switch to add when building a program that uses the library.
0067 --
0068 
0069 SEE ALSO
0070 --------
0071 _libtraceevent(3)_, _trace-cmd(1)_
0072 
0073 AUTHOR
0074 ------
0075 [verse]
0076 --
0077 *Steven Rostedt* <rostedt@goodmis.org>, author of *libtraceevent*.
0078 *Tzvetomir Stoyanov* <tz.stoyanov@gmail.com>, author of this man page.
0079 --
0080 REPORTING BUGS
0081 --------------
0082 Report bugs to  <linux-trace-devel@vger.kernel.org>
0083 
0084 LICENSE
0085 -------
0086 libtraceevent is Free Software licensed under the GNU LGPL 2.1
0087 
0088 RESOURCES
0089 ---------
0090 https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git