1LIBTRACEEVENT(3)             libtraceevent Manual             LIBTRACEEVENT(3)
2
3
4

NAME

6       tep_parse_event, tep_parse_format - Parse the event format information
7

SYNOPSIS

9       #include <event-parse.h>
10
11       enum tep_errno tep_parse_event(struct tep_handle *tep, const char *buf, unsigned long size, const char *sys);
12       enum tep_errno tep_parse_format(struct tep_handle *tep, struct tep_event **eventp, const char *buf, unsigned long size, const char *sys);
13

DESCRIPTION

15       The tep_parse_event() function parses the event format and creates an
16       event structure to quickly parse raw data for a given event. The tep
17       argument is the trace event parser context. The created event structure
18       is stored in the tep context. The buf argument is a buffer with size,
19       where the event format data is. The event format data can be taken from
20       tracefs/events/.../.../format files. The sys argument is the system of
21       the event.
22
23       The tep_parse_format() function does the same as tep_parse_event(). The
24       only difference is in the extra eventp argument, where the newly
25       created event structure is returned.
26

RETURN VALUE

28       Both tep_parse_event() and tep_parse_format() functions return 0 on
29       success, or TEP_ERRNO__... in case of an error.
30

EXAMPLE

32           #include <event-parse.h>
33           ...
34           struct tep_handle *tep = tep_alloc();
35           ...
36           char *buf;
37           int size;
38           struct tep_event *event = NULL;
39           buf = read_file("/sys/kernel/tracing/events/ftrace/print/format", &size);
40           if (tep_parse_event(tep, buf, size, "ftrace") != 0) {
41                   /* Failed to parse the ftrace print format */
42           }
43
44           if (tep_parse_format(tep, &event, buf, size, "ftrace") != 0) {
45                   /* Failed to parse the ftrace print format */
46           }
47           ...
48

FILES

50           event-parse.h
51                   Header file to include in order to have access to the library APIs.
52           -ltraceevent
53                   Linker switch to add when building a program that uses the library.
54

SEE ALSO

56       libtraceevent(3), trace-cmd(1)
57

AUTHOR

59           Steven Rostedt <rostedt@goodmis.org[1]>, author of libtraceevent.
60           Tzvetomir Stoyanov <tz.stoyanov@gmail.com[2]>, author of this man page.
61

REPORTING BUGS

63       Report bugs to <linux-trace-devel@vger.kernel.org[3]>
64

LICENSE

66       libtraceevent is Free Software licensed under the GNU LGPL 2.1
67

RESOURCES

69       https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/
70

NOTES

72        1. rostedt@goodmis.org
73           mailto:rostedt@goodmis.org
74
75        2. tz.stoyanov@gmail.com
76           mailto:tz.stoyanov@gmail.com
77
78        3. linux-trace-devel@vger.kernel.org
79           mailto:linux-trace-devel@vger.kernel.org
80
81
82
83libtraceevent 1.2.1               07/22/2021                  LIBTRACEEVENT(3)
Impressum