1libtraceevent(3)
2================
3
4NAME
5----
6tep_parse_event, tep_parse_format - Parse the event format information
7
8SYNOPSIS
9--------
10[verse]
11--
12*#include <event-parse.h>*
13
14enum tep_errno *tep_parse_event*(struct tep_handle pass:[*]_tep_, const char pass:[*]_buf_, unsigned long _size_, const char pass:[*]_sys_);
15enum 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--
17
18DESCRIPTION
19-----------
20The _tep_parse_event()_ function parses the event format and creates an event
21structure to quickly parse raw data for a given event. The _tep_ argument is
22the trace event parser context. The created event structure is stored in the
23_tep_ context. The _buf_ argument is a buffer with _size_, where the event
24format data is. The event format data can be taken from
25tracefs/events/.../.../format files. The _sys_ argument is the system of
26the event.
27
28The _tep_parse_format()_ function does the same as _tep_parse_event()_. The only
29difference is in the extra _eventp_ argument, where the newly created event
30structure is returned.
31
32RETURN VALUE
33------------
34Both _tep_parse_event()_ and _tep_parse_format()_ functions return 0 on success,
35or TEP_ERRNO__... in case of an error.
36
37EXAMPLE
38-------
39[source,c]
40--
41#include <event-parse.h>
42...
43struct tep_handle *tep = tep_alloc();
44...
45char *buf;
46int size;
47struct tep_event *event = NULL;
48buf = read_file("/sys/kernel/tracing/events/ftrace/print/format", &size);
49if (tep_parse_event(tep, buf, size, "ftrace") != 0) {
50	/* Failed to parse the ftrace print format */
51}
52
53if (tep_parse_format(tep, &event, buf, size, "ftrace") != 0) {
54	/* Failed to parse the ftrace print format */
55}
56...
57--
58
59FILES
60-----
61[verse]
62--
63*event-parse.h*
64	Header file to include in order to have access to the library APIs.
65*-ltraceevent*
66	Linker switch to add when building a program that uses the library.
67--
68
69SEE ALSO
70--------
71_libtraceevent(3)_, _trace-cmd(1)_
72
73AUTHOR
74------
75[verse]
76--
77*Steven Rostedt* <rostedt@goodmis.org>, author of *libtraceevent*.
78*Tzvetomir Stoyanov* <tz.stoyanov@gmail.com>, author of this man page.
79--
80REPORTING BUGS
81--------------
82Report bugs to  <linux-trace-devel@vger.kernel.org>
83
84LICENSE
85-------
86libtraceevent is Free Software licensed under the GNU LGPL 2.1
87
88RESOURCES
89---------
90https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
91